Skip to main content

ShellMCP

Expose Shell Commands as MCP Tools

ShellMCP is a powerful tool that allows you to easily create Model Context Protocol (MCP) servers by exposing shell commands as structured tools. Instead of granting AI agents full shell access (which poses security risks), ShellMCP enables you to expose only the specific commands you trust, allowing agents to work autonomously with a predefined set of safe operations.

Define your tools in YAML, and ShellMCP generates and runs a complete FastMCP server for you.

Quick Start

# Install ShellMCP
pip install shellmcp

# Run a built-in MCP server directly
shellmcp run basics

# Or create a custom server configuration
shellmcp new --name "my-server" --desc "My custom MCP server"

# Add a tool interactively
shellmcp add-tool my-server.yml

# Validate the configuration
shellmcp validate my-server.yml

# Generate the FastMCP server
shellmcp generate my-server.yml

# Or run directly from a YAML file
shellmcp run --config_file my-server.yml

Features

  • 🚀 Simple YAML Configuration: Define tools and resources in clean YAML
  • 🔧 Interactive CLI: Add tools and resources with guided prompts
  • 📝 Template Support: Use Jinja2 templates for dynamic command generation
  • ✅ Validation: Built-in configuration validation and error checking
  • 🎯 FastMCP Integration: Generates and runs production-ready FastMCP servers
  • 📦 Built-in Configurations: Pre-configured servers ready to run
  • 🔒 Security-First: Expose only trusted commands to AI agents
  • 🎨 Flexible: Support for tools and resources with reusable arguments
  • ⚡ Instant Execution: Run servers directly from YAML without generating files

Example

server:
  name: "file-manager"
  desc: "File system operations"
  version: "1.0.0"

args:
  path_arg:
    help: "Directory path"
    type: string
    default: "."
  pattern_arg:
    help: "Search pattern"
    type: string

tools:
  list_files:
    cmd: "ls -la {{path}}"
    desc: "List files in a directory"
    args:
      - name: path
        ref: path_arg
  
  search_files:
    cmd: "find {{path}} -name '{{pattern}}' -type f"
    desc: "Search for files matching a pattern"
    args:
      - name: path
        ref: path_arg
      - name: pattern
        ref: pattern_arg

resources:
  system_info:
    uri: "file:///tmp/system-info.txt"
    name: "System Information"
    description: "Current system status and info"
    cmd: "uname -a && df -h"
    mime_type: "text/plain"

prompts:
  file_analysis:
    name: "File Analysis Assistant"
    description: "Helps analyze file system contents"
    template: |
      Analyze the following file system information:
      
      Current directory: {{path}}
      Files: {{file_list}}
      
      Provide insights about the file structure and suggest any organization improvements.
    args:
      - name: path
        help: "Directory path to analyze"
        type: string
        default: "."
      - name: file_list
        help: "List of files to analyze"
        type: string

CLI Commands

ShellMCP provides several commands to help you create and manage MCP servers:

shellmcp run

Run an MCP server directly from a built-in configuration or YAML file.

# Run a built-in configuration
shellmcp run basics

# Run from a custom YAML file
shellmcp run --config_file my-server.yml

Built-in configurations:

  • basics: Basic shell operations for file system, process management, and system information

The basics configuration includes tools for:

  • File operations (list, find, copy, move, delete)
  • Directory management (create, remove, navigate)
  • Process management (list, kill processes)
  • System information (memory, disk, network)
  • Text operations (read, write, search)
  • Resources for system status and environment info

shellmcp new

Create a new server configuration file.

shellmcp new --name "my-server" --desc "My custom MCP server" --version "1.0.0"

shellmcp add-tool

Add a new tool to an existing configuration.

shellmcp add-tool my-server.yml --name "list-files" --cmd "ls -la {{path}}" --desc "List files in directory"

shellmcp add-resource

Add a new resource to an existing configuration.

shellmcp add-resource my-server.yml --name "system-info" --uri "file:///tmp/system-info.txt" --resource-name "System Information"

shellmcp add-prompt

Add a new prompt to an existing configuration.

shellmcp add-prompt my-server.yml --name "file-analysis" --prompt-name "File Analysis Assistant"

shellmcp validate

Validate a YAML configuration file.

shellmcp validate my-server.yml --verbose

shellmcp generate

Generate a FastMCP server from YAML configuration.

Default behavior: Creates a subdirectory with the server name to prevent overwriting existing files.

# Generate with default output directory (creates ./my-server/ subdirectory)
shellmcp generate my-server.yml --verbose

# Generate with custom output directory
shellmcp generate my-server.yml --output-dir ./output --verbose

Documentation

License

MIT License - see LICENSE for details.

Metadata

Release files for shellmcp 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shellmcp 1.1.0
File Size Uploaded Provenance
shellmcp-1.1.0.tar.gz 24.3 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for shellmcp 1.1.0
File Interpreter ABI Platform
shellmcp-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 47.2 kB

Release files / shellmcp-1.1.0.tar.gz

Download URL shellmcp-1.1.0.tar.gz
Size 24.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8fa6dddd72e10a9de5077dc6aeefc06954f7c6d389e28c53ec5821c61a61f7f5
BLAKE2b-256 checksum
How to use checksums
3a12c8409692029ea5589e51b1789224cc85b4b49db2f9bc64d1728a280c866b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2025.

Transparency log

Release files / shellmcp-1.1.0-py3-none-any.whl

Download URL shellmcp-1.1.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
37f4174818afb3d770f33874e5d20d72345129d531674618c65dda0c4202280c
BLAKE2b-256 checksum
How to use checksums
e1c84ac6e9c518d18fed93852cb45d649e60592fb8d7dc3a58200cba503873d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2025.

Transparency log

Security for shellmcp 1.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shellmcp-1.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 14, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page