Gemini 2.5 and 3.0 MCP Client Setup Guide
Connect Google Gemini 2.5 Pro, Flash, and Antigravity IDE directly to Model Context Protocol (MCP) servers using stdio and SSE transports.
Generate & Validate Multi-Client MCP Config
One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.
Gemini 2.5 and 3.0 MCP Client Setup Guide
With the release of Google Gemini 2.5 and 3.0 models alongside Google's Antigravity developer environment, the Model Context Protocol (MCP) has become a primary bridge for connecting Google's multi-million token context window to local developer databases, Git repositories, and cloud infrastructures.
Because Gemini natively processes tools through structured function declarations, connecting Gemini to MCP requires an adapter runtime that translates MCP tools/list schemas into Gemini FunctionDeclaration objects and serializes Gemini tool call outputs back into standard JSON-RPC 2.0 frames.
This guide provides the complete setup for configuring Gemini models and the Antigravity IDE as an authoritative MCP client.
1. Architecture: The Gemini MCP Bridge
Gemini communicates via the Google GenAI SDK, while MCP servers operate over standard input/output (stdio) or Server-Sent Events (SSE). The bridge runs locally to handle protocol translation:
sequenceDiagram
participant User as Developer / Antigravity IDE
participant Gemini as Gemini 2.5 / 3.0 Model
participant Bridge as Gemini MCP Bridge
participant Server as MCP Server (PostgreSQL)
User->>Bridge: User prompt ("Find active users in db")
Bridge->>Server: tools/list (JSON-RPC)
Server-->>Bridge: Tool schemas (query, inspect_table)
Bridge->>Gemini: Prompt + FunctionDeclarations
Gemini-->>Bridge: functionCall: query(sql="SELECT * FROM users...")
Bridge->>Server: tools/call (name="query", args={...})
Server-->>Bridge: result: { rows: [...] }
Bridge->>Gemini: functionResponse: { rows: [...] }
Gemini-->>User: Formatted analytical response2. Antigravity IDE MCP Configuration
In Google Antigravity, MCP servers are declared in the root configuration file located at ~/.gemini/antigravity-ide/mcp_config.json:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-postgres",
"postgresql://admin:secret@/app_development"
]
},
"github": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxxxxxxxxxxxxxxxxxx"
}
},
"filesystem": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-filesystem",
"c:/Users/developer/projects"
]
}
}
}3. Python SDK: Native Gemini MCP Client
If you are invoking Gemini models programmatically in Python, use the following adapter to wire MCP servers into Gemini's chats:
# gemini_mcp_client.py
import asyncio
import json
from google import genai
from google.genai import types
class GeminiMCPClient:
def __init__(self, api_key: str, mcp_cmd: str, mcp_args: list[str]):
self.ai = genai.Client(api_key=api_key)
self.cmd = mcp_cmd
self.args = mcp_args
self.server = None
async def start(self):
"""Spawn the MCP server process over stdio."""
self.server = await asyncio.create_subprocess_exec(
self.cmd, *self.args,
stdin=asyncio.subprocess.PIPE,
stdout=asyncio.subprocess.PIPE
)
# Initialize MCP handshake
await self._rpc_call("initialize", {
"protocolVersion": "2024-11-05",
"capabilities": {},
"clientInfo": {"name": "Gemini-MCP-Runner", "version": "1.0"}
})
async def get_gemini_tool_declarations(self):
"""Fetch MCP tools and convert to Gemini FunctionDeclaration format."""
tools_res = await self._rpc_call("tools/list", {})
mcp_tools = tools_res.get("tools", [])
function_declarations = []
for tool in mcp_tools:
function_declarations.append(
types.FunctionDeclaration(
name=tool["name"],
description=tool.get("description", ""),
parameters=tool.get("inputSchema", {})
)
)
return types.Tool(function_declarations=function_declarations)
async def execute_tool_call(self, name: str, args: dict):
"""Relay Gemini tool call back into MCP tools/call."""
res = await self._rpc_call("tools/call", {
"name": name,
"arguments": args
})
return res.get("content", [])
async def _rpc_call(self, method: str, params: dict):
payload = {"jsonrpc": "2.0", "id": 1, "method": method, "params": params}
self.server.stdin.write((json.dumps(payload) + "\n").encode())
await self.server.stdin.drain()
line = await self.server.stdout.readline()
return json.loads(line.decode()).get("result", {})With this integration, Gemini's 2M+ token context window can ingest massive schema definitions and execute verified SQL queries, filesystem refactors, and Git PR audits with zero tool hallucination.
Build your full agent toolstack in the Visual Generator
Combine Gemini 2.5 and 3.0 MCP Client Setup Guide with databases, search APIs, and memory graphs in a single configuration file.
Did this setup guide work with your AI host?
Real-time developer votes ensure configurations stay current across client updates.
Gemini 2.5 and 3.0 MCP Client Setup Guide FAQ
What is the Gemini 2.5 and 3.0 MCP Client Setup Guide?
Connect Google Gemini 2.5 Pro, Flash, and Antigravity IDE directly to Model Context Protocol (MCP) servers using stdio and SSE transports.
How do I configure Gemini 2.5 and 3.0 MCP Client Setup Guide in Claude Desktop or Cursor?
You can copy the configuration JSON from our guide or launch the interactive MCP Codex Config Generator at https://mcp-codex.com/generator to export valid configs in 1 click.
Can I use Gemini 2.5 and 3.0 MCP Client Setup Guide with the OpenAI Codex CLI?
Yes, OpenAI Codex CLI supports Model Context Protocol. You can add it directly to ~/.codex/config.toml or pass arguments to codex mcp add.
Specializing in Model Context Protocol (MCP) integrations, autonomous AI agent orchestration, and distributed developer toolchains. Researches and benchmarks production MCP client-server architectures across OpenAI Codex, Claude, and Cursor.
Related Guides
Configure MCP Servers in OpenAI Codex CLI
Complete 2026 config.toml setup, CLI commands, and troubleshooting for connecting MCP servers to OpenAI Codex CLI.
Getting StartedWhat Is the Model Context Protocol (MCP)? A Complete Introduction
An authoritative technical breakdown of the Model Context Protocol (MCP): architecture, JSON-RPC 2.0 wire lifecycle, stdio vs SSE transports, and secure AI tool integrations.
Getting StartedHow to Set Up Your First MCP Server in 5 Minutes
A quick-start guide to installing and configuring your very first MCP server with Claude Desktop. Get up and running in minutes.