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 test
Explore 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.
Learn to connect to MCP servers over HTTP with Python SDK using SSE for efficient protocol communication
Analyze search intent with MCP API for SEO insights and keyword categorization
Next-generation MCP server enhances documentation analysis with AI-powered neural processing and multi-language support
Connect your AI with your Bee data for seamless conversations facts and reminders
Learn how to use MCProto Ruby gem to create and chain MCP servers for custom solutions
Expose Chicago Public Schools data with a local MCP server accessing SQLite and LanceDB databases