- MCPShell
MCPShell
Imagine you want Cursor (or some other MCP client) help you with your space problems in your hard disk.
Create a configuration file example.yaml defining your tools:
mcp:
description: |
Tool for analyzing disk usage to help identify what's consuming space.
run:
shell: bash
tools:
- name: "disk_usage"
description: "Check disk usage for a directory"
params:
directory:
type: string
description: "Directory to analyze"
required: true
max_depth:
type: number
description: "Maximum depth to analyze (1-3)"
default: 2
constraints:
- "directory.startsWith('/')" # Must be absolute path
- "!directory.contains('..')" # Prevent directory traversal
- "max_depth >= 1 && max_depth <= 3" # Limit recursion depth
- "directory.matches('^[\\w\\s./\\-_]+$')" # Only allow safe path characters, prevent command injection
run:
command: |
du -h --max-depth={{ .max_depth }} {{ .directory }} | sort -hr | head -20
output:
prefix: |
Disk Usage Analysis (Top 20 largest directories):
Take a look at the examples directory for more sophisticated and useful examples. Maybe you prefer to let the LLM know about your Kubernetes cluster with kubectl? Or let it run some AWS CLI commands?
Configure the MCP server in Cursor (or in any other LLM client with support for MCP)
For example, for Cursor, create .cursor/mcp.json:
{
// you need the "go" command available
"mcpServers": {
"mcp-cli-examples": {
"command": "go",
"args": [
"run", "github.com/inercia/MCPShell@v0.1.4",
"mcp", "--config", "/my/example.yaml", "--logfile", "/some/path/mcpshell/example.log"
]
}
}
}
See more details on how to configure Cursor or Visual Studio Code. Other LLMs with support for MCPs should be configured in a similar way.
Make sure your MCP client is refreshed (Cursor should recognize it automatically the firt time, but any change in the config file will require a refresh).
Ask your LLM some questions it should be able to answer with the new tool. For example: "I'm running out of space in my hard disk. Could you help me finding the problem?".
Server Config
{
"mcpServers": {
"mcpshell": {
"command": "go",
"args": [
"run",
"github.com/inercia/MCPShell@v0.1.4",
"mcp",
"--config",
"https://raw.githubusercontent.com/inercia/MCPShell/refs/heads/main/examples/kubectl-ro.yaml"
]
}
}
}