The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Bray listing page.
Trust-aware Nostr MCP for AI and humans. 261 tools across 29 groups. Model-agnostic. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf, or any MCP client.
Install globally or run via npx:
New to Nostr? Mint a key first -- this works before anything is configured and prints your npub plus a 24-word mnemonic (write it down; it is the key):
Add to your MCP client config:
Then ask your AI to call whoami to verify it works.
For production use, prefer Heartwood or any NIP-46 bunker (your key never leaves your signing device):
| Tier | Method | Key exposure |
|---|---|---|
| Heartwood | Dedicated signing appliance (BUNKER_URI) | Key never leaves the signing device. Supports nsec-tree derivation, per-client permissions, and device-backed attestations. |
| Software bunker | Any NIP-46 bunker (BUNKER_URI) | Key held by a separate process. Never seen by bray. |
| ncryptsec | NIP-49 encrypted key (NOSTR_NCRYPTSEC) | Key encrypted at rest, decrypted in memory at startup. |
| Key file | File path (NOSTR_SECRET_KEY_FILE) | Key on disk, read once, env var deleted. |
| Env var | Inline secret (NOSTR_SECRET_KEY) | Key visible in process environment. Use only for development. |
| Group | Tools | Key examples |
|---|---|---|
| Identity | 16 | whoami, identity-derive-persona, identity-switch, identity-prove, nip05-lookup |
| Social | 15 | social-post, social-reply, social-feed, contacts-follow, social-notifications |
| Direct Messages | 4 | dm-send, dm-read, dm-conversation |
| Trust | 22 | trust-attest, trust-ring-prove, trust-spoken-challenge, trust-attest-chain |
| Dispatch | 13 | dispatch-send, dispatch-check, dispatch-reply, dispatch-capability-discover |
| Relay | 13 | relay-query, relay-set, relay-discover, cast-spell, relay-health |
| Moderation | 16 | label-create, list-mute, list-bookmark, list-followset-create, moderation-filter |
| Marketplace | 16 | marketplace-discover, marketplace-call, listing-create, listing-search |
| Safety | 14 | canary-session-create, canary-group-create, canary-duress-signal, safety-activate |
| Blossom | 10 | blossom-upload, blossom-mirror, blossom-verify, blossom-repair |
| Privacy | 10 | privacy-commit, privacy-prove-range, privacy-prove-age, privacy-publish-proof |
| Zap | 9 | zap-send, zap-balance, zap-make-invoice, zap-decode |
| Wallet service | 5 | wallet-grant, wallet-grants, wallet-revoke, wallet-refill, wallet-serve |
| Vault | 9 | vault-create, vault-encrypt, vault-share, vault-rotate |
| Workflow | 7 | trust-score, verify-person, identity-setup, relay-health, feed-discover |
| Signet | 7 | signet-badge, signet-vouch, signet-credentials, signet-challenge |
| Communities | 5 | community-create, community-feed, community-post, community-approve |
| Badges | 4 | badge-create, badge-award, badge-accept, badge-list |
| Groups (NIP-29) | 20 | group-inspect, group-invite-create, group-forum-comment, group-delete |
| Articles | 3 | article-publish, article-read, article-list |
| Calendar | 3 | calendar-create, calendar-read, calendar-rsvp |
| Wiki | 3 | wiki-publish, wiki-read, wiki-list |
| Search | 3 | search-notes, search-profiles, hashtag-feed |
| Scheduling | 4 | post-schedule, post-queue-list, post-queue-cancel, publish-event |
| Community NIPs | 2 | nip-publish, nip-read |
| Utility | 20 | decode, validate-event, verify-event, nip44-encrypt, tombstone |
| Sync (NIP-77) | 1 | sync-plan (pull/push are explicit CLI and SDK operations) |
| Handler | 2 | handler-publish, handler-discover |
| Catalog | 2 | search-actions, execute-action |
Use search-actions to find tools by keyword, then execute-action to run them.
Protocol foundations: semantic event validation, NIP-77 reconciliation, and relay-scoped NIP-29 groups.
Dispatch lets AI agents collaborate over encrypted Nostr DMs. Any MCP-capable client can send structured tasks to other agents and receive results back.
13 message types: send, check, reply, ack, status, cancel, refuse, failure, query, propose, capability-publish, capability-discover, capability-read.
NIP-89 capability discovery: Agents publish what they can do. Other agents discover capabilities by topic, then route tasks to the right collaborator automatically.
All messages are NIP-44 encrypted. Recipients are resolved by name, NIP-05, npub, or hex.
Every tool that accepts a recipient uses universal identity resolution. You never need to look up hex pubkeys manually.
Accepted formats:
"alice" (resolved from your dispatch contacts)"alice@example.com" (HTTP lookup)"npub1abc..." (NIP-19 decode)"a1b2c3..." (64-character passthrough)Sign events now, publish later. Events are signed immediately with your current key, then held in a queue until the scheduled time.
nostr-bray implements or integrates the following NIPs:
| NIP | What |
|---|---|
| NIP-01 | Events, signing, relay protocol |
| NIP-02 | Follow lists |
| NIP-05 | DNS identity (lookup, verify, relay hints) |
| NIP-09 | Event deletion |
| NIP-11 | Relay information |
| NIP-17 | Private DMs (gift wrap, default) |
| NIP-19 | bech32 encoding (npub, nsec, nprofile, nevent, naddr) |
| NIP-23 | Long-form articles (kind 30023) |
| NIP-22 | Schema-correct comments for group forums |
| NIP-29 | Relay-scoped groups, chat, forums, invitations and administration |
| NIP-32 | Labels |
| NIP-40 | Expiration tags |
| NIP-42 | Relay auth |
| NIP-44 | Encrypted payloads v2 |
| NIP-45 | Event counts |
| NIP-46 | Nostr Connect (bunker) |
| NIP-47 | Nostr Wallet Connect: pay BOLT-11 invoices, balance, invoices, and scoped spending connections over one wallet. NIP-44 v2 only |
| NIP-49 | Private key encryption (ncryptsec) |
| NIP-50 | Search |
| NIP-51 | Lists (mute, pin, follow sets, bookmarks) |
| NIP-52 | Calendar events |
| NIP-54 | Wiki pages |
| NIP-57 | Zap receipts (kind 9735) are read. bray pays BOLT-11 invoices over NIP-47 but does not build kind 9734 zap requests or resolve LNURL, so it cannot yet zap a profile or note by itself |
| NIP-58 | Badges |
| NIP-65 | Relay list metadata |
| NIP-72 | Communities |
| NIP-77 | Negentropy ID reconciliation with truthful REQ fallback |
| NIP-78 | Application-specific data |
| NIP-85 | Trust rankings |
| NIP-89 | Recommended applications (dispatch capability discovery) |
| NIP-96 | HTTP file storage (Blossom) |
| NIP-99 | Classified listings |
| NIP-A7 | Spells (kind 777 — cast saved queries) |
| NIP-VA | Verifiable attestations (kind 31000) |
Create ~/.config/bray/config.json (or ~/.nostr/bray.json):
Secrets are referenced by file path (bunkerUriFile, secretKeyFile, nwcUriFile) so they never appear in the config itself.
Search order: BRAY_CONFIG env var > $XDG_CONFIG_HOME/bray/config.json > ~/.nostr/bray.json.
| Variable | Description |
|---|---|
BRAY_CONFIG | Path to config file |
BUNKER_URI | NIP-46 bunker URL (safest) |
BUNKER_URI_FILE | Path to bunker URI file |
NOSTR_SECRET_KEY | nsec, hex, or BIP-39 mnemonic |
NOSTR_SECRET_KEY_FILE | Path to secret key file |
NOSTR_NCRYPTSEC | NIP-49 encrypted key |
NOSTR_NCRYPTSEC_PASSWORD | Password for ncryptsec |
NWC_URI_FILE | Path to a private 0600 file containing the NWC bearer URI |
BRAY_MAX_PAYMENT_MSAT | bray's ceiling on any one payment, in msat (default 5000000, 5,000 sats) |
BRAY_MAX_DAILY_MSAT | bray's ceiling on spending in any rolling 24 hours, in msat (default 20000000, 20,000 sats) |
BRAY_WALLET_SERVICE | Set 1 to register wallet-grant, wallet-refill and wallet-serve |
BRAY_HOME | Directory for bray's state files (default $XDG_CONFIG_HOME/bray, else ~/.config/bray) |
NOSTR_RELAYS | Comma-separated relay URLs |
NOSTR_FORBID_PUBKEY | Comma-separated npubs or hex this process must never sign as. See below. |
TOR_PROXY | SOCKS5h proxy for Tor |
NIP04_ENABLED | Set 1 to enable legacy NIP-04 DMs |
TRANSPORT | stdio (default) or http |
PORT | HTTP port (default 3000) |
All secret env vars are deleted from process.env before parsing can fail.
Raw NWC_URI is refused; use NWC_URI_FILE or wallet connect <nwc-file> so
the bearer credential never appears in a process environment, command argument
or MCP tool argument. The wallet must speak NIP-44 v2 encryption for NWC;
wallets that only offer NIP-04 are refused.
An agent that comes up holding the wrong key is indistinguishable from one
working correctly. Every signature verifies, every tool succeeds, and the
only symptom is that whoami quietly answers with somebody else's npub —
which the driving model has no reason to doubt, because it is its own tool
telling it.
The worst version is a principal's key: a person's own. An agent signing as its principal can attest that it belongs to itself, and approve its own requests, because it is the principal those checks look for.
or forbidPubkeys in the config file. Either takes npubs or hex. Activating
one of those keys throws instead — at startup, on identity-switch, and on
bunker --persona alike, because the check sits at the moment an identity
becomes active rather than at any one entry point. An entry that cannot be
parsed is an error too: a list nobody can read must not silently permit
everything.
The active npub is printed on stderr on every start, so the answer to "which key is this?" does not depend on asking the agent.
The hard limit is the wallet's own. Point NWC_URI_FILE (or
wallet connect <file>) at a connection your wallet issued with a spending
budget. Whatever bray does, and whatever a model asks of it, the wallet will
not pay past that budget. Everything below is bray policing itself, which is
worth having but is not the same thing.
On top of that, every payment bray makes (zap-send, marketplace-pay, the
CLI's zap-send and wallet pay, the SDK, and payments made through the
scoped connections below) is checked before anything is sent:
BRAY_MAX_PAYMENT_MSAT (default 5,000 sats).BRAY_MAX_DAILY_MSAT in any rolling 24 hours (default
20,000 sats), counting a 1% (minimum 1 sat) fee reserve until the real fee
is known. Attempts are written to payment-ledger.json in the state
directory before the wallet is asked, so a restart does not hand the
allowance back.confirm: true is set by the model, so it is not a human approval. When your
MCP client supports elicitation, zap-send and marketplace-pay also ask
you directly and pay only on an explicit yes; clients without elicitation
fall back to confirm, with the caps still applying. zap-send is not in
the default tool list either: it is reached through search-actions.
zap-send spends through the NWC URI you configured. That URI is an
unbounded capability over the wallet behind it: every method it supports, no
ceiling, until it is rotated. Handing one to an agent hands over everything.
wallet-grant issues scoped spending connections over that one wallet: one
wallet, one balance, and several narrower ways in. They are not separate
wallets. The tools that mint or widen spending authority (wallet-grant,
wallet-refill, wallet-serve) are registered only with
BRAY_WALLET_SERVICE=1; wallet-grants and wallet-revoke are always
available.
wallet-grant writes the new connection's nostr+walletconnect:// URI to a
0600 file under wallet-connections/ beside the grants file and returns
the path; the URI itself never appears in a tool result.
What a connection may do is an allowlist, and the default grants no spending
and does not disclose anything: get_info and make_invoice. The others are
opt-in per connection, and a connection that can spend must carry a
budget - there is no unlimited grant to issue by accident. A connection
sees only itself:
get_balance reports the connection's remaining budget, never the
wallet's balance.lookup_invoice answers only for invoices that connection issued or paid;
anything else is reported as not found.The rules exist because a payment cannot be recalled:
expiration tag claims.Grants live in wallet-grants.json (0600, per identity), and they are
answered only while wallet-serve is running - which is to say, only for
as long as this process is alive. That is worth telling whoever you hand a URI
to: a connection that works while an MCP session is open is a different
promise from one that works overnight.
The file is the record, shared by every bray process on the machine. Only one process may serve the grants at a time, the serving process re-reads a grant before every request, and every change is a locked update of the file, so a revocation or refill made from any process applies to the next request and cannot be written away by another.
See llms.txt for a concise summary optimised for AI context windows, or llms-full.txt for complete tool documentation with parameter details.
ForgeSworn builds open-source cryptographic identity, payments, and coordination tools for Nostr.
| Library | What it does |
|---|---|
| nsec-tree | Deterministic sub-identity derivation |
| ring-sig | SAG/LSAG ring signatures on secp256k1 |
| range-proof | Pedersen commitment range proofs |
| canary-kit | Coercion-resistant spoken verification |
| spoken-token | Human-speakable verification tokens |
| toll-booth | L402 payment middleware |
| geohash-kit | Geohash toolkit with polygon coverage |
| nostr-attestations | NIP-VA verifiable attestations |
| dominion | Epoch-based encrypted access control |
| nostr-veil | Privacy-preserving Web of Trust |
For issues and feature requests, see GitHub Issues.
If bray is useful to you, a tip is always welcome:
profusemeat89@walletofsatoshi.comnpub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2MIT