Add a local MCP server from the command line
mcp & extensions
// what it does
gemini mcp add registers a Model Context Protocol server so its tools show up in the agent. For a local stdio server, give a name followed by the command and its args. Add -e KEY=value to pass environment variables and -s user to register it for every project instead of just this one (the default scope is project).
// shell
$ gemini mcp add github npx -y @modelcontextprotocol/server-github$ gemini mcp add -s user -e API_KEY=xyz weather npx -y weather-mcp// gotcha
Anything after the server name is parsed as the command and its arguments, so flags meant for gemini mcp add must come before the name or they get handed to the server instead. Registration writes to settings.json; it does not verify the server actually starts — run /mcp to confirm it connected.