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.
git clone https://github.com/username/gemini-mcp-server.git
cd gemini-mcp-server
npm install
.env
file in the project root:GOOGLE_API_KEY=your_google_api_key_here
npm start
The server will begin running on the default port. Ensure it's accessible to your Claude Desktop application.
The MCP server provides two main tools that you can use through Claude Desktop:
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 Geminitemperature
(optional): Controls randomness (0.0-1.0)maxTokens
(optional): Limits the response lengthsafeMode
(optional): Boolean to enable safety filters for sensitive topicsuseSearch
(optional): Boolean to enable Google Search integration for groundingExample usage in Claude Desktop:
/tool generateWithGemini
prompt: Explain quantum computing in simple terms
temperature: 0.7
maxTokens: 500
useSearch: true
Retrieves information about the Gemini model being used.
Example usage in Claude Desktop:
/tool getModelInfo
To use the Google Search grounding feature:
useSearch
parameter to true
when using the generateWithGemini toolIf you experience connection problems:
If you receive authentication errors:
.env
file contains the correct API keyThere 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.
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"
]
}
}
}
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.
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.