@staticpayload/gemini-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +674 -0
  2. package/README.md +273 -0
  3. package/package.json +48 -0
  4. package/src/index.js +413 -0
package/README.md ADDED
@@ -0,0 +1,273 @@
1
+ <p align="center">
2
+ <img src="https://img.shields.io/badge/MCP-Protocol-7c3aed?style=for-the-badge&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xMiAyQzYuNDggMiAyIDYuNDggMiAxMnM0LjQ4IDEwIDEwIDEwIDEwLTQuNDggMTAtMTBTMTcuNTIgMiAxMiAyem0wIDE4Yy00LjQxIDAtOC0zLjU5LTgtOHMzLjU5LTggOC04IDggMy41OSA4IDgtMy41OSA4LTggOHoiLz48L3N2Zz4=" alt="MCP Protocol">
3
+ <img src="https://img.shields.io/badge/Google-Gemini-4285F4?style=for-the-badge&logo=google&logoColor=white" alt="Google Gemini">
4
+ <img src="https://img.shields.io/badge/Node.js-20+-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="Node.js 20+">
5
+ <img src="https://img.shields.io/badge/License-GPL--3.0-blue?style=for-the-badge" alt="GPL-3.0 License">
6
+ </p>
7
+
8
+ <h1 align="center">
9
+ <br>
10
+ ✦ gemini-cli-mcp
11
+ <br>
12
+ </h1>
13
+
14
+ <h4 align="center">
15
+ Bridge Google's Gemini CLI to any MCP-compatible AI assistant
16
+ </h4>
17
+
18
+ <p align="center">
19
+ <a href="#-quick-start">Quick Start</a> •
20
+ <a href="#-tools">Tools</a> •
21
+ <a href="#-usage">Usage</a> •
22
+ <a href="#-configuration">Configuration</a> •
23
+ <a href="#-how-it-works">How It Works</a>
24
+ </p>
25
+
26
+ <br>
27
+
28
+ <div align="center">
29
+
30
+ ```
31
+ ┌─────────────────────────────────────────────────────────────────┐
32
+ │ │
33
+ │ Claude / Cursor / Any MCP Client │
34
+ │ │ │
35
+ │ ▼ │
36
+ │ ┌─────────────────────────────────────┐ │
37
+ │ │ gemini-cli-mcp │ │
38
+ │ │ ┌─────────┐ ┌─────────┐ ┌───────┐ │ │
39
+ │ │ │ prompt │ │ models │ │ raw │ │ ◄── MCP Tools │
40
+ │ │ └────┬────┘ └────┬────┘ └───┬───┘ │ │
41
+ │ └────────┼───────────┼─────────┼──────┘ │
42
+ │ │ │ │ │
43
+ │ └───────────┼─────────┘ │
44
+ │ ▼ │
45
+ │ ┌───────────────────────┐ │
46
+ │ │ Gemini CLI │ ◄── Your existing auth │
47
+ │ │ (gemini binary) │ & configuration │
48
+ │ └───────────────────────┘ │
49
+ │ │
50
+ └─────────────────────────────────────────────────────────────────┘
51
+ ```
52
+
53
+ </div>
54
+
55
+ <br>
56
+
57
+ ---
58
+
59
+ ## ✨ Features
60
+
61
+ <table>
62
+ <tr>
63
+ <td width="50%">
64
+
65
+ ### 🔌 Zero Configuration
66
+ Uses your existing Gemini CLI installation and authentication. No API keys to manage, no duplicate auth flows.
67
+
68
+ ### 🚀 Universal Access
69
+ Register once, use Gemini from Claude, Cursor, Windsurf, or any MCP-compatible client.
70
+
71
+ </td>
72
+ <td width="50%">
73
+
74
+ ### ⚡ Production Ready
75
+ Health checks, graceful shutdown, 5-minute timeouts, proper signal handling. Built for reliability.
76
+
77
+ ### 🛠️ Three Powerful Tools
78
+ Prompt execution, model listing, and raw CLI access for advanced use cases.
79
+
80
+ </td>
81
+ </tr>
82
+ </table>
83
+
84
+ ---
85
+
86
+ ## 🚀 Quick Start
87
+
88
+ ### Prerequisites
89
+
90
+ ```bash
91
+ # Install Gemini CLI globally
92
+ npm install -g @google/gemini-cli
93
+
94
+ # Authenticate (run once)
95
+ gemini
96
+ ```
97
+
98
+ ### Run the MCP Server
99
+
100
+ ```bash
101
+ npx gemini-cli-mcp
102
+ ```
103
+
104
+ That's it. The server starts and waits for MCP connections via stdio.
105
+
106
+ ---
107
+
108
+ ## 🔧 Tools
109
+
110
+ ### `gemini_prompt`
111
+
112
+ Send a prompt to Gemini and get a response.
113
+
114
+ | Parameter | Type | Required | Description |
115
+ |-----------|------|----------|-------------|
116
+ | `prompt` | string | ✅ | The prompt to send |
117
+ | `model` | string | ❌ | Model override (e.g., `gemini-2.5-flash`) |
118
+
119
+ ### `gemini_models`
120
+
121
+ List all available Gemini models.
122
+
123
+ *No parameters required.*
124
+
125
+ ### `gemini_raw`
126
+
127
+ Execute any Gemini CLI command with raw arguments.
128
+
129
+ | Parameter | Type | Required | Description |
130
+ |-----------|------|----------|-------------|
131
+ | `args` | string[] | ✅ | CLI arguments array |
132
+
133
+ **Example:** `["--version"]` or `["-p", "Hello", "-m", "gemini-2.5-pro"]`
134
+
135
+ ---
136
+
137
+ ## 📋 Usage
138
+
139
+ ### With Claude Desktop
140
+
141
+ Add to your Claude configuration (`~/.claude/config.json`):
142
+
143
+ ```json
144
+ {
145
+ "mcpServers": {
146
+ "gemini": {
147
+ "command": "npx",
148
+ "args": ["gemini-cli-mcp"]
149
+ }
150
+ }
151
+ }
152
+ ```
153
+
154
+ ### With Claude CLI
155
+
156
+ ```bash
157
+ claude mcp add gemini -- npx gemini-cli-mcp
158
+ ```
159
+
160
+ ### With Cursor / Windsurf
161
+
162
+ Add to your MCP settings:
163
+
164
+ ```json
165
+ {
166
+ "gemini": {
167
+ "command": "npx",
168
+ "args": ["gemini-cli-mcp"]
169
+ }
170
+ }
171
+ ```
172
+
173
+ ---
174
+
175
+ ## ⚙️ Configuration
176
+
177
+ ### Environment Variables
178
+
179
+ | Variable | Description |
180
+ |----------|-------------|
181
+ | `GEMINI_CLI_PATH` | Override the Gemini binary location |
182
+ | `GEMINI_API_KEY` | Gemini API key (if not using OAuth) |
183
+ | `GOOGLE_APPLICATION_CREDENTIALS` | Service account credentials path |
184
+
185
+ ### Inherited Configuration
186
+
187
+ The server inherits your full environment, so existing Gemini configuration works automatically:
188
+
189
+ ```
190
+ ~/.config/gemini/ ← CLI configuration
191
+ ~/.gemini/settings.json ← Gemini settings
192
+ GEMINI_* env vars ← All Gemini environment variables
193
+ gcloud auth ← Application default credentials
194
+ ```
195
+
196
+ ---
197
+
198
+ ## 🔬 How It Works
199
+
200
+ ```
201
+ ┌──────────────┐ stdio ┌─────────────────┐ spawn ┌─────────────┐
202
+ │ MCP Client │ ◄────────────► │ gemini-cli-mcp │ ◄───────────► │ gemini CLI │
203
+ │ (Claude) │ JSON-RPC │ (Node.js) │ child proc │ (binary) │
204
+ └──────────────┘ └─────────────────┘ └─────────────┘
205
+ ```
206
+
207
+ 1. **MCP Client** sends JSON-RPC requests over stdio
208
+ 2. **gemini-cli-mcp** translates MCP tool calls to Gemini CLI commands
209
+ 3. **Gemini CLI** executes with your existing auth & config
210
+ 4. Response flows back through the same path
211
+
212
+ The server is a thin translation layer—all heavy lifting happens in Gemini CLI.
213
+
214
+ ---
215
+
216
+ ## 🏗️ Architecture
217
+
218
+ ```
219
+ gemini-cli-mcp/
220
+ ├── src/
221
+ │ └── index.js # MCP server (single file, ~300 lines)
222
+ ├── package.json # npm package with bin entry
223
+ └── README.md
224
+ ```
225
+
226
+ **Design Principles:**
227
+ - Single responsibility: translate MCP ↔ Gemini CLI
228
+ - Zero global state
229
+ - Fail fast with clear errors
230
+ - Minimal dependencies (`@modelcontextprotocol/sdk`, `zod`)
231
+
232
+ ---
233
+
234
+ ## 🐛 Troubleshooting
235
+
236
+ ### "Gemini CLI not found"
237
+
238
+ ```bash
239
+ # Ensure gemini is installed and in PATH
240
+ which gemini
241
+
242
+ # Or set the path explicitly
243
+ export GEMINI_CLI_PATH=/path/to/gemini
244
+ ```
245
+
246
+ ### "Auth method not set"
247
+
248
+ ```bash
249
+ # Option 1: Run Gemini CLI once to authenticate
250
+ gemini
251
+
252
+ # Option 2: Set API key
253
+ export GEMINI_API_KEY=your-api-key
254
+ ```
255
+
256
+ ### Server not responding
257
+
258
+ Check stderr output for health check results:
259
+ ```
260
+ [gemini-mcp] Gemini CLI: /usr/local/bin/gemini (0.22.4)
261
+ ```
262
+
263
+ ---
264
+
265
+ ## 📄 License
266
+
267
+ GPL-3.0 © 2024
268
+
269
+ ---
270
+
271
+ <p align="center">
272
+ <sub>Built with ❤️ for the MCP ecosystem</sub>
273
+ </p>
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@staticpayload/gemini-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server that bridges Google's Gemini CLI to any MCP-compatible AI assistant",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "bin": {
8
+ "gemini-mcp": "src/index.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node src/index.js"
12
+ },
13
+ "keywords": [
14
+ "mcp",
15
+ "model-context-protocol",
16
+ "gemini",
17
+ "google",
18
+ "ai",
19
+ "cli",
20
+ "claude",
21
+ "cursor",
22
+ "windsurf",
23
+ "llm",
24
+ "assistant"
25
+ ],
26
+ "author": "",
27
+ "license": "GPL-3.0",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": ""
31
+ },
32
+ "bugs": {
33
+ "url": ""
34
+ },
35
+ "homepage": "",
36
+ "engines": {
37
+ "node": ">=20.0.0"
38
+ },
39
+ "dependencies": {
40
+ "@modelcontextprotocol/sdk": "^1.0.0",
41
+ "zod": "^3.25.0"
42
+ },
43
+ "files": [
44
+ "src/**/*",
45
+ "README.md",
46
+ "LICENSE"
47
+ ]
48
+ }