Shell Command Runner MCP server

Enables AI systems to execute shell commands and scripts securely with proper output handling for system automation, file manipulation, and command-line tool integration.
Back to servers
Setup instructions
Provider
OldFangDong
Release date
Mar 20, 2025
Language
TypeScript
Stats
1 star

This server implements the Model Context Protocol (MCP) to run shell scripts or commands, allowing AI models to execute actions on your system based on commands received. It serves as a bridge between AI models and your local environment for task automation.

Installation

You can install the MCP server using npm:

npm install -g mcp-server-cli

Usage

Basic Usage

To start the MCP server with default settings:

mcp-server

This command starts the MCP server with the default configuration.

Configuration Options

You can customize the server behavior with various command-line options:

mcp-server [options]

Available options:

  • -h, --help - Display help information
  • -s, --server <server> - Specify the MCP server URL (default: "wss://mcp.mistral.ai/ws")
  • -p, --port <port> - Set local server port (default: 8999)
  • -a, --apiKey <apiKey> - Provide your API key
  • --shell <shell> - Specify which shell to use (default: determined by OS)
  • --shellArgs <shellArgs> - Specify shell arguments
  • --allowPrivacy - Allow privacy endpoint
  • --allowRunCommand - Allow running commands in PATH
  • --allowRunScript - Allow running scripts at path
  • --allowNetwork - Allow network access
  • --allowEnv - Allow access to environment variables
  • --allowFileRead - Allow reading files
  • --allowFileWrite - Allow writing files
  • --allowListDir - Allow listing directories
  • -v, --verbose - Enable verbose mode

Examples

Running with API key

mcp-server --apiKey your_api_key_here

Custom server URL and port

mcp-server --server wss://custom-mcp-server.com/ws --port 9000

Allowing specific permissions

To allow the server to execute commands and read files:

mcp-server --allowRunCommand --allowFileRead

Full access mode (use with caution)

mcp-server --allowPrivacy --allowRunCommand --allowRunScript --allowNetwork --allowEnv --allowFileRead --allowFileWrite --allowListDir

Securing Your Server

For security reasons, only enable the permissions that you absolutely need. Running with all permissions enabled could potentially allow malicious code execution if the server is compromised.

Troubleshooting

Connection Issues

If you experience connection problems with the default MCP server:

  1. Check your internet connection
  2. Verify your API key is valid
  3. Try specifying the server URL explicitly

Permission Errors

If you encounter permission errors when executing commands:

  1. Ensure you've enabled the appropriate permission flags
  2. Check that your user account has the necessary system permissions
  3. Run the server with elevated privileges if necessary (not recommended for production)

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "mcp-server-cli" '{"command":"npx","args":["mcp-server-cli"]}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "mcp-server-cli": {
            "command": "npx",
            "args": [
                "mcp-server-cli"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "mcp-server-cli": {
            "command": "npx",
            "args": [
                "mcp-server-cli"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later