Skip to main content
Glama

TL;DR

Your AI can write code but can't run it. shell-mcp gives it a terminal.

npx -y @shell-mcp/mcp-lite --init

Restart your AI app. Done. Your AI can now run commands, install packages, use git, start servers, run tests — everything you do in a terminal.


Related MCP server: local-mcp

Demo


The Problem

You're using Claude Desktop and ask your AI to:

  • "Run my tests"

  • "Install that package"

  • "Check the git status"

  • "Start the dev server"

It can't. It has no terminal. You end up copy-pasting commands back and forth like it's 2005.

The Fix

npx -y @shell-mcp/mcp-lite --init

That's literally it. This one command:

  1. Auto-detects which AI apps you have installed

  2. Configures them automatically

  3. No JSON to edit, no config files to find

Just restart your AI app. It now has a terminal.

  shell-mcp -- init
  -----------------

  Claude Desktop    + Added
  Cursor            + Added
  Windsurf          + Added

  Restart your clients to activate.

What can your AI do now?

Anything you can do in a terminal:

"Run npm install"                    ✓
"Start the dev server"               ✓
"Run the test suite"                 ✓
"Check git status and commit"        ✓
"List all running processes"         ✓
"Create a new React project"         ✓
"Build and deploy"                   ✓
"SSH into the server" (if you want)  ✓

State persists between commands — cd, environment variables, nvm use, conda activate all carry over. Just like a real terminal.


5 tools. That's all it needs.

Most MCP servers give AI 20+ tools. We give it 5. Here's why that's better.

Tool

Why it exists

run_command

The workhorse. Runs any shell command — git, npm, curl, docker, make, anything. Your AI already knows how to use a terminal.

write_file

Shell is terrible at writing files (quoting, escaping, multiline). This does it reliably.

read_file

Reads files without encoding headaches. Cleaner than cat.

get_audit_log

Every command is logged. Your AI can review what happened.

get_safety_config

Shows active safety rules. Read-only — AI can't change them.

Why not more? Your AI already knows git status, ls -la, ps aux, kill. Wrapping them in custom tools adds complexity without value. Give it a terminal and get out of the way.


Safety first

Your AI has a terminal, but it's not unsupervised. Commands are checked before they execute.

Blocked (never runs)

rm -rf /       ·  DROP DATABASE     ·  curl ... | bash
format C:      ·  dd of=/dev/sda    ·  :(){ :|:& };:

Warned (runs with a flag)

sudo ...       ·  rm -rf            ·  git push --force
kill -9        ·  shutdown          ·  chmod 777

Every command — blocked or executed — is logged to ~/.shell-mcp/logs/audit.jsonl.

Lock it down

Want to restrict what your AI can run? Use allowlists:

{
  "mcpServers": {
    "shell-mcp": {
      "command": "npx",
      "args": ["-y", "@shell-mcp/mcp-lite"],
      "env": {
        "SHELL_MCP_ALLOWLIST": "npm.*,git.*,node.*",
        "SHELL_MCP_DEFAULT_DENY": "true"
      }
    }
  }
}

Now only npm, git, and node commands are allowed. Everything else is blocked.


Smart timeout

Other tools kill npm install after 30 seconds because of a fixed timeout. We don't.

Others:       |---- 30s fixed ---------| KILL (npm install dies mid-download)

shell-mcp:    |-- 15s --| reset |-- 15s --| reset |-- 15s --| done
                  ^ output    ^ output       ^ output

The timeout resets every time output is produced. Your command only dies after 15 seconds of complete silence or a 5-minute absolute cap.


Works everywhere

Platform

Default Shell

Status

macOS

zsh

Supported

Linux

bash

Supported

Windows

PowerShell

Supported

Zero native dependencies. No build tools required. Just Node.js 20+.


Configuration (all optional)

shell-mcp works out of the box. Customize only if you want to.

Variable

Default

What it does

SHELL_MCP_CWD

current dir

Starting directory for sessions

SHELL_MCP_SHELL

auto-detect

Force a shell (bash, zsh, powershell.exe)

