Expose Shell Commands as MCP tools
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file shellmcp-1.1.0.tar.gz.
File metadata
- Download URL: shellmcp-1.1.0.tar.gz
- Upload date:
- Size: 24.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8fa6dddd72e10a9de5077dc6aeefc06954f7c6d389e28c53ec5821c61a61f7f5
|
|
| MD5 |
8e0bce75ca43116753a493c194b1db85
|
|
| BLAKE2b-256 |
3a12c8409692029ea5589e51b1789224cc85b4b49db2f9bc64d1728a280c866b
|
Provenance
The following attestation bundles were made for shellmcp-1.1.0.tar.gz:
Publisher:
pypi-publish.yml on BlakeASmith/shellmcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shellmcp-1.1.0.tar.gz -
Subject digest:
8fa6dddd72e10a9de5077dc6aeefc06954f7c6d389e28c53ec5821c61a61f7f5 - Sigstore transparency entry: 514927760
- Sigstore integration time:
-
Permalink:
BlakeASmith/shellmcp@51c77529e1361b7e29cfce709d9306a51116dc26 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/BlakeASmith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@51c77529e1361b7e29cfce709d9306a51116dc26 -
Trigger Event:
push
-
Statement type:
File details
Details for the file shellmcp-1.1.0-py3-none-any.whl.
File metadata
- Download URL: shellmcp-1.1.0-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37f4174818afb3d770f33874e5d20d72345129d531674618c65dda0c4202280c
|
|
| MD5 |
1311aa5ce876ce582b3aecfef41f982e
|
|
| BLAKE2b-256 |
e1c84ac6e9c518d18fed93852cb45d649e60592fb8d7dc3a58200cba503873d2
|
Provenance
The following attestation bundles were made for shellmcp-1.1.0-py3-none-any.whl:
Publisher:
pypi-publish.yml on BlakeASmith/shellmcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shellmcp-1.1.0-py3-none-any.whl -
Subject digest:
37f4174818afb3d770f33874e5d20d72345129d531674618c65dda0c4202280c - Sigstore transparency entry: 514927791
- Sigstore integration time:
-
Permalink:
BlakeASmith/shellmcp@51c77529e1361b7e29cfce709d9306a51116dc26 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/BlakeASmith
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@51c77529e1361b7e29cfce709d9306a51116dc26 -
Trigger Event:
push
-
Statement type: