Skip to main content
Glama

Gemini MCP Server

English Version

Claude Code에서 Gemini AI를 MCP 서버로 사용할 수 있게 해주는 도구입니다.

주요 이점

  1. 대용량 파일 분석: Gemini의 거대한 컨텍스트 윈도우를 활용하여 대용량 파일과 디렉토리를 한 번에 분석 가능

  2. 토큰 절약: 무료로 제공되는 Gemini CLI를 이용해서 Claude Code의 토큰 사용량을 절약하면서도 Claude Code만의 강력한 기능을 활용 가능

  3. 간편한 통합: 기존 Claude Code 워크플로우에 쉽게 통합 가능

이 서버는 로컬에 설치된 gemini CLI 도구를 사용하여 작동합니다.

Related MCP server: Gemini MCP Server

사전 요구사항

빠른 시작

1. 저장소 클론

git clone https://github.com/InfolabAI/gemini-cli-mcp.git
cd gemini-cli-mcp
  • uv 설치

uv는 시스템 레벨에 설치해야 합니다 (Python 가상환경과 독립적으로 작동):

# Linux/macOS (권장)
curl -LsSf https://astral.sh/uv/install.sh | sh

# macOS Homebrew
brew install uv

# Windows PowerShell
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"

# 설치 확인
uv --version
  • 의존성 설치:

uv sync

Tools

  • run_gemini

    • Gemini를 이용해서 파일, 디렉토리, URL의 대량 정보를 처리합니다

    • 입력:

      • prompt (string): Gemini에 전달할 프롬프트

      • file_dir_url_path (string): 분석할 파일, 디렉토리 또는 URL 경로

      • working_directory (string): 작업 디렉토리 (필수)

Configuration

Claude Code에서 사용하려면 MCP 서버 설정을 추가하세요:

Linux 의 경우, ~/.claude.json 파일에 다음 설정을 추가:

{
  "mcpServers": {
    "gemini": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/your/project",
        "run",
        "python",
        "/path/to/your/project/gemini_mcp_server.py"
      ],
      "env": {}
    }
  }
}

참고: /path/to/your/project/를 다운받은 git 프로젝트 경로로 변경하세요.

개발

  • 서버 직접 실행(실행 후, 멈춰있는 것이 정상임)

uv run python gemini_mcp_server.py
  • 테스트

uv run python test_gemini_mcp.py
  • Debugging

MCP 서버는 stdio를 통해 통신하므로 디버깅이 어려울 수 있습니다. MCP Inspector 사용을 권장합니다.

  • 주의할 점

subprocess.run 을 사용할 때 shell=True 옵션을 사용해야 합니다. 이는 MCP 서버 환경에서 쉘을 통해 명령을 실행하기 위함입니다. 이 옵션이 없으면, Gemini CLI 명령 실행 시, 대기 상태에 빠질 수 있습니다. 그 이유는, MCP 서버는 stdio 모드로 실행되어 stdin/stdout이 파이프로 연결되는데, 일부 CLI 도구(특히 Node.js 기반)는 tty 환경에서와 파이프 환경에서 다르게 동작하기 때문입니다. 터미널에서 직접 run_gemini.py 를 실행될 때는 완전한 tty 환경 제공하기 때문에 shell=True 옵션이 필요하지 않습니다.

사용 예시

Claude Code에서 MCP 서버를 사용하여 Gemini CLI를 호출할 수 있습니다. 예를 들어, 다음과 같이 사용할 수 있습니다:

  • Claude Code에서의 Gemini 호출과 Gemini 의 응답의 예

╭───────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code!                         │
╰───────────────────────────────────────────────────╯


> gemini 로 gemini_mcp_server.py 요약 분석 진행해

● I'll analyze the gemini_mcp_server.py file using the Gemini MCP server to provide a summary.

