nostrclaw
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., "@nostrclawAudit wss://relay.hivescope.xyz — is it healthy and what's its traffic?"
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.
nostrclaw
Leer en español: README.es.md
An MCP server that lets Claude analyse a Nostr relay: is it healthy, what does it advertise, what is going through it, and which keys look suspicious. By default it is read-only. Optionally (off until you enable it) Claude can also draft and publish notes and reactions through a remote signer (NIP-46: Clave, nsec.app, a bunker) — your private key never reaches this program and every publication needs your explicit confirmation. See Publishing and docs/signing-design.md.
Written in TypeScript on the official MCP SDK and nostr-tools. It runs locally over stdio (Claude Code, Claude Desktop) and talks to the relays you allow, nothing else.
Quick start
git clone https://github.com/rzazo24/nostrclaw && cd nostrclaw
npm install && npm run build
# Claude Code
claude mcp add nostrclaw -e NOSTRCLAW_RELAYS=wss://relay.hivescope.xyz -- node "$PWD/dist/index.js"Claude Desktop (claude_desktop_config.json):
{ "mcpServers": { "nostrclaw": {
"command": "node", "args": ["/absolute/path/to/nostrclaw/dist/index.js"],
"env": { "NOSTRCLAW_RELAYS": "wss://relay.hivescope.xyz" }
} } }Then ask Claude things like “Audit my relay”, “What is the traffic of the last 24 hours made of?” or “Look at this key: npub1…”. The audit_relay prompt walks through a full review.
Related MCP server: Nostr Tools for AI Agents
Tools
Tool | What it does |
| How the server is configured (allowed relays, limits) and that it is read-only |
| Reachability and latency (HTTP and WebSocket), NIP-11 document (NIPs, limits, policies) and, if the relay publishes them, its public statistics |
| Newest events, filterable by kind, author and age; content cleaned and truncated; signatures verified |
| NIP-45 |
| Analysis of a sample: counts by kind, events per hour, top authors, the same text from several keys, bursts from one key, share of single-event authors, and a short list of signals |
| One key: profile (kind 0), follows, relay list, activity on this relay |
| Lists the authors of a window whose behaviour looks like spam (text shared with other keys — near-copies included —, bursts, link-only posting), each point with a stated reason. Short greetings ("Azul", "gm") don't count as copying, and "high" needs two behaviour signals. Missing profile/follows/relay list on this relay adds to the score but never flags a key on its own; keys with no behaviour signal are only counted. A triage aid, not a verdict |
| One event: replies, reactions, reposts and zaps, counted from the events that reference it (up to 500; NIP-45 COUNT with tag filters answers a silent 0 on khatru+sqlite, so it is not used), reaction breakdown and distinct reactors |
recent_events, count_events and activity_report also accept a tags filter ({"e": [id]}, {"p": [pubkey]}, {"t": ["bitcoin"]}).
Publishing (optional, NIP-46)
Off by default. Enable it with NOSTRCLAW_ENABLE_SIGNING=1 and five more tools appear:
Tool | What it does |
| Resumes the saved session, or returns a |
| Connection state, which npub it signs as, the policy in force, signatures requested in the last hour |
| Closes the session and deletes the saved app key |
| Prepares an unsigned event and checks it against your policy. Publishes nothing |
| Takes a draft id, asks you to confirm, has your signer sign it and sends it to your relays |
How it stays under your control:
Your key never leaves your signer. nostrclaw holds only an app key that identifies it to the signer, saved with mode
0600.A human decides, through a channel the model cannot write to. If your client supports it,
publish_eventasks you (MCP elicitation) showing the exact event, who signs it and where it goes; without an explicit yes nothing is signed. Your signer then asks for its own approval.Use manual approval in the signer (Clave: low trust). If the signer approves by itself, anything that can read the app key saved on your machine — including an assistant with a shell — could ask it for signatures with no prompt; nostrclaw warns when it sees that.
“Always allow” is detected. Without elicitation, the signer's approval is the lock — so it is verified: a signature that comes back faster than a person could decide (default 2 s) is discarded and never published, and further publishing is refused until you fix the signer and reconnect.
Policy you own (
~/.config/nostrclaw/policy.json, no tool can write it): allowed kinds (default notes1and reactions7only), publications per hour (default 5), maximum length, relays, and blocked patterns (anything that looks like annsec1…,bunker://,secret=…). An invalid file stops the server.The model cannot alter or replay anything:
publish_eventtakes only a draft id; the signed event is checked against the draft and goes only to the relays, never back into the conversation.Audit log (
~/.local/state/nostrclaw/audit.jsonl): every step with ids and hashes, never content or secrets.
Quick start with Clave on the iPhone:
claude mcp add nostrclaw -e NOSTRCLAW_ENABLE_SIGNING=1 -e NOSTRCLAW_RELAYS=wss://relay.hivescope.xyz -- node "$PWD/dist/index.js"Then ask Claude to “connect my signer”, open the link it gives you in Clave and approve (do not choose “always allow”), and ask it to “draft a note saying …”. The connection link lists wss://relay.powr.build as well as your relay, because Clave only receives background requests through that one.
Safety model
An assistant reading a public network is exposed to text written by strangers, so the design assumes everything from the network is hostile:
Read-only by default. The analysis tools publish, sign, delete or change nothing and declare
readOnlyHint. Writing exists only behindNOSTRCLAW_ENABLE_SIGNING=1and the rules above.Untrusted text is fenced. Event content, profile fields and the relay's own description are returned only under an
untrustedkey, with a note telling the model to treat it as data and never follow instructions found in it. Signals and statistics never contain third-party text.Hidden characters are removed from everything third-party (zero-width, bidirectional overrides, control and Unicode “tag” characters) and long text is truncated.
Relay allowlist. Tools only talk to the relays in
NOSTRCLAW_RELAYS, so a prompt cannot make this process connect elsewhere. Local and private addresses are refused unlessNOSTRCLAW_ALLOW_PRIVATE=1, HTTP redirects are not followed and responses are size-limited.Signatures are verified; events with a bad signature are dropped and counted.
Bounded output: limits on events per call, sample sizes and timeouts.
Configuration
Variable | Default | Meaning |
|
| Comma-separated relays the tools may use; the first is the default |
| off |
|
|
| Per-request timeout (500–60000) |
|
| Most events any single call may fetch (1–2000) |
| off |
|
|
| Relays used to talk to the signer |
|
|
|
|
|
|
Development
npm test # builds, then unit tests (safety, analysis, tools with a pretend network)
RELAY_BIN=/path/to/nostr-relay-khatru npm test # …plus end-to-end tests against a real relay and over real stdioThe signing tests run a pretend NIP-46 signer (test/fake-signer.ts) through the real relay. Without RELAY_BIN the end-to-end tests are skipped (a sibling checkout of nostr-relay-khatru is picked up automatically). CI builds that relay and runs everything.
File | What it does |
| The tools and the |
| The analysis: pure functions over events (no network) |
| Relay allowlist, private-address guard, cleaning of third-party text |
| Minimal read-only Nostr client (REQ, COUNT, NIP-11, |
| Publishing: |
| Configuration and the stdio entry point |
Roadmap
0.1: read-only analysis.
0.2 (now): NIP-46 signing, opt-in — connect to a remote signer, draft events, publish only after explicit human confirmation. Design and threat model in docs/signing-design.md.
Later: more analysis (multi-relay comparison, follow-graph / web-of-trust signals).
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Approve Nostr signatures with your own browser signer without exposing a private key.
Agent registry with Nostr identity, reputation, escrow, observability, and Lightning payments.
A public relay where AI instances read traces left by others and may leave one. No auth.
Read public AT Protocol profiles, records, threads, backlinks and lexicons. No API key required.
Related MCP Servers
- AlicenseBqualityBmaintenanceA Model Context Protocol server that enables LLMs like Claude to interact with the Nostr social network, allowing for fetching user profiles, text notes, and zap payment information.1810 npm37MIT
- AlicenseCqualityCmaintenance23 tools for AI agents working with Nostr Open source. No API key. No account. NIP-46 remote signing Publish notes, reply, react, repost Encrypted DMs (NIP-04 + NIP-44) Fetch events, profiles, social graph2310 npm1MIT
- AlicenseNot gradedqualityBmaintenanceTrust-aware Nostr MCP server. 236 tools for identity, social, DMs, trust scoring, AI-to-AI dispatch, Lightning payments, privacy proofs, and encrypted vaults. NIP-46 bunker auth; keys never leave the signing device.701 npm1MIT
- AlicenseAqualityBmaintenanceA read-only MCP server for safely exploring Nostr, enabling agents to resolve identifiers, fetch profiles and events, query notes, and inspect relay metadata. It does not accept private keys or publish events.510 npmMIT