Gemini Agent MCP Server
Provides a Model Context Protocol interface to the Gemini CLI, enabling AI agents to call the Gemini model and interact with development tools like code linting, GitHub operations, and documentation generation. Includes security measures to prevent unauthorized file access through path validation.
README
Gemini Agent MCP Server
This server provides a Model Context Protocol (MCP) interface to the Gemini CLI. It allows AI agents and other systems to call the Gemini model and other tools by interacting with a standardized JSON-RPC endpoint.
Setup
-
Install Dependencies:
pip install -r requirements.txt -
Install Linters (for
lint_codetool):- For Python linting,
pylintis installed with the requirements. - For JavaScript linting, you need to have
eslintinstalled and available in your system's PATH. You can typically install it using npm:npm install -g eslint
- For Python linting,
-
Set Environment Variables:
-
Ensure you are logged in to Gemini CLI: Make sure you have the Gemini CLI installed and you are logged in. The server uses the Gemini CLI to call the Gemini model.
-
GitHub Token: For the
create_github_issueandcreate_github_prtools, you need to set theGITHUB_TOKENenvironment variable to your GitHub personal access token.export GITHUB_TOKEN="YOUR_GITHUB_TOKEN" -
Server Port (Optional): The server port can be configured using the
MCP_PORTenvironment variable. It defaults to5001.export MCP_PORT=8080
-
-
Run the Server:
python src/main.pyThe server will start on the port specified by
MCP_PORT, or 5001 by default.
Usage
The server exposes two main endpoints:
GET /mcp: Returns the MCP manifest, which describes the available tools.POST /jsonrpc: The JSON-RPC endpoint for calling the tools.
Example: Calling a tool using JSON-RPC
You can use curl to send a JSON-RPC request to any of the available tools. Here is an example of calling the call_gemini tool:
curl -X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "call_gemini",
"params": {
"prompt": "What is the capital of France?",
"context": "This is a simple geography question."
},
"id": 1
}' \
http://127.0.0.1:5001/jsonrpc
This will return a JSON-RPC response with the answer from the Gemini model.
Browsable API
For development and testing, you can access a web browsable API for the JSON-RPC endpoint by navigating to http://127.0.0.1:5001/jsonrpc in your web browser.
Security
This server includes security measures to prevent unauthorized file access.
File Path Validation
All tools that accept a file path (summarize_docs, lint_code, analyze_dependencies, generate_unit_tests, generate_docstrings) perform a validation to ensure that the requested path is within the project directory. This is to prevent directory traversal attacks where a user could potentially access sensitive files outside of the project's scope.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.