This server allows you to securely execute terminal commands with controlled access and resource management:
- Command Execution: Run shell commands and capture their output (stdout, stderr) along with exit codes
- Security Controls: Restrict commands to a predefined list to prevent unauthorized actions and command injection
- Resource Management: Set limits on execution time (timeout) and maximum output size to prevent resource exhaustion
- Customizable Settings: Configure allowed commands and resource limits on a per-request basis
- Communication: Uses the Model Context Protocol (MCP) for interaction
MCP Terminal Server
A secure terminal execution server implementing the Model Context Protocol (MCP). This server provides controlled command execution capabilities with security features and resource limits.
Features
- Command Execution: Execute shell commands with output capture and error handling
- Security Controls: Restrict allowed commands and prevent command injection
- Resource Controls:
- Command timeouts
- Maximum output size limits
- MCP Protocol Support:
- Standard MCP message format
- Capability advertisement
- Streaming output support
Development
Local Setup
Publishing to PyPI
Testing with MCP Inspector
The MCP Inspector tool can be used to test the server implementation:
Running Tests
Using with Claude Desktop
Once the package is published to PyPI:
- Install UV (if not already installed):
- Install the Package using UV:
- Configure Claude Desktop:
Edit your Claude Desktop config file (typically at
~/Library/Application Support/Claude/claude_desktop_config.json
on macOS):
Protocol Implementation
The server implements the Model Context Protocol (MCP) with the following capabilities:
Capabilities Advertisement
Message Format
Request:
Response:
Error:
Security Considerations
- Command Validation:
- Only allowed commands can be executed
- Shell operators are blocked
- Command injection attempts are prevented
- Resource Protection:
- Command timeouts prevent hanging
- Output size limits prevent memory exhaustion
- Error handling for all failure cases
- Best Practices:
- Always set
allowed-commands
in production - Use conservative timeout and size limits
- Monitor command execution logs
- Always set
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
A secure terminal execution server that enables controlled command execution with security features and resource limits via the Model Context Protocol (MCP).
- Features
- Development
- Using with Claude Desktop
- Protocol Implementation
- Security Considerations
- Contributing
- License
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityA secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.Last updated -174PythonMIT License
- AsecurityAlicenseAqualityA secure server for executing terminal commands within predefined paths, allowing safe interaction by Large Language Models with operating system environments.Last updated -1113JavaScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that provides secure command-line access to Windows systems, allowing MCP clients like Claude Desktop to safely execute commands in PowerShell, CMD, and Git Bash shells with configurable security controls.Last updated -9420210JavaScriptMIT License
- -securityFlicense-qualityAn MCP server that allows secure execution of macOS terminal commands through Claude or Roo Code with built-in security whitelisting and approval mechanisms.Last updated -1JavaScript
Appeared in Searches
- Information about Docker software and containerization
- Making an MCP server interact with launched shell commands, including interactive commands
- How to retrieve information about a device using Microsoft Defender, Intune, and Jamf
- Using Claude in Cursor to Run and Read Outputs from PowerShell or Terminal
- Information about 'Terminal'