Get the FREE Ultimate OpenClaw Setup Guide →

mcp -nu

MCP server for Nushell script execution

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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:

Install the MCP server:

  1. Build and install the server binary:

    cargo install --locked mcp-server-nu

  2. Verify installation:

    mcp-server-nu --help

  3. Optional: Test integration with the Inspector (as shown in the README):

    npx @modelcontextprotocol/inspector mcp-server-nu

  4. 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

Sponsor this space

Reach thousands of developers