Skip to main content
Glama
YongpengFu

Terminal MCP Server

by YongpengFu

Terminal MCP Server

A simple MCP (Model Context Protocol) server that exposes a terminal tool and a resource for running shell commands and accessing documentation.

Features

  • Terminal Tool: Execute shell commands and get their output

  • Resource Support: Access the MCP readme documentation file

  • Working Directory Support: Optionally specify a working directory for commands

  • Timeout Protection: Commands timeout after 30 seconds

  • Error Handling: Proper error handling for failed commands

Related MCP server: MCP-dev

Installation

The project uses uv for dependency management. Install dependencies:

uv sync

Usage

Running the Server

python server.py

Tools

The server exposes a single tool called terminal with the following schema:

{
  "name": "terminal",
  "description": "Run terminal commands and return the output",
  "inputSchema": {
    "type": "object",
    "properties": {
      "command": {
        "type": "string",
        "description": "The shell command to execute"
      },
      "cwd": {
        "type": "string",
        "description": "Working directory for the command (optional)"
      }
    },
    "required": ["command"]
  }
}

Example Usage

The tool can be called with:

{
  "command": "ls -la",
  "cwd": "/path/to/directory"
}

Resources

The server exposes a resource for accessing the MCP readme documentation:

  • URI: file:///resource/mcpreadme.md

  • Name: MCP Readme

  • Description: MCP documentation and readme file

  • MIME Type: text/markdown

This resource allows clients to read the MCP documentation directly through the server.

Security Note

⚠️ Warning: This server allows execution of arbitrary shell commands. Use with caution and only in trusted environments.

Dependencies

  • mcp[cli]>=1.13.0 - MCP Python SDK

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Custom MCP tools for local development that enable file system access, shell command execution, and web resource browsing. Designed for local use with safety considerations for potentially destructive operations.
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables execution of arbitrary CLI tools and shell scripts by defining them in YAML configuration files as MCP Tools. Supports custom shells (bash, Python, Node.js, Deno), input parameters passed as environment variables, and flexible timeout settings.
    12 npm
    36
    MIT