Secure MCP Terminal Server with command control, security, and resource limits for safe remote execution
MCP Terminal Server is an advanced, secure terminal execution server implementing the Model Context Protocol (MCP). Developed to provide controlled command execution capabilities with enhanced security features and resource management, this server ensures that AI applications can execute shell commands while adhering strictly to predefined constraints. By leveraging MCP, the server offers a unified approach for various AI tools like Claude Desktop, Continue, Cursor, and more, enabling seamless integration through standardized protocol messages.
MCP Terminal Server stands out with its robust security controls and resource management mechanisms, ensuring that all command executions are secure, efficient, and reliable. The server supports the following key capabilities:
Command Execution: A core feature allows the execution of shell commands within a controlled environment, capturing outputs and handling errors gracefully.
Security Controls:
Resource Controls:
MCP Protocol Support:
The architecture and protocol implementation of MCP Terminal Server are meticulously designed to ensure compatibility and efficient operation with various MCP clients. The server implements the MCP protocol by adhering to the following steps:
To set up MCP Terminal Server on your local machine, follow these steps:
Local Setup:
# Clone the repository
git clone https://github.com/RinardNick/mcp-terminal.git
cd mcp-terminal
# Create and activate virtual environment using uv
uv venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install development dependencies
uv pip install -e ".[dev]"
Publishing to PyPI:
# Build the package
uv pip install build
python -m build
# Upload to PyPI
uv pip install twine
python -m twine upload dist/*
Testing with MCP Inspector: The MCP Inspector tool can be used for testing the server implementation:
# Install inspector
npm install -g @modelcontextprotocol/inspector
# Test server
npx @modelcontextprotocol/inspector python3 src/mcp_terminal/server.py --allowed-commands "python,pip,git,ls,cd"
Running Tests:
# Run all tests
pytest tests/
# Run specific test file
pytest tests/test_terminal.py
# Run with coverage
pytest --cov=mcp_terminal tests/
MCP Terminal Server offers several use cases that are particularly valuable for AI workflows, enhancing the interaction between AI applications and external tools. Two primary examples include:
Model Evaluation:
{
"type": "execute",
"data": {
"command": "python evaluate_model.py"
}
}
Data Collection:
{
"type": "execute",
"data": {
"command": "wget http://example.com/data.zip && unzip data.zip -d ./data/"
}
}
To integrate MCP Terminal Server with specific AI applications, the following MCP client compatibility matrix outlines supported features and statuses:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
MCP Terminal Server ensures compatibility and performance across a wide range of environments and configurations. The following table provides an overview of the server's performance under different conditions:
Environment | Performance |
---|---|
Production | High Stability |
Development | Optimized Tests |
Multi-User | Scalable |
MCP Terminal Server is designed with advanced security features to ensure the safety and integrity of command executions. Key considerations include:
An example MCP server configuration for production use is provided below:
{
"mcpServers": {
"terminal": {
"command": "uv",
"args": [
"pip",
"run",
"mcp-terminal",
"--allowed-commands",
"python,pip,git,ls,cd",
"--timeout-ms",
"30000",
"--max-output-size",
"1048576"
]
}
}
}
Can MCP Terminal Server run on Windows?
Yes, the server is compatible with both Linux and Windows. Use uv
to set up a virtual environment for non-Unix systems.
How can I limit command execution time?
Set the --timeout-ms
parameter during startup. This ensures that commands do not run indefinitely.
Is my data safe when using MCP Terminal Server?
The server is built with security controls to prevent injection attacks and ensure data safety. Only predefined commands are allowed, and timeouts limit execution length.
How do I monitor command executions?
Monitor logs generated by the server for detailed insights into command executions, errors, and other critical events.
Can I integrate MCP Terminal Server with multiple AI applications?
Yes, MCP Terminal Server is compatible with several AI applications through its standard MCP protocol implementation.
For detailed instructions, refer to the CONTRIBUTING.md
file in the repository.
MCP Terminal Server is part of a broader ecosystem that includes other MCP servers and tools, fostering interoperability among various AI applications. Explore additional resources for integrating and deploying MCP solutions:
By following this comprehensive documentation, developers can effectively utilize MCP Terminal Server to enhance their AI workflows, ensuring secure and efficient command execution across multiple applications.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods