Skip to content
Back to search

Gemini-mcp

MCP server implementation for Google's Gemini API

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/lkbaba--gemini-mcp/badge.svg)](/listings/lkbaba--gemini-mcp)

HTML

<a href="/listings/lkbaba--gemini-mcp"><img src="/api/listings/lkbaba--gemini-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Add to your MCP config file:

- **Mac**: `~/Library/Application Support/Claude/claude_desktop_config.json` - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` - **Linux**: `~/.config/Claude/claude_desktop_config.json`

Then restart Claude Code.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 269 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Gemini MCP Server
  2. > **Give Claude Code the power of Gemini 3.1**
  3. An MCP server that connects Claude Code to Google's Gemini 3.1, unlocking capabilities that complement Claude's strengths.
  4. ## Why Gemini + Claude?
  5. | Gemini's Strengths | Use Case |
  6. |-------------------|----------|
  7. | **1M Token Context** | Analyze entire codebases in one shot |
  8. | **Google Search Grounding** | Get real-time documentation & latest info |
  9. | **Multimodal Vision** | Understand screenshots, diagrams, designs |
  10. > **Philosophy**: Claude is the commander, Gemini is the specialist.
  11. ## Quick Start
  12. Add to your MCP config file:
  13. - **Mac**: `~/Library/Application Support/Claude/claude_desktop_config.json`
  14. - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
  15. - **Linux**: `~/.config/Claude/claude_desktop_config.json`
  16. Then restart Claude Code.
  17. ## Authentication
  18. Two authentication modes are supported. The server auto-detects which mode to use based on environment variables.
  19. ### Option 1: AI Studio API Key (Simplest)
  20. Best for personal development and quick trials.
  21. 1. Visit [Google AI Studio](https://aistudio.google.com/apikey) and create an API key
  22. 2. Add to your MCP config:
  23. ```json
  24. {
  25. "mcpServers": {
  26. "gemini": {
  27. "command": "npx",
  28. "args": ["-y", "@lkbaba/mcp-server-gemini"],
  29. "env": {
  30. "GEMINI_API_KEY": "your-api-key"
  31. }
  32. }
  33. }
  34. }
  35. ```
  36. ### Option 2: Vertex AI (Recommended for Production)
  37. More secure, uses Google Cloud IAM authentication.
  38. **Prerequisites:**
  39. 1. A Google Cloud project with Vertex AI API enabled
  40. 2. A service account with **Vertex AI User** role ([create one here](https://console.cloud.google.com/iam-admin/serviceaccounts))
  41. **Setup (2 minutes):**
  42. 1. Create a service account in GCP Console → download JSON key file
  43. 2. Open the JSON key file, copy **all** key-value pairs
  44. 3. Paste them into the `env` section of your MCP config:
  45. ```json
  46. {
  47. "mcpServers": {
  48. "gemini": {
  49. "command": "npx",
  50. "args": ["-y", "@lkbaba/mcp-server-gemini"],
  51. "env": {
  52. "type": "service_account",
  53. "project_id": "your-project-id",
  54. "private_key_id": "key-id-here",
  55. "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEv...\n-----END PRIVATE KEY-----\n",
  56. "client_email": "your-sa@your-project.iam.gserviceaccount.com",
  57. "client_id": "123456789",
  58. "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  59. "token_uri": "https://oauth2.googleapis.com/token",
  60. "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  61. "client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/your-sa%40your-project.iam.gserviceaccount.com",
  62. "universe_domain": "googleapis.com"
  63. }
  64. }
  65. }
  66. }
  67. ```
  68. The server **auto-detects** service account credentials from env vars — no `GOOGLE_GENAI_USE_VERTEXAI` or `GOOGLE_CLOUD_PROJECT` needed. Just paste and go.
  69. > **Tip:** On Windows, the server automatically fixes slash corruption (`/` → `\`) in PEM private keys that some MCP clients introduce.
  70. > **Advanced options:** You can also use `GOOGLE_GENAI_USE_VERTEXAI=true` + `GOOGLE_CREDENTIALS_JSON`, `GOOGLE_APPLICATION_CREDENTIALS` (file path), or `gcloud auth application-default login`. See the environment variables reference below.
  71. <details>
  72. <summary>Environment variables reference</summary>
  73. **Paste JSON approach** (Option 2 above — simplest for Vertex AI):
  74. Just paste the service account JSON fields directly into `env`. No extra variables needed — the server auto-detects `type: "service_account"`.
  75. **Explicit Vertex AI mode** (advanced):
  76. | Variable | Required | Description |
  77. |----------|----------|-------------|
  78. | `GOOGLE_GENAI_USE_VERTEXAI` | Yes | Set to `"true"` to enable |
  79. | `GOOGLE_CLOUD_PROJECT` | Yes | GCP project ID |
  80. | `GOOGLE_CLOUD_LOCATION` | No | Region (default: `global`) |
  81. | `GOOGLE_CREDENTIALS_JSON` | No* | Entire service account JSON as a single string |
  82. | `GOOGLE_APPLICATION_CREDENTIALS` | No* | File path to service account JSON key |
  83. \* At least one credential source is needed: `GOOGLE_CREDENTIALS_JSON`, `GOOGLE_APPLICATION_CREDENTIALS`, or `gcloud` ADC.
  84. **AI Studio mode:**
  85. | Variable | Required | Description |
  86. |----------|----------|-------------|
  87. | `GEMINI_API_KEY` | Yes | API key from [Google AI Studio](https://aistudio.google.com/apikey) |
  88. If both modes are configured, Vertex AI takes priority.
  89. </details>
  90. ### Migration Notice
  91. **v2.0.0 (2026-04):** The protocol layer has been rewritten on top of the official [`@modelcontextprotocol/sdk`](https://github.com/modelcontextprotocol/typescript-sdk). This fixes a JSON-RPC `notifications/initialized` spec violation inherited from the upstream fork, which caused strict MCP clients (recent Claude CLI, some VS Code extensions) to drop the connection with `MCP error -32000: Connection closed` or to silently omit the Gemini tools from the tool list. No user-facing API changes — upgrade is drop-in.
  92. **v1.3.0+:**
  93. - The default model is now `gemini-3.1-pro-preview`
  94. - Old model names are automatically mapped (no config changes needed)
  95. - See [CHANGELOG.md](CHANGELOG.md) for details
  96. ## Tools (5)
  97. ### Research & Search
  98. | Tool | Description |
  99. |------|-------------|
  100. | `gemini_search` | Web search with Google Search grounding. Get real-time info, latest docs, current events. |
  101. ### Analysis (1M Token Context)
  102. | Tool | Description |
  103. |------|-------------|
  104. | `gemini_analyze_codebase` | Analyze entire projects with 1M token context. Supports directory path, file paths, or direct content. |
  105. | `gemini_analyze_content` | Analyze code, documents, or data. Supports file path or direct content input. |
  106. ### Multimodal
  107. | Tool | Description |
  108. |------|-------------|
  109. | `gemini_multimodal_query` | Analyze images with natural language. Understand designs, diagrams, screenshots. |
  110. ### Creative
  111. | Tool | Description |
  112. |------|-------------|
  113. | `gemini_brainstorm` | Generate creative ideas with project context. Supports reading README, PRD files. |
  114. ## Model Selection (v1.3.0)
  115. All tools now support an optional `model` parameter:
  116. | Model | Speed | Best For |
  117. |-------|-------|----------|
  118. | `gemini-3.1-pro-preview` | Standard | Complex analysis, deep reasoning, agentic workflows (default) |
  119. | `gemini-3-flash-preview` | Fast | Simple tasks, quick responses, search queries |
  120. **Note**: `gemini-3-pro-preview` is deprecated (retired 2026-03-09) and will be automatically mapped to `gemini-3.1-pro-preview`.
  121. **Example: Use the new default model**
  122. ```json
  123. {
  124. "name": "gemini_analyze_content",
  125. "arguments": {
  126. "filePath": "./src/index.ts",
  127. "task": "review",
  128. "model": "gemini-3.1-pro-preview"
  129. }
  130. }
  131. ```
  132. ## Usage Examples
  133. ### Analyze a Large Codebase
  134. ```
  135. "Use Gemini to analyze the ./src directory for architectural patterns and potential issues"
  136. ```
  137. ### Search for Latest Documentation
  138. ```
  139. "Search for the latest Next.js 15 App Router documentation"
  140. ```
  141. ### Analyze an Image
  142. ```
  143. "Analyze this architecture diagram and explain the data flow" (attach image)
  144. ```
  145. ### Brainstorm with Context
  146. ```
  147. "Brainstorm feature ideas based on this project's README.md"
  148. ```
  149. ## Proxy Configuration
  150. <details>
  151. <summary>For users behind proxy/VPN</summary>
  152. Add proxy environment variable to your config:
  153. ```json
  154. {
  155. "mcpServers": {
  156. "gemini": {
  157. "command": "npx",
  158. "args": ["-y", "@lkbaba/mcp-server-gemini"],
  159. "env": {
  160. "GEMINI_API_KEY": "your_api_key_here",
  161. "HTTPS_PROXY": "http://127.0.0.1:7897"
  162. }
  163. }
  164. }
  165. }
  166. ```
  167. </details>
  168. ## Local Development
  169. <details>
  170. <summary>Build from source</summary>
  171. ```bash
  172. git clone https://github.com/LKbaba/Gemini-mcp.git
  173. cd Gemini-mcp
  174. npm install
  175. npm run build
  176. export GEMINI_API_KEY="your_api_key_here"
  177. npm start
  178. ```
  179. </details>
  180. ## Project Structure
  181. ```
  182. src/
  183. ├── config/
  184. │ ├── models.ts # Model configurations
  185. │ └── constants.ts # Global constants
  186. ├── tools/
  187. │ ├── definitions.ts # MCP tool definitions
  188. │ ├── multimodal-query.ts # Multimodal queries
  189. │ ├── analyze-content.ts # Content analysis
  190. │ ├── analyze-codebase.ts # Codebase analysis
  191. │ ├── brainstorm.ts # Brainstorming
  192. │ └── search.ts # Web search
  193. ├── utils/
  194. │ ├── gemini-factory.ts # Dual-mode auth factory (API Key + Vertex AI)
  195. │ ├── gemini-client.ts # Gemini API client
  196. │ ├── file-reader.ts # File system access
  197. │ ├── security.ts # Path validation
  198. │ ├── validators.ts # Parameter validation
  199. │ └── error-handler.ts # Error handling
  200. ├── types.ts # Type definitions
  201. └── server.ts # Main server
  202. ```
  203. ## Credits
  204. Based on [aliargun/mcp-server-gemini](https://github.com/aliargun/mcp-server-gemini)
  205. ## License
  206. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.