Gemini Agent MCP Server

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.

Category
Visit Server

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

  1. Install Dependencies:

    pip install -r requirements.txt
    
  2. Install Linters (for lint_code tool):

    • For Python linting, pylint is installed with the requirements.
    • For JavaScript linting, you need to have eslint installed and available in your system's PATH. You can typically install it using npm:
      npm install -g eslint
      
  3. 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_issue and create_github_pr tools, you need to set the GITHUB_TOKEN environment 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_PORT environment variable. It defaults to 5001.

      export MCP_PORT=8080
      
  4. Run the Server:

    python src/main.py
    

    The 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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured