mcp -nu
MCP server for Nushell script execution
claude mcp add --transport stdio cablehead-mcp-server-nu mcp-server-nu
How to use
This MCP server exposes a tool named exec that lets an AI assistant run Nushell scripts with full system access. When you pass a Nushell script, the server launches nu -c "<script>" under the hood, executing with the same permissions as the MCP server process. This enables the assistant to interact with the file system, make network requests, read environment variables, and invoke system commands via Nushell’s shell integration. Use this capability with trusted assistants and in controlled environments due to the potential security implications of arbitrary code execution.
To run a Nushell script, provide the script as the script parameter to the exec tool and optionally set a timeout in seconds with timeout_seconds. The default timeout is 30 seconds. Example: the assistant can run a pipeline to list, filter, and extract data from the filesystem or services, then return stdout, stderr, and exit code to the caller.
How to install
Prerequisites:
- Rust toolchain (cargo) installed: https://www.rust-lang.org/tools/install
- Optional: Nushell (nu) available in PATH if not bundled by deployment; the server will spawn nu -c "<script>".
Install the MCP server:
-
Build and install the server binary:
cargo install --locked mcp-server-nu
-
Verify installation:
mcp-server-nu --help
-
Optional: Test integration with the Inspector (as shown in the README):
npx @modelcontextprotocol/inspector mcp-server-nu
-
If using a custom Nushell configuration, you can run the server with custom configs:
mcp-server-nu --nu-config /path/to/config.nu --nu-env-config /path/to/env.nu
Note: After installation, the executable mcp-server-nu should be available on your PATH. You can also run it directly via the inspector tool for quick validation.
Additional notes
Tips and common considerations:
- Security: The server grants the executing Nushell processes the same permissions as the MCP server, including filesystem, network, and environment access. Use in trusted environments and consider network isolation if possible.
- Nu configuration: You can provide custom nu.config.nu and nu-env.config.nu files to tailor commands, aliases, and environment variables for each script execution.
- Timeouts: Use timeout_seconds to prevent long-running scripts from hanging the server. The default is 30 seconds.
- Diagnostics: If you encounter issues, check for Nushell availability in PATH and ensure the mcp-server-nu binary is accessible. Review any custom Nushell configurations for syntax or path problems.
- Inspector usage: For quick testing in development, you can leverage npx @modelcontextprotocol/inspector mcp-server-nu to launch and interact with the server.
Related MCP Servers
rust -schema
A type-safe implementation of the official Model Context Protocol (MCP) schema in Rust.
turbovault
MCP server that transforms your Obsidian vault into an intelligent knowledge system
mcp-loxone
An opinionated Model Context Protocol (MCP) server for controlling Loxone home automation systems.
ultrafast
High-performance, ergonomic Model Context Protocol (MCP) implementation in Rust
firecrawl -zed
Firecrawl MCP Server for Zed
bookworm
MCP server for Rust documentation