Integrates with Gemini, Google's AI assistant, allowing for custom tool creation and interaction through the MCP protocol. The example server provides a simple greeting tool that can be called from Gemini CLI.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Greeter MCP Servergreet me as John"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Example
Quick and simple repo to demonstrate the very basics MCP and Gemini CLI. Nothing more.
Related MCP server: Gemini Thinking MCP Server
Quick Setup
Quick setup of a new project (using uv):
(linux and mac)
Clone project and initialize virtualenv
Write MCP Server And Test
The file we'll run is in
gemini-mcp-example/main.pyand already defined. Take a look at it. The main components are
Run file
(Don't forget to activate your virtual env source .venv/bin/activate)
Init communication
We're going to initialize the 2024-11-05 protocol version using stdin/stdout (the stdio protocol which we setup our fast MCP server to use).
Paste this exactly into your shell:
You should see:
NOTE: The json commands here and below must be pasted as is. You cannot have newlines in between. If the formatting is incorrect, the server will just ignore your requests.
When you do, paste this to start the connection:
Now type this to list available tools:
you should see something like this (you may see additional logging):
Congratulations! You have successfully started a Stdio connection with an MCP server! Now test calling your tool:
you should then see:
This is how you're going to setup an MCP server with Gemini.
Gemini CLI will run your server as a child process and send commands to stdin and receive responses from stdout using the stdio protocol.
Gemini CLI
Integrating with Gemini CLI.
Add the Gemini extension from here (docs):
(NOTE: This should be run from the root of this github repo)
Start gemini and list mcp servers
Then type:
You should see this:

NOTE: You must start gemini from the code folder. The reason is that the
extension runs python ./gemini-mcp-example/main.py. If you want to make this runnable from everywhere, you'll need to make sure your base python environment contains the fastmcp library and that the gemini-extension.json refers to an absolute path.
NOTE: If this is your first time setting up Gemini CLI, you will also see some easy to follow setup steps.
Give it your name. It will likely try to call your tools.
Input something like:
Gemini should figure that it might want to call the greeting tool, given you've introduced yourself. You should get a request to call the tool:

And it should hopefully have called the tool.

Troubleshooting
Running into problems? Try running the mcp server yourself to see if it's able to start up:
(Also don't forget to run source .venv/bin/activate before starting gemini; We're running this in a local virtual environment here.)
Where to go from here?
This demonstrates how easy it is to setup an MCP server and integrate it with Gemini. You should be able to have a basic enough understanding to integrate it with your own tools now!