How to Get Gemini-CLI to Recognize MCP Servers from Docker?

0
4
Asked By CuriousCat123 On

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?

2 Answers

Answered By WSLWarrior99 On

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?

Answered By DockerDude42 On

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.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.