Simple MCP server for running command line apps with easy setup and debugging options
The cmd-line-executor MCP server serves as a critical component for integrating command line applications with AI-driven platforms through the Model Context Protocol (MCP). By leveraging MCP, this server facilitates seamless communication and execution of CLI tools within AI workflows. This enhances functionality by allowing users to run custom scripts or commands directly from their AI application interfaces.
This MCP server is engineered with key features that ensure robust integration capabilities:
run_command tool accepts cmd and args as string arguments, executing the command line app and returning detailed outputs like stdout, stderr, status code, etc.The cmd-line-executor adheres to MCP architecture principles by:
The run_command tool example is straightforward:
def run_command(cmd, args):
# Execute the command with provided arguments
process = subprocess.Popen([cmd] + args.split(), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = process.communicate()
return {"stdout": out.decode("utf-8"), "stderr": err.decode("utf-8"), "status_code": process.returncode}
To set up the cmd-line-executor MCP server, follow these steps:
open ~/Library/Application\ Support/Claude/claude_desktop_config.json"mcpServers": {
"cmd-line-executor": {
"command": "uv",
"args": ["--directory", "/Users/$(whoami)/experiments/claude-mvp/cmd-line-executor", "run", "cmd-line-executor"]
}
}
notepad %APPDATA%/Claude/claude_desktop_config.json"mcpServers": {
"cmd-line-executor": {
"command": "uvx",
"args": ["cmd-line-executor"]
}
}
The cmd-line-executor is meticulously designed to support multiple MCP clients:
{
"mcpServers": {
"cmd-line-executor": {
"command": "uv",
"args": ["--directory", "/Users/$(whoami)/experiments/claude-mvp/cmd-line-executor", "run", "cmd-line-executor"]
}
}
}
This matrix provides detailed compatibility information:
| MCP Client | Resources | Tools | Prompts | Status |
|---|---|---|---|---|
| Claude Desktop | ✅ | ✅ | ✅ | Full Support |
| Continue | ✅ | ✅ | ✅ | Full Support |
| Cursor | ❌ | ✅ | ❌ | Tools Only |
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
graph TD;
tool-->|Send Request| MCP_Server -->|Receive Response| AI_Application;
AI_Application ---> tool;
subgraph Client
client_part1;
client_part2;
end
subgraph Server
server_part1;
server_part2;
end
Advanced configurations and security measures can be found in the documentation. Key focus areas include:
"env": {
"API_KEY": "your-api-key"
}
Q: How does this server integrate with Claude Desktop?
Q: Can the cmd-line-executor be used with other AI clients besides Claude Desktop?
Q: What security measures are in place for commands being run through MCP?
Q: How do I debug issues with the server configuration?
Q: Can I customize this tool for specific use cases?
Contributions are welcome! Here’s how you can get started:
uv testExplore the broader MCP ecosystem and related resources:
By understanding and utilizing the cmd-line-executor MCP server, developers can significantly enhance their AI application’s capabilities, enabling more versatile and flexible workflows.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration