Files
personal_development/gemini_projects/mcp/README.md
T
2026-01-03 14:06:04 -05:00

1.3 KiB

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 using FastMCP that exposes two tools (add_numbers, get_current_time).
  • gemini_client.py: A Python script that acts as an MCP client. It connects to simple_server.py, lists the available tools, and provides guidance on integrating them with the google-genai SDK.
  • 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

  1. Run the setup script:
    ./setup.sh
    
  2. Activate the virtual environment:
    source venv/bin/activate
    
  3. 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