MCP Shell Server
A simple Model Context Protocol (MCP) server that exposes a terminal tool for executing shell commands.
Features
- Terminal Tool: Execute shell commands and get results
- Safety Features: 30-second timeout and error handling
- Flexible: Optional working directory parameter
- Claude Integration: Tool named
run_command
for easy Claude integration
Installation
The project uses uv
for dependency management. Dependencies are already configured in pyproject.toml
.
Usage
Running the Server
The server will start and wait for MCP client connections via stdin/stdout.
Tool Description
The server exposes a run_command
tool with the following parameters:
command
(required): The shell command to executeworking_directory
(optional): Directory to run the command in
Example Usage
The terminal tool can be used to run commands like:
ls -la
- List files in current directorypwd
- Get current working directoryecho "Hello World"
- Print textpython --version
- Check Python version
Response Format
The tool returns a dictionary with:
stdout
: Standard output from the commandstderr
: Standard error from the commandreturn_code
: Exit code of the commandsuccess
: Boolean indicating if command succeeded (return code 0)
MCP Integration
This server follows the Model Context Protocol specification and can be integrated with MCP clients like Claude Desktop. The tool is named run_command
for easy identification and use.
Security Note
This server allows execution of arbitrary shell commands. Use with caution and ensure proper access controls are in place in production environments.
Development
This is a simple implementation using the MCP Python SDK with FastMCP. The server can be extended with additional tools as needed.
This server cannot be installed
A simple MCP server that provides a terminal tool for executing shell commands with safety features like timeouts and error handling.
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
- AsecurityAlicenseAqualityAn MCP server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface for LLMs.Last updated -1058PythonMIT License
- AsecurityAlicenseAqualityA secure terminal execution server that enables controlled command execution with security features and resource limits via the Model Context Protocol (MCP).Last updated -1121JavaScriptMIT License
- -securityFlicense-qualityA simple MCP server that allows accessing and executing shell commands on a VM machine through a web-based terminal interface, with automatic tunneling to make the VM accessible from anywhere.Last updated -392JavaScript