@selfagency/git-mcp 0.1.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 ADDED
@@ -0,0 +1,228 @@
1
+ # git-mcp
2
+
3
+ > A Git [MCP](https://modelcontextprotocol.io) server that doesn't suck
4
+
5
+ Exposes the full Git workflow to any MCP-compatible AI client — inspect, write, branch, remote, stash, rebase, LFS, git-flow, documentation lookup, and more. Designed to be safe by default, composable, and fast. Powered by [`simple-git`](https://github.com/steveukx/git-js).
6
+
7
+ ---
8
+
9
+ ## Features
10
+
11
+ - **30+ tools** covering everyday Git workflows and advanced recovery operations
12
+ - **Safety-first** — destructive operations require explicit confirmation; force push and hook bypass are opt-in via server config
13
+ - **GPG/SSH signing** for commits and tags, with server-level auto-sign support
14
+ - **Git LFS** — track patterns, manage objects, install hooks, migrate history
15
+ - **Git Flow** — full branching model (feature/release/hotfix/support) without requiring the `git-flow` CLI
16
+ - **Documentation lookup** — search git-scm.com and fetch man pages directly from the LLM
17
+ - **MCP Resources** — URI-addressable read-only views of status, log, branches, and diff
18
+ - **Multi-repo** — pass `repo_path` per-call or configure a server-level default
19
+ - **Cross-platform** — macOS, Linux, Windows (Git for Windows)
20
+
21
+ ---
22
+
23
+ ## Quick Start
24
+
25
+ ### npx (no install)
26
+
27
+ ```bash
28
+ npx @selfagency/git-mcp --repo-path /path/to/your/repo
29
+ ```
30
+
31
+ ### Install globally
32
+
33
+ ```bash
34
+ npm install -g @selfagency/git-mcp
35
+ git-mcp --repo-path /path/to/your/repo
36
+ ```
37
+
38
+ ### Claude Desktop
39
+
40
+ Add to `~/Library/Application Support/Claude/claude_desktop_config.json`:
41
+
42
+ ```json
43
+ {
44
+ "mcpServers": {
45
+ "git": {
46
+ "command": "npx",
47
+ "args": ["-y", "@selfagency/git-mcp", "--repo-path", "/path/to/your/repo"]
48
+ }
49
+ }
50
+ }
51
+ ```
52
+
53
+ ### VS Code (Copilot)
54
+
55
+ Add to `.vscode/mcp.json` in your project:
56
+
57
+ ```json
58
+ {
59
+ "servers": {
60
+ "git": {
61
+ "command": "npx",
62
+ "args": ["-y", "@selfagency/git-mcp", "--repo-path", "${workspaceFolder}"]
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ ---
69
+
70
+ ## Configuration
71
+
72
+ All configuration is via environment variables. Pass them in your MCP client config:
73
+
74
+ | Variable | Default | Description |
75
+ | ----------------------- | ------- | ----------------------------------------------------- |
76
+ | `GIT_REPO_PATH` | — | Default repository path (also: `--repo-path` CLI arg) |
77
+ | `GIT_ALLOW_NO_VERIFY` | `false` | Allow `--no-verify` on commit/push (bypasses hooks) |
78
+ | `GIT_ALLOW_FORCE_PUSH` | `false` | Allow `--force` on push |
79
+ | `GIT_AUTO_SIGN_COMMITS` | `false` | Automatically sign every commit |
80
+ | `GIT_AUTO_SIGN_TAGS` | `false` | Automatically sign every tag |
81
+ | `GIT_SIGNING_KEY` | — | Default GPG key ID or SSH key path |
82
+ | `GIT_SIGNING_FORMAT` | — | Signing format: `openpgp`, `ssh`, or `x509` |
83
+
84
+ ---
85
+
86
+ ## Tool Reference
87
+
88
+ ### Inspect (read-only)
89
+
90
+ | Tool | Description |
91
+ | ------------ | ------------------------------------------ |
92
+ | `git_status` | Working tree and branch status |
93
+ | `git_log` | Commit history with filters and pagination |
94
+ | `git_show` | Patch and metadata for any ref |
95
+ | `git_diff` | Unstaged, staged, or ref-to-ref diff |
96
+ | `git_blame` | Line-level author attribution |
97
+ | `git_reflog` | HEAD movement history for recovery |
98
+
99
+ ### Write
100
+
101
+ | Tool | Description |
102
+ | ------------- | ---------------------------------------- |
103
+ | `git_add` | Stage files |
104
+ | `git_restore` | Restore paths from index or a source ref |
105
+ | `git_commit` | Create commits (amend, sign, no-verify) |
106
+ | `git_reset` | Soft/mixed/hard reset |
107
+ | `git_revert` | Safe undo via revert commit |
108
+
109
+ ### Branches
110
+
111
+ | Tool | Description |
112
+ | ------------------- | -------------------------------- |
113
+ | `git_list_branches` | List local or all branches |
114
+ | `git_create_branch` | Create branch from HEAD or ref |
115
+ | `git_delete_branch` | Delete a local branch |
116
+ | `git_rename_branch` | Rename a branch |
117
+ | `git_checkout` | Switch to branch, tag, or commit |
118
+ | `git_set_upstream` | Set upstream tracking |
119
+
120
+ ### Remote
121
+
122
+ | Tool | Description |
123
+ | ------------ | ----------------------------------------- |
124
+ | `git_remote` | Add, remove, or set-url for a remote |
125
+ | `git_fetch` | Fetch with optional pruning |
126
+ | `git_pull` | Pull with merge or rebase |
127
+ | `git_push` | Push (force-with-lease, force, no-verify) |
128
+
129
+ ### Advanced
130
+
131
+ | Tool | Description |
132
+ | ----------------- | ------------------------------------------- |
133
+ | `git_stash` | Save, list, apply, pop, or drop stashes |
134
+ | `git_rebase` | Start, continue, skip, or abort rebase |
135
+ | `git_cherry_pick` | Start, continue, or abort cherry-pick |
136
+ | `git_bisect` | Binary search to find regressions |
137
+ | `git_tag` | List, create, or delete tags (with signing) |
138
+ | `git_worktree` | Add, list, or remove worktrees |
139
+ | `git_submodule` | Add, list, update, or sync submodules |
140
+
141
+ ### Context & Config
142
+
143
+ | Tool | Description |
144
+ | --------------------- | ------------------------------------------ |
145
+ | `git_context_summary` | High-signal repo summary for LLM workflows |
146
+ | `git_search` | Pickaxe + grep across history |
147
+ | `git_get_config` | Read git config values |
148
+ | `git_set_config` | Write repository-local git config |
149
+
150
+ ### LFS
151
+
152
+ | Tool | Description |
153
+ | --------- | --------------------------------------------------------- |
154
+ | `git_lfs` | Track patterns, pull/push objects, install hooks, migrate |
155
+
156
+ ### Git Flow
157
+
158
+ | Tool | Description |
159
+ | ---------- | ------------------------------------------------- |
160
+ | `git_flow` | Init, feature, release, hotfix, support workflows |
161
+
162
+ ### Documentation
163
+
164
+ | Tool | Description |
165
+ | ---------- | ------------------------------------- |
166
+ | `git_docs` | Search git-scm.com or fetch man pages |
167
+
168
+ ---
169
+
170
+ ## MCP Resources
171
+
172
+ URI-addressable read-only snapshots (subscribe-capable):
173
+
174
+ | Resource URI | Content |
175
+ | --------------------------------- | ----------------------------- |
176
+ | `git+repo://status/{repo_path}` | Working tree status (JSON) |
177
+ | `git+repo://log/{repo_path}` | Recent commit log (JSON) |
178
+ | `git+repo://branches/{repo_path}` | Branch list (JSON) |
179
+ | `git+repo://diff/{repo_path}` | Unstaged + staged diff (JSON) |
180
+
181
+ ---
182
+
183
+ ## Development
184
+
185
+ ```bash
186
+ # Clone and install
187
+ git clone https://github.com/selfagency/git-mcp.git
188
+ cd git-mcp
189
+ pnpm install
190
+
191
+ # Run in development mode (hot reload)
192
+ pnpm dev
193
+
194
+ # Build
195
+ pnpm build
196
+
197
+ # Run tests
198
+ pnpm test
199
+
200
+ # Type check
201
+ pnpm typecheck
202
+
203
+ # Lint
204
+ pnpm lint
205
+
206
+ # Docs (dev server)
207
+ pnpm docs:dev
208
+
209
+ # Docs (build)
210
+ pnpm docs:build
211
+ ```
212
+
213
+ ---
214
+
215
+ ## Safety
216
+
217
+ - All mutating tools have `destructiveHint: true` in their MCP annotations
218
+ - `git_reset --hard` requires `confirm=true`
219
+ - Force push (`--force`) is disabled unless `GIT_ALLOW_FORCE_PUSH=true`
220
+ - Hook bypass (`--no-verify`) is disabled unless `GIT_ALLOW_NO_VERIFY=true`
221
+ - Paths are validated against the repository root — traversal attempts are rejected
222
+ - Credentials and tokens are never included in responses
223
+
224
+ ---
225
+
226
+ ## License
227
+
228
+ MIT © [Daniel Sieradski](https://self.agency)
package/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node