@andrebuzeli/git-mcp 6.3.0 → 6.3.2
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/dist/index.js +1 -1
- package/dist/resources/toolsGuide.js +185 -11
- package/dist/tools/gitFix.js +34 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -77,7 +77,7 @@ async function main() {
|
|
|
77
77
|
// Create MCP Server with STDIO transport
|
|
78
78
|
const server = new index_js_1.Server({
|
|
79
79
|
name: '@andrebuzeli/git-mcp',
|
|
80
|
-
version: '6.3.
|
|
80
|
+
version: '6.3.2',
|
|
81
81
|
});
|
|
82
82
|
// Register tool list handler
|
|
83
83
|
server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => {
|
|
@@ -10,10 +10,48 @@ exports.TOOLS_GUIDE = {
|
|
|
10
10
|
name: "Git-MCP Tools Complete Guide",
|
|
11
11
|
description: "Detailed documentation and usage instructions for all 20 Git tools with 102 actions",
|
|
12
12
|
mimeType: "text/markdown",
|
|
13
|
-
content: `# 🛠️ Git-MCP
|
|
13
|
+
content: `# 🛠️ Git-MCP v6.3.1 - Complete Tools Guide
|
|
14
14
|
|
|
15
|
-
> **Comprehensive documentation for all
|
|
15
|
+
> **Comprehensive documentation for all 21 Git tools with 110+ actions**
|
|
16
16
|
> **Supports:** GitHub, Gitea, and Local Git operations
|
|
17
|
+
> **NEW in v6.3.1:** git-fix tool for dual-provider migration
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## ⚠️ CRITICAL: projectPath Requirements
|
|
22
|
+
|
|
23
|
+
**ALL TOOLS REQUIRE projectPath PARAMETER**
|
|
24
|
+
|
|
25
|
+
### ✅ Correct Usage:
|
|
26
|
+
\\\`\\\`\\\`javascript
|
|
27
|
+
{
|
|
28
|
+
"projectPath": "Z:/absolute/path/to/project-root"
|
|
29
|
+
// Must be the ROOT folder of the opened project
|
|
30
|
+
// NOT a subfolder, NOT a file, NOT a parent folder
|
|
31
|
+
}
|
|
32
|
+
\\\`\\\`\\\`
|
|
33
|
+
|
|
34
|
+
### ❌ WRONG Usage:
|
|
35
|
+
\\\`\\\`\\\`javascript
|
|
36
|
+
// ❌ Relative path
|
|
37
|
+
"projectPath": "./my-project"
|
|
38
|
+
|
|
39
|
+
// ❌ Subfolder instead of root
|
|
40
|
+
"projectPath": "/project-root/src"
|
|
41
|
+
|
|
42
|
+
// ❌ Parent folder
|
|
43
|
+
"projectPath": "/path/to/workspace"
|
|
44
|
+
|
|
45
|
+
// ❌ File path
|
|
46
|
+
"projectPath": "/project/package.json"
|
|
47
|
+
\\\`\\\`\\\`
|
|
48
|
+
|
|
49
|
+
### 📋 Rule:
|
|
50
|
+
**projectPath MUST be:**
|
|
51
|
+
- ✅ Absolute path (starts with / or drive letter)
|
|
52
|
+
- ✅ Points to the ROOT folder of the opened project
|
|
53
|
+
- ✅ The same folder you opened in your IDE
|
|
54
|
+
- ✅ Contains .git folder (for Git operations)
|
|
17
55
|
|
|
18
56
|
---
|
|
19
57
|
|
|
@@ -22,13 +60,14 @@ exports.TOOLS_GUIDE = {
|
|
|
22
60
|
1. [Quick Start](#quick-start)
|
|
23
61
|
2. [Provider Types](#provider-types)
|
|
24
62
|
3. [Core Workflow Tools](#core-workflow-tools)
|
|
25
|
-
4. [
|
|
26
|
-
5. [
|
|
27
|
-
6. [
|
|
28
|
-
7. [
|
|
29
|
-
8. [
|
|
30
|
-
9. [
|
|
31
|
-
10. [
|
|
63
|
+
4. [Migration Tools (NEW)](#migration-tools)
|
|
64
|
+
5. [Remote Management Tools](#remote-management-tools)
|
|
65
|
+
6. [Issue & Pull Request Tools](#issue--pull-request-tools)
|
|
66
|
+
7. [Release & Package Tools](#release--package-tools)
|
|
67
|
+
8. [Branch & Tag Tools](#branch--tag-tools)
|
|
68
|
+
9. [Configuration & Monitoring Tools](#configuration--monitoring-tools)
|
|
69
|
+
10. [Advanced Tools](#advanced-tools)
|
|
70
|
+
11. [Best Practices](#best-practices)
|
|
32
71
|
|
|
33
72
|
---
|
|
34
73
|
|
|
@@ -91,6 +130,8 @@ npm install @andrebuzeli/git-mcp
|
|
|
91
130
|
|
|
92
131
|
**Type:** HYBRID - Local operations + Remote operations (GitHub/Gitea)
|
|
93
132
|
|
|
133
|
+
**projectPath:** ⚠️ REQUIRED - Absolute path to project ROOT folder (where you opened the project in IDE)
|
|
134
|
+
|
|
94
135
|
**Actions:**
|
|
95
136
|
- \`init\` - Initialize new repository
|
|
96
137
|
- \`status\` - Check repository status
|
|
@@ -289,6 +330,138 @@ npm install @andrebuzeli/git-mcp
|
|
|
289
330
|
|
|
290
331
|
---
|
|
291
332
|
|
|
333
|
+
## 🔧 Migration Tools (NEW in v6.3.1)
|
|
334
|
+
|
|
335
|
+
### 21. **git-fix** (LOCAL)
|
|
336
|
+
**Description:** Fix local Git repositories to work with dual-provider system (GitHub + Gitea)
|
|
337
|
+
|
|
338
|
+
**Type:** LOCAL - Converts existing repos to dual-provider configuration
|
|
339
|
+
|
|
340
|
+
**projectPath:** ⚠️ REQUIRED - Absolute path to project ROOT folder that needs fixing
|
|
341
|
+
|
|
342
|
+
**Features:**
|
|
343
|
+
- 🔍 **Auto-detection:** Automatically detects repository name from existing remotes
|
|
344
|
+
- ✅ **Username correction:** Uses correct usernames from GITHUB_USERNAME and GITEA_USERNAME env vars
|
|
345
|
+
- 🗑️ **Clean setup:** Removes old remotes and creates standardized configuration
|
|
346
|
+
- 🔄 **Dual-push:** Configures origin to push to both GitHub and Gitea simultaneously
|
|
347
|
+
- 📝 **Preserves history:** Keeps all commits and Git history intact
|
|
348
|
+
- ⚙️ **.gitignore creation:** Creates standard .gitignore if missing
|
|
349
|
+
|
|
350
|
+
**Parameters:**
|
|
351
|
+
- \\\`projectPath\\\` (required) - Absolute path to Git repository ROOT folder
|
|
352
|
+
- \\\`autoDetect\\\` (optional) - Auto-detect repo name from remotes (default: true)
|
|
353
|
+
- \\\`githubRepo\\\` (optional) - GitHub repo in format "owner/repo" (auto-detected if not provided)
|
|
354
|
+
- \\\`giteaRepo\\\` (optional) - Gitea repo in format "owner/repo" (auto-detected if not provided)
|
|
355
|
+
|
|
356
|
+
**Requirements:**
|
|
357
|
+
- \\\`GITHUB_USERNAME\\\` env var (REQUIRED)
|
|
358
|
+
- \\\`GITEA_USERNAME\\\` env var (REQUIRED)
|
|
359
|
+
- \\\`GITEA_URL\\\` env var (default: http://localhost:3000)
|
|
360
|
+
|
|
361
|
+
**When to use:**
|
|
362
|
+
- ✅ Existing Git repo NOT configured for dual-provider
|
|
363
|
+
- ✅ Migrating from single remote (GitHub OR Gitea) to dual-push
|
|
364
|
+
- ✅ Fixing incorrect username configuration
|
|
365
|
+
- ✅ Standardizing repository configuration across projects
|
|
366
|
+
|
|
367
|
+
**What it does:**
|
|
368
|
+
1. ✅ Verifies/initializes Git repository
|
|
369
|
+
2. 🔍 Captures current remotes (before state)
|
|
370
|
+
3. 🔍 Auto-detects repository name from existing URLs
|
|
371
|
+
4. 🗑️ Removes old remotes (origin, github, gitea)
|
|
372
|
+
5. ➕ Adds new 'github' remote with correct username
|
|
373
|
+
6. ➕ Adds new 'gitea' remote with correct username
|
|
374
|
+
7. ⚙️ Configures 'origin' for dual-push (GitHub + Gitea)
|
|
375
|
+
8. 📝 Creates .gitignore if missing
|
|
376
|
+
9. 📊 Shows before/after comparison
|
|
377
|
+
|
|
378
|
+
**Examples:**
|
|
379
|
+
|
|
380
|
+
\\\`\\\`\\\`javascript
|
|
381
|
+
// 1. Auto-detect and fix repository
|
|
382
|
+
{
|
|
383
|
+
"tool": "git-fix",
|
|
384
|
+
"params": {
|
|
385
|
+
"projectPath": "Z:/my-old-project",
|
|
386
|
+
"autoDetect": true
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
// Before:
|
|
391
|
+
// origin → https://github.com/olduser/old-project.git
|
|
392
|
+
|
|
393
|
+
// After:
|
|
394
|
+
// github → https://github.com/Your-GitHub-Username/old-project.git
|
|
395
|
+
// gitea → http://nas-ubuntu:9999/your-gitea-username/old-project.git
|
|
396
|
+
// origin → dual-push to both
|
|
397
|
+
|
|
398
|
+
// 2. Manual repo specification
|
|
399
|
+
{
|
|
400
|
+
"tool": "git-fix",
|
|
401
|
+
"params": {
|
|
402
|
+
"projectPath": "Z:/my-project",
|
|
403
|
+
"githubRepo": "Andre-Buzeli/my-project",
|
|
404
|
+
"giteaRepo": "andrebuzeli/my-project",
|
|
405
|
+
"autoDetect": false
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// 3. Fix multiple projects (use sequentially)
|
|
410
|
+
// Project 1
|
|
411
|
+
{
|
|
412
|
+
"tool": "git-fix",
|
|
413
|
+
"params": {
|
|
414
|
+
"projectPath": "Z:/project-1",
|
|
415
|
+
"autoDetect": true
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Project 2
|
|
420
|
+
{
|
|
421
|
+
"tool": "git-fix",
|
|
422
|
+
"params": {
|
|
423
|
+
"projectPath": "Z:/project-2",
|
|
424
|
+
"autoDetect": true
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
\\\`\\\`\\\`
|
|
428
|
+
|
|
429
|
+
**Result Structure:**
|
|
430
|
+
\\\`\\\`\\\`json
|
|
431
|
+
{
|
|
432
|
+
"success": true,
|
|
433
|
+
"projectPath": "Z:/my-project",
|
|
434
|
+
"fixed": [
|
|
435
|
+
"✅ Repositório Git válido encontrado",
|
|
436
|
+
"🔍 Nome do repo auto-detectado: my-project",
|
|
437
|
+
"✅ GitHub repo: Andre-Buzeli/my-project",
|
|
438
|
+
"✅ Gitea repo: andrebuzeli/my-project",
|
|
439
|
+
"🗑️ Removido remote antigo: origin",
|
|
440
|
+
"✅ Adicionado remote GitHub: https://github.com/Andre-Buzeli/my-project.git",
|
|
441
|
+
"✅ Adicionado remote Gitea: http://nas-ubuntu:9999/andrebuzeli/my-project.git",
|
|
442
|
+
"✅ Configurado origin para push dual (GitHub + Gitea)",
|
|
443
|
+
"✅ Histórico de commits preservado",
|
|
444
|
+
"✅ Criado .gitignore padrão"
|
|
445
|
+
],
|
|
446
|
+
"warnings": [],
|
|
447
|
+
"errors": [],
|
|
448
|
+
"remotes": {
|
|
449
|
+
"before": [...],
|
|
450
|
+
"after": [...]
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
\\\`\\\`\\\`
|
|
454
|
+
|
|
455
|
+
**⚠️ Important Notes:**
|
|
456
|
+
- Always backup your repository before running git-fix
|
|
457
|
+
- Requires valid GITHUB_USERNAME and GITEA_USERNAME env vars
|
|
458
|
+
- Repository name detection works with github.com and Gitea URLs
|
|
459
|
+
- Falls back to folder name if no remote detected
|
|
460
|
+
- Does NOT push to remotes (only configures them)
|
|
461
|
+
- Safe to run multiple times (idempotent)
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
292
465
|
## 🌐 Remote Management Tools
|
|
293
466
|
|
|
294
467
|
### 5. **git-remote** (LOCAL)
|
|
@@ -1411,8 +1584,9 @@ for (const repo of repos) {
|
|
|
1411
1584
|
| git-backup | LOCAL | 4 | Backup operations |
|
|
1412
1585
|
| git-archive | LOCAL | 4 | Archive creation |
|
|
1413
1586
|
| git-files | LOCAL | 4 | File operations |
|
|
1587
|
+
| **git-fix** | **LOCAL** | **1** | **Migrate repos to dual-provider (NEW v6.3.1)** |
|
|
1414
1588
|
|
|
1415
|
-
**Total:
|
|
1589
|
+
**Total: 21 tools, 110+ actions**
|
|
1416
1590
|
|
|
1417
1591
|
---
|
|
1418
1592
|
|
|
@@ -1485,7 +1659,7 @@ for (const repo of repos) {
|
|
|
1485
1659
|
|
|
1486
1660
|
---
|
|
1487
1661
|
|
|
1488
|
-
**Git-MCP
|
|
1662
|
+
**Git-MCP v6.3.1** | Built with ❤️ for developers | 110+ Actions | 21 Tools | 3 Provider Types | NEW: git-fix migration tool
|
|
1489
1663
|
`
|
|
1490
1664
|
};
|
|
1491
1665
|
exports.default = exports.TOOLS_GUIDE;
|
package/dist/tools/gitFix.js
CHANGED
|
@@ -51,41 +51,56 @@ async function handleGitFix(args) {
|
|
|
51
51
|
// Capturar remotes antes
|
|
52
52
|
const remotesBefore = await git.getRemotes(true);
|
|
53
53
|
result.remotes.before = remotesBefore.map(r => ({ name: r.name, url: r.refs.fetch || '' }));
|
|
54
|
+
// Obter usernames das env vars (OBRIGATÓRIO usar as credenciais fornecidas)
|
|
55
|
+
const githubUsername = process.env.GITHUB_USERNAME;
|
|
56
|
+
const giteaUsername = process.env.GITEA_USERNAME;
|
|
57
|
+
if (!githubUsername || !giteaUsername) {
|
|
58
|
+
throw new Error('GITHUB_USERNAME e GITEA_USERNAME são obrigatórios nas env vars');
|
|
59
|
+
}
|
|
54
60
|
// Auto-detectar repos se solicitado
|
|
55
61
|
let finalGithubRepo = githubRepo;
|
|
56
62
|
let finalGiteaRepo = giteaRepo;
|
|
63
|
+
let detectedRepoName = null;
|
|
57
64
|
if (autoDetect && remotesBefore.length > 0) {
|
|
58
65
|
for (const remote of remotesBefore) {
|
|
59
66
|
const url = remote.refs.fetch || '';
|
|
60
|
-
|
|
61
|
-
|
|
67
|
+
// Detectar APENAS o nome do repo (sem username)
|
|
68
|
+
if (url.includes('github.com') && !detectedRepoName) {
|
|
69
|
+
const match = url.match(/github\.com[:/][^/]+\/([^/.]+)/);
|
|
62
70
|
if (match) {
|
|
63
|
-
|
|
64
|
-
result.fixed.push(`🔍
|
|
71
|
+
detectedRepoName = match[1];
|
|
72
|
+
result.fixed.push(`🔍 Nome do repo auto-detectado: ${detectedRepoName}`);
|
|
65
73
|
}
|
|
66
74
|
}
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
// Detectar de Gitea
|
|
76
|
+
if ((url.includes('nas-ubuntu') || url.includes('gitea')) && !detectedRepoName) {
|
|
77
|
+
const match = url.match(/\/[^/]+\/([^/.]+)(?:\.git)?$/);
|
|
69
78
|
if (match) {
|
|
70
|
-
|
|
71
|
-
result.fixed.push(`🔍
|
|
79
|
+
detectedRepoName = match[1];
|
|
80
|
+
result.fixed.push(`🔍 Nome do repo auto-detectado: ${detectedRepoName}`);
|
|
72
81
|
}
|
|
73
82
|
}
|
|
74
83
|
}
|
|
75
84
|
}
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
finalGithubRepo = `${githubUsername}/${folderName}`;
|
|
83
|
-
result.warnings.push(`⚠️ GitHub repo não detectado - usando: ${finalGithubRepo}`);
|
|
85
|
+
// Construir repos usando os usernames CORRETOS das env vars
|
|
86
|
+
if (detectedRepoName) {
|
|
87
|
+
finalGithubRepo = finalGithubRepo || `${githubUsername}/${detectedRepoName}`;
|
|
88
|
+
finalGiteaRepo = finalGiteaRepo || `${giteaUsername}/${detectedRepoName}`;
|
|
89
|
+
result.fixed.push(`✅ GitHub repo: ${finalGithubRepo}`);
|
|
90
|
+
result.fixed.push(`✅ Gitea repo: ${finalGiteaRepo}`);
|
|
84
91
|
}
|
|
85
|
-
|
|
92
|
+
// Se não detectou repos, usar o nome da pasta
|
|
93
|
+
if (!finalGithubRepo || !finalGiteaRepo) {
|
|
86
94
|
const folderName = path_1.default.basename(absolutePath);
|
|
87
|
-
|
|
88
|
-
|
|
95
|
+
if (!finalGithubRepo) {
|
|
96
|
+
finalGithubRepo = `${githubUsername}/${folderName}`;
|
|
97
|
+
}
|
|
98
|
+
if (!finalGiteaRepo) {
|
|
99
|
+
finalGiteaRepo = `${giteaUsername}/${folderName}`;
|
|
100
|
+
}
|
|
101
|
+
result.warnings.push(`⚠️ Repo não detectado - usando nome da pasta: ${folderName}`);
|
|
102
|
+
result.fixed.push(`✅ GitHub repo: ${finalGithubRepo}`);
|
|
103
|
+
result.fixed.push(`✅ Gitea repo: ${finalGiteaRepo}`);
|
|
89
104
|
}
|
|
90
105
|
// Remover remotes antigos
|
|
91
106
|
const remotesToRemove = ['origin', 'github', 'gitea'];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@andrebuzeli/git-mcp",
|
|
3
|
-
"version": "6.3.
|
|
3
|
+
"version": "6.3.2",
|
|
4
4
|
"description": "Professional MCP server for Git operations - STDIO UNIVERSAL: works in ANY IDE (Cursor, VSCode, Claude Desktop). Fully autonomous with intelligent error handling. Auto-detects branches, owner, repo. User-friendly error messages. Dual-provider execution (GitHub + Gitea)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|