● gemini-mcp-server:run_gemini (MCP)(prompt: "이 Python 파일의 주요 기능과 구조를 한국어로 요약해주세요. 클래스, 함수, 주요 로직을 포함해서 분석해주세요.", file_dir_url_path:
                                    "gemini_mcp_server.py")
  ⎿ { 
    "result": "[dotenv@16.6.0] injecting env (2) from ../../../.env\n[dotenv@16.6.0] injecting env (2) from ../../../.env\n[dotenv@16.6.0] injecting env (2) from ../../../.env\nMCP STDERR (github): GitHub MCP Server running on stdio\n\nMCP STDERR (sequential-thinking): Sequential Thinking MCP Server running on stdio\n\nMCP STDERR (context7): Context7 Documentation MCP Server running on stdio\n\n이 Python 파일(`gemini_mcp_server.py`)은 Gemini CLI 도구를 MCP(Multi-Agent Communication Protocol) 서버를 통해 외부에서 호출할 수 있도록 래핑하는 역할을 합니다.\n\n**주요 기능 및 구조:**\n\n*   **FastMCP 서버 초기화**: `FastMCP(\"Gemini MCP Server\")`를 사용하여 `mcp`라는 MCP 서버 인스턴스를 생성합니다. 이는 이 파일이 MCP 프로토콜을 통해 다른 에이전트와 통신할 수 있는 서버임을 나타냅니다.\n*   **`run_gemini` 함수 (도구)**:\n    *   `@mcp.tool()` 데코레이터가 붙어 있어, 이 함수가 MCP 서버를 통해 외부에서 호출될 수 있는 \"도구\"로 노출됨을 의미합니다.\n    *   **인자**: `prompt` (Gemini에 전달할 프롬프트)와 `file_dir_url_path` (분석할 파일, 디렉토리 또는 URL 경로)를 받습니다.\n    *   **주요 로직**:\n 1.  `file_dir_url_path`를 `prompt`에 추가하여 Gemini CLI에 전달될 최종 프롬프트를 구성합니다.\n        2.  `subprocess.run`을 사용하여 실제 `gemini` CLI 명령을 실행합니다. 이 때 `shell=True` 옵션을 사용하여 쉘을 통해 명령을 실행하며, 이는 MCP 서버 환경에서 필요하다고 주석에 명시되어 있습니다.\n        3.  `gemini -m gemini-2.5-flash -p \"...\"` 형식으로 명령어를 구성합니다.\n        4.  명령 실행 중 발생할 수 있는 `subprocess.TimeoutExpired` (60초 시간 초과), `FileNotFoundError` (Gemini CLI가 설치되지 않은 경우), 그리고 일반 `Exception`을 처리하여 사용자에게 적절한 에러 메시지를 반환합니다.\n        5.  Gemini CLI 실행이 성공하면 표준 출력(`stdout`)을 결과로 반환하고, 에러가 발생하면 에러 메시지를 반환합니다.\n*   **서버 실행**: `if __name__ == \"__main__\":` 블록 내에서 `mcp.run()`을 호출하여 MCP 서버를 시작합니다. 이는 이 스크립트가 직접 실행될 때 서버가 구동됨을 의미합니다.\n\n**요약:**\n\n`gemini_mcp_server.py`는 `FastMCP` 프레임워크를 사용하여 Gemini CLI를 외부에서 호출 가능한 도구(`run_gemini` 함수)로 제공하는 간단한 서버입니다. 이 서버는 특정 프롬프트와 파일/디렉토리/URL 경로를 인자로 받아 Gemini CLI를 실행하고 그 결과를 반환하며, 실행 중 발생할 수 있는 다양한 오류를 처리합니다."
    }
  • Gemini의 응답을 이용한 Claude Code 의 최종 출력

● gemini_mcp_server.py는 Gemini CLI를 MCP 서버로 래핑한 파일입니다. FastMCP 프레임워크를 사용하여 run_gemini 도구를 제공하며, 프롬프트와 파일 경로를 받아 Gemini CLI를 실행하고 결과를 반환합니다. 60초 타임아웃과 에러 처리가 포함되어 있습니다.

라이선스

이 프로젝트는 MIT 라이선스 하에 배포됩니다.

Available Tools

1 tool
run_geminiB
Gemini를 사용하여 프롬프트를 실행합니다.

Args:
    prompt: Gemini에 전달할 프롬프트
    file_dir_url_path: 분석할 파일, 디렉토리 또는 URL 경로
    working_directory: 작업 디렉토리 (필수)

Returns:
    dict: 실행 결과 또는 에러 메시지
ParametersJSON Schema
NameRequiredDescriptionDefault
promptYes
file_dir_url_pathYes
working_directoryYes

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It mentions '실행 결과 또는 에러 메시지' (execution result or error message), hinting at possible errors, but lacks details on behavioral traits like rate limits, authentication needs, or what 'run' entails (e.g., is it destructive, async, etc.). This is inadequate for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded: it starts with the core purpose, then lists args and returns in a structured format. Every sentence adds value, with no wasted words, though it could be slightly more polished.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters with 0% schema coverage and no output schema, the description provides basic purpose and parameter semantics but lacks details on behavior, usage context, and output format. It's minimally viable but has clear gaps in completeness for a tool that executes prompts with external resources.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaning by explaining each parameter: 'prompt' is for Gemini input, 'file_dir_url_path' is for analysis targets, and 'working_directory' is required for operations. This clarifies semantics beyond the bare schema, though it could be more detailed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Gemini를 사용하여 프롬프트를 실행합니다' (Run a prompt using Gemini). It specifies the verb ('run') and resource ('prompt with Gemini'), but without sibling tools, it cannot distinguish from alternatives. The purpose is clear but lacks differentiation context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It lists parameters but offers no context about appropriate scenarios, prerequisites, or exclusions. Without sibling tools, this is less critical, but still a gap in usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.2/5.0
Disambiguation5/5

With only one tool, there is no possibility of ambiguity or overlap. The single tool 'run_gemini' has a clear, distinct purpose of executing prompts with the Gemini model.

Naming Consistency5/5

The naming is trivially consistent as there is only one tool. It follows a clear verb_noun pattern ('run_gemini'), and with no other tools to compare, there are no inconsistencies.

Tool Count2/5

A single tool is too few for a server named 'Gemini MCP Server', which suggests broader capabilities. While the tool handles prompt execution, typical MCP servers for AI models include tools for chat, streaming, configuration, or model selection, making this feel thin and under-scoped.

Completeness2/5

The tool surface is severely incomplete for a Gemini server. It lacks basic operations like chat interactions, model listing, or streaming responses, and does not cover common workflows such as multi-turn conversations or system prompt management, leading to significant gaps.

Maintenance

ActivityInactive
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • F
    license
    A
    quality
    D
    maintenance
    An MCP server that connects Gemini 2.5 Pro to Claude Code, enabling users to generate detailed implementation plans based on their codebase and receive feedback on code changes.
    5
    14
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that enables Claude to collaborate with Google's Gemini AI models, providing tools for question answering, code review, brainstorming, test generation, and explanations.
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    A lightweight server that connects Claude Code with Google's Gemini AI models, allowing developers to leverage Gemini's massive context window (1M+ tokens) for code analysis without leaving their coding environment.
    234
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/InfolabAI/gemini-cli-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server