You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(mcp): add way to deny certain commands for MCP mode #19334
I have done a basic search through the issue tracker to find similar or related issues.
I have made myself familiar with the available features of Nushell for the particular area this enhancement request touches.
Related problem
There isn't much in the MCP spec relating to permissions so models can sometimes inadvertenly use destructive or undesired commands that bypass agent restrictions.
Short term, it would be nice if something akin to nu --mcp --env-config mcp-permissions.nu could work though I have not thought through how a nushell script could do this in a legible way.
Additional context and details
I don't want to have an agent use nushell MCP and rm -rf :D
changed the title [-]feat(mcp): add way to scope permissions for MCP mode[/-][+]feat(mcp): add way to deny certain commands for MCP mode[/+]on Oct 23, 2026
I generally think this is a good idea but has potential to be expanded a bit along these lines. These are just ideas to be discussed at this point.
Nushell runs every built-in in-process, so it can know what a script is about to do before the OS does.
Today.Category in crates/nu-protocol/src/signature.rs groups commands for help pages, not by effect. ls and rm are both FileSystem. Safety features live in single commands: rm --trash with rm.always_trash, mktemp --dry, save --force. nu --mcp gives an agent three tools (list_commands, command_help, evaluate), and evaluate runs anything with the user's full rights.
The leap. Add an effects list to each built-in's Signature: fs-read, fs-write, net, spawn, env, plugin. External calls count as spawn. That one annotation pays for five features.
Permissions in the Deno style: nu --allow fs-read=. --allow net=api.github.com script.nu, or with-permissions {fs-write: [./out]} { ... }. The REPL asks once on first use. Externals are allowed by name, and on Linux and macOS the spawn can run inside Landlock or Seatbelt so the OS enforces the same rules.
dry-run { ... } makes every fs-write command return a plan table (op, path, size) instead of acting.
A journal of the last command's file operations, so undo can reverse mv, cp, mkdir, save and a trashed rm.
nu --mcp --tools deploy.nu --allow ... exposes a module's exported commands as typed MCP tools, with JSON Schema built from their signatures. The agent calls deploy --env staging inside the permission set rather than sending free-form code to evaluate.
A secret value type that prints as <secret> in tables, errors, $ans, history and MCP output, and becomes a plain string only when passed to an external, $env or an http header.
Prompt for user confirmation on sensitive operations
In a case like "allow git fetch and git show but deny git commit and git push I'm not sure keys like network.allowedDomains touch on this.
The approach/proposal does not guarantee any safeguards especially when an LLM is particularly deluded/malicious but merely means to discourage some common behaviour.
this is really meant to cover the spawn example, to my understanding this correlates best with NushellMcpServer::evaluate:
Activity
[-]feat(mcp): add way to scope permissions for MCP mode[/-][+]feat(mcp): add way to deny certain commands for MCP mode[/+]fdncred commentedon Oct 27, 2026
I generally think this is a good idea but has potential to be expanded a bit along these lines. These are just ideas to be discussed at this point.
Nushell runs every built-in in-process, so it can know what a script is about to do before the OS does.
Today.
Categoryincrates/nu-protocol/src/signature.rsgroups commands for help pages, not by effect.lsandrmare bothFileSystem. Safety features live in single commands:rm --trashwithrm.always_trash,mktemp --dry,save --force.nu --mcpgives an agent three tools (list_commands,command_help,evaluate), andevaluateruns anything with the user's full rights.The leap. Add an effects list to each built-in's
Signature:fs-read,fs-write,net,spawn,env,plugin. External calls count asspawn. That one annotation pays for five features.nu --allow fs-read=. --allow net=api.github.com script.nu, orwith-permissions {fs-write: [./out]} { ... }. The REPL asks once on first use. Externals are allowed by name, and on Linux and macOS the spawn can run inside Landlock or Seatbelt so the OS enforces the same rules.dry-run { ... }makes everyfs-writecommand return a plan table (op,path,size) instead of acting.undocan reversemv,cp,mkdir,saveand a trashedrm.nu --mcp --tools deploy.nu --allow ...exposes a module's exported commands as typed MCP tools, with JSON Schema built from their signatures. The agent callsdeploy --env staginginside the permission set rather than sending free-form code toevaluate.secretvalue type that prints as<secret>in tables, errors,$ans, history and MCP output, and becomes a plain string only when passed to an external,$envor anhttpheader.mkatychev commentedon Oct 27, 2026
It looks like the MCP spec does support a similar scoping..
Tools - Model Context Protocol
In a case like "allow
git fetchandgit showbut denygit commitandgit pushI'm not sure keys likenetwork.allowedDomainstouch on this.The approach/proposal does not guarantee any safeguards especially when an LLM is particularly deluded/malicious but merely means to discourage some common behaviour.
this is really meant to cover the
spawnexample, to my understanding this correlates best withNushellMcpServer::evaluate:nushell/crates/nu-mcp/src/server.rs
Lines 59 to 65 in 9970552