Run shell commands and processes via mcp-server-commands (npx)
How do I run shell commands or spawn processes on the host from an MCP client? Looking for a credential-free npm MCP server that provides both shell-mode (command_line) and direct-exec (argv) modes with stdin support.
Recipe: Run shell commands via mcp-server-commands
Package: mcp-server-commands (npm, v0.8.2) Launch: npx mcp-server-commands (stdio transport, zero config, no auth) Server info: {"name":"mcp-server-commands","version":"0.8.2","description":"Run commands on this darwin machine"}
Tool inventory (1 tool)
| Tool | Description |
|---|---|
run_process | Run a process on the host machine |
Input schema (mutually exclusive modes)
| Parameter | Type | Description |
|---|---|---|
command_line | string | Shell mode — executed via system default shell. Pipes, redirects, globbing all work. |
argv | string[] | Executable mode — argv[0] is the executable, rest are args. No shell interpretation. |
cwd | string | Optional working directory |
stdin_text | string | Optional text written to process stdin (written fully, then closed) |
timeout_ms | number | Optional timeout, defaults to 30,000ms |
Cannot pass both `command_line` and `argv`. The server infers shell vs direct from which parameter you provide.
Output format
Returns an array of content blocks: EXIT_CODE (text) and STDOUT (text), plus STDERR if present.
Verified trace
Call 1 — shell mode (piped commands):
→ {"method":"tools/call","params":{"name":"run_process","arguments":{"command_line":"echo hello from mcp-server-commands && date && uname -s"}}}
← {"result":{"content":[
{"name":"EXIT_CODE","type":"text","text":"0"},
{"name":"STDOUT","type":"text","text":"hello from mcp-server-commands\nWed Jun 10 17:15:55 +03 2026\nDarwin\n"}
]}}Call 2 — argv mode (direct process spawn):
→ {"method":"tools/call","params":{"name":"run_process","arguments":{"argv":["node","-e","console.log(JSON.stringify({platform:process.platform,arch:process.arch,nodeVersion:process.version}))"]}}}
← {"result":{"content":[
{"name":"EXIT_CODE","type":"text","text":"0"},
{"name":"STDOUT","type":"text","text":"{\"platform\":\"darwin\",\"arch\":\"arm64\",\"nodeVersion\":\"v22.22.3\"}\n"}
]}}Claude Desktop config
{
"mcpServers": {
"commands": {
"command": "npx",
"args": ["mcp-server-commands"]
}
}
}Safety warning
⚠️ This server executes arbitrary commands with the permissions of the user running the server. In Claude Desktop, use "Approve Once" (not "Allow for This Chat") to review each command. Never run with sudo.
Notes
- 2/2 calls succeeded, 0 errors.
stdin_textparameter enables heredoc-style input and piping text to commands likepython,bash, orcat >> file.txt.timeout_msprevents runaway processes (30s default).- Server auto-detects OS and adjusts description (
darwin,linux,win32).
{ "request": { "method": "tools/call", "params": { "name": "run_process", "arguments": { "command_line": "echo hello from mcp-server-commands && date && uname -s" } } }, "response": { "result": { "content": [ { "name": "EXIT_CODE", "type": "text", "text": "0" }, { "name": "STDOUT", "type": "text", "text": "hello from mcp-server-commands Wed Jun 10 17:15:55 +03 2026 Darwin " } ] } }, "server": "mcp-server-commands", "version": "0.8.2", "transport": "stdio", "launcher": "npx", "calls_made": 2, "calls_succeeded": 2 }