gemini-bridge 1.0.1__tar.gz → 1.0.3__tar.gz

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.
@@ -0,0 +1,645 @@
1
+ Metadata-Version: 2.4
2
+ Name: gemini-bridge
3
+ Version: 1.0.3
4
+ Summary: Lightweight MCP server bridging Claude Code to Google's Gemini AI via official CLI
5
+ Author-email: Shelakh <info@shelakh.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/eLyiN/gemini-bridge
8
+ Project-URL: Repository, https://github.com/eLyiN/gemini-bridge
9
+ Project-URL: Issues, https://github.com/eLyiN/gemini-bridge/issues
10
+ Keywords: mcp,gemini,ai,coding,assistant
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ Requires-Dist: mcp>=1.0.0
23
+ Dynamic: license-file
24
+
25
+ # Gemini Bridge
26
+
27
+ ![CI Status](https://github.com/eLyiN/gemini-bridge/actions/workflows/ci.yml/badge.svg)
28
+ ![PyPI Version](https://img.shields.io/pypi/v/gemini-bridge)
29
+ ![MIT License](https://img.shields.io/badge/license-MIT-blue.svg)
30
+ ![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)
31
+ ![MCP Compatible](https://img.shields.io/badge/MCP-compatible-green.svg)
32
+ ![Gemini CLI](https://img.shields.io/badge/Gemini-CLI-blue.svg)
33
+
34
+ A lightweight MCP (Model Context Protocol) server that enables AI coding assistants to interact with Google's Gemini AI through the official CLI. Works with Claude Code, Cursor, VS Code, and other MCP-compatible clients. Designed for simplicity, reliability, and seamless integration.
35
+
36
+ ## ✨ Features
37
+
38
+ - **Direct Gemini CLI Integration**: Zero API costs using official Gemini CLI
39
+ - **Simple MCP Tools**: Two core functions for basic queries and file analysis
40
+ - **Stateless Operation**: No sessions, caching, or complex state management
41
+ - **Production Ready**: Robust error handling with configurable 60-second timeouts
42
+ - **Minimal Dependencies**: Only requires `mcp>=1.0.0` and Gemini CLI
43
+ - **Easy Deployment**: Support for both uvx and traditional pip installation
44
+ - **Universal MCP Compatibility**: Works with any MCP-compatible AI coding assistant
45
+
46
+ ## 🚀 Quick Start
47
+
48
+ ### Prerequisites
49
+
50
+ 1. **Install Gemini CLI**:
51
+ ```bash
52
+ npm install -g @google/gemini-cli
53
+ ```
54
+
55
+ 2. **Authenticate with Gemini**:
56
+ ```bash
57
+ gemini auth login
58
+ ```
59
+
60
+ 3. **Verify installation**:
61
+ ```bash
62
+ gemini --version
63
+ ```
64
+
65
+ ### Installation
66
+
67
+ **🎯 Recommended: PyPI Installation**
68
+ ```bash
69
+ # Install from PyPI
70
+ pip install gemini-bridge
71
+
72
+ # Add to Claude Code with uvx (recommended)
73
+ claude mcp add gemini-bridge -s user -- uvx gemini-bridge
74
+ ```
75
+
76
+ **Alternative: From Source**
77
+ ```bash
78
+ # Clone the repository
79
+ git clone https://github.com/shelakh/gemini-bridge.git
80
+ cd gemini-bridge
81
+
82
+ # Build and install locally
83
+ uvx --from build pyproject-build
84
+ pip install dist/*.whl
85
+
86
+ # Add to Claude Code
87
+ claude mcp add gemini-bridge -s user -- uvx gemini-bridge
88
+ ```
89
+
90
+ **Development Installation**
91
+ ```bash
92
+ # Clone and install in development mode
93
+ git clone https://github.com/shelakh/gemini-bridge.git
94
+ cd gemini-bridge
95
+ pip install -e .
96
+
97
+ # Add to Claude Code (development)
98
+ claude mcp add gemini-bridge-dev -s user -- python -m src
99
+ ```
100
+
101
+ ## 🌐 Multi-Client Support
102
+
103
+ **Gemini Bridge works with any MCP-compatible AI coding assistant** - the same server supports multiple clients through different configuration methods.
104
+
105
+ ### Supported MCP Clients
106
+ - **Claude Code** ✅ (Default)
107
+ - **Cursor** ✅
108
+ - **VS Code** ✅
109
+ - **Windsurf** ✅
110
+ - **Cline** ✅
111
+ - **Void** ✅
112
+ - **Cherry Studio** ✅
113
+ - **Augment** ✅
114
+ - **Roo Code** ✅
115
+ - **Zencoder** ✅
116
+ - **Any MCP-compatible client** ✅
117
+
118
+ ### Configuration Examples
119
+
120
+ <details>
121
+ <summary><strong>Claude Code</strong> (Default)</summary>
122
+
123
+ ```bash
124
+ # Recommended installation
125
+ claude mcp add gemini-bridge -s user -- uvx gemini-bridge
126
+
127
+ # Development installation
128
+ claude mcp add gemini-bridge-dev -s user -- python -m src
129
+ ```
130
+
131
+ </details>
132
+
133
+ <details>
134
+ <summary><strong>Cursor</strong></summary>
135
+
136
+ **Global Configuration** (`~/.cursor/mcp.json`):
137
+ ```json
138
+ {
139
+ "mcpServers": {
140
+ "gemini-bridge": {
141
+ "command": "uvx",
142
+ "args": ["gemini-bridge"],
143
+ "env": {}
144
+ }
145
+ }
146
+ }
147
+ ```
148
+
149
+ **Project-Specific** (`.cursor/mcp.json` in your project):
150
+ ```json
151
+ {
152
+ "mcpServers": {
153
+ "gemini-bridge": {
154
+ "command": "uvx",
155
+ "args": ["gemini-bridge"],
156
+ "env": {}
157
+ }
158
+ }
159
+ }
160
+ ```
161
+
162
+ Go to: `Settings` → `Cursor Settings` → `MCP` → `Add new global MCP server`
163
+
164
+ </details>
165
+
166
+ <details>
167
+ <summary><strong>VS Code</strong></summary>
168
+
169
+ **Configuration** (`.vscode/mcp.json` in your workspace):
170
+ ```json
171
+ {
172
+ "servers": {
173
+ "gemini-bridge": {
174
+ "type": "stdio",
175
+ "command": "uvx",
176
+ "args": ["gemini-bridge"]
177
+ }
178
+ }
179
+ }
180
+ ```
181
+
182
+ **Alternative: Through Extensions**
183
+ 1. Open Extensions view (Ctrl+Shift+X)
184
+ 2. Search for MCP extensions
185
+ 3. Add custom server with command: `uvx gemini-bridge`
186
+
187
+ </details>
188
+
189
+ <details>
190
+ <summary><strong>Windsurf</strong></summary>
191
+
192
+ Add to your Windsurf MCP configuration:
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "gemini-bridge": {
197
+ "command": "uvx",
198
+ "args": ["gemini-bridge"],
199
+ "env": {}
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
205
+ </details>
206
+
207
+ <details>
208
+ <summary><strong>Cline</strong> (VS Code Extension)</summary>
209
+
210
+ 1. Open Cline and click **MCP Servers** in the top navigation
211
+ 2. Select **Installed** tab → **Advanced MCP Settings**
212
+ 3. Add to `cline_mcp_settings.json`:
213
+
214
+ ```json
215
+ {
216
+ "mcpServers": {
217
+ "gemini-bridge": {
218
+ "command": "uvx",
219
+ "args": ["gemini-bridge"],
220
+ "env": {}
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ </details>
227
+
228
+ <details>
229
+ <summary><strong>Void</strong></summary>
230
+
231
+ Go to: `Settings` → `MCP` → `Add MCP Server`
232
+
233
+ ```json
234
+ {
235
+ "mcpServers": {
236
+ "gemini-bridge": {
237
+ "command": "uvx",
238
+ "args": ["gemini-bridge"],
239
+ "env": {}
240
+ }
241
+ }
242
+ }
243
+ ```
244
+
245
+ </details>
246
+
247
+ <details>
248
+ <summary><strong>Cherry Studio</strong></summary>
249
+
250
+ 1. Navigate to **Settings → MCP Servers → Add Server**
251
+ 2. Fill in the server details:
252
+ - **Name**: `gemini-bridge`
253
+ - **Type**: `STDIO`
254
+ - **Command**: `uvx`
255
+ - **Arguments**: `["gemini-bridge"]`
256
+ 3. Save the configuration
257
+
258
+ </details>
259
+
260
+ <details>
261
+ <summary><strong>Augment</strong></summary>
262
+
263
+ **Using the UI:**
264
+ 1. Click hamburger menu → **Settings** → **Tools**
265
+ 2. Click **+ Add MCP** button
266
+ 3. Enter command: `uvx gemini-bridge`
267
+ 4. Name: **Gemini Bridge**
268
+
269
+ **Manual Configuration:**
270
+ ```json
271
+ "augment.advanced": {
272
+ "mcpServers": [
273
+ {
274
+ "name": "gemini-bridge",
275
+ "command": "uvx",
276
+ "args": ["gemini-bridge"],
277
+ "env": {}
278
+ }
279
+ ]
280
+ }
281
+ ```
282
+
283
+ </details>
284
+
285
+ <details>
286
+ <summary><strong>Roo Code</strong></summary>
287
+
288
+ 1. Go to **Settings → MCP Servers → Edit Global Config**
289
+ 2. Add to `mcp_settings.json`:
290
+
291
+ ```json
292
+ {
293
+ "mcpServers": {
294
+ "gemini-bridge": {
295
+ "command": "uvx",
296
+ "args": ["gemini-bridge"],
297
+ "env": {}
298
+ }
299
+ }
300
+ }
301
+ ```
302
+
303
+ </details>
304
+
305
+ <details>
306
+ <summary><strong>Zencoder</strong></summary>
307
+
308
+ 1. Go to Zencoder menu (...) → **Tools** → **Add Custom MCP**
309
+ 2. Add configuration:
310
+
311
+ ```json
312
+ {
313
+ "command": "uvx",
314
+ "args": ["gemini-bridge"],
315
+ "env": {}
316
+ }
317
+ ```
318
+
319
+ 3. Hit the **Install** button
320
+
321
+ </details>
322
+
323
+ <details>
324
+ <summary><strong>Alternative Installation Methods</strong></summary>
325
+
326
+ **For pip-based installations:**
327
+ ```json
328
+ {
329
+ "command": "gemini-bridge",
330
+ "args": [],
331
+ "env": {}
332
+ }
333
+ ```
334
+
335
+ **For development/local testing:**
336
+ ```json
337
+ {
338
+ "command": "python",
339
+ "args": ["-m", "src"],
340
+ "env": {},
341
+ "cwd": "/path/to/gemini-bridge"
342
+ }
343
+ ```
344
+
345
+ **For npm-style installation** (if needed):
346
+ ```json
347
+ {
348
+ "command": "npx",
349
+ "args": ["gemini-bridge"],
350
+ "env": {}
351
+ }
352
+ ```
353
+
354
+ </details>
355
+
356
+ ### Universal Usage
357
+
358
+ Once configured with any client, use the same two tools:
359
+
360
+ 1. **Ask general questions**: "What authentication patterns are used in this codebase?"
361
+ 2. **Analyze specific files**: "Review these auth files for security issues"
362
+
363
+ **The server implementation is identical** - only the client configuration differs!
364
+
365
+ ## ⚙️ Configuration
366
+
367
+ ### Timeout Configuration
368
+
369
+ By default, Gemini Bridge uses a 60-second timeout for all CLI operations. For longer queries (large files, complex analysis), you can configure a custom timeout using the `GEMINI_BRIDGE_TIMEOUT` environment variable.
370
+
371
+ **Example configurations:**
372
+
373
+ <details>
374
+ <summary><strong>Claude Code</strong></summary>
375
+
376
+ ```bash
377
+ # Add with custom timeout (120 seconds)
378
+ claude mcp add gemini-bridge -s user --env GEMINI_BRIDGE_TIMEOUT=120 -- uvx gemini-bridge
379
+ ```
380
+
381
+ </details>
382
+
383
+ <details>
384
+ <summary><strong>Manual Configuration (mcp_settings.json)</strong></summary>
385
+
386
+ ```json
387
+ {
388
+ "mcpServers": {
389
+ "gemini-bridge": {
390
+ "command": "uvx",
391
+ "args": ["gemini-bridge"],
392
+ "env": {
393
+ "GEMINI_BRIDGE_TIMEOUT": "120"
394
+ }
395
+ }
396
+ }
397
+ }
398
+ ```
399
+
400
+ </details>
401
+
402
+ **Timeout Options:**
403
+ - **Default**: 60 seconds (if not configured)
404
+ - **Range**: Any positive integer (seconds)
405
+ - **Recommended**: 120-300 seconds for large file analysis
406
+ - **Invalid values**: Fall back to 60 seconds with warning
407
+
408
+ ## 🛠️ Available Tools
409
+
410
+ ### `consult_gemini`
411
+ Direct CLI bridge for simple queries.
412
+
413
+ **Parameters:**
414
+ - `query` (string): The question or prompt to send to Gemini
415
+ - `directory` (string): Working directory for the query (default: current directory)
416
+ - `model` (string, optional): Model to use - "flash" or "pro" (default: "flash")
417
+
418
+ **Example:**
419
+ ```python
420
+ consult_gemini(
421
+ query="Find authentication patterns in this codebase",
422
+ directory="/path/to/project",
423
+ model="flash"
424
+ )
425
+ ```
426
+
427
+ ### `consult_gemini_with_files`
428
+ CLI bridge with file attachments for detailed analysis.
429
+
430
+ **Parameters:**
431
+ - `query` (string): The question or prompt to send to Gemini
432
+ - `directory` (string): Working directory for the query
433
+ - `files` (list): List of file paths relative to the directory
434
+ - `model` (string, optional): Model to use - "flash" or "pro" (default: "flash")
435
+
436
+ **Example:**
437
+ ```python
438
+ consult_gemini_with_files(
439
+ query="Analyze these auth files and suggest improvements",
440
+ directory="/path/to/project",
441
+ files=["src/auth.py", "src/models.py"],
442
+ model="pro"
443
+ )
444
+ ```
445
+
446
+ ## 📋 Usage Examples
447
+
448
+ ### Basic Code Analysis
449
+ ```python
450
+ # Simple research query
451
+ consult_gemini(
452
+ query="What authentication patterns are used in this project?",
453
+ directory="/Users/dev/my-project"
454
+ )
455
+ ```
456
+
457
+ ### Detailed File Review
458
+ ```python
459
+ # Analyze specific files
460
+ consult_gemini_with_files(
461
+ query="Review these files and suggest security improvements",
462
+ directory="/Users/dev/my-project",
463
+ files=["src/auth.py", "src/middleware.py"],
464
+ model="pro"
465
+ )
466
+ ```
467
+
468
+ ### Multi-file Analysis
469
+ ```python
470
+ # Compare multiple implementation files
471
+ consult_gemini_with_files(
472
+ query="Compare these database implementations and recommend the best approach",
473
+ directory="/Users/dev/my-project",
474
+ files=["src/db/postgres.py", "src/db/sqlite.py", "src/db/redis.py"]
475
+ )
476
+ ```
477
+
478
+ ## 🏗️ Architecture
479
+
480
+ ### Core Design
481
+ - **CLI-First**: Direct subprocess calls to `gemini` command
482
+ - **Stateless**: Each tool call is independent with no session state
483
+ - **Fixed Timeout**: 60-second maximum execution time
484
+ - **Simple Error Handling**: Clear error messages with fail-fast approach
485
+
486
+ ### Project Structure
487
+ ```
488
+ gemini-bridge/
489
+ ├── src/
490
+ │ ├── __init__.py # Entry point
491
+ │ ├── __main__.py # Module execution entry point
492
+ │ └── mcp_server.py # Main MCP server implementation
493
+ ├── .github/ # GitHub templates and workflows
494
+ ├── pyproject.toml # Python package configuration
495
+ ├── README.md # This file
496
+ ├── CONTRIBUTING.md # Contribution guidelines
497
+ ├── CODE_OF_CONDUCT.md # Community standards
498
+ ├── SECURITY.md # Security policies
499
+ ├── CHANGELOG.md # Version history
500
+ └── LICENSE # MIT license
501
+ ```
502
+
503
+ ## 🔧 Development
504
+
505
+ ### Local Testing
506
+ ```bash
507
+ # Install in development mode
508
+ pip install -e .
509
+
510
+ # Run directly
511
+ python -m src
512
+
513
+ # Test CLI availability
514
+ gemini --version
515
+ ```
516
+
517
+ ### Integration with Claude Code
518
+ The server automatically integrates with Claude Code when properly configured through the MCP protocol.
519
+
520
+ ## 🔍 Troubleshooting
521
+
522
+ ### CLI Not Available
523
+ ```bash
524
+ # Install Gemini CLI
525
+ npm install -g @google/gemini-cli
526
+
527
+ # Authenticate
528
+ gemini auth login
529
+
530
+ # Test
531
+ gemini --version
532
+ ```
533
+
534
+ ### Connection Issues
535
+ - Verify Gemini CLI is properly authenticated
536
+ - Check network connectivity
537
+ - Ensure Claude Code MCP configuration is correct
538
+ - Check that the `gemini` command is in your PATH
539
+
540
+ ### Timeout Issues 🔥
541
+
542
+ Gemini Bridge now includes comprehensive timeout debugging. If you're experiencing timeout issues:
543
+
544
+ **1. Use the Debug Tool**
545
+ ```python
546
+ # Get detailed diagnostics about your configuration
547
+ get_debug_info()
548
+ ```
549
+
550
+ This will show:
551
+ - Current timeout configuration
552
+ - Gemini CLI status and version
553
+ - Authentication status
554
+ - Environment variables
555
+ - System information
556
+
557
+ **2. Configure Appropriate Timeout**
558
+
559
+ For different operation types, recommended timeouts:
560
+
561
+ - **Default operations**: 60 seconds (default)
562
+ - **Large file analysis**: 240 seconds
563
+ - **Complex multi-file operations**: 300+ seconds
564
+
565
+ **Configuration Examples:**
566
+
567
+ ```bash
568
+ # Claude Code with 4-minute timeout for large operations
569
+ claude mcp add gemini-bridge -s user --env GEMINI_BRIDGE_TIMEOUT=240 -- uvx gemini-bridge
570
+
571
+ # Environment variable (if running manually)
572
+ export GEMINI_BRIDGE_TIMEOUT=240
573
+ ```
574
+
575
+ **3. Common Timeout Scenarios**
576
+
577
+ | Scenario | Recommended Timeout | Reason |
578
+ |----------|-------------------|---------|
579
+ | Single file < 10KB | 60s (default) | Fast processing |
580
+ | Multiple files or large files | 240s | More content to process |
581
+ | Complex code analysis | 300s | Deep reasoning required |
582
+ | Very large files (>100KB) | 300-600s | Processing overhead |
583
+
584
+ **4. Debugging Steps**
585
+
586
+ 1. **Check your configuration**:
587
+ ```bash
588
+ # Run the debug tool to see current timeout
589
+ # Look for "Actual timeout used" in the output
590
+ ```
591
+
592
+ 2. **Monitor logs**: The server now logs detailed timing information
593
+
594
+ 3. **Test with smaller queries**: If large queries timeout, break them into smaller parts
595
+
596
+ 4. **Verify Gemini CLI performance**: Test `gemini` directly with similar queries
597
+
598
+ **5. Advanced Troubleshooting**
599
+
600
+ If timeouts persist even with high timeout values:
601
+
602
+ - **Network issues**: Check your internet connection
603
+ - **Gemini CLI version**: Update with `npm install -g @google/gemini-cli@latest`
604
+ - **Authentication**: Re-authenticate with `gemini auth login`
605
+ - **System resources**: Check if your system is under high load
606
+ - **File encoding**: Ensure files are UTF-8 encoded
607
+ - **MCP client timeout**: Some clients have their own timeout settings
608
+
609
+ ### Common Error Messages
610
+ - **"CLI not available"**: Gemini CLI is not installed or not in PATH
611
+ - **"Authentication required"**: Run `gemini auth login`
612
+ - **"Timeout after X seconds"**: Operation took longer than configured timeout
613
+ - Solution: Increase `GEMINI_BRIDGE_TIMEOUT` environment variable
614
+ - For immediate testing: Use smaller files or simpler queries
615
+ - **"Large content size warning"**: Files total >100KB, may need longer timeout
616
+ - **"Very high timeout configured"**: Timeout >300s, failed operations will wait long
617
+
618
+ ## 🤝 Contributing
619
+
620
+ We welcome contributions from the community! Please read our [Contributing Guidelines](CONTRIBUTING.md) for details on how to get started.
621
+
622
+ ### Quick Contributing Guide
623
+ 1. Fork the repository
624
+ 2. Create a feature branch
625
+ 3. Make your changes
626
+ 4. Add tests if applicable
627
+ 5. Submit a pull request
628
+
629
+ ## 📄 License
630
+
631
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
632
+
633
+ ## 🔄 Version History
634
+
635
+ See [CHANGELOG.md](CHANGELOG.md) for detailed version history.
636
+
637
+ ## 🆘 Support
638
+
639
+ - **Issues**: Report bugs or request features via [GitHub Issues](https://github.com/shelakh/gemini-bridge/issues)
640
+ - **Discussions**: Join the community discussion
641
+ - **Documentation**: Additional docs can be created in the `docs/` directory
642
+
643
+ ---
644
+
645
+ **Focus**: A simple, reliable bridge between Claude Code and Gemini AI through the official CLI.