Gemini 2.5 Pro MCP server

Enables Claude Desktop to interact with Google's Gemini 2.5 Pro model through a TypeScript server with Google Search integration for grounded responses and detailed token usage reporting.
Back to servers
Provider
dakrin
Release date
Mar 28, 2025
Language
TypeScript
Stats
4 stars

This MCP server implements the Model Context Protocol to connect Claude Desktop with Google's Gemini 2.5 Pro Experimental AI model. It serves as a bridge between these platforms, allowing you to utilize Gemini's capabilities through the Claude interface.

Installation

Prerequisites

  • Node.js (recent version)
  • A Google API key for Gemini model access

Setup Instructions

  1. Clone the repository and install dependencies:
git clone https://github.com/username/gemini-mcp-server.git
cd gemini-mcp-server
npm install
  1. Set up your environment variables by creating a .env file in the project root:
GOOGLE_API_KEY=your_google_api_key_here
  1. Start the server:
npm start

The server will begin running on the default port. Ensure it's accessible to your Claude Desktop application.

Usage

Connecting to Claude Desktop

  1. Open Claude Desktop
  2. Navigate to settings
  3. Add a new MCP connection pointing to your server's address

Available Tools

The MCP server provides two main tools that you can use through Claude Desktop:

1. Generate with Gemini

This tool allows you to generate content using Google's Gemini 2.5 Pro Experimental model.

Parameters:

  • prompt (required): The text prompt to send to Gemini
  • temperature (optional): Controls randomness (0.0-1.0)
  • maxTokens (optional): Limits the response length
  • safeMode (optional): Boolean to enable safety filters for sensitive topics
  • useSearch (optional): Boolean to enable Google Search integration for grounding

Example usage in Claude Desktop:

/tool generateWithGemini
prompt: Explain quantum computing in simple terms
temperature: 0.7
maxTokens: 500
useSearch: true

2. Get Model Information

Retrieves information about the Gemini model being used.

Example usage in Claude Desktop:

/tool getModelInfo

Enabling Google Search Integration

To use the Google Search grounding feature:

  1. Set the useSearch parameter to true when using the generateWithGemini tool
  2. Ensure your API key has appropriate permissions for Google Search

Troubleshooting

Connection Issues

If you experience connection problems:

  • Verify your Google API key is valid and has appropriate permissions
  • Check that the server is running and accessible
  • Ensure your network allows the connection between Claude Desktop and the MCP server

API Key Problems

If you receive authentication errors:

  • Double-check that your .env file contains the correct API key
  • Verify that your Google API key has access to the Gemini 2.5 Pro Experimental model
  • Ensure the API key hasn't exceeded usage limits or expired

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later