Gemini MCP Integration
This directory contains a boilerplate setup for integrating Google Gemini with the Model Context Protocol (MCP).
Structure
simple_server.py: A simple MCP server usingFastMCPthat exposes two tools (add_numbers,get_current_time).gemini_client.py: A Python script that acts as an MCP client. It connects tosimple_server.py, lists the available tools, and provides guidance on integrating them with thegoogle-genaiSDK.setup.sh: A provision script that sets up the Python virtual environment and installs dependencies.requirements.txt: List of Python dependencies.
Prerequisites
- Python 3
- Node.js & npm (for MCP Inspector)
Setup
- Run the setup script:
./setup.sh - Activate the virtual environment:
source venv/bin/activate - Set your Google API Key in
.env:# Edit .env file GOOGLE_API_KEY=your_api_key_here
Running the Example
Run the client script to see the connection to the server and the list of tools:
python gemini_client.py
Using MCP Inspector
You can use the official MCP Inspector to interact with the simple_server.py visually.
npx @modelcontextprotocol/inspector python simple_server.py