@commitsage/mcp-server 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/README.md +434 -0
- package/dist/adapters/sse.d.ts +26 -0
- package/dist/adapters/sse.d.ts.map +1 -0
- package/dist/adapters/sse.js +45 -0
- package/dist/adapters/sse.js.map +1 -0
- package/dist/auth/jwt.d.ts +70 -0
- package/dist/auth/jwt.d.ts.map +1 -0
- package/dist/auth/jwt.js +171 -0
- package/dist/auth/jwt.js.map +1 -0
- package/dist/auth/oauth.d.ts +71 -0
- package/dist/auth/oauth.d.ts.map +1 -0
- package/dist/auth/oauth.js +213 -0
- package/dist/auth/oauth.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/models/errors.d.ts +34 -0
- package/dist/models/errors.d.ts.map +1 -0
- package/dist/models/errors.js +67 -0
- package/dist/models/errors.js.map +1 -0
- package/dist/models/types.d.ts +39 -0
- package/dist/models/types.d.ts.map +1 -0
- package/dist/models/types.js +9 -0
- package/dist/models/types.js.map +1 -0
- package/dist/server/mcpServer.d.ts +11 -0
- package/dist/server/mcpServer.d.ts.map +1 -0
- package/dist/server/mcpServer.js +216 -0
- package/dist/server/mcpServer.js.map +1 -0
- package/dist/server/tools.d.ts +93 -0
- package/dist/server/tools.d.ts.map +1 -0
- package/dist/server/tools.js +272 -0
- package/dist/server/tools.js.map +1 -0
- package/dist/services/aiService.d.ts +12 -0
- package/dist/services/aiService.d.ts.map +1 -0
- package/dist/services/aiService.js +86 -0
- package/dist/services/aiService.js.map +1 -0
- package/dist/services/baseAIService.d.ts +47 -0
- package/dist/services/baseAIService.d.ts.map +1 -0
- package/dist/services/baseAIService.js +153 -0
- package/dist/services/baseAIService.js.map +1 -0
- package/dist/services/codestralService.d.ts +7 -0
- package/dist/services/codestralService.d.ts.map +1 -0
- package/dist/services/codestralService.js +49 -0
- package/dist/services/codestralService.js.map +1 -0
- package/dist/services/geminiService.d.ts +18 -0
- package/dist/services/geminiService.d.ts.map +1 -0
- package/dist/services/geminiService.js +139 -0
- package/dist/services/geminiService.js.map +1 -0
- package/dist/services/gitBlameAnalyzer.d.ts +15 -0
- package/dist/services/gitBlameAnalyzer.d.ts.map +1 -0
- package/dist/services/gitBlameAnalyzer.js +135 -0
- package/dist/services/gitBlameAnalyzer.js.map +1 -0
- package/dist/services/gitService.d.ts +54 -0
- package/dist/services/gitService.d.ts.map +1 -0
- package/dist/services/gitService.js +394 -0
- package/dist/services/gitService.js.map +1 -0
- package/dist/services/ollamaService.d.ts +7 -0
- package/dist/services/ollamaService.d.ts.map +1 -0
- package/dist/services/ollamaService.js +43 -0
- package/dist/services/ollamaService.js.map +1 -0
- package/dist/services/openaiService.d.ts +9 -0
- package/dist/services/openaiService.d.ts.map +1 -0
- package/dist/services/openaiService.js +69 -0
- package/dist/services/openaiService.js.map +1 -0
- package/dist/services/promptService.d.ts +10 -0
- package/dist/services/promptService.d.ts.map +1 -0
- package/dist/services/promptService.js +136 -0
- package/dist/services/promptService.js.map +1 -0
- package/dist/utils/config.d.ts +27 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +80 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/httpUtils.d.ts +33 -0
- package/dist/utils/httpUtils.d.ts.map +1 -0
- package/dist/utils/httpUtils.js +54 -0
- package/dist/utils/httpUtils.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -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/dist/utils/retryUtils.d.ts +29 -0
- package/dist/utils/retryUtils.d.ts.map +1 -0
- package/dist/utils/retryUtils.js +49 -0
- package/dist/utils/retryUtils.js.map +1 -0
- package/dist/utils/textProcessing.d.ts +8 -0
- package/dist/utils/textProcessing.d.ts.map +1 -0
- package/dist/utils/textProcessing.js +10 -0
- package/dist/utils/textProcessing.js.map +1 -0
- package/package.json +47 -0
package/README.md
ADDED
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
# CommitSage MCP Server
|
|
2
|
+
|
|
3
|
+
AI-powered commit message generation via Model Context Protocol (MCP).
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
CommitSage MCP Server provides AI-powered Git commit message generation through the standardized Model Context Protocol. It supports multiple AI providers (Gemini, OpenAI, Codestral, Ollama) and various commit formats, making it easy to integrate into your workflow with Claude Code, Cursor, Zed, and other MCP-compatible tools.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🤖 **Multiple AI Providers**: Gemini, OpenAI, Codestral, Ollama
|
|
12
|
+
- 📝 **Multiple Commit Formats**: Conventional, Angular, Karma, Semantic, Emoji, and more
|
|
13
|
+
- 🌍 **Multi-language Support**: English, Russian, Chinese, Japanese, Spanish
|
|
14
|
+
- 🔧 **Customizable**: Custom instructions, formats, and languages
|
|
15
|
+
- 🚀 **Fast & Efficient**: Local git operations with smart caching
|
|
16
|
+
- 🔌 **MCP Compatible**: Works with Claude Code, Cursor, Zed, and more
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
|
|
22
|
+
- Node.js 18.0.0 or higher
|
|
23
|
+
- Git installed and in PATH
|
|
24
|
+
- API key for your chosen provider (Gemini, OpenAI, or Codestral) - not needed for Ollama
|
|
25
|
+
|
|
26
|
+
### Installation Options
|
|
27
|
+
|
|
28
|
+
#### Option 1: Zed Extension (Recommended)
|
|
29
|
+
|
|
30
|
+
The easiest way to use CommitSage is through the Zed extension, which handles installation and configuration automatically.
|
|
31
|
+
|
|
32
|
+
See the [Zed Extension README](./zed-extension/README.md) for details.
|
|
33
|
+
|
|
34
|
+
#### Option 2: Manual Installation
|
|
35
|
+
|
|
36
|
+
1. **Clone or download the project**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
cd C:\Users\IVAN\Documents\home\CommitSage\mcp-server
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. **Install dependencies**
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
3. **Build the project**
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm run build
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
4. **Configure in your MCP client** (see Configuration section below)
|
|
55
|
+
|
|
56
|
+
## Configuration for IDE Clients
|
|
57
|
+
|
|
58
|
+
### Claude Code
|
|
59
|
+
|
|
60
|
+
Add to your Claude Code configuration file:
|
|
61
|
+
|
|
62
|
+
**Windows:** `%USERPROFILE%\.claude\config.json`
|
|
63
|
+
**macOS/Linux:** `~/.claude/config.json`
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
{
|
|
67
|
+
"mcpServers": {
|
|
68
|
+
"commitsage": {
|
|
69
|
+
"command": "node",
|
|
70
|
+
"args": ["C:/Users/IVAN/Documents/home/CommitSage/mcp-server/dist/index.js"],
|
|
71
|
+
"env": {
|
|
72
|
+
"GEMINI_API_KEY": "your-api-key-here",
|
|
73
|
+
"DEFAULT_PROVIDER": "gemini",
|
|
74
|
+
"DEFAULT_COMMIT_FORMAT": "conventional",
|
|
75
|
+
"DEFAULT_COMMIT_LANGUAGE": "english",
|
|
76
|
+
"API_REQUEST_TIMEOUT": "30"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Minimal configuration (Gemini only):**
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"commitsage": {
|
|
89
|
+
"command": "node",
|
|
90
|
+
"args": ["C:/Users/IVAN/Documents/home/CommitSage/mcp-server/dist/index.js"],
|
|
91
|
+
"env": {
|
|
92
|
+
"GEMINI_API_KEY": "your-api-key-here"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Cursor
|
|
100
|
+
|
|
101
|
+
Add to Cursor settings (Settings > MCP):
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"mcp": {
|
|
106
|
+
"servers": {
|
|
107
|
+
"commitsage": {
|
|
108
|
+
"command": "node",
|
|
109
|
+
"args": ["C:/Users/IVAN/Documents/home/CommitSage/mcp-server/dist/index.js"],
|
|
110
|
+
"env": {
|
|
111
|
+
"GEMINI_API_KEY": "your-api-key-here",
|
|
112
|
+
"DEFAULT_PROVIDER": "gemini",
|
|
113
|
+
"DEFAULT_COMMIT_FORMAT": "conventional"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Zed (Manual Configuration)
|
|
122
|
+
|
|
123
|
+
**Note:** For Zed, we recommend using the [Zed Extension](./zed-extension/README.md) instead.
|
|
124
|
+
|
|
125
|
+
If you prefer manual configuration, add to `.zed/settings.json`:
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"context_servers": {
|
|
130
|
+
"commitsage": {
|
|
131
|
+
"command": "node",
|
|
132
|
+
"args": ["C:/Users/IVAN/Documents/home/CommitSage/mcp-server/dist/index.js"],
|
|
133
|
+
"env": {
|
|
134
|
+
"GEMINI_API_KEY": "your-api-key-here",
|
|
135
|
+
"DEFAULT_PROVIDER": "gemini"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Available MCP Tools
|
|
143
|
+
|
|
144
|
+
### 1. `generate_commit_message`
|
|
145
|
+
|
|
146
|
+
Generate an AI-powered commit message for a Git repository.
|
|
147
|
+
|
|
148
|
+
**Parameters:**
|
|
149
|
+
- `repoPath` (required): Path to the git repository
|
|
150
|
+
- `provider` (optional): AI provider (`gemini`, `openai`, `codestral`, `ollama`)
|
|
151
|
+
- `format` (optional): Commit format (`conventional`, `angular`, `karma`, `semantic`, `emoji`, `emojiKarma`, `google`, `atom`)
|
|
152
|
+
- `language` (optional): Language (`english`, `russian`, `chinese`, `japanese`, `spanish`)
|
|
153
|
+
- `onlyStaged` (optional): Only analyze staged changes (default: `false`)
|
|
154
|
+
- `customInstructions` (optional): Custom instructions for generation
|
|
155
|
+
|
|
156
|
+
**Example:**
|
|
157
|
+
```json
|
|
158
|
+
{
|
|
159
|
+
"repoPath": "/path/to/your/repo",
|
|
160
|
+
"provider": "gemini",
|
|
161
|
+
"format": "conventional",
|
|
162
|
+
"language": "english",
|
|
163
|
+
"onlyStaged": true
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Response:**
|
|
168
|
+
```json
|
|
169
|
+
{
|
|
170
|
+
"success": true,
|
|
171
|
+
"message": "feat(auth): add OAuth2 authentication\n\nImplement GitHub OAuth flow with JWT tokens",
|
|
172
|
+
"model": "gemini-2.0-flash",
|
|
173
|
+
"provider": "gemini"
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### 2. `analyze_changes`
|
|
178
|
+
|
|
179
|
+
Analyze git changes in a repository.
|
|
180
|
+
|
|
181
|
+
**Parameters:**
|
|
182
|
+
- `repoPath` (required): Path to the git repository
|
|
183
|
+
- `onlyStaged` (optional): Only analyze staged changes
|
|
184
|
+
|
|
185
|
+
**Example:**
|
|
186
|
+
```json
|
|
187
|
+
{
|
|
188
|
+
"repoPath": "/path/to/your/repo",
|
|
189
|
+
"onlyStaged": false
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Response:**
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"success": true,
|
|
197
|
+
"analysis": {
|
|
198
|
+
"hasStagedChanges": true,
|
|
199
|
+
"hasUnstagedChanges": false,
|
|
200
|
+
"hasUntrackedFiles": false,
|
|
201
|
+
"changedFilesCount": 3,
|
|
202
|
+
"changedFiles": ["src/auth.ts", "src/config.ts", "README.md"],
|
|
203
|
+
"diffLength": 1234,
|
|
204
|
+
"diffPreview": "diff --git a/src/auth.ts..."
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### 3. `list_commit_formats`
|
|
210
|
+
|
|
211
|
+
List all available commit message formats.
|
|
212
|
+
|
|
213
|
+
**Parameters:** None
|
|
214
|
+
|
|
215
|
+
**Response:**
|
|
216
|
+
```json
|
|
217
|
+
{
|
|
218
|
+
"success": true,
|
|
219
|
+
"formats": [
|
|
220
|
+
{
|
|
221
|
+
"name": "conventional",
|
|
222
|
+
"description": "Conventional Commits format: type(scope): description",
|
|
223
|
+
"example": "feat(auth): add OAuth2 authentication"
|
|
224
|
+
},
|
|
225
|
+
...
|
|
226
|
+
],
|
|
227
|
+
"currentFormat": "conventional"
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### 4. `validate_api_key`
|
|
232
|
+
|
|
233
|
+
Validate that an API key is configured for a provider.
|
|
234
|
+
|
|
235
|
+
**Parameters:**
|
|
236
|
+
- `provider` (required): Provider to validate (`gemini`, `openai`, `codestral`, `ollama`)
|
|
237
|
+
|
|
238
|
+
**Example:**
|
|
239
|
+
```json
|
|
240
|
+
{
|
|
241
|
+
"provider": "gemini"
|
|
242
|
+
}
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Usage Examples
|
|
246
|
+
|
|
247
|
+
### In Claude Code
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
Generate a commit message for my staged changes in C:/projects/myapp using conventional format
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
Claude Code will call the `generate_commit_message` tool and provide you with a properly formatted commit message.
|
|
254
|
+
|
|
255
|
+
### In Cursor
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
Analyze the changes in /home/user/projects/webapp
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
Cursor will call the `analyze_changes` tool to show you what's changed.
|
|
262
|
+
|
|
263
|
+
### In Zed
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
List all available commit formats
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Zed will call the `list_commit_formats` tool and show you all options.
|
|
270
|
+
|
|
271
|
+
## Environment Variables Reference
|
|
272
|
+
|
|
273
|
+
| Variable | Description | Default | Required |
|
|
274
|
+
|----------|-------------|---------|----------|
|
|
275
|
+
| `GEMINI_API_KEY` | Google Gemini API key | - | For Gemini provider |
|
|
276
|
+
| `OPENAI_API_KEY` | OpenAI API key | - | For OpenAI provider |
|
|
277
|
+
| `CODESTRAL_API_KEY` | Mistral Codestral API key | - | For Codestral provider |
|
|
278
|
+
| `OLLAMA_BASE_URL` | Ollama API base URL | `http://localhost:11434` | For Ollama provider |
|
|
279
|
+
| `OLLAMA_MODEL` | Ollama model name | `llama3.2` | For Ollama provider |
|
|
280
|
+
| `DEFAULT_PROVIDER` | Default AI provider | `gemini` | No |
|
|
281
|
+
| `DEFAULT_COMMIT_FORMAT` | Default commit format | `conventional` | No |
|
|
282
|
+
| `DEFAULT_COMMIT_LANGUAGE` | Default language | `english` | No |
|
|
283
|
+
| `API_REQUEST_TIMEOUT` | API timeout in seconds | `30` | No |
|
|
284
|
+
| `LOG_LEVEL` | Logging level | `info` | No |
|
|
285
|
+
| `USE_CUSTOM_INSTRUCTIONS` | Enable custom instructions | `false` | No |
|
|
286
|
+
| `CUSTOM_INSTRUCTIONS` | Custom prompt instructions | - | If `USE_CUSTOM_INSTRUCTIONS` is `true` |
|
|
287
|
+
|
|
288
|
+
## Supported Commit Formats
|
|
289
|
+
|
|
290
|
+
1. **Conventional** - `type(scope): description`
|
|
291
|
+
2. **Angular** - Angular commit message format
|
|
292
|
+
3. **Karma** - `type(scope): message`
|
|
293
|
+
4. **Semantic** - `type: message`
|
|
294
|
+
5. **Emoji** - `:emoji: message`
|
|
295
|
+
6. **EmojiKarma** - `:emoji: type(scope): message`
|
|
296
|
+
7. **Google** - Google's commit format
|
|
297
|
+
8. **Atom** - Atom editor commit format
|
|
298
|
+
|
|
299
|
+
## Supported Languages
|
|
300
|
+
|
|
301
|
+
- English
|
|
302
|
+
- Russian (Русский)
|
|
303
|
+
- Chinese (中文)
|
|
304
|
+
- Japanese (日本語)
|
|
305
|
+
- Spanish (Español)
|
|
306
|
+
|
|
307
|
+
## Development
|
|
308
|
+
|
|
309
|
+
### Run in development mode
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
npm run dev
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### Build
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
npm run build
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Clean build artifacts
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
npm run clean
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Troubleshooting
|
|
328
|
+
|
|
329
|
+
### "Git is not installed or not found in PATH"
|
|
330
|
+
|
|
331
|
+
Make sure Git is installed and available in your system PATH.
|
|
332
|
+
|
|
333
|
+
```bash
|
|
334
|
+
git --version
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
### "Invalid repository path"
|
|
338
|
+
|
|
339
|
+
Ensure the `repoPath` parameter points to a valid Git repository (contains `.git` directory).
|
|
340
|
+
|
|
341
|
+
### "No changes detected"
|
|
342
|
+
|
|
343
|
+
Make sure you have uncommitted changes in your repository. Use `git status` to check.
|
|
344
|
+
|
|
345
|
+
### "Authentication failed"
|
|
346
|
+
|
|
347
|
+
Verify your API key is correct and has the necessary permissions.
|
|
348
|
+
|
|
349
|
+
### Connection timeout
|
|
350
|
+
|
|
351
|
+
If requests are timing out, increase the timeout:
|
|
352
|
+
|
|
353
|
+
```env
|
|
354
|
+
API_REQUEST_TIMEOUT=60
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
Or set to `-1` for no timeout:
|
|
358
|
+
|
|
359
|
+
```env
|
|
360
|
+
API_REQUEST_TIMEOUT=-1
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
## API Keys
|
|
364
|
+
|
|
365
|
+
### Getting API Keys
|
|
366
|
+
|
|
367
|
+
- **Gemini**: [Google AI Studio](https://makersuite.google.com/app/apikey) (Free tier available)
|
|
368
|
+
- **OpenAI**: [OpenAI API Keys](https://platform.openai.com/api-keys) (Paid)
|
|
369
|
+
- **Codestral**: [Mistral AI Console](https://console.mistral.ai/codestral) (Free tier available)
|
|
370
|
+
- **Ollama**: No API key needed, runs locally
|
|
371
|
+
|
|
372
|
+
## Architecture
|
|
373
|
+
|
|
374
|
+
```
|
|
375
|
+
mcp-server/
|
|
376
|
+
├── src/
|
|
377
|
+
│ ├── index.ts # Entry point
|
|
378
|
+
│ ├── server/
|
|
379
|
+
│ │ ├── mcpServer.ts # MCP server implementation
|
|
380
|
+
│ │ └── tools.ts # MCP tools definitions
|
|
381
|
+
│ ├── services/ # Business logic
|
|
382
|
+
│ │ ├── aiService.ts # Main AI service coordinator
|
|
383
|
+
│ │ ├── geminiService.ts # Gemini provider
|
|
384
|
+
│ │ ├── openaiService.ts # OpenAI provider
|
|
385
|
+
│ │ ├── codestralService.ts # Codestral provider
|
|
386
|
+
│ │ ├── ollamaService.ts # Ollama provider
|
|
387
|
+
│ │ ├── gitService.ts # Git operations
|
|
388
|
+
│ │ ├── gitBlameAnalyzer.ts # Git blame analysis
|
|
389
|
+
│ │ └── promptService.ts # Prompt generation
|
|
390
|
+
│ ├── models/
|
|
391
|
+
│ │ ├── types.ts # TypeScript types
|
|
392
|
+
│ │ └── errors.ts # Custom errors
|
|
393
|
+
│ └── utils/
|
|
394
|
+
│ ├── config.ts # Configuration
|
|
395
|
+
│ ├── logger.ts # Logging
|
|
396
|
+
│ ├── httpUtils.ts # HTTP utilities
|
|
397
|
+
│ ├── retryUtils.ts # Retry logic
|
|
398
|
+
│ └── textProcessing.ts # Text processing
|
|
399
|
+
├── package.json
|
|
400
|
+
├── tsconfig.json
|
|
401
|
+
└── README.md
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
## Security
|
|
405
|
+
|
|
406
|
+
- API keys are never logged or exposed
|
|
407
|
+
- All git operations are read-only
|
|
408
|
+
- No data is sent to external services except the AI providers
|
|
409
|
+
- Local git operations only access the specified repository
|
|
410
|
+
|
|
411
|
+
## License
|
|
412
|
+
|
|
413
|
+
MIT
|
|
414
|
+
|
|
415
|
+
## Support
|
|
416
|
+
|
|
417
|
+
For issues, questions, or contributions, please visit:
|
|
418
|
+
- Main project: [CommitSage GitHub](https://github.com/VizzleTF/CommitSage)
|
|
419
|
+
- Issues: [GitHub Issues](https://github.com/VizzleTF/CommitSage/issues)
|
|
420
|
+
|
|
421
|
+
## Credits
|
|
422
|
+
|
|
423
|
+
Built on top of the [CommitSage VSCode Extension](https://marketplace.visualstudio.com/items?itemName=VizzleTF.commitsage) by VizzleTF.
|
|
424
|
+
|
|
425
|
+
## Changelog
|
|
426
|
+
|
|
427
|
+
### v1.0.0 (2026-02-06)
|
|
428
|
+
|
|
429
|
+
- Initial release
|
|
430
|
+
- Support for Gemini, OpenAI, Codestral, and Ollama providers
|
|
431
|
+
- 8 commit message formats
|
|
432
|
+
- 5 language support
|
|
433
|
+
- Full MCP protocol implementation
|
|
434
|
+
- Compatible with Claude Code, Cursor, and Zed
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSE (Server-Sent Events) Transport for remote MCP access
|
|
3
|
+
* Used for Vercel deployment
|
|
4
|
+
*/
|
|
5
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
6
|
+
export interface SSETransportOptions {
|
|
7
|
+
endpoint: string;
|
|
8
|
+
response: any;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Creates and configures SSE transport for remote MCP server
|
|
12
|
+
*/
|
|
13
|
+
export declare class SSETransportAdapter {
|
|
14
|
+
private transport;
|
|
15
|
+
private server;
|
|
16
|
+
constructor(server: Server, options: SSETransportOptions);
|
|
17
|
+
/**
|
|
18
|
+
* Start the SSE transport connection
|
|
19
|
+
*/
|
|
20
|
+
connect(): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Close the SSE transport connection
|
|
23
|
+
*/
|
|
24
|
+
close(): Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=sse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../src/adapters/sse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAGnE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,GAAG,CAAC;CACf;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB;IAMxD;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAU9B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAS7B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSE (Server-Sent Events) Transport for remote MCP access
|
|
3
|
+
* Used for Vercel deployment
|
|
4
|
+
*/
|
|
5
|
+
import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js';
|
|
6
|
+
import { Logger } from '../utils/logger.js';
|
|
7
|
+
/**
|
|
8
|
+
* Creates and configures SSE transport for remote MCP server
|
|
9
|
+
*/
|
|
10
|
+
export class SSETransportAdapter {
|
|
11
|
+
transport;
|
|
12
|
+
server;
|
|
13
|
+
constructor(server, options) {
|
|
14
|
+
this.server = server;
|
|
15
|
+
this.transport = new SSEServerTransport(options.endpoint, options.response);
|
|
16
|
+
Logger.log(`SSE transport created for endpoint: ${options.endpoint}`);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Start the SSE transport connection
|
|
20
|
+
*/
|
|
21
|
+
async connect() {
|
|
22
|
+
try {
|
|
23
|
+
await this.server.connect(this.transport);
|
|
24
|
+
Logger.log('SSE transport connected successfully');
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
Logger.error('Failed to connect SSE transport:', error);
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Close the SSE transport connection
|
|
33
|
+
*/
|
|
34
|
+
async close() {
|
|
35
|
+
try {
|
|
36
|
+
await this.transport.close();
|
|
37
|
+
Logger.log('SSE transport closed');
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
Logger.error('Error closing SSE transport:', error);
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=sse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../src/adapters/sse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,yCAAyC,CAAC;AAE7E,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAO5C;;GAEG;AACH,MAAM,OAAO,mBAAmB;IACtB,SAAS,CAAqB;IAC9B,MAAM,CAAS;IAEvB,YAAY,MAAc,EAAE,OAA4B;QACtD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,kBAAkB,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC5E,MAAM,CAAC,GAAG,CAAC,uCAAuC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,OAAO;QACX,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC1C,MAAM,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;QACrD,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,kCAAkC,EAAE,KAAK,CAAC,CAAC;YACxD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC;YAC7B,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,KAAK,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAC;YACpD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JWT Token Management for MCP Authentication
|
|
3
|
+
*/
|
|
4
|
+
export interface JWTPayload {
|
|
5
|
+
userId: string;
|
|
6
|
+
email: string;
|
|
7
|
+
name: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
iat: number;
|
|
10
|
+
exp: number;
|
|
11
|
+
}
|
|
12
|
+
export interface TokenPair {
|
|
13
|
+
accessToken: string;
|
|
14
|
+
refreshToken: string;
|
|
15
|
+
expiresIn: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* JWT Service for token generation and validation
|
|
19
|
+
* Note: In production, use a proper JWT library like 'jsonwebtoken'
|
|
20
|
+
* This is a simplified implementation for demonstration
|
|
21
|
+
*/
|
|
22
|
+
export declare class JWTService {
|
|
23
|
+
private secret;
|
|
24
|
+
private accessTokenExpiry;
|
|
25
|
+
private refreshTokenExpiry;
|
|
26
|
+
constructor(secret: string);
|
|
27
|
+
/**
|
|
28
|
+
* Generate access and refresh tokens
|
|
29
|
+
*/
|
|
30
|
+
generateTokenPair(user: {
|
|
31
|
+
id: string;
|
|
32
|
+
email: string;
|
|
33
|
+
name: string;
|
|
34
|
+
provider: string;
|
|
35
|
+
}): TokenPair;
|
|
36
|
+
/**
|
|
37
|
+
* Validate and decode token
|
|
38
|
+
*/
|
|
39
|
+
validateToken(token: string): JWTPayload | null;
|
|
40
|
+
/**
|
|
41
|
+
* Refresh access token using refresh token
|
|
42
|
+
*/
|
|
43
|
+
refreshAccessToken(refreshToken: string): string | null;
|
|
44
|
+
/**
|
|
45
|
+
* Encode payload to JWT token (simplified implementation)
|
|
46
|
+
* In production, use a proper library like 'jsonwebtoken'
|
|
47
|
+
*/
|
|
48
|
+
private encode;
|
|
49
|
+
/**
|
|
50
|
+
* Decode JWT token (simplified implementation)
|
|
51
|
+
*/
|
|
52
|
+
private decode;
|
|
53
|
+
/**
|
|
54
|
+
* Create signature for token
|
|
55
|
+
*/
|
|
56
|
+
private sign;
|
|
57
|
+
/**
|
|
58
|
+
* Base64 URL encode
|
|
59
|
+
*/
|
|
60
|
+
private base64UrlEncode;
|
|
61
|
+
/**
|
|
62
|
+
* Base64 URL decode
|
|
63
|
+
*/
|
|
64
|
+
private base64UrlDecode;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Create JWT service from environment variables
|
|
68
|
+
*/
|
|
69
|
+
export declare function createJWTServiceFromEnv(): JWTService;
|
|
70
|
+
//# sourceMappingURL=jwt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,kBAAkB,CAAkB;gBAEhC,MAAM,EAAE,MAAM;IAO1B;;OAEG;IACH,iBAAiB,CAAC,IAAI,EAAE;QACtB,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB,GAAG,SAAS;IAiCb;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI;IAsB/C;;OAEG;IACH,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAkBvD;;;OAGG;IACH,OAAO,CAAC,MAAM;IAad;;OAEG;IACH,OAAO,CAAC,MAAM;IA0Bd;;OAEG;IACH,OAAO,CAAC,IAAI;IASZ;;OAEG;IACH,OAAO,CAAC,eAAe;IAQvB;;OAEG;IACH,OAAO,CAAC,eAAe;CAUxB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,IAAI,UAAU,CAQpD"}
|