@andre.buzeli/git-mcp 16.1.2 → 16.1.3
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/package.json +1 -1
- package/src/index.js +53 -7
- package/src/resources/index.js +3 -3
- package/src/tools/git-diff.js +1 -0
- package/src/tools/git-history.js +2 -0
- package/src/tools/git-stash.js +1 -0
- package/src/tools/git-workflow.js +7 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -49,13 +49,59 @@ if (!hasGitHub && !hasGitea) {
|
|
|
49
49
|
|
|
50
50
|
const transport = new StdioServerTransport();
|
|
51
51
|
const server = new Server(
|
|
52
|
-
{ name: "git-mcp", version: "16.
|
|
53
|
-
{
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
{ name: "git-mcp", version: "16.1.3" },
|
|
53
|
+
{
|
|
54
|
+
capabilities: {
|
|
55
|
+
tools: { listChanged: true },
|
|
56
|
+
resources: { subscribe: true, listChanged: true },
|
|
57
|
+
prompts: {},
|
|
58
|
+
logging: {}
|
|
59
|
+
},
|
|
60
|
+
instructions: `# git-mcp — Instruções para AI Agents
|
|
61
|
+
|
|
62
|
+
## REGRA #1: projectPath é OBRIGATÓRIO
|
|
63
|
+
Toda tool (exceto git-help) exige "projectPath" com o caminho absoluto do projeto aberto no IDE.
|
|
64
|
+
O servidor NÃO consegue detectar o projeto automaticamente.
|
|
65
|
+
Exemplo: "projectPath": "C:/Users/user/meu-projeto" ou "/home/user/meu-projeto"
|
|
66
|
+
|
|
67
|
+
## REGRA #2: action é OBRIGATÓRIO
|
|
68
|
+
Toda tool usa o padrão { "projectPath": "...", "action": "nome-da-action", ...params }.
|
|
69
|
+
Consulte o enum de cada tool para saber as actions disponíveis.
|
|
70
|
+
|
|
71
|
+
## Guia Rápido de Tools
|
|
72
|
+
|
|
73
|
+
| Necessidade | Tool | Action | Params obrigatórios |
|
|
74
|
+
|-------------|------|--------|---------------------|
|
|
75
|
+
| Atualizar projeto completo | git-workflow | update | message |
|
|
76
|
+
| Ver status do repo | git-workflow | status | - |
|
|
77
|
+
| Inicializar repo novo | git-workflow | init | - |
|
|
78
|
+
| Ver diferenças locais | git-diff | show | - |
|
|
79
|
+
| Comparar branches/commits | git-diff | compare | target |
|
|
80
|
+
| Criar branch | git-branches | create | branch |
|
|
81
|
+
| Trocar branch | git-branches | checkout | branch |
|
|
82
|
+
| Listar branches | git-branches | list | - |
|
|
83
|
+
| Merge de branch | git-merge | merge | sourceBranch |
|
|
84
|
+
| Criar tag | git-tags | create | tag |
|
|
85
|
+
| Clonar repo | git-clone | clone | url |
|
|
86
|
+
| Criar issue | git-issues | create | title |
|
|
87
|
+
| Criar PR | git-pulls | create | head, title |
|
|
88
|
+
| Salvar stash | git-stash | save | - |
|
|
89
|
+
| Reset commits | git-reset | soft/mixed/hard | - |
|
|
90
|
+
| Configurar git | git-config | get/set | key |
|
|
91
|
+
| Gerenciar .gitignore | git-ignore | add/list | patterns |
|
|
92
|
+
| Ler arquivo do git | git-files | read | filepath |
|
|
93
|
+
| Ver histórico | git-history | log | - |
|
|
94
|
+
| Fetch/Pull remoto | git-sync | fetch/pull | - |
|
|
95
|
+
| Gerenciar remotes | git-remote | list/ensure | - |
|
|
96
|
+
|
|
97
|
+
## Exemplo Completo (ação mais comum)
|
|
98
|
+
\`\`\`json
|
|
99
|
+
{ "projectPath": "/caminho/do/projeto", "action": "update", "message": "feat: descrição das mudanças" }
|
|
100
|
+
\`\`\`
|
|
101
|
+
|
|
102
|
+
## Dica
|
|
103
|
+
Use git-help action="listTools" para ver todas as tools e actions disponíveis em tempo real.`
|
|
104
|
+
}
|
|
59
105
|
);
|
|
60
106
|
server.connect(transport);
|
|
61
107
|
|
package/src/resources/index.js
CHANGED
|
@@ -69,9 +69,9 @@ Visualizar diferenças.
|
|
|
69
69
|
|
|
70
70
|
| Action | Descrição | Parâmetros |
|
|
71
71
|
|--------|-----------|------------|
|
|
72
|
-
| show | Ver mudanças locais |
|
|
73
|
-
| compare | Comparar commits |
|
|
74
|
-
| stat | Estatísticas |
|
|
72
|
+
| show | Ver mudanças locais (working vs HEAD) | staged=true (opcional, para staged vs HEAD) |
|
|
73
|
+
| compare | Comparar branches/commits | target="main" (obrigatório), source="HEAD" (opcional) |
|
|
74
|
+
| stat | Estatísticas resumidas | target="HEAD~1" (opcional), source (opcional) |
|
|
75
75
|
|
|
76
76
|
---
|
|
77
77
|
|
package/src/tools/git-diff.js
CHANGED
package/src/tools/git-history.js
CHANGED
|
@@ -19,10 +19,12 @@ export function createGitHistoryTool(git) {
|
|
|
19
19
|
},
|
|
20
20
|
ref: {
|
|
21
21
|
type: "string",
|
|
22
|
+
default: "HEAD",
|
|
22
23
|
description: "Referência inicial para o log (branch, tag, SHA). Default: HEAD"
|
|
23
24
|
},
|
|
24
25
|
maxCount: {
|
|
25
26
|
type: "number",
|
|
27
|
+
default: 50,
|
|
26
28
|
description: "Número máximo de commits a retornar. Default: 50"
|
|
27
29
|
}
|
|
28
30
|
},
|
package/src/tools/git-stash.js
CHANGED
|
@@ -40,7 +40,8 @@ export function createGitWorkflowTool(pm, git, server) {
|
|
|
40
40
|
files: {
|
|
41
41
|
type: "array",
|
|
42
42
|
items: { type: "string" },
|
|
43
|
-
|
|
43
|
+
default: ["."],
|
|
44
|
+
description: "Lista de arquivos para add/remove. Default: ['.'] (todos). Ex: ['src/index.js', 'package.json']"
|
|
44
45
|
},
|
|
45
46
|
message: {
|
|
46
47
|
type: "string",
|
|
@@ -61,22 +62,27 @@ export function createGitWorkflowTool(pm, git, server) {
|
|
|
61
62
|
},
|
|
62
63
|
force: {
|
|
63
64
|
type: "boolean",
|
|
65
|
+
default: false,
|
|
64
66
|
description: "Force push (use apenas se push normal falhar com erro de histórico divergente). Default: false"
|
|
65
67
|
},
|
|
66
68
|
createGitignore: {
|
|
67
69
|
type: "boolean",
|
|
70
|
+
default: true,
|
|
68
71
|
description: "Se true, cria .gitignore padrão baseado no tipo de projeto (action='init'). Default: true"
|
|
69
72
|
},
|
|
70
73
|
isPublic: {
|
|
71
74
|
type: "boolean",
|
|
75
|
+
default: false,
|
|
72
76
|
description: "Se true, repositório será PÚBLICO. Default: false (privado). Aplica-se a action='init' e 'ensure-remotes'"
|
|
73
77
|
},
|
|
74
78
|
dryRun: {
|
|
75
79
|
type: "boolean",
|
|
80
|
+
default: false,
|
|
76
81
|
description: "Se true, simula a operação sem executar (útil para testes). Default: false"
|
|
77
82
|
},
|
|
78
83
|
skipIfClean: {
|
|
79
84
|
type: "boolean",
|
|
85
|
+
default: false,
|
|
80
86
|
description: "Para action='update': se true, pula silenciosamente se não houver mudanças. Default: false"
|
|
81
87
|
},
|
|
82
88
|
gitignore: {
|