Gemini Agent MCP Server
An MCP server that gives AI clients Gemini Flash–powered web search, URL analysis, and Python code execution on Vertex AI.
Web search: Google Search–grounded answers with up-to-the-minute information (
gemini_web_search).URL analysis: fetch and deeply analyze specific pages, with an optional instruction for what to extract (
gemini_url_context).Code execution: write and run Python in a Gemini sandbox for math, data analysis, statistics, simulations, and logical reasoning (
gemini_code_execution).Thinking mode: internal reasoning with a configurable budget (512 tokens by default).
Client-side orchestration: each tool makes a single-tool call, so multi-step research is coordinated across requests by the client.
Schema note: the provided schema exposes only the legacy
ask_gemini_agenttool (a single search-grounded call taking aquery); the three purpose-built tools above are described in the README but not present in this schema snippet.
Integrates with Google Cloud's Vertex AI to access Gemini 3.1 models, enabling complex research, search grounding, URL analysis, and Python code execution.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gemini Agent MCP Servercompare the capabilities of GPT-4 and Gemini 3.1"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gemini Agent MCP Server
An advanced Model Context Protocol (MCP) server that provides three purpose-built agent tools — web search, URL analysis, and code execution — via Gemini Flash models on Vertex AI.
Unlike a standard search tool, this server separates each capability into its own MCP tool, so your AI client (goose, Claude Desktop, etc.) can orchestrate real-time Google Search, deep URL analysis, and Python code execution across multiple requests to solve complex, multi-step research and data tasks.
Features
Search Grounding: Uses Google Search to find up-to-the-minute information.
URL Context: Automatically fetches and parses the content of specific web pages for deep analysis.
Code Execution: Writes and executes Python code on-the-fly to perform calculations, data manipulation, or logical reasoning.
Thinking Mode: Uses Gemini's internal reasoning to plan and refine its approach before answering — a 512-token thinking budget by default, overridable with
GEMINI_THINKING_LEVELorGEMINI_THINKING_BUDGET.
Related MCP server: Gemini Research MCP Server
Prerequisites
Google Cloud Project: You must have a Google Cloud project with the Vertex AI API enabled.
Authentication: You must have gcloud CLI installed and authenticated:
gcloud auth application-default loginPermissions: Your account needs the
Vertex AI Userrole on the project.
Configuration
The server requires the following environment variables:
Variable | Description | Default |
| Your Google Cloud Project ID (Required) | - |
| Vertex AI location |
|
| Gemini model ID to call; must be available for the project and location on Vertex AI |
|
| Overrides thinking depth ( | unset |
| Thinking budget in tokens |
|
Note: GOOGLE_CLOUD_PROJECT can also be used instead of GCP_PROJECT_ID, and GOOGLE_CLOUD_LOCATION instead of GCP_LOCATION.
Installation & Usage
1. Build the project
npm install
npm run build2. Integration with Goose
Add the following to your ~/.config/goose/profiles.yaml (or manage via the Goose UI):
gemini-agent:
cmd: node
args:
- /path/to/gemini-agent-mcp/build/index.js
envs:
GCP_PROJECT_ID: "your-project-id"
GCP_LOCATION: "global"3. Integration with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"gemini-agent": {
"command": "node",
"args": ["/path/to/gemini-agent-mcp/build/index.js"],
"env": {
"GCP_PROJECT_ID": "your-project-id",
"GCP_LOCATION": "global",
"PATH": "/usr/local/bin:/usr/bin:/bin"
}
}
}
}Tools
The server exposes three purpose-built tools. Because the underlying model rejects requests that combine multiple tools ("Multiple tools are supported only when they are all search tools"), each tool makes a single-tool Gemini call; orchestration across capabilities happens at the client level.
gemini_web_search
Search the web using Google Search grounding and get an AI-synthesized answer with up-to-the-minute information.
Arguments:
query(string, required)Use for: current events, recent releases, news, or any question where search results would improve the answer.
gemini_url_context
Fetches and deeply analyzes the content of specific web page URLs.
Arguments:
urls(array of URLs, required),instruction(string, optional — what to learn from the page(s))Use for: when you have a concrete URL and want to extract, summarize, or answer questions about its content.
gemini_code_execution
Writes and executes Python code in a Gemini sandbox to solve computational problems.
Arguments:
task(string, required — described in plain language)Use for: math, data analysis, statistics, data transformation, simulations, or logical reasoning.
ask_gemini_agent (legacy)
The original all-in-one tool, kept for backward compatibility with existing client configurations. Because the configured model cannot combine tools in one request, it now performs a single search-grounded call — prefer the three purpose-built tools above.
Limitations
Model: Defaults to
gemini-3.8-flash(current Gemini Flash model on Vertex AI,globallocation). Override withGEMINI_MODELto any model available for your project andGCP_LOCATION. Note: Developer-API aliases such asgemini-flash-latestdo not exist as Vertex AI publisher models and fail with 404 — see the model documentation.One Tool Per Request: The model supports search, URL context, and code execution individually, but the API rejects combining them in a single request; the server automatically falls back to a single tool (search first) if the combined request is rejected.
Python-only Code Execution: The code execution environment is restricted to standard Python libraries provided by the Gemini sandbox.
Stdio Transport: This server currently only supports standard I/O communication.
Testing
npm run test:integration runs an end-to-end smoke test over stdio: it launches the built server with GEMINI_MODEL unset (exercising the built-in default model), verifies all four tools are registered, and issues one live search-grounded request. It requires Google Application Default Credentials ("gcloud auth application-default login") and network access.
npm run build
npm run test:integrationLicense
MIT
Available Tools
1 toolask_gemini_agentA
An AI agent capable of searching the web (search grounding), analyzing specific URLs, and writing/executing Python code to solve complex problems, perform data analysis, or answer research questions.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The task, question, or research topic for the agent to resolve |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
The description openly lists the agent's capabilities (web search, URL analysis, code execution). Without annotations, it carries the full burden and does so fairly well, though it omits potential limitations or failure modes.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single sentence that efficiently conveys the tool's purpose. It is concise but not overly terse; however, it could be broken into shorter sentences for clarity.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the single parameter and no output schema or sibling tools, the description provides sufficient context to understand when and how to use the tool. It covers the agent's main capabilities.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The sole parameter 'query' is well-described in the schema as 'the task, question, or research topic.' The tool description reinforces this by explaining the agent's actions, adding context beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the agent's capabilities: web search, URL analysis, and Python code execution. It specifies the resource (Gemini agent) and actions, making the purpose unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides clear context on when to use the tool ('complex problems, data analysis, research questions'). However, it does not explicitly state when not to use it or list alternatives, though no sibling tools exist.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
1 tool update
v2.0.0- First observed
ask_gemini_agent
TDQS
Scored across 1 tool
With only one tool, there is no risk of confusion between tools; the single tool's purpose is clearly described.
The single tool name follows a clear verb_noun pattern and is consistently styled, so no inconsistency arises.
One tool is borderline for a server that aims to provide web search, URL analysis, and code execution; typically such capabilities yield at least 3-5 tools.
The tool covers a broad range of tasks, but bundling them into one tool may hide missing operations; a more modular surface would be expected for a domain like this.
Maintenance
Related MCP Connectors
Web search API and MCP server for developers building AI agents.
Official MCP server for Agentwork — delegate tasks to AI agents with human-in-the-loop
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
An MCP server that gives your AI access to the source code and docs of all public github repos
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that utilizes LangGraph and Google Gemini to conduct comprehensive research through multi-iteration deep searches and quick results. It provides high-quality analysis with automated citations and grounding metadata for thorough investigations.2MIT
- AlicenseAqualityAmaintenanceMCP server for AI-powered research using Gemini. Provides fast grounded web search, deep autonomous research, URL extraction, and session management.983 PyPI9MIT
- AlicenseAqualityBmaintenanceAn MCP server that exposes Gemini's Deep Research Agent for comprehensive web research.262 npm46 PyPI4MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that lets AI assistants use Google's Gemini models. Generate text, analyze images, review code, and more — with support for multi-turn conversations and web-grounded answers.116 npm1MIT