Add a local stdio MCP server

mcp tools

// what it does

grok mcp add registers an MCP server so Grok can call its tools. For a local server, use --transport stdio with --command (the executable) and --args (its arguments); Grok launches it as a subprocess. Pass --env to inject any secrets it needs.

// shell

$ grok mcp add my-server --transport stdio --command "bun" --args server.js
$ grok mcp add my-server --transport stdio --command "python" --args "-m" "my_mcp_server" --env "API_KEY=your-key"

// gotcha

stdio servers run as child processes on your machine with your permissions — only add servers you trust. The server is recorded in .grok/settings.json under mcpServers, so it applies to that project.

// resources