shell-mcp
Runs the user's commands in zsh (a supported login shell, alongside bash, sh, fish, cmd and PowerShell) via the run_command tool, returning exit code, stdout, stderr and duration, with a configurable time limit and child-process cleanup.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
shell-mcp
A local MCP server that lets an AI assistant run commands in your own shell on macOS, Windows and Linux.
This gives an AI model the same power over your computer as you have in a terminal. It can read, change and delete files, install or remove software, change settings, use your logged-in accounts (git, cloud CLIs, SSH) and send data over the network. There is no undo and no sandbox. Read Before you install first.
Contents
Related MCP server: Command Center
The problem it solves
Desktop AI assistants can usually explain which command to run, but can't run it. You copy the command into a terminal, copy the output back, and repeat.
Servers that do run commands often support a single operating system. They also start with a
reduced environment, so git, node or gh work in your terminal but fail with
"command not found" in the assistant.
shell-mcp runs the command and returns the exit code, stdout and stderr:
The same tools work on macOS, Windows and Linux.
It supports bash, zsh, sh, fish, cmd and PowerShell.
It finds your tools, by loading your login profile on macOS/Linux and reading the registry on Windows.
Commands have a time limit, and when it passes their child processes are stopped too.
Long output is shortened in the middle so it doesn't flood the conversation.
Before you install
What it can change
Any file your user account can write to, including deleting it.
Installed software, system settings and running processes, within your account's rights.
Anything your account is signed in to: git pushes, cloud resources, databases, SSH hosts.
What it can see
Any file you can read, and environment variables, including tokens and passwords stored there.
Command output is passed to the AI client, which normally sends it to the model provider.
Risks to know about
The model can make mistakes, such as a wrong path in a delete command.
A web page, file or email the model reads can contain instructions meant to trick it into running something harmful (prompt injection).
The server keeps no command log and can't roll anything back.
How to use it safely
Keep tool approval on in your client and read each command before allowing it. Avoid "always allow" for
run_command.Never run it as root or Administrator.
Keep backups, and commit your work to git before letting the model change it.
For untrusted content or risky work, run it in a virtual machine or container.
Don't rely on
SHELL_MCP_DENYfor protection. It is a plain text match and easy to get around.
The server communicates over stdio with the client that launched it and opens no network port. The commands it runs can use the network.
Built with
Component | Used for |
Python 3.10+ | Language |
MCP Python SDK ( | Protocol and stdio transport; the only direct runtime dependency |
Installing and running | |
Package build | |
pytest and GitHub Actions | Tests on Windows, macOS and Linux |
Installation
1. Install uv. See the uv installation guide. It downloads a suitable Python if you don't have one.
2. Get the code and its dependencies.
git clone https://github.com/dcvetkovic88/shell-mcp.gitcd shell-mcpuv sync3. Connect a client. See Where to use it.
To update later, run git pull and uv sync, then restart the client. To uninstall, remove the
shell entry from the client's configuration and delete the folder.
Where to use it
It works with MCP clients that can start a local (stdio) server. It does not work with browser-only assistants, which can't start a program on your computer.
Replace /path/to/shell-mcp below with your folder. On Windows use forward slashes, for example
C:/dev/shell-mcp.
Claude Desktop
uv run shell-mcp installThis adds a shell entry to the config file, keeps your other settings, and saves the previous
version with a .bak ending. Restart the app afterwards.
To do it by hand, edit the config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"shell": {
"command": "uv",
"args": ["--directory", "/path/to/shell-mcp", "run", "shell-mcp"]
}
}
}Claude Code
claude mcp add shell -- uv --directory /path/to/shell-mcp run shell-mcpCursor
Put the same JSON as for Claude Desktop in ~/.cursor/mcp.json (all projects) or
.cursor/mcp.json (one project).
VS Code
Put this in .vscode/mcp.json:
{
"servers": {
"shell": {
"type": "stdio",
"command": "uv",
"args": ["--directory", "/path/to/shell-mcp", "run", "shell-mcp"]
}
}
}Other clients
Use the same command and args wherever the client defines local MCP servers.
Tools
Tool | What it does | Arguments |
| Runs a command and returns exit code, stdout, stderr and duration |
|
| Sets the working directory for later commands |
|
| Returns the current working directory | none |
| Shows OS, architecture, user, default shell and installed shells | none |
| Shows versions and locations of git, gh, node, npm, python, uv, docker and others, plus PATH | none |
| Returns one variable, or lists all with secret-looking values hidden | optional |
run_command arguments:
Argument | Meaning |
| Command line to run. Pipes, |
|
|
| Working directory for this command |
| Time limit in seconds |
| Extra environment variables |
| Text passed to the command's input |
Commands can't be interactive, so prompts and editors such as vim won't work.
get_env shows the full value when asked for a variable by name, even if it looks like a secret.
Examples
Things you can ask the assistant:
"Which version of Node and Python do I have?"
"Show the git status of
~/projects/shopand summarize the changes.""Run the tests in this folder and explain the failures."
"Find the ten largest files in Downloads. Don't delete anything."
"Use PowerShell to list the services that are running."
What the tool calls look like:
{ "command": "git status --short", "cwd": "~/projects/shop" }{ "command": "npm run build", "cwd": "~/projects/shop", "timeout": 600 }{ "command": "Get-Service | Where-Object Status -eq 'Running'", "shell": "powershell" }{ "command": "wc -l", "shell": "bash", "stdin": "one\ntwo\n" }A result:
exit_code: 0
cwd: /Users/you/projects/shop
duration: 0.12s
--- stdout ---
M src/cart.py
?? notes.txtConfiguration
Set these environment variables in the client's env block. All are optional.
Variable | Default | Meaning |
| home folder | Starting working directory |
|
| Default time limit in seconds |
|
| Highest time limit a call may ask for |
|
| Characters kept from each of stdout and stderr |
| empty | Comma-separated texts; commands containing one are refused |
{
"mcpServers": {
"shell": {
"command": "uv",
"args": ["--directory", "/path/to/shell-mcp", "run", "shell-mcp"],
"env": {
"SHELL_MCP_CWD": "~/projects",
"SHELL_MCP_TIMEOUT": "120",
"SHELL_MCP_DENY": "sudo ,mkfs,shutdown"
}
}
}
}Platform notes
macOS and Linux: bash, zsh and sh run as login shells, so PATH additions from your login
profile apply. Settings that are only in .zshrc or .bashrc may not load.
Windows:
User and system variables are read from the registry on each call. Common folders for Git, GitHub CLI, Node, scoop, VS Code and PowerShell 7 are added to PATH.
bashmeans Git Bash when it is installed in a standard location. Otherwise it is whicheverbashis on PATH, which is often WSL.powershellis Windows PowerShell 5 andpwshis PowerShell 7. Each falls back to the other.
Troubleshooting
Problem | What to try |
The client can't start the server | Use the full path of |
"command not found" | Ask the assistant to run |
A command is stopped too early | Pass a higher |
A command waits and then times out | It probably asks for input. Use a flag such as |
The tools don't appear | Restart the client completely and check its MCP logs |
Development
src/shell_mcp/__init__.py server and tools
src/shell_mcp/windows.py Windows environment and Git Bash lookup
src/shell_mcp/install.py Claude Desktop installer
tests/ testsRun the tests:
uv run pytestTry the server in the MCP Inspector (needs Node):
npx @modelcontextprotocol/inspector uv --directory . run shell-mcpLicense
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Use your own Windows, Mac or Linux computer from ChatGPT, Claude, Cursor or Gemini CLI: run commands, read, write and search files, run long processes. Your computer only makes an outgoing connection (no open ports or VPN). Read-only mode, allowed folders, blocked commands and an action log keep you in control. Free plan available.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Connect AI assistants to your Mac and Linux computers with scoped access to local files and tools.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables safe execution of terminal commands across different shells (bash, cmd, PowerShell) with configurable timeouts, working directories, and resource limits for command-line operations through AI assistants.-
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to keep persistent shell sessions open across turns—running tests, tailing logs, driving REPLs and holding SSH connections—alongside text-file tools, all bounded by person-controlled folder limits and a command blocklist. Runs locally on macOS, Linux and Windows with no telemetry or remote calls.Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI agents to execute shell commands without a shell and receive structured JSON output, with parsers for dozens of commands, row filtering/sorting, large-result pagination, and pre-execution guards for allowed commands, paths, and secrets.375 npm12MIT
- AlicenseBqualityBmaintenanceEnables LLMs to execute shell commands with configurable security controls, foreground/background task management, timeouts, and output truncation over local or HTTP transports.4MIT