ngit-mcp
Reads git repositories that are hosted on Nostr: resolves a repo's maintainers, git servers and health, fetches the diffstat and unified diff of a pull request straight from its git servers, and works with PR revisions, draft/ready state and merges.
Talks to Nostr relays: reads signed PR, issue and comment events from a repo's relays, keeps a live relay subscription so cached reads are marked stale on change, and publishes approved writes (comment, issue, status, label, merge) to the relays via the user's signer, checking the relays before any retry so an event is never posted twice.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ngit-mcp list the open pull requests for this repo"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
ngit-mcp
Let an AI assistant read and work with git repositories that live on Nostr. It is safe by default.
ngit is a way to host git repos on Nostr. There is no GitHub: pull requests,
issues and comments are signed events on relays. ngit-mcp connects that world to any MCP host
(Claude Desktop, Cursor, Grok Bot and others), so an assistant can:
Read: a repo's maintainers and servers, the PR and issue lists, full threads with CI, the actual code diff of a PR, and a live feed of "what happened sinceβ¦".
Act (only when you switch it on): open or update a PR, comment, create an issue, label, close or reopen, merge. Each action is shown to you as a plan first, and your own signer app signs it. The server never holds a key.
Why it's nice
β‘ Fast | Repeat reads take about 0.2 ms instead of about 560 ms, and stay fresh via a live relay subscription. With |
π Connect in the chat | Ask for a write and you get one message: a QR for your signer app, or "just tell me your name". New to Nostr? Two questions (your name, an optional backup email) and you have an account, made on this machine, with the key never shown to the AI. There's no terminal and no config. See ONBOARDING.md. |
π Can't post until you connect | Signing tools stay off until you pair a signer in this session, which is a physical act on your own device. Reads need no setup and run in a private, keyless home that cannot reach a signer. |
π§Ύ Plan β approve β commit | Every write is a plan with an exact preview and a token. The token is a hash of the exact command, so what you approved is exactly what runs. |
π Never posts twice | Before any retry it checks the relays for the event. If the relays can't be reached, it refuses instead of guessing. |
π‘οΈ Prompt-injection fencing | Anything other people wrote comes back inside |
π€ No secrets in output | Keys and bunker secrets are redacted from every response, including errors. |
Related MCP server: GitAgentic MCP Server
Install
Requires Node β₯ 20 and ngit on your PATH.
git clone <this repo> ngit-mcp && cd ngit-mcp
npm install && npm run buildAdd it to your MCP host
{
"mcpServers": {
"ngit": {
"command": "node",
"args": ["/path/to/ngit-mcp/dist/index.js",
"--warm", "nostr://npub1β¦/relay.ngit.dev/my-repo"]
}
}
}That's all the setup there is. Reading works at once. The first time you ask for a write, the
assistant calls ngit_connect and shows you this:
Open your Nostr signer app and scan this. New to Nostr? Just tell me your name and I'll set you up here. βΉQRβΊ
Scan it and approve, and you get "β Connected as you". Or tell it your name: it asks one more question ("Email for your backup? (optional)") and ends with "β You're on Nostr as Ada (npubβ¦). Nothing is posted until you approve it." From then on every write is shown to you as a plan first, and your signer app asks before signing. The full script and every failure case are in ONBOARDING.md.
Optional flags:
Flag | Effect |
| Enables |
| No writing at all: removes |
| Passed to |
| For servers that don't run on your computer: no |
| Override the pairing relays. |
| Preloads a repo at startup, so the first call is instant. |
| Hides text from people who are not maintainers or in |
| Marks extra people as trusted. |
| Refuses every other repo. Entries must use npub or naddr form. |
| Lets |
| Where caches live (default |
Tools
Tool | What it does |
| Name, maintainers, git servers, health |
|
|
| One PR or issue with its comment thread (PRs include CI) |
| Diffstat and unified diff of a PR, fetched straight from its git servers |
| New PRs, issues, comments, status changes and updates since a time (live) |
| Connects your identity. It returns the QR (as an image and as text) and waits with |
| (signing) Builds an exact plan and token for pr_open, pr_update, comment, issue_create, status, label or merge. Publishes nothing. |
| (signing) Runs a plan by token. Your signer app asks you to approve. Call it again with the same token to check progress; it never publishes twice. |
Every read accepts fresh: true to force a network round trip. Repos can be written as nostr://<npub>/<relay>/<id>, naddr1β¦, or with a NIP-05 owner such as nostr://dan@gitworkshop.dev/relay.ngit.dev/ngit.
Demo (real output, read-only, against a public repo)
> tools: ngit_repo, ngit_list, ngit_get, ngit_pr_diff, ngit_activity
> ngit_repo (610.7 ms, fetched)
name=<untrusted author="npub1m5tuβ¦" role="maintainer">routstrd-remote</untrusted> maintainers=1
> ngit_list type=pr (555.3 ms, fetched) count=2
[open] <untrusted author="npub1626pβ¦" role="other">feat(npubs): per-npub model allowlist and expiry</untrusted>
[applied] <untrusted author="npub1m5tuβ¦" role="maintainer">feat(admin): seed the container's own identity as the first admin</untrusted>
> ngit_list type=pr again (0.9 ms, memory)
> ngit_get type=pr (549.0 ms) comments=0
> ngit_pr_diff (1455 ms cold / 1.4 ms warm) 6 files changed, 667 insertions(+), 30 deletions(-)
> ngit_activity since=0 (2.5 ms) events=5To reproduce it, run npx tsx scripts/demo.ts [repo]. A signing session looks like this:
assistant β ngit_plan {action:"comment", on:"pr", id:"nevent1β¦", body:"LGTM"}
server β {token:"ngp_3fβ¦", signer:"npub1youβ¦", preview:{what:"Comment on pr", body:"LGTM"},
commands:[["ngit","--repo","nostr://β¦","pr","comment","nevent1β¦","--body=LGTM","--json"]]}
assistant: "I'll post 'LGTM' on PR #β¦ as npub1youβ¦ β OK?" you: "yes"
assistant β ngit_commit {token:"ngp_3fβ¦"} (your phone asks you to approve; you tap Approve)
server β {state:"done", attempt:1, result:{β¦}}Speed (real MCP round trips, routstrd-pro on relay.ngit.dev)
Tool | Raw | ngit-mcp cold | ngit-mcp warm p50 | with |
repo | 545β1361 ms | 1215 ms | 0.22 ms | 7 ms |
pr list | β570 ms | 540 ms | 0.35 ms | 1 ms |
pr view | β560 ms | 553 ms | 0.44 ms | β |
issue list | β560 ms | 539 ms | 0.12 ms | 1 ms |
pr diff | (no equivalent) | 1484 ms | 1.5β1.9 ms | β |
activity | (no equivalent) | 2 ms | 0.6 ms | β |
A cold read is ngit itself, because ngit stays the source of truth. Every later read is served from
memory and refreshed in the background. A live relay subscription marks it stale as soon as anything
changes. Raw numbers are in bench/ (npm run bench).
Tests
npm test # 60 tests (25 property suites, a 5,040-run model check of the
# signing protocol, the real server process); fakes, no network (β55 s)
./test/e2e/run.sh # 28 tests: real ngit + git-remote-nostr + real signatures with a
# throwaway key, against a local relay AND a local GRASP server
# (relay + git smart-HTTP enforcing GRASP push rules), inside a
# network namespace with NO internet (needs unshare)The onboarding e2e pairs real ngit with a scripted NIP-46 signer (throwaway keys) in these
modes: ok, asleep, never answers, rejects, no keychain, already logged in, and a
pasted promenade-style bunker followed by a signed issue through it. It also runs the
newcomer wizard (with and without email, and hosted) using real ngit account create against
a local relay. That covers the backup page (its ncryptsec decrypts to the exact key ngit
stores) and a signed issue with the new key, and it checks every byte of tool output for the
key.
The e2e covers the whole PR lifecycle: open β diff β update (revision) β stale-plan refusal β
comment β draft/ready β merge and publish. It also checks that a rogue push is rejected by the
GRASP rules.
INVARIANTS.md lists the 19 invariants, how each is proved or checked, and the 15 bugs that
the tests found. LOOPS.md is the build diary.
Limitations
A cold read costs one ngit call (about 0.55β1.2 s). Use
--warmfor the repos you care about.A key created in the chat signs without asking on a device; the approval is the plan step in the chat. Move it to your phone (backup page) for a second factor. On a hosted agent the key lives on the host. See ONBOARDING.md, limits.
The signer is whichever ngit account is active in your environment. The connector never holds keys, and it has only been tested with throwaway keys. It has not been tested with a real phone signer.
Plans live in memory. After a restart, make a new plan. The new plan warns (
possible_duplicate) if you published a matching event in the last 10 minutes.The GRASP server used in the e2e is a minimal test implementation written for this project, not ngit-grasp itself. ngit 3.2.0 and git-remote-nostr are the real thing.
ngit_pr_difffetches from https clone URLs named in the PR. That means it can reach any https host the PR author chose, but only to read git objects.Short lowercase words (β€20 letters, such as status values) are left unfenced by design.
Available Tools
6 toolsngit_activityBRead-only
What happened since a time: new PRs/issues, comments, status changes, PR updates (live). Use to watch for replies.
Inputs: repo (required), id, fresh, since.
ngit_connectA
Connect the user's Nostr identity. Call with no arguments, show say (and the QR, or qr_text if you cannot show images), then wait_s=50 until connected. For a new user, pass name and then email as say asks (email="" to skip). Never ask for, accept or repeat an nsec.
Inputs: name, email, backup, bunker, +5 more.
ngit_getBRead-only
One PR or issue with its full comment thread (PRs include CI results in ci).
Inputs: id (required), repo (required), type (required), fresh.
ngit_listARead-only
List pull requests or issues (default: open + draft). Text written by others is wrapped in tags.
Inputs: repo (required), type (required), fresh, label, +2 more.
ngit_pr_diffBRead-only
The code change of a PR: diffstat + unified diff (merge-base..tip), fetched from its git servers.
Inputs: id (required), repo (required), fresh, max_bytes.
ngit_repoARead-only
Repository metadata: name, maintainers (confirmed/invited), git servers, health, default branch tip.
Inputs: repo (required), fresh.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 6 tools
The tools mostly target distinct resources and actions: repo metadata, listing, single-item retrieval, PR diff, activity feed, and identity connection. The boundary between ngit_list (current open/draft PRs and issues) and ngit_activity (changes since a timestamp) could be confused, but descriptions help clarify.
All names share the same ngit_ prefix and snake_case style, making them readable and predictable. However, the suffix pattern mixes verbs (list, get, connect) and nouns (repo, activity, pr_diff), so it is not a strict verb_noun convention throughout.
Six tools is well-scoped for a PR/issue browsing and monitoring server, with each tool covering a distinct capability. There is no obvious redundancy or bloated surface.
The surface covers repo metadata, listing/fetching PRs and issues, PR diffs, activity monitoring, and identity connection. But it appears read-only: there are no tools to create issues/PRs, comment, update status, or merge, which are notable gaps for a collaboration workflow.
Maintenance
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Hosted git for AI agents: repos, files, code search, issues, pull requests, branches, merges.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with local Git repositories for operations like status, commits, branching, and diffs, plus GitHub API integration for managing pull requests when authenticated.-
- FlicenseNot gradedqualityDmaintenanceEnables AI models like Claude or GPT to interact with a decentralized git network, supporting repository initialization, DID generation, agent spawning, and pull requests.-
- AlicenseBqualityDmaintenanceEnables AI assistants to inspect local Git repositories and interact with the GitHub API for reading commits, diffs, files, issues, comments, pull requests, and project boards.10ISC
- AlicenseCqualityBmaintenanceMCP server for gittr.space, a decentralized Git platform on Nostr, enabling AI agents to create repos, push code, manage issues/PRs, and work with Lightning bounties using Nostr identity.10751MIT