SHELL_MCP_MAX_SESSIONS

10

Max parallel sessions

SHELL_MCP_BLOCKLIST

built-in

Extra blocked patterns (comma-separated regex)

SHELL_MCP_ALLOWLIST

none

Only allow these commands (comma-separated regex)

SHELL_MCP_DEFAULT_DENY

false

Block everything not in allowlist

SHELL_MCP_AUDIT

true

Enable/disable audit logging

Pass them as environment variables in your MCP config:

{
  "mcpServers": {
    "shell-mcp": {
      "command": "npx",
      "args": ["-y", "@shell-mcp/mcp-lite"],
      "env": {
        "SHELL_MCP_CWD": "/path/to/project",
        "SHELL_MCP_SHELL": "bash"
      }
    }
  }
}

Manual setup

If --init doesn't detect your client, or you prefer to configure manually:

Config file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

Add this to the file:

{
  "mcpServers": {
    "shell-mcp": {
      "command": "npx",
      "args": ["-y", "@shell-mcp/mcp-lite"]
    }
  }
}

Config file: ~/.cursor/mcp.json

{
  "mcpServers": {
    "shell-mcp": {
      "command": "npx",
      "args": ["-y", "@shell-mcp/mcp-lite"]
    }
  }
}

Config file: ~/.windsurf/mcp.json

{
  "mcpServers": {
    "shell-mcp": {
      "command": "npx",
      "args": ["-y", "@shell-mcp/mcp-lite"]
    }
  }
}

How it works (for the curious)

You ask: "Run my tests"
        |
        v
  AI calls run_command("npm test")
        |
        v
  Safety check (blocked? warned? ok?)
        |
        v
  Execute in persistent shell session
  (state carries over between commands)
        |
        v
  Smart timeout (auto-extends while output flows)
        |
        v
  Log to audit trail --> return result to AI
        |
        v
  AI reads output, decides what to do next

No PTY. No native dependencies. Just clean stdin/stdout pipes.


Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

git clone https://github.com/psdlabs/shell-mcp.git
cd shell-mcp
pnpm install
pnpm build
packages/
  core/        -- Session engine, safety, audit
  mcp-lite/    -- MCP server (what users install)

FAQ

Yes. Destructive commands are blocked before they execute. Every command is logged to an audit trail. You can lock it down further with allowlists and DEFAULT_DENY mode. The AI cannot modify safety rules — they're read-only.

If your client supports MCP (Model Context Protocol), yes. The --init command auto-detects Claude Desktop, Cursor, and Windsurf. For others, add the JSON config manually.

Smart timeout handles it. If a command produces no output for 15 seconds, it times out. There's also a 5-minute absolute cap. The AI gets a clear "TIMED OUT" status and can decide what to do.

It's designed for interactive AI use, but there's nothing stopping you from using it in automation. Just configure the safety rules for your use case.

No. npx downloads and runs it automatically. You just need Node.js 20 or later.


Star History

If this project helps you, consider giving it a star. It helps others find it.

Star History Chart


License

MIT -- do whatever you want with it.


Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      B
      maintenance
      Enables AI coding agents to run shell commands, spawn persistent background tasks, and read/write files inside isolated remote container sandboxes on a VPS. It also provides project workspace listing, task attach/kill controls, and a searchable knowledge graph for memory continuity across sessions.
      -
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI assistants to securely inspect, modify, and manage local projects with trusted filesystem access, safe Git operations, controlled task execution, and developer runtime process management over stdio or HTTP.
      4
      Apache 2.0
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables local, permissioned development workflows from compatible AI clients, including filesystem editing, interactive terminals, durable jobs, Git operations, and semantic browser testing.
      53 npm
      1
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables AI agents to run shell commands, perform sandboxed file operations, and make HTTP requests through zero-trust guards that block command injection, path traversal, and SSRF while redacting secrets from inputs and outputs. Circuit breakers, per-session rate limits, and an append-only audit ledger prevent runaway loops, excessive token spend, and provide post-hoc traceability.
      5
      MIT