@anzchy/mcp-server-gemini 0.5.1
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.
- package/CHANGELOG.md +133 -0
- package/LICENSE +21 -0
- package/README.md +264 -0
- package/dist/enhanced-stdio-server.js +1226 -0
- package/dist/enhanced-stdio-server.js.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +67 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [5.0.0] - 2026-02-12
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Gemini 3 series models**: `gemini-3-pro-preview` (default) and `gemini-3-flash-preview`
|
|
12
|
+
- `thinkingLevel` parameter for `generate_text` — configurable thinking depth (minimal/low/medium/high)
|
|
13
|
+
- `mediaResolution` parameter for `analyze_image` — control token allocation for images (low/medium/high)
|
|
14
|
+
- `gemini-embedding-001` as the new default embedding model
|
|
15
|
+
- Comprehensive test suite (46 tests) with real Gemini API integration tests covering all tools and parameter combinations
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- **BREAKING**: Default model changed from `gemini-2.5-flash` to `gemini-3-pro-preview`
|
|
19
|
+
- **BREAKING**: Default temperature changed from `0.7` to `1.0` (Google's recommendation for Gemini 3)
|
|
20
|
+
- **BREAKING**: Default embedding model changed from `text-embedding-004` to `gemini-embedding-001`
|
|
21
|
+
- Updated `@google/genai` dependency from `^1.8.0` to `^1.41.0` (required for `thinkingConfig` support)
|
|
22
|
+
- Server version bumped to `5.0.0`
|
|
23
|
+
- All help content, resources, and prompts updated for Gemini 3
|
|
24
|
+
- `analyze_image` vision model enum now includes Gemini 3 models
|
|
25
|
+
- Temperature fallback uses nullish coalescing (`??`) to allow explicit `temperature: 0`
|
|
26
|
+
|
|
27
|
+
### Removed
|
|
28
|
+
- Deprecated Gemini 2.0 series models (`gemini-2.0-flash`, `gemini-2.0-flash-lite`, `gemini-2.0-pro-experimental`) — EOL 2026-03-31
|
|
29
|
+
- Deprecated Gemini 1.5 series models (`gemini-1.5-pro`, `gemini-1.5-flash`)
|
|
30
|
+
- Old dead test files referencing removed `handlers.ts` and `server.ts` modules
|
|
31
|
+
|
|
32
|
+
## [4.2.2] - 2025-07-08
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
- Fixed image truncation issue by adding crlfDelay: Infinity to readline interface
|
|
36
|
+
- Added proper UTF-8 encoding for stdin to handle large Base64 data
|
|
37
|
+
- Improved error handling and debugging for image analysis
|
|
38
|
+
- Added logging for Base64 data size to help diagnose issues
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
- Enhanced error messages for image analysis failures
|
|
42
|
+
- Added input validation for image analysis parameters
|
|
43
|
+
|
|
44
|
+
## [4.2.1] - 2025-07-08
|
|
45
|
+
|
|
46
|
+
### Fixed
|
|
47
|
+
- Fixed conversation context role validation error by adding 'user' role to all user messages
|
|
48
|
+
- Added proper role field to generate_text, analyze_image, and count_tokens API calls
|
|
49
|
+
- Resolved "Invalid role" error when using conversation_id feature
|
|
50
|
+
|
|
51
|
+
## [4.2.0] - 2025-07-08
|
|
52
|
+
|
|
53
|
+
### Changed
|
|
54
|
+
- Cleaned up repository by removing legacy WebSocket implementation files
|
|
55
|
+
- Removed unused dependencies (ws and @types/ws)
|
|
56
|
+
- Streamlined codebase to only include stdio-based MCP implementation
|
|
57
|
+
|
|
58
|
+
### Security
|
|
59
|
+
- Performed comprehensive security audit
|
|
60
|
+
- Verified no exposed secrets or API keys
|
|
61
|
+
- Confirmed all dependencies are vulnerability-free
|
|
62
|
+
- API keys only accessed via environment variables
|
|
63
|
+
|
|
64
|
+
### Removed
|
|
65
|
+
- `src/server.ts` - Legacy WebSocket server
|
|
66
|
+
- `src/index.ts` - Old entry point
|
|
67
|
+
- `src/handlers.ts` - Unused handler functions
|
|
68
|
+
- `src/protocol.ts` - Legacy protocol definitions
|
|
69
|
+
- `src/stdio-server.ts` - Superseded by enhanced-stdio-server
|
|
70
|
+
- WebSocket dependencies
|
|
71
|
+
|
|
72
|
+
## [4.1.0] - 2025-07-07
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
- Self-documenting `get_help` tool for discovering features within MCP clients
|
|
76
|
+
- New MCP resources for documentation access:
|
|
77
|
+
- `gemini://help/usage` - Usage guide
|
|
78
|
+
- `gemini://help/parameters` - Parameters reference
|
|
79
|
+
- `gemini://help/examples` - Example usage patterns
|
|
80
|
+
- Support for `resources/read` to access documentation programmatically
|
|
81
|
+
- Updated documentation to support all MCP clients (not just Claude Desktop)
|
|
82
|
+
|
|
83
|
+
### Changed
|
|
84
|
+
- Updated README to include setup instructions for multiple MCP clients
|
|
85
|
+
- Enhanced documentation with comprehensive parameter references
|
|
86
|
+
|
|
87
|
+
## [4.0.0] - 2025-07-07
|
|
88
|
+
|
|
89
|
+
### Added
|
|
90
|
+
- Support for all latest Gemini models (as of July 2025):
|
|
91
|
+
- Gemini 2.5 series with thinking capabilities
|
|
92
|
+
- Gemini 2.0 series including pro-experimental
|
|
93
|
+
- Legacy 1.5 models for compatibility
|
|
94
|
+
- 5 powerful tools:
|
|
95
|
+
- `generate_text` - Advanced text generation with all features
|
|
96
|
+
- `analyze_image` - Vision analysis capabilities
|
|
97
|
+
- `count_tokens` - Token counting for cost estimation
|
|
98
|
+
- `list_models` - Model discovery with filtering
|
|
99
|
+
- `embed_text` - Text embeddings for semantic search
|
|
100
|
+
- Advanced features:
|
|
101
|
+
- JSON mode with schema validation
|
|
102
|
+
- Google Search grounding for current information
|
|
103
|
+
- System instructions for behavior control
|
|
104
|
+
- Conversation memory with session IDs
|
|
105
|
+
- Customizable safety settings
|
|
106
|
+
- Temperature, topK, topP controls
|
|
107
|
+
- 3 MCP prompts for common tasks
|
|
108
|
+
- 2 MCP resources for model and capability information
|
|
109
|
+
|
|
110
|
+
### Changed
|
|
111
|
+
- Complete rewrite to use stdio-based MCP protocol
|
|
112
|
+
- Switched to newline-delimited JSON (not Content-Length headers)
|
|
113
|
+
- Updated to new @google/genai SDK
|
|
114
|
+
|
|
115
|
+
## [3.0.0] - 2025-07-07
|
|
116
|
+
|
|
117
|
+
### Changed
|
|
118
|
+
- Migrated from WebSocket to stdio-based communication
|
|
119
|
+
- Fixed MCP protocol implementation based on official spec
|
|
120
|
+
|
|
121
|
+
## [2.0.0] - 2025-07-07
|
|
122
|
+
|
|
123
|
+
### Changed
|
|
124
|
+
- Updated from deprecated @google/generative-ai to @google/genai SDK
|
|
125
|
+
- Fixed TypeScript ESM configuration
|
|
126
|
+
- Added proper .js extensions to imports
|
|
127
|
+
|
|
128
|
+
## [1.0.0] - 2024-12-15
|
|
129
|
+
|
|
130
|
+
### Added
|
|
131
|
+
- Initial release with WebSocket-based MCP server
|
|
132
|
+
- Basic Gemini text generation support
|
|
133
|
+
- TypeScript implementation
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Ali Argün
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
# Gemini MCP Server
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
A powerful MCP (Model Context Protocol) server that brings Google's latest Gemini AI models to your favorite development environment. Access Gemini 3's state-of-the-art reasoning, configurable thinking depth, vision analysis, embeddings, and more through a seamless integration.
|
|
10
|
+
|
|
11
|
+
🚀 **Works with**: Claude Desktop, Cursor, Windsurf, and any MCP-compatible client
|
|
12
|
+
🎯 **Why use this**: Get Gemini's cutting-edge AI features directly in your IDE with full parameter control
|
|
13
|
+
📚 **Self-documenting**: Built-in help system means you never need to leave your editor
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **6 Powerful Tools**: Text generation, image analysis, token counting, model listing, embeddings, and self-documenting help
|
|
18
|
+
|
|
19
|
+
- **Latest Gemini 3 Models**: `gemini-3-pro-preview` and `gemini-3-flash-preview` with configurable thinking depth
|
|
20
|
+
|
|
21
|
+
- **Thinking Level Control**: Adjust reasoning depth per request (minimal/low/medium/high)
|
|
22
|
+
|
|
23
|
+
- **Media Resolution Control**: Configure token allocation for image/video inputs
|
|
24
|
+
|
|
25
|
+
- **Advanced Features**: JSON mode, Google Search grounding, system instructions, conversation memory
|
|
26
|
+
|
|
27
|
+
- **Full MCP Protocol**: Standard stdio communication for seamless integration with any MCP client
|
|
28
|
+
|
|
29
|
+
- **Self-Documenting**: Built-in help system - no external docs needed
|
|
30
|
+
|
|
31
|
+
- **TypeScript & ESM**: Modern, type-safe implementation
|
|
32
|
+
|
|
33
|
+
### Supported Models
|
|
34
|
+
|
|
35
|
+
| Model | Context | Max Output | Thinking Levels | Best For |
|
|
36
|
+
| ---------------------- | --------- | ---------- | -------------------------- | -------------------------- |
|
|
37
|
+
| gemini-3-pro-preview ⭐ | 1M tokens | 64K tokens | low, high | Complex reasoning, agentic |
|
|
38
|
+
| gemini-3-flash-preview | 1M tokens | 64K tokens | minimal, low, medium, high | Fast + smart |
|
|
39
|
+
| gemini-2.5-pro | 2M tokens | — | — | Legacy complex tasks |
|
|
40
|
+
| gemini-2.5-flash | 1M tokens | — | — | Legacy general use |
|
|
41
|
+
| gemini-2.5-flash-lite | 1M tokens | — | — | Legacy cost-efficient |
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
1. **Get Gemini API Key**
|
|
46
|
+
|
|
47
|
+
- Visit [Google AI Studio](https://makersuite.google.com/app/apikey)
|
|
48
|
+
|
|
49
|
+
- Create a new API key
|
|
50
|
+
|
|
51
|
+
- **IMPORTANT**: Keep your API key secure and never commit it to version control
|
|
52
|
+
|
|
53
|
+
2. **Configure Your MCP Client**
|
|
54
|
+
|
|
55
|
+
<details open>
|
|
56
|
+
<summary><b>Claude Desktop</b></summary>
|
|
57
|
+
|
|
58
|
+
Config location:
|
|
59
|
+
|
|
60
|
+
- Mac: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
61
|
+
|
|
62
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
63
|
+
|
|
64
|
+
- Linux: `~/.config/Claude/claude_desktop_config.json`
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"mcpServers": {
|
|
69
|
+
"gemini": {
|
|
70
|
+
"type": "stdio",
|
|
71
|
+
"command": "npx",
|
|
72
|
+
"args": ["-y", "github:anzchy/gemini-cli-mcp-server"],
|
|
73
|
+
"env": {
|
|
74
|
+
"GEMINI_API_KEY": "your_api_key_here"
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
</details>
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary><b>Cursor</b></summary>
|
|
84
|
+
|
|
85
|
+
Add to Cursor's MCP settings:
|
|
86
|
+
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"gemini": {
|
|
90
|
+
"type": "stdio",
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": ["-y", "github:anzchy/gemini-cli-mcp-server"],
|
|
93
|
+
"env": {
|
|
94
|
+
"GEMINI_API_KEY": "your_api_key_here"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
</details>
|
|
100
|
+
|
|
101
|
+
<details>
|
|
102
|
+
<summary><b>Windsurf</b></summary>
|
|
103
|
+
|
|
104
|
+
Configure in Windsurf's MCP settings following their documentation.
|
|
105
|
+
</details>
|
|
106
|
+
|
|
107
|
+
<details>
|
|
108
|
+
<summary><b>Other MCP Clients</b></summary>
|
|
109
|
+
|
|
110
|
+
Use the standard MCP stdio configuration:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"type": "stdio",
|
|
115
|
+
"command": "npx",
|
|
116
|
+
"args": ["-y", "github:anzchy/gemini-cli-mcp-server"],
|
|
117
|
+
"env": {
|
|
118
|
+
"GEMINI_API_KEY": "your_api_key_here"
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
</details>
|
|
123
|
+
|
|
124
|
+
3. **Restart Your MCP Client**
|
|
125
|
+
|
|
126
|
+
## How to Use
|
|
127
|
+
|
|
128
|
+
Once configured, you can use natural language in your MCP client to access Gemini's capabilities:
|
|
129
|
+
|
|
130
|
+
### Basic Commands
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
"Use Gemini to explain quantum computing"
|
|
134
|
+
"Analyze this image with Gemini"
|
|
135
|
+
"List all Gemini models"
|
|
136
|
+
"Get help on using Gemini"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Advanced Examples
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
"Use Gemini 3 Pro with thinkingLevel high to review this code"
|
|
143
|
+
"Use Gemini in JSON mode to extract key points with schema {title, summary, tags}"
|
|
144
|
+
"Use Gemini with grounding to research the latest in quantum computing"
|
|
145
|
+
"Analyze this image with mediaResolution high for maximum detail"
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
📖 **[See the complete Usage Guide](USAGE_GUIDE.md)** for detailed examples and advanced features.
|
|
149
|
+
|
|
150
|
+
## Why Gemini MCP Server?
|
|
151
|
+
|
|
152
|
+
- **Access Latest Models**: Use Gemini 3 with configurable thinking depth - Google's most advanced models
|
|
153
|
+
|
|
154
|
+
- **Full Feature Set**: All Gemini API features including JSON mode, grounding, thinkingLevel, mediaResolution, and system instructions
|
|
155
|
+
|
|
156
|
+
- **Easy Setup**: One-line npx installation, no complex configuration needed
|
|
157
|
+
|
|
158
|
+
- **Production Ready**: Comprehensive error handling, TypeScript types, and extensive documentation
|
|
159
|
+
|
|
160
|
+
- **Active Development**: Regular updates with new Gemini features as they're released
|
|
161
|
+
|
|
162
|
+
## Documentation
|
|
163
|
+
|
|
164
|
+
- **[Usage Guide](USAGE_GUIDE.md)** - Complete guide on using all tools and features
|
|
165
|
+
|
|
166
|
+
- **[Parameters Reference](PARAMETERS_REFERENCE.md)** - Detailed documentation of all parameters
|
|
167
|
+
|
|
168
|
+
- **[Quick Reference](QUICK_REFERENCE.md)** - Quick commands cheat sheet
|
|
169
|
+
|
|
170
|
+
- **[Enhanced Features](ENHANCED_FEATURES.md)** - Detailed list of v5.0.0 capabilities
|
|
171
|
+
|
|
172
|
+
- [Claude Desktop Setup Guide](docs/claude-desktop-setup.md) - Detailed setup instructions
|
|
173
|
+
|
|
174
|
+
- [Examples and Usage](docs/examples.md) - Usage examples and advanced configuration
|
|
175
|
+
|
|
176
|
+
- [Implementation Notes](docs/implementation-notes.md) - Technical implementation details
|
|
177
|
+
|
|
178
|
+
- [Development Guide](docs/development-guide.md) - Guide for developers
|
|
179
|
+
|
|
180
|
+
- [Troubleshooting Guide](docs/troubleshooting.md) - Common issues and solutions
|
|
181
|
+
|
|
182
|
+
## Local Development
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Clone repository
|
|
186
|
+
git clone https://github.com/anzchy/gemini-cli-mcp-server.git
|
|
187
|
+
cd mcp-server-gemini
|
|
188
|
+
|
|
189
|
+
# Install dependencies
|
|
190
|
+
npm install
|
|
191
|
+
|
|
192
|
+
# Set up environment variables
|
|
193
|
+
cp .env.example .env
|
|
194
|
+
# Edit .env and add your GEMINI_API_KEY
|
|
195
|
+
|
|
196
|
+
# Start development server
|
|
197
|
+
npm run dev
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
## Contributing
|
|
201
|
+
|
|
202
|
+
Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md).
|
|
203
|
+
|
|
204
|
+
## Common Issues
|
|
205
|
+
|
|
206
|
+
1. **Connection Issues**
|
|
207
|
+
|
|
208
|
+
- Ensure your MCP client is properly restarted
|
|
209
|
+
|
|
210
|
+
- Check the client's logs (e.g., `~/Library/Logs/Claude/mcp-server-gemini.log` for Claude Desktop on Mac)
|
|
211
|
+
|
|
212
|
+
- Verify internet connection
|
|
213
|
+
|
|
214
|
+
- See [Troubleshooting Guide](docs/troubleshooting.md)
|
|
215
|
+
|
|
216
|
+
2. **API Key Problems**
|
|
217
|
+
|
|
218
|
+
- Verify API key is correct
|
|
219
|
+
|
|
220
|
+
- Check API key has proper permissions
|
|
221
|
+
|
|
222
|
+
- Ensure the key is set in the environment variable
|
|
223
|
+
|
|
224
|
+
- See [Setup Guide](docs/claude-desktop-setup.md)
|
|
225
|
+
|
|
226
|
+
3. **Stale Version / Not Picking Up Updates**
|
|
227
|
+
|
|
228
|
+
When using `npx -y github:anzchy/gemini-cli-mcp-server`, npx caches the package locally. If you're not seeing new features or bug fixes after an update, clear the cache:
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Clear the npx cache (installs a small helper, then wipes the cache)
|
|
232
|
+
npx clear-npx-cache
|
|
233
|
+
|
|
234
|
+
# Also clear the npm cache for good measure
|
|
235
|
+
npm cache clean --force
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
After clearing, restart your MCP client. The next invocation will pull the latest version from GitHub.
|
|
239
|
+
|
|
240
|
+
**Tip:** If you want to skip caching entirely during development, point your MCP client to the local build instead:
|
|
241
|
+
```json
|
|
242
|
+
{
|
|
243
|
+
"command": "node",
|
|
244
|
+
"args": ["--use-env-proxy", "/path/to/dist/enhanced-stdio-server.js"]
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Security
|
|
249
|
+
|
|
250
|
+
- API keys are handled via environment variables only
|
|
251
|
+
|
|
252
|
+
- Never commit API keys to version control
|
|
253
|
+
|
|
254
|
+
- The `.claude/` directory is excluded from git
|
|
255
|
+
|
|
256
|
+
- No sensitive data is logged or stored
|
|
257
|
+
|
|
258
|
+
- Regular security updates
|
|
259
|
+
|
|
260
|
+
- If your API key is exposed, regenerate it immediately in Google Cloud Console
|
|
261
|
+
|
|
262
|
+
## License
|
|
263
|
+
|
|
264
|
+
MIT
|