home / mcp / greeter mcp server
Quick Example for adding an MCP to Gemini
Configuration
View docs{
"mcpServers": {
"jrmlhermitte-gemini-mcp-example": {
"command": "python",
"args": [
"gemini-mcp-example/main.py"
]
}
}
}You can run a local MCP server in Python and expose a simple tool that responds to a greeting. This setup uses the standard stdio transport, letting a client send requests and receive responses through the command’s standard input and output streams. It’s a lightweight way to prototype an MCP-enabled service and validate integration with clients like Gemini CLI.
You use an MCP client to connect to your local MCP server and discover its available tools. Once connected, you can invoke a tool by name and provide the required arguments. The server will respond with structured results or error information. This flow is ideal for quick testing, experimentation, and validating client integrations before deploying a production endpoint.
Prerequisites you need to have before running the server:
Install UV (Linux and macOS):
curl -LsSf https://astral.sh/uv/install.sh | shClone the example project, change into the directory, and synchronize dependencies. Then activate the virtual environment.
git clone https://github.com/jrmlhermitte/gemini-mcp-example.git
cd gemini-mcp-example
uv sync
source .venv/bin/activateStart the MCP server using the local Python file included in the project. This runs the server in stdio mode, so it can communicate with a client via standard input and output streams.
python gemini-mcp-example/main.pyOnce the server is running, you initialize the protocol version and interact with it using the client. The client will negotiate capabilities and then you can list and call tools exposed by the server. When you are done testing, you can terminate the process. The setup uses the stdio transport by default.
If you run into issues starting the server, ensure you activated the virtual environment and that you are executing the Python script from the project root.
Gemini CLI integration is demonstrated by mapping the MCP server to a local extension. You can start Gemini from the project folder and use the extension to locate and interact with the MCP server.
The server exposes a single tool that greets users by name.
Greets the provided name and returns a greeting string.