@andrebuzeli/git-mcp 5.5.2 → 5.8.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 +69 -6
- package/dist/index.js +65 -9
- package/dist/resources/toolsGuide.d.ts +12 -0
- package/dist/resources/toolsGuide.js +1491 -0
- package/dist/server.d.ts +2 -1
- package/dist/server.js +33 -0
- package/dist/tools/gitBranches.d.ts +2 -2
- package/dist/tools/gitBranches.js +2 -1
- package/dist/tools/gitFiles.d.ts +6 -0
- package/dist/tools/gitFiles.js +10 -8
- package/dist/tools/gitHistory.d.ts +17 -0
- package/dist/tools/gitHistory.js +365 -0
- package/dist/tools/gitIssues.d.ts +1 -16
- package/dist/tools/gitIssues.js +208 -122
- package/dist/tools/gitPulls.d.ts +1 -69
- package/dist/tools/gitPulls.js +225 -127
- package/dist/tools/gitRelease.d.ts +1 -29
- package/dist/tools/gitRelease.js +277 -55
- package/dist/tools/gitUpdate.d.ts +14 -0
- package/dist/tools/gitUpdate.js +374 -0
- package/dist/tools/gitUpload.d.ts +11 -0
- package/dist/tools/gitUpload.js +342 -0
- package/dist/tools/gitWorkflow.d.ts +1 -64
- package/dist/tools/gitWorkflow.js +224 -50
- package/dist/types.d.ts +7 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
# GIT MCP Server
|
|
2
2
|
|
|
3
|
-
Professional MCP (Model Context Protocol) server for Git operations with multi-provider support, enhanced security,
|
|
3
|
+
Professional MCP (Model Context Protocol) server for Git operations with multi-provider support, enhanced security, comprehensive safety features, and **self-documenting resources**.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- 🚀 **
|
|
8
|
-
-
|
|
7
|
+
- 🚀 **20 Specialized Git Tools** - Complete Git workflow coverage with safety warnings
|
|
8
|
+
- 📚 **NEW: Self-Documenting Resources** - Complete documentation via MCP protocol
|
|
9
|
+
- ⚡ **3 Powerful Tools with Full Traceability**
|
|
10
|
+
- **git-upload** - Upload complete projects to GitHub + Gitea automatically
|
|
11
|
+
- **git-update** - Complete update workflow (add + commit + push) with tracking
|
|
12
|
+
- **git-history** - Detailed history tracking with remote issues
|
|
13
|
+
- 🔄 **Dual Provider Support** - GitHub and Gitea with automatic dual execution
|
|
9
14
|
- 🔒 **Security-First Design** - Read-only file operations, no content modification via API
|
|
10
15
|
- 🚨 **Safety Warnings** - Comprehensive warnings for destructive operations
|
|
11
16
|
- 🛡️ **Enhanced Error Handling** - Detailed diagnostics with actionable solutions
|
|
@@ -13,6 +18,49 @@ Professional MCP (Model Context Protocol) server for Git operations with multi-p
|
|
|
13
18
|
- 🔧 **IDE/Client Compatibility** - Universal aliases for different MCP client expectations
|
|
14
19
|
- 📦 **NPM Distribution** - Easy installation via npx
|
|
15
20
|
- 🤖 **AI Agent Integration** - Designed for AI agent workflows with safety controls
|
|
21
|
+
- 📊 **Full Traceability** - Every operation tracked locally and remotely
|
|
22
|
+
|
|
23
|
+
## Resources System
|
|
24
|
+
|
|
25
|
+
Git-MCP v5.7.0 includes a comprehensive **Resources** system that provides detailed documentation directly through the MCP protocol:
|
|
26
|
+
|
|
27
|
+
### Available Resources
|
|
28
|
+
|
|
29
|
+
#### Tools Guide Resource
|
|
30
|
+
- **URI:** `git-mcp://tools/guide`
|
|
31
|
+
- **Format:** Markdown
|
|
32
|
+
- **Content:** Complete documentation for all 20 tools with 102 actions
|
|
33
|
+
- **Size:** 35,000+ characters
|
|
34
|
+
|
|
35
|
+
### Accessing Documentation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
# List all available resources
|
|
39
|
+
curl http://localhost:3210/resources
|
|
40
|
+
|
|
41
|
+
# Get complete tools guide
|
|
42
|
+
curl "http://localhost:3210/resources/git-mcp://tools/guide"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### What's Included
|
|
46
|
+
|
|
47
|
+
- ✅ Quick start guide
|
|
48
|
+
- ✅ All 20 tools documented with examples
|
|
49
|
+
- ✅ 102 actions with parameters
|
|
50
|
+
- ✅ Provider types explained (LOCAL/DUAL/HYBRID)
|
|
51
|
+
- ✅ Best practices and workflows
|
|
52
|
+
- ✅ Troubleshooting guide
|
|
53
|
+
- ✅ Complete reference tables
|
|
54
|
+
|
|
55
|
+
**See [RESOURCES.md](RESOURCES.md) for detailed documentation on the resources system.**
|
|
56
|
+
|
|
57
|
+
## Provider Architecture
|
|
58
|
+
|
|
59
|
+
This MCP server supports **2 providers** (for remote API operations only):
|
|
60
|
+
- **`github`** - GitHub remote operations (issues, PRs, releases) via @octokit/rest
|
|
61
|
+
- **`gitea`** - Gitea remote operations (issues, PRs, releases) via axios to nas-ubuntu:3000
|
|
62
|
+
|
|
63
|
+
**Important**: Local Git operations (commit, branch, tag, stash, etc) use `simple-git` directly and do **NOT** require a `provider` parameter. The `provider` parameter is only needed for remote API operations (issues, PRs, releases, etc). Gitea as a provider is only for remote API calls, not for local Git operations.
|
|
16
64
|
|
|
17
65
|
## Quick Start
|
|
18
66
|
|
|
@@ -52,7 +100,7 @@ $env:GITEA_USERNAME = 'your_username'
|
|
|
52
100
|
```
|
|
53
101
|
|
|
54
102
|
#### Multi-Provider Support
|
|
55
|
-
|
|
103
|
+
You can configure both GitHub and Gitea simultaneously. Use `provider="github"` or `provider="gitea"` in tool calls to specify which provider to use for remote operations.
|
|
56
104
|
|
|
57
105
|
## Available Tools
|
|
58
106
|
|
|
@@ -176,14 +224,13 @@ All tools provide detailed error messages with actionable solutions:
|
|
|
176
224
|
}
|
|
177
225
|
```
|
|
178
226
|
|
|
179
|
-
### Remote Repository Operations
|
|
227
|
+
### Remote Repository Operations (GitHub Example)
|
|
180
228
|
|
|
181
229
|
```json
|
|
182
230
|
{
|
|
183
231
|
"tool": "git-workflow",
|
|
184
232
|
"params": {
|
|
185
233
|
"action": "create",
|
|
186
|
-
"projectPath": "/path/to/project",
|
|
187
234
|
"provider": "github",
|
|
188
235
|
"name": "my-new-repo",
|
|
189
236
|
"description": "My new repository",
|
|
@@ -192,6 +239,22 @@ All tools provide detailed error messages with actionable solutions:
|
|
|
192
239
|
}
|
|
193
240
|
```
|
|
194
241
|
|
|
242
|
+
### Remote Repository Operations (Gitea Example)
|
|
243
|
+
|
|
244
|
+
```json
|
|
245
|
+
{
|
|
246
|
+
"tool": "git-issues",
|
|
247
|
+
"params": {
|
|
248
|
+
"action": "create",
|
|
249
|
+
"provider": "gitea",
|
|
250
|
+
"owner": "your-username",
|
|
251
|
+
"repo": "your-repo",
|
|
252
|
+
"title": "Bug report",
|
|
253
|
+
"body": "Description of the issue"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
195
258
|
### Safe File Operations (Read-Only)
|
|
196
259
|
|
|
197
260
|
```json
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
const server_1 = require("./server");
|
|
5
8
|
const providerManager_1 = require("./providers/providerManager");
|
|
@@ -21,14 +24,21 @@ const gitArchive_1 = require("./tools/gitArchive");
|
|
|
21
24
|
const gitSync_1 = require("./tools/gitSync");
|
|
22
25
|
const gitPackages_1 = require("./tools/gitPackages");
|
|
23
26
|
const gitAnalytics_1 = require("./tools/gitAnalytics");
|
|
27
|
+
const gitUpload_1 = require("./tools/gitUpload");
|
|
28
|
+
const gitUpdate_1 = require("./tools/gitUpdate");
|
|
29
|
+
const gitHistory_1 = require("./tools/gitHistory");
|
|
30
|
+
const toolsGuide_1 = __importDefault(require("./resources/toolsGuide"));
|
|
24
31
|
async function main() {
|
|
25
32
|
// Load optional mcp.json configuration (will populate process.env if values present)
|
|
26
33
|
(0, config_1.loadMCPConfig)();
|
|
27
34
|
const providerManager = new providerManager_1.ProviderManager();
|
|
28
35
|
// Register providers (validation happens inside manager)
|
|
29
36
|
const validation = await providerManager.validateConfiguredProviders();
|
|
30
|
-
|
|
31
|
-
|
|
37
|
+
// Only log validation in debug mode (prevents JSON parsing errors in MCP clients)
|
|
38
|
+
if (process.env.DEBUG) {
|
|
39
|
+
console.error('Provider validation:', JSON.stringify(validation, null, 2));
|
|
40
|
+
}
|
|
41
|
+
// Register all 20 Git tools
|
|
32
42
|
const tools = [
|
|
33
43
|
new gitWorkflow_1.GitWorkflowTool(),
|
|
34
44
|
new gitFiles_1.GitFilesTool(),
|
|
@@ -47,14 +57,60 @@ async function main() {
|
|
|
47
57
|
new gitSync_1.GitSyncTool(),
|
|
48
58
|
new gitPackages_1.GitPackagesTool(),
|
|
49
59
|
new gitAnalytics_1.GitAnalyticsTool(),
|
|
60
|
+
new gitUpload_1.GitUploadTool(),
|
|
61
|
+
new gitUpdate_1.GitUpdateTool(),
|
|
62
|
+
new gitHistory_1.GitHistoryTool(),
|
|
50
63
|
];
|
|
51
|
-
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
64
|
+
// Register resources
|
|
65
|
+
const resources = [
|
|
66
|
+
toolsGuide_1.default
|
|
67
|
+
];
|
|
68
|
+
// Silent mode for MCP clients - only log to stderr in debug mode
|
|
69
|
+
if (process.env.DEBUG) {
|
|
70
|
+
console.error(`Registered ${tools.length} Git tools`);
|
|
71
|
+
console.error(`Registered ${resources.length} resource(s)`);
|
|
72
|
+
}
|
|
73
|
+
const app = (0, server_1.createServer)({ tools, providerManager, resources });
|
|
74
|
+
// Try default port, then find available port if occupied
|
|
75
|
+
let port = parseInt(process.env.PORT || '3210');
|
|
76
|
+
const startServer = (attemptPort) => {
|
|
77
|
+
return new Promise((resolve, reject) => {
|
|
78
|
+
const server = app.listen(attemptPort, () => {
|
|
79
|
+
// Send success message to stderr (MCP clients expect JSON on stdout)
|
|
80
|
+
if (process.env.DEBUG) {
|
|
81
|
+
console.error(`✅ git-mcp server ready on http://localhost:${attemptPort}`);
|
|
82
|
+
console.error(`Tools: ${tools.map(t => t.name).join(', ')}`);
|
|
83
|
+
console.error(`Resources: ${resources.map(r => r.uri).join(', ')}`);
|
|
84
|
+
}
|
|
85
|
+
resolve(server);
|
|
86
|
+
});
|
|
87
|
+
server.on('error', (err) => {
|
|
88
|
+
if (err.code === 'EADDRINUSE') {
|
|
89
|
+
// Port in use, try next port
|
|
90
|
+
server.close();
|
|
91
|
+
resolve(null);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
reject(err);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
// Try to start server on available port
|
|
100
|
+
let server = null;
|
|
101
|
+
const maxAttempts = 10;
|
|
102
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
103
|
+
const tryPort = port + attempt;
|
|
104
|
+
server = await startServer(tryPort);
|
|
105
|
+
if (server) {
|
|
106
|
+
port = tryPort;
|
|
107
|
+
break;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (!server) {
|
|
111
|
+
console.error(`❌ Failed to find available port after ${maxAttempts} attempts`);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
58
114
|
server.on('error', (err) => {
|
|
59
115
|
console.error('❌ Server error:', err);
|
|
60
116
|
process.exit(1);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git-MCP Tools Guide Resource
|
|
3
|
+
* Comprehensive documentation for all 20 Git tools available in the MCP server
|
|
4
|
+
*/
|
|
5
|
+
export declare const TOOLS_GUIDE: {
|
|
6
|
+
uri: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
content: string;
|
|
11
|
+
};
|
|
12
|
+
export default TOOLS_GUIDE;
|