The Model Context Protocol (MCP) is an open protocol that standardizes how applications provide context and tools to LLMs. It acts as a plugin system for Cursor, allowing you to extend the AI's capabilities by connecting it to various data sources and tools through standardized interfaces.
The MCPShell lets you expose command-line tools to Cursor's AI, enabling it to interact with your system, run commands, and process their output.
Create a mcp-cli.yaml file with your tool definitions:
mcp:
run:
shell: bash
tools:
- name: "weather"
description: "Get the weather for a location"
params:
location:
type: string
description: "The location to get weather for"
required: true
constraints:
- "location.size() <= 50" # Prevent overly long inputs
run:
command: "curl -s 'https://wttr.in/{{ .location }}?format=3'"Cursor supports two configuration locations:
- Project-specific: Create a
.cursor/mcp.jsonfile in your project directory - Global: Create a
~/.cursor/mcp.jsonfile in your home directory
The MCPShell uses the "stdio" transport type, which runs locally on your machine.
{
"mcpServers": {
"mcpshell": {
"command": "go",
"args": [
"run",
"github.com/inercia/MCPShell@v0.1.8",
"mcp",
"--tools",
"/absolute/path/to/mcp-cli.yaml"
]
}
}
}{
"mcpServers": {
"mcpshell": {
"command": "/absolute/path/to/mcpshell",
"args": ["mcp", "--tools", "/absolute/path/to/mcp-cli.yaml"]
}
}
}After creating or modifying your MCP configuration, reflesh the Cursor client for the changes to take effect.
You can configure multiple instances of the MCPShell, each with different tool sets and configurations:
{
"mcpServers": {
"mcp-cli-examples": {
"command": "/some/path/mcpshell/build/mcpshell",
"args": [
"mcp",
"--tools",
"/some/path/mcpshell/examples/config.yaml",
"--logfile",
"/some/path/mcpshell/debug.log"
],
"env": {}
},
"mcp-cli-kubernetes-ro": {
"command": "/some/path/mcpshell/build/mcpshell",
"args": [
"mcp",
"--tools",
"/some/path/mcpshell/examples/kubectl-ro.yaml",
"--logfile",
"/some/path/mcpshell/debug.kubernetes-ro.log"
],
"env": {
"KUBECONFIG": "/some/path/ethos/kubeconfig/kubeconfig.yaml"
}
}
}
}With this configuration, Cursor will have access to tools from both instances:
You can provide authentication credentials and other sensitive information using environment variables:
{
"mcpServers": {
"mcpshell": {
"command": "/absolute/path/to/mcpshell",
"args": ["mcp", "--tools", "/absolute/path/to/mcp-cli.yaml"],
"env": {
"API_KEY": "your-api-key-here",
"SECRET_TOKEN": "your-secret-token"
}
}
}
}When you chat with Cursor, the AI will:
- Automatically detect when a tool might be useful based on your request
- Ask for approval before running any tool (by default)
- Display the results in the chat conversation
You can prompt Cursor to use specific tools by mentioning them by name or description in your request.
By default, when Cursor wants to use an MCP tool, it will display a message asking for your approval. You can:
- View the arguments the tool will be called with
- Approve the tool just once
- Approve the tool for the current session
- Configure auto-run to allow tools to run without approval
- Tool Quantity: Cursor currently supports up to 40 tools at a time
- Remote Development: MCP servers may not work properly when accessing Cursor over SSH or other remote development environments
- Resources: Currently, only tools are supported in Cursor; resources are not yet supported
Read the troubleshooting guide.
