MCP (Model Context Protocol)¶
Autobot can connect to external MCP servers to extend the LLM's capabilities with remote tools. MCP servers expose tools via JSON-RPC 2.0 over stdio — autobot discovers them at startup and registers them as regular tools so the LLM can use them transparently.
How It Works¶
- On startup, autobot reads the
mcp.serverssection fromconfig.yml - All servers are started in the background — they do not block startup
- For each server, it spawns the command as a child process
- Performs the MCP protocol handshake (initialize + notifications/initialized)
- Calls
tools/listto discover available tools - Registers each tool as
mcp_{server}_{tool}in the tool registry - The LLM sees these as native tools and can call them like any other
Since MCP servers connect asynchronously, tools become available shortly after startup rather than delaying it. Multiple servers are started concurrently.
Configuration¶
Add an mcp section to your config.yml:
mcp:
servers:
garmin:
command: "uvx"
args: ["--python", "3.12", "--from", "git+https://github.com/Taxuspt/garmin_mcp", "garmin-mcp"]
env:
GARMIN_EMAIL: "${GARMIN_EMAIL}"
GARMIN_PASSWORD: "${GARMIN_PASSWORD}"
github:
command: "npx"
args: ["-y", "@modelcontextprotocol/server-github"]
env:
GITHUB_TOKEN: "${GITHUB_TOKEN}"
Each server entry has:
| Field | Type | Description |
|---|---|---|
command |
string | Executable to spawn (must be in PATH) |
args |
string[] | Command-line arguments |
env |
map | Environment variables passed to the process |
tools |
string[] | Tool allowlist (empty = all). Supports * prefix matching |
Environment variables support ${VAR} expansion from your .env file or shell environment.
Tool Naming¶
MCP tools are prefixed to avoid collisions with built-in tools:
All characters outside [a-z0-9_] are replaced with underscores. For example:
| Server | Remote Tool | Registered As |
|---|---|---|
| garmin | get_activities | mcp_garmin_get_activities |
| github | list-repos | mcp_github_list_repos |
Security¶
MCP servers run as regular child processes (not sandboxed) because they typically need network access for external APIs. However, several safeguards are in place:
- Env isolation: Only explicitly configured env vars are passed to the process, plus
PATH,HOME, andLANGfrom the host - No workspace sharing: MCP processes do not receive access to autobot's workspace directory
- Timeouts: 30s for initialization handshake, 60s for tool calls
- Response truncation: Tool results are capped at 50KB to prevent memory issues
- No auto-restart: If a server crashes, its tools return errors until autobot is restarted
Troubleshooting¶
Server fails to start¶
Check that the command is installed and in your PATH:
Enable debug logging to see stderr output from MCP servers:
Tools not discovered¶
Verify the server responds to the MCP protocol. You can test manually:
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"0.1.0"}}}' | npx -y @modelcontextprotocol/server-github
Timeouts¶
If a server takes longer than 30s to initialize (e.g. downloading dependencies on first run), the handshake will fail. Pre-install dependencies before running autobot: