Skip to main content
Glama

MCP Shell Server

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

# Using uv uv run python server.py # Or directly with Python python server.py

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 execute
  • working_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 directory
  • pwd - Get current working directory
  • echo "Hello World" - Print text
  • python --version - Check Python version

Response Format

The tool returns a dictionary with:

  • stdout: Standard output from the command
  • stderr: Standard error from the command
  • return_code: Exit code of the command
  • success: 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.

-
security - not tested
F
license - not found
-
quality - not tested

A simple MCP server that provides a terminal tool for executing shell commands with safety features like timeouts and error handling.

  1. Features
    1. Installation
      1. Usage
        1. Running the Server
        2. Tool Description
        3. Example Usage
        4. Response Format
      2. MCP Integration
        1. Security Note
          1. Development

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A 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 -
              1
              74
              Python
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              An MCP server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface for LLMs.
              Last updated -
              10
              58
              Python
              MIT License
              • Apple
            • A
              security
              A
              license
              A
              quality
              A secure terminal execution server that enables controlled command execution with security features and resource limits via the Model Context Protocol (MCP).
              Last updated -
              1
              12
              1
              JavaScript
              MIT License
              • Apple
            • -
              security
              F
              license
              -
              quality
              A 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 -
              39
              2
              JavaScript

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/IsaacCode0107/MCP-Test'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server