@houtini/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.
- package/.env.example +10 -0
- package/LICENSE +21 -0
- package/README.md +442 -0
- package/claude_desktop_config_example.json +12 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +22 -0
- package/dist/cli.js.map +1 -0
- package/dist/config/index.d.ts +4 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +81 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +24 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +3 -0
- package/dist/config/types.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +154 -0
- package/dist/index.js.map +1 -0
- package/dist/services/base-service.d.ts +8 -0
- package/dist/services/base-service.d.ts.map +1 -0
- package/dist/services/base-service.js +30 -0
- package/dist/services/base-service.js.map +1 -0
- package/dist/services/gemini/index.d.ts +15 -0
- package/dist/services/gemini/index.d.ts.map +1 -0
- package/dist/services/gemini/index.js +182 -0
- package/dist/services/gemini/index.js.map +1 -0
- package/dist/services/gemini/types.d.ts +29 -0
- package/dist/services/gemini/types.d.ts.map +1 -0
- package/dist/services/gemini/types.js +3 -0
- package/dist/services/gemini/types.js.map +1 -0
- package/dist/tools/gemini-chat.d.ts +9 -0
- package/dist/tools/gemini-chat.d.ts.map +1 -0
- package/dist/tools/gemini-chat.js +82 -0
- package/dist/tools/gemini-chat.js.map +1 -0
- package/dist/tools/gemini-list-models.d.ts +9 -0
- package/dist/tools/gemini-list-models.d.ts.map +1 -0
- package/dist/tools/gemini-list-models.js +42 -0
- package/dist/tools/gemini-list-models.js.map +1 -0
- package/dist/utils/error-handler.d.ts +17 -0
- package/dist/utils/error-handler.d.ts.map +1 -0
- package/dist/utils/error-handler.js +61 -0
- package/dist/utils/error-handler.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +59 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +94 -0
package/.env.example
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Gemini MCP Server Contributors
|
|
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,442 @@
|
|
|
1
|
+
# Gemini MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/js/@houtini/gemini-mcp)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://www.typescriptlang.org/)
|
|
6
|
+
|
|
7
|
+
A professional, production-ready Model Context Protocol (MCP) server that provides seamless integration with Google's Gemini AI models. Built with TypeScript and designed for enterprise use, this package offers robust error handling, comprehensive logging, and easy deployment.
|
|
8
|
+
|
|
9
|
+
## 🚀 Quick Start
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Install globally
|
|
13
|
+
npm install -g @houtini/gemini-mcp
|
|
14
|
+
|
|
15
|
+
# Or install locally
|
|
16
|
+
npm install @houtini/gemini-mcp
|
|
17
|
+
|
|
18
|
+
# Set your API key
|
|
19
|
+
export GEMINI_API_KEY="your-api-key-here"
|
|
20
|
+
|
|
21
|
+
# Run the server
|
|
22
|
+
gemini-mcp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 📋 Table of Contents
|
|
26
|
+
|
|
27
|
+
- [Features](#-features)
|
|
28
|
+
- [Installation](#-installation)
|
|
29
|
+
- [Configuration](#-configuration)
|
|
30
|
+
- [Usage Examples](#-usage-examples)
|
|
31
|
+
- [API Reference](#-api-reference)
|
|
32
|
+
- [Development](#-development)
|
|
33
|
+
- [Troubleshooting](#-troubleshooting)
|
|
34
|
+
- [Contributing](#-contributing)
|
|
35
|
+
|
|
36
|
+
## ✨ Features
|
|
37
|
+
|
|
38
|
+
### Core Functionality
|
|
39
|
+
- **🤖 Multi-Model Support** - Access to 6 Gemini models including the latest Gemini 2.5 Flash
|
|
40
|
+
- **💬 Chat Interface** - Advanced chat functionality with customisable parameters
|
|
41
|
+
- **📊 Model Information** - Detailed model capabilities and specifications
|
|
42
|
+
- **🎛️ Fine-Grained Control** - Temperature, token limits, and system prompts
|
|
43
|
+
|
|
44
|
+
### Enterprise Features
|
|
45
|
+
- **🏗️ Professional Architecture** - Modular services-based design
|
|
46
|
+
- **🛡️ Robust Error Handling** - Comprehensive error handling with detailed logging
|
|
47
|
+
- **📝 Winston Logging** - Production-ready logging with file rotation
|
|
48
|
+
- **🔒 Security Focused** - No hardcoded credentials, environment-based configuration
|
|
49
|
+
- **🏷️ Full TypeScript** - Complete type safety and IntelliSense support
|
|
50
|
+
- **⚡ High Performance** - Optimised for minimal latency and resource usage
|
|
51
|
+
|
|
52
|
+
## 📦 Installation
|
|
53
|
+
|
|
54
|
+
### Prerequisites
|
|
55
|
+
|
|
56
|
+
- **Node.js** 18.0.0 or higher (you're running v24.6.0 ✅)
|
|
57
|
+
- **Google AI Studio API Key** ([Get your key here](https://makersuite.google.com/app/apikey))
|
|
58
|
+
|
|
59
|
+
### Global Installation (Recommended)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npm install -g @houtini/gemini-mcp
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Local Installation
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npm install @houtini/gemini-mcp
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### From Source
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
git clone https://github.com/houtini-ai/gemini-mcp.git
|
|
75
|
+
cd gemini-mcp
|
|
76
|
+
npm install
|
|
77
|
+
npm run build
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## ⚙️ Configuration
|
|
81
|
+
|
|
82
|
+
### Environment Variables
|
|
83
|
+
|
|
84
|
+
The simplest way to configure the server is through environment variables:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Required
|
|
88
|
+
export GEMINI_API_KEY="your-api-key-here"
|
|
89
|
+
|
|
90
|
+
# Optional
|
|
91
|
+
export LOG_LEVEL="info" # debug, info, warn, error
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Using .env File
|
|
95
|
+
|
|
96
|
+
Create a `.env` file in your project directory:
|
|
97
|
+
|
|
98
|
+
```env
|
|
99
|
+
# Google Gemini Configuration
|
|
100
|
+
GEMINI_API_KEY=your-api-key-here
|
|
101
|
+
|
|
102
|
+
# Logging Configuration
|
|
103
|
+
LOG_LEVEL=info
|
|
104
|
+
|
|
105
|
+
# Optional server configuration
|
|
106
|
+
SERVER_NAME=gemini-mcp
|
|
107
|
+
SERVER_VERSION=1.0.0
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Claude Desktop Configuration
|
|
111
|
+
|
|
112
|
+
Add to your Claude Desktop configuration file:
|
|
113
|
+
|
|
114
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
115
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
116
|
+
|
|
117
|
+
#### For Global Installation:
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcpServers": {
|
|
121
|
+
"gemini": {
|
|
122
|
+
"command": "gemini-mcp",
|
|
123
|
+
"env": {
|
|
124
|
+
"GEMINI_API_KEY": "your-api-key-here",
|
|
125
|
+
"LOG_LEVEL": "info"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### For Local Installation:
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"mcpServers": {
|
|
136
|
+
"gemini": {
|
|
137
|
+
"command": "node",
|
|
138
|
+
"args": ["./node_modules/@houtini/gemini-mcp/dist/index.js"],
|
|
139
|
+
"env": {
|
|
140
|
+
"GEMINI_API_KEY": "your-api-key-here"
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
#### For Development:
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"mcpServers": {
|
|
151
|
+
"gemini": {
|
|
152
|
+
"command": "node",
|
|
153
|
+
"args": ["C:\\path\\to\\gemini-mcp\\dist\\index.js"],
|
|
154
|
+
"env": {
|
|
155
|
+
"GEMINI_API_KEY": "your-api-key-here"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## 💡 Usage Examples
|
|
163
|
+
|
|
164
|
+
### Basic Chat
|
|
165
|
+
|
|
166
|
+
Ask Claude to use Gemini:
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
Can you help me understand quantum computing using Gemini?
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Claude will automatically use the `gemini_chat` tool to get a response from Gemini.
|
|
173
|
+
|
|
174
|
+
### Creative Writing
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
Use Gemini to write a short story about artificial intelligence discovering creativity.
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Technical Analysis
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
Can you use Gemini Pro to explain the differences between various machine learning algorithms?
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Model Selection
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
Use Gemini 1.5 Pro to analyse this code and suggest improvements.
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Getting Model Information
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Show me all available Gemini models and their capabilities.
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## 🔧 API Reference
|
|
199
|
+
|
|
200
|
+
### Available Tools
|
|
201
|
+
|
|
202
|
+
#### `gemini_chat`
|
|
203
|
+
|
|
204
|
+
Chat with Gemini models to generate text responses.
|
|
205
|
+
|
|
206
|
+
**Parameters:**
|
|
207
|
+
|
|
208
|
+
| Parameter | Type | Required | Default | Description |
|
|
209
|
+
|-----------|------|----------|---------|-------------|
|
|
210
|
+
| `message` | string | ✅ | - | The message to send to Gemini |
|
|
211
|
+
| `model` | string | ❌ | "gemini-2.5-flash" | Model to use |
|
|
212
|
+
| `temperature` | number | ❌ | 0.7 | Controls randomness (0.0-1.0) |
|
|
213
|
+
| `max_tokens` | integer | ❌ | 2048 | Maximum tokens in response (1-8192) |
|
|
214
|
+
| `system_prompt` | string | ❌ | - | System instruction to guide the model |
|
|
215
|
+
|
|
216
|
+
**Example:**
|
|
217
|
+
```json
|
|
218
|
+
{
|
|
219
|
+
"message": "Explain machine learning in simple terms",
|
|
220
|
+
"model": "gemini-1.5-pro",
|
|
221
|
+
"temperature": 0.5,
|
|
222
|
+
"max_tokens": 1000,
|
|
223
|
+
"system_prompt": "You are a helpful teaching assistant. Explain concepts clearly and use analogies where appropriate."
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
#### `gemini_list_models`
|
|
228
|
+
|
|
229
|
+
Retrieve information about all available Gemini models.
|
|
230
|
+
|
|
231
|
+
**Parameters:** None required
|
|
232
|
+
|
|
233
|
+
**Example:**
|
|
234
|
+
```json
|
|
235
|
+
{}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
**Response includes:**
|
|
239
|
+
- Model names and display names
|
|
240
|
+
- Descriptions of each model's strengths
|
|
241
|
+
- Recommended use cases
|
|
242
|
+
|
|
243
|
+
### Available Models
|
|
244
|
+
|
|
245
|
+
| Model | Best For | Description |
|
|
246
|
+
|-------|----------|-------------|
|
|
247
|
+
| **gemini-2.5-flash** | General use, latest features | Latest Gemini 2.5 Flash - Fast, versatile performance |
|
|
248
|
+
| **gemini-2.0-flash** | Speed-optimised tasks | Gemini 2.0 Flash - Fast, efficient model |
|
|
249
|
+
| **gemini-1.5-flash** | Quick responses | Gemini 1.5 Flash - Fast, efficient model |
|
|
250
|
+
| **gemini-1.5-pro** | Complex reasoning | Gemini 1.5 Pro - Advanced reasoning capabilities |
|
|
251
|
+
| **gemini-pro** | Balanced performance | Gemini Pro - Balanced performance for most tasks |
|
|
252
|
+
| **gemini-pro-vision** | Multimodal tasks | Gemini Pro Vision - Text and image understanding |
|
|
253
|
+
|
|
254
|
+
## 🛠️ Development
|
|
255
|
+
|
|
256
|
+
### Building from Source
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Clone the repository
|
|
260
|
+
git clone https://github.com/houtini-ai/gemini-mcp.git
|
|
261
|
+
cd gemini-mcp
|
|
262
|
+
|
|
263
|
+
# Install dependencies
|
|
264
|
+
npm install
|
|
265
|
+
|
|
266
|
+
# Build the project
|
|
267
|
+
npm run build
|
|
268
|
+
|
|
269
|
+
# Run in development mode
|
|
270
|
+
npm run dev
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Scripts
|
|
274
|
+
|
|
275
|
+
| Command | Description |
|
|
276
|
+
|---------|-------------|
|
|
277
|
+
| `npm run build` | Compile TypeScript to JavaScript |
|
|
278
|
+
| `npm run dev` | Run in development mode with live reload |
|
|
279
|
+
| `npm start` | Run the compiled server |
|
|
280
|
+
| `npm test` | Run test suite |
|
|
281
|
+
| `npm run lint` | Check code style |
|
|
282
|
+
| `npm run lint:fix` | Fix linting issues automatically |
|
|
283
|
+
|
|
284
|
+
### Project Structure
|
|
285
|
+
|
|
286
|
+
```
|
|
287
|
+
src/
|
|
288
|
+
├── config/ # Configuration management
|
|
289
|
+
│ ├── index.ts # Main configuration
|
|
290
|
+
│ └── types.ts # Configuration types
|
|
291
|
+
├── services/ # Core business logic
|
|
292
|
+
│ ├── base-service.ts
|
|
293
|
+
│ └── gemini/ # Gemini service implementation
|
|
294
|
+
│ ├── index.ts
|
|
295
|
+
│ └── types.ts
|
|
296
|
+
├── tools/ # MCP tool implementations
|
|
297
|
+
│ ├── gemini-chat.ts
|
|
298
|
+
│ └── gemini-list-models.ts
|
|
299
|
+
├── utils/ # Utility functions
|
|
300
|
+
│ ├── logger.ts # Winston logging setup
|
|
301
|
+
│ └── error-handler.ts
|
|
302
|
+
├── cli.ts # CLI entry point
|
|
303
|
+
└── index.ts # Main server implementation
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
### Architecture
|
|
307
|
+
|
|
308
|
+
The server follows a clean, layered architecture:
|
|
309
|
+
|
|
310
|
+
1. **CLI Layer** (`cli.ts`) - Command-line interface
|
|
311
|
+
2. **Server Layer** (`index.ts`) - MCP protocol handling
|
|
312
|
+
3. **Tools Layer** (`tools/`) - MCP tool implementations
|
|
313
|
+
4. **Service Layer** (`services/`) - Business logic and API integration
|
|
314
|
+
5. **Utility Layer** (`utils/`) - Cross-cutting concerns
|
|
315
|
+
|
|
316
|
+
## 🐛 Troubleshooting
|
|
317
|
+
|
|
318
|
+
### Common Issues
|
|
319
|
+
|
|
320
|
+
#### "GEMINI_API_KEY environment variable not set"
|
|
321
|
+
|
|
322
|
+
**Solution:**
|
|
323
|
+
```bash
|
|
324
|
+
export GEMINI_API_KEY="your-actual-api-key"
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
Or create a `.env` file with your API key.
|
|
328
|
+
|
|
329
|
+
#### Server not appearing in Claude Desktop
|
|
330
|
+
|
|
331
|
+
**Solutions:**
|
|
332
|
+
1. Restart Claude Desktop after updating configuration
|
|
333
|
+
2. Check that the path in your configuration is correct
|
|
334
|
+
3. Ensure the built files exist in the `dist` directory
|
|
335
|
+
4. Verify your API key is valid
|
|
336
|
+
|
|
337
|
+
#### "Module not found" errors
|
|
338
|
+
|
|
339
|
+
**Solutions:**
|
|
340
|
+
```bash
|
|
341
|
+
# Reinstall dependencies
|
|
342
|
+
npm install
|
|
343
|
+
|
|
344
|
+
# Rebuild the project
|
|
345
|
+
npm run build
|
|
346
|
+
|
|
347
|
+
# Check Node.js version (requires 18.0.0+)
|
|
348
|
+
node --version
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
#### TypeScript compilation errors
|
|
352
|
+
|
|
353
|
+
**Solution:**
|
|
354
|
+
```bash
|
|
355
|
+
# Clean and rebuild
|
|
356
|
+
rm -rf dist
|
|
357
|
+
npm run build
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
### Debug Mode
|
|
361
|
+
|
|
362
|
+
Enable detailed logging:
|
|
363
|
+
|
|
364
|
+
```bash
|
|
365
|
+
export LOG_LEVEL=debug
|
|
366
|
+
npm start
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
### Log Files
|
|
370
|
+
|
|
371
|
+
Logs are written to:
|
|
372
|
+
- **Console output** (stdout/stderr)
|
|
373
|
+
- **`logs/combined.log`** - All log levels
|
|
374
|
+
- **`logs/error.log`** - Error logs only
|
|
375
|
+
|
|
376
|
+
### Testing Your Setup
|
|
377
|
+
|
|
378
|
+
Test the server with these Claude queries:
|
|
379
|
+
|
|
380
|
+
1. **Basic connectivity**: "Can you list the available Gemini models?"
|
|
381
|
+
2. **Simple chat**: "Use Gemini to explain photosynthesis."
|
|
382
|
+
3. **Advanced features**: "Use Gemini 1.5 Pro with temperature 0.9 to write a creative poem about coding."
|
|
383
|
+
|
|
384
|
+
### Performance Tuning
|
|
385
|
+
|
|
386
|
+
For better performance:
|
|
387
|
+
|
|
388
|
+
1. **Adjust token limits** based on your use case
|
|
389
|
+
2. **Use appropriate models** (Flash for speed, Pro for complex tasks)
|
|
390
|
+
3. **Monitor logs** for rate limiting or API issues
|
|
391
|
+
4. **Set reasonable temperature values** (0.7 for balanced, 0.3 for focused, 0.9 for creative)
|
|
392
|
+
|
|
393
|
+
## 🤝 Contributing
|
|
394
|
+
|
|
395
|
+
Contributions are welcome! Please follow these steps:
|
|
396
|
+
|
|
397
|
+
1. **Fork the repository**
|
|
398
|
+
2. **Create a feature branch**: `git checkout -b feature/amazing-feature`
|
|
399
|
+
3. **Make your changes** and add tests if applicable
|
|
400
|
+
4. **Ensure all tests pass**: `npm test`
|
|
401
|
+
5. **Lint your code**: `npm run lint:fix`
|
|
402
|
+
6. **Build the project**: `npm run build`
|
|
403
|
+
7. **Commit your changes**: `git commit -m 'Add amazing feature'`
|
|
404
|
+
8. **Push to the branch**: `git push origin feature/amazing-feature`
|
|
405
|
+
9. **Open a Pull Request**
|
|
406
|
+
|
|
407
|
+
### Development Guidelines
|
|
408
|
+
|
|
409
|
+
- **Follow TypeScript best practices**
|
|
410
|
+
- **Add tests for new functionality**
|
|
411
|
+
- **Update documentation as needed**
|
|
412
|
+
- **Use conventional commit messages**
|
|
413
|
+
- **Ensure backwards compatibility**
|
|
414
|
+
|
|
415
|
+
## 📄 License
|
|
416
|
+
|
|
417
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
418
|
+
|
|
419
|
+
## 🆘 Support
|
|
420
|
+
|
|
421
|
+
- **GitHub Issues**: [Report bugs or request features](https://github.com/houtini-ai/gemini-mcp/issues)
|
|
422
|
+
- **GitHub Discussions**: [Ask questions or share ideas](https://github.com/houtini-ai/gemini-mcp/discussions)
|
|
423
|
+
|
|
424
|
+
## 📈 Changelog
|
|
425
|
+
|
|
426
|
+
### v1.0.0
|
|
427
|
+
|
|
428
|
+
**Initial Release**
|
|
429
|
+
- Complete Node.js/TypeScript rewrite from Python
|
|
430
|
+
- Professional modular architecture with services pattern
|
|
431
|
+
- Comprehensive error handling and logging system
|
|
432
|
+
- Full MCP protocol compliance
|
|
433
|
+
- Support for 6 Gemini models
|
|
434
|
+
- NPM package distribution ready
|
|
435
|
+
- Enterprise-grade configuration management
|
|
436
|
+
- Production-ready build system
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
**Built with ❤️ for the Model Context Protocol community**
|
|
441
|
+
|
|
442
|
+
For more information about MCP, visit [modelcontextprotocol.io](https://modelcontextprotocol.io)
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
const index_1 = require("./index");
|
|
8
|
+
const logger_1 = __importDefault(require("./utils/logger"));
|
|
9
|
+
// CLI entry point
|
|
10
|
+
async function cli() {
|
|
11
|
+
try {
|
|
12
|
+
logger_1.default.info('Starting Gemini MCP Server via CLI...');
|
|
13
|
+
const server = new index_1.GeminiMcpServer();
|
|
14
|
+
await server.start();
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
logger_1.default.error('CLI startup failed', { error });
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
cli();
|
|
22
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAEA,mCAA0C;AAC1C,4DAAoC;AAEpC,kBAAkB;AAClB,KAAK,UAAU,GAAG;IAChB,IAAI,CAAC;QACH,gBAAM,CAAC,IAAI,CAAC,uCAAuC,CAAC,CAAC;QAErD,MAAM,MAAM,GAAG,IAAI,uBAAe,EAAE,CAAC;QACrC,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IAEvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,gBAAM,CAAC,KAAK,CAAC,oBAAoB,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAMjC,eAAO,MAAM,MAAM,EAAE,MAiCpB,CAAC;AAEF,wBAAgB,cAAc,IAAI,IAAI,CAOrC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.config = void 0;
|
|
37
|
+
exports.validateConfig = validateConfig;
|
|
38
|
+
const dotenv = __importStar(require("dotenv"));
|
|
39
|
+
// Load environment variables
|
|
40
|
+
dotenv.config();
|
|
41
|
+
exports.config = {
|
|
42
|
+
gemini: {
|
|
43
|
+
apiKey: process.env.GEMINI_API_KEY,
|
|
44
|
+
safetySettings: [
|
|
45
|
+
{
|
|
46
|
+
category: 'HARM_CATEGORY_HARASSMENT',
|
|
47
|
+
threshold: 'BLOCK_NONE'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
category: 'HARM_CATEGORY_HATE_SPEECH',
|
|
51
|
+
threshold: 'BLOCK_NONE'
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
category: 'HARM_CATEGORY_SEXUALLY_EXPLICIT',
|
|
55
|
+
threshold: 'BLOCK_NONE'
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
category: 'HARM_CATEGORY_DANGEROUS_CONTENT',
|
|
59
|
+
threshold: 'BLOCK_NONE'
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
defaultModel: 'gemini-2.5-flash',
|
|
63
|
+
maxTokens: 8192,
|
|
64
|
+
temperature: 0.7
|
|
65
|
+
},
|
|
66
|
+
server: {
|
|
67
|
+
name: 'gemini-mcp',
|
|
68
|
+
version: '1.0.0'
|
|
69
|
+
},
|
|
70
|
+
logging: {
|
|
71
|
+
level: process.env.LOG_LEVEL || 'info',
|
|
72
|
+
format: 'combined'
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function validateConfig() {
|
|
76
|
+
if (!exports.config.gemini.apiKey) {
|
|
77
|
+
throw new Error('GEMINI_API_KEY environment variable not set. ' +
|
|
78
|
+
'Please set your Gemini API key: export GEMINI_API_KEY=your-api-key-here');
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,wCAOC;AA/CD,+CAAiC;AAEjC,6BAA6B;AAC7B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEH,QAAA,MAAM,GAAW;IAC5B,MAAM,EAAE;QACN,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;QAClC,cAAc,EAAE;YACd;gBACE,QAAQ,EAAE,0BAA0B;gBACpC,SAAS,EAAE,YAAY;aACxB;YACD;gBACE,QAAQ,EAAE,2BAA2B;gBACrC,SAAS,EAAE,YAAY;aACxB;YACD;gBACE,QAAQ,EAAE,iCAAiC;gBAC3C,SAAS,EAAE,YAAY;aACxB;YACD;gBACE,QAAQ,EAAE,iCAAiC;gBAC3C,SAAS,EAAE,YAAY;aACxB;SACF;QACD,YAAY,EAAE,kBAAkB;QAChC,SAAS,EAAE,IAAI;QACf,WAAW,EAAE,GAAG;KACjB;IACD,MAAM,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;KACjB;IACD,OAAO,EAAE;QACP,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM;QACtC,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,SAAgB,cAAc;IAC5B,IAAI,CAAC,cAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CACb,+CAA+C;YAC/C,yEAAyE,CAC1E,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface SafetySetting {
|
|
2
|
+
category: string;
|
|
3
|
+
threshold: string;
|
|
4
|
+
}
|
|
5
|
+
export interface GeminiConfig {
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
safetySettings: SafetySetting[];
|
|
8
|
+
defaultModel: string;
|
|
9
|
+
maxTokens: number;
|
|
10
|
+
temperature: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ServerConfig {
|
|
13
|
+
name: string;
|
|
14
|
+
version: string;
|
|
15
|
+
}
|
|
16
|
+
export interface Config {
|
|
17
|
+
gemini: GeminiConfig;
|
|
18
|
+
server: ServerConfig;
|
|
19
|
+
logging: {
|
|
20
|
+
level: string;
|
|
21
|
+
format: string;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
declare class GeminiMcpServer {
|
|
3
|
+
private server;
|
|
4
|
+
private geminiService;
|
|
5
|
+
private tools;
|
|
6
|
+
constructor();
|
|
7
|
+
private initializeTools;
|
|
8
|
+
private setupHandlers;
|
|
9
|
+
start(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export { GeminiMcpServer };
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAgBA,cAAM,eAAe;IACnB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,KAAK,CAAmB;;IAsChC,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,aAAa;IAsDf,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAuB7B;AAoCD,OAAO,EAAE,eAAe,EAAE,CAAC"}
|