This project demonstrates a simple MCP server using the MCP Python SDK. The server exposes a single tool, call_terminal, which allows users to run terminal commands asynchronously and receive their output.
- Exposes a single tool:
call_terminal - Allows running terminal commands from MCP-compatible clients
- Asynchronous implementation for non-blocking command execution
- Python 3.8+
- MCP Python SDK
-
Clone the repository (if you haven't already):
git clone <your-repo-url> cd shellserver
-
Install dependencies (using pip):
pip install "mcp[cli]"Or with uv:
uv pip install "mcp[cli]"
Run the server script:
python server.pyOr, for development/testing with the MCP CLI:
mcp dev server.pyThe server exposes a tool called call_terminal that takes a single argument:
command(str): The shell command to execute.
It returns the standard output or error from the command.
If you connect to this server using an MCP-compatible client, you can call the tool like this:
- Tool name:
call_terminal - Arguments:
command:echo Hello, MCP!
Response:
Hello, MCP!
This tool executes arbitrary shell commands. For demonstration and local use only. Do not expose this server to untrusted users or production environments.