MCP Gemini Server logo

MCP Gemini Server

by Novakiki

This project provides a dedicated MCP (Model Context Protocol) server that wraps the `@google/genai` SDK. It exposes Google's Gemini model capabilities as standard MCP tools, allowing other LLMs or MCP-compatible systems to leverage Gemini's features.

View on GitHub

Last updated: N/A

What is MCP Gemini Server?

The MCP Gemini Server is a dedicated server that wraps the @google/genai SDK, exposing Google's Gemini model capabilities as standard MCP tools. This allows other LLMs or MCP-compatible systems to utilize Gemini's features through a consistent, tool-based interface managed via the MCP standard.

How to use MCP Gemini Server?

To use the server, you need to install it either via Smithery or manually. After installation, configure your MCP client (e.g., Cline, Claude Desktop App) with the server's path and your Google AI Studio API key. Then, you can call the available MCP tools using the use_mcp_tool format in your MCP client, providing the necessary arguments for each tool.

Key features of MCP Gemini Server

  • Core Generation (standard and streaming)

  • Function Calling

  • Stateful Chat Management

  • File Handling (upload, list, retrieve, delete)

  • Caching (create, list, retrieve, update, delete)

Use cases of MCP Gemini Server

  • Integrating Gemini's text generation capabilities into other LLM workflows.

  • Enabling function calling with Gemini models in MCP-compatible systems.

  • Building stateful chat applications powered by Gemini.

  • Managing files using the Gemini API through an MCP interface.

  • Optimizing prompts and reducing costs with caching.

FAQ from MCP Gemini Server

What are the prerequisites for using this server?

You need Node.js (v18 or later) and an API Key from Google AI Studio.

Can I use Vertex AI credentials with this server?

No, this server currently only supports Google AI Studio API keys. File Handling and Caching APIs are also only compatible with Google AI Studio API keys.

How do I configure the server?

The server is configured using environment variables, specifically GOOGLE_GEMINI_API_KEY (required) and GOOGLE_GEMINI_MODEL (optional).

What kind of errors can I expect?

The server returns structured errors using the MCP standard McpError type, including code, message, and details. Common error scenarios include invalid API keys, invalid parameters, safety blocks, and file/cache not found errors.

Is true streaming supported for gemini_generateContentStream?

No, the current implementation uses a workaround and collects all chunks before returning the full text. True streaming to the MCP client is not yet implemented.