How to Get Gemini-CLI to Recognize MCP Servers from Docker?
Asked by
8min_exposure
I'm having trouble getting the gemini-cli to recognize the MCP servers listed in the Docker catalog. I've run the command to check the status and it shows that the MCP servers are either ready or disconnected, but I can't seem to access the tools available in the disconnected ones. It works fine on Cursor. Has anyone figured out how to fix this issue?
Answers
To connect the gemini-cli with the MCP Toolkit, youโll need to update your `~/.gemini/settings.json` file. The exact settings depend on which version of the MCP Toolkit youโre using.
If you're using the recent version included in Docker Desktop (version 4.42 or later), your configuration should look like this:
```json
{
"mcpServers": {
"docker-mcp": {
"command": "docker",
"args": [
"mcp",
"gateway",
"run"
]
}
}
}
```
For the older MCP Toolkit running as an extension (which is being phased out), youโll need:
```json
{
"mcpServers": {
"docker-mcp": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"alpine/socat",
"STDIO",
"TCP:host.docker.internal:8811"
]
}
}
}
```
Keep in mind, the Gemini CLI might not always update the tool list automatically, so after modifying the MCP settings, a restart of the gemini-cli is usually necessary to see the new changes.
Reply to this answer
I tried adding the suggested configuration but it's still not workingโrunning gemini-cli within WSL (Ubuntu 22.04). Hereโs how my `~/.gemini/settings.json` looks:
```json
{
"selectedAuthType": "oauth-personal",
"theme": "Ayu",
"mcpServers": {
"desktop-commander": {
"command":"cmd",
"args":[
"/c",
"npx",
"-y",
"@smithery/cli@latest",
"run",
"@wonderwhy-er/desktop-commander",
"--key",
"c2dab..."
]
},
"MCP_DOCKER": {
"command":"docker",
"args":[
"mcp",
"gateway",
"run"
],
"env": {
"LOCALAPPDATA":"/mnt/c/users/pedro/AppData/Local",
"ProgramFiles":"/mnt/c/Program Files"
}
}
}
}
```
Can anyone help with what might be going wrong here?
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions