Claude Command Runner is a powerful Model Context Protocol (MCP) server that connects Claude Desktop with terminal applications. It enables Claude to execute commands and intelligently retrieve outputs, creating a seamless integration between AI assistance and your terminal environment.
Clone and build the server:
git clone https://github.com/M-Pineapple/claude-command-runner.git
cd claude-command-runner
./build.sh
Configure Claude Desktop by adding to your MCP settings:
{
"claude-command-runner": {
"command": "/path/to/claude-command-runner/.build/release/claude-command-runner",
"args": ["--port", "9876"],
"env": {}
}
}
Restart Claude Desktop
Claude Command Runner provides several tools you can use:
You: "Build my Swift project"
Claude: [Executes: swift build]
[Waits intelligently up to 77 seconds]
Claude: "Build completed successfully! Here's the output..."
The execute_with_auto_retrieve
command intelligently adjusts wait times based on command type:
You can customize the server's behavior through the configuration file located at ~/.claude-command-runner/config.json
:
{
"terminal": {
"preferred": "auto",
"fallbackOrder": ["Warp", "WarpPreview", "iTerm", "Terminal"]
},
"security": {
"blockedCommands": ["rm -rf /", "format"],
"maxCommandLength": 1000
},
"history": {
"enabled": true,
"maxEntries": 10000
}
}
lsof -i :9876
./build.sh
execute_with_auto_retrieve
(not execute_command
)ls /tmp/claude_output_*.json
If commands execute but aren't saved to the database:
Check database integrity:
sqlite3 ~/.claude-command-runner/claude_commands.db "PRAGMA integrity_check;"
If corrupted, backup and remove the database:
mv ~/.claude-command-runner/claude_commands.db ~/.claude-command-runner/claude_commands.db.backup
# Restart Claude Desktop - a new database will be created automatically
Verify the database is working:
sqlite3 ~/.claude-command-runner/claude_commands.db "SELECT COUNT(*) FROM commands;"
For the best experience, Warp Terminal is recommended as it supports advanced features:
While basic command execution works with Terminal.app and iTerm2, these terminals lack support for automatic output capture and advanced features.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "claude-command-runner" '{"command":"/path/to/claude-command-runner/.build/release/claude-command-runner","args":["--port","9876"]}'
See the official Claude Code MCP documentation for more details.
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.
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": {
"claude-command-runner": {
"command": "/path/to/claude-command-runner/.build/release/claude-command-runner",
"args": [
"--port",
"9876"
]
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"claude-command-runner": {
"command": "/path/to/claude-command-runner/.build/release/claude-command-runner",
"args": [
"--port",
"9876"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect