MCP Server + CLI

Trust-aware Nostr for AI and humans

Verification, proximity, and access: three dimensions of trust, woven into every interaction. 106 tools for identity, social, payments, moderation, and encrypted access control.

$ npx nostr-bray click to copy
View on GitHub
106 Tools
13 Groups
3 Trust Layers
96% Coverage

Nostr has no trust layer.

Pubkeys prove ownership. They do not prove identity, reputation, or intent. Every Nostr user, human or AI, runs into the same three gaps.

🎭

Who is this person?

Anyone can claim to be anyone. Impersonation is trivial. Without verifiable attestations, there is no way to tell a real person from a bot or an impostor.

📡

Spam drowns everything

Your Web of Trust lives in your head. There is no machine-readable social graph distance, so every feed is a flood and moderation is all-or-nothing.

📋

No middle ground between public and private

You can post publicly or encrypt to one person. There is no way to share content with a trusted tier (members, subscribers, crew) without bespoke infrastructure.

🗝

Key loss is permanent

Lose your nsec, lose your identity forever. No recovery, no recourse. Your entire social graph, reputation, and history, gone.

🛡

No coercion resistance

If forced to hand over your key, the attacker gets everything. There is no way to comply under duress while signalling the situation.

📨

AI agents have no identity

AI agents share your key or generate throwaway ones. No hierarchy, no recovery, no context separation. The agent's actions are indistinguishable from yours.

Three dimensions of trust,
woven into every interaction.

Bray combines three independent trust signals into a single, unified surface. Each dimension answers a different question.

Verification

Are they real?

Four-tier progressive identity verification via the Signet protocol. From simple self-declaration through peer vouches up to cryptographic attestation. Every claim is machine-verifiable, revocable, and auditable.

Signet · 7 tools
Proximity

Do I know them?

Web of Trust graph distance and endorsement weight, computed from your follow graph. Filter feeds, weight replies, and make moderation decisions based on social proximity, not platform policy.

WoT · Trust group
Access

What can they see?

Epoch-based encrypted content tiers via the Dominion protocol. Share with members, subscribers, or a trusted crew, without a server or a database. Keys rotate on epoch change. Revocation is instant.

Vault · 8 tools

Three dimensions of trust

Not workarounds. Proper cryptographic primitives across three axes: who you are, how close you are, and what you can see.

1

Progressive identity verification

Seven Signet tools let any agent fetch, vouch, challenge, and enforce identity claims. Policy checks gate access by verification tier. No hand-rolled logic required.

Signet
2

WoT-scored feeds and moderation

Trust scores derived from your social graph weight every interaction. Filter spam by graph distance. Endorse peers. Surface content from people you actually know.

trust-wot-score
3

Encrypted access tiers

Eight Vault tools create Dominion-encrypted content channels. Tiered keys are derived per epoch. Revoke a member's access and their old keys cannot decrypt new content.

Vault
4

Hierarchical identity derivation

One master secret generates unlimited child key pairs via nsec-tree. Derive personas for work, personal, anonymous use, each cryptographically independent.

nsec-tree
5

Shamir Secret Sharing recovery

Split your master secret into BIP-39 word shards. Distribute them to trusted parties. Any threshold subset reconstructs the original. No single point of failure.

shamir-words
6

Gift-wrapped DMs by default

NIP-17 gift wrapping hides sender, recipient, and conversation metadata. No opt-in required; it is the default for every DM.

NIP-17
7

Duress personas

Configure an alternative identity that activates under coercion. Indistinguishable from a normal persona switch. The attacker cannot tell you have complied under duress.

canary-kit
8

Key zeroisation

Private keys are cryptographically zeroed from memory on identity eviction and process shutdown. LRU cache ensures minimal key material exposure at any given moment.

IdentityContext

106 tools. 13 groups.
One coherent surface.

Every tool operates as the active identity. Switch persona, and your posts, DMs, attestations, and payments all follow. No configuration changes needed.

Identity

12 tools

Create, derive, switch, prove, backup, and migrate Nostr identities. Hierarchical key tree with Shamir recovery.

whoami identity-derive-persona identity-switch identity-prove identity-backup-shamir identity-migrate

Social

19 tools

Post, reply, react, repost, DM by name, read feeds and conversations. Name-based lookups across your contact graph.

social-post dm-send dm-by-name contacts-search feed-by-name social-feed

Trust

12 tools

Verifiable attestations, ring signatures for anonymous proofs, spoken verification tokens, linkage proofs.

trust-attest trust-ring-prove trust-spoken-challenge trust-verify trust-revoke

Zap

7 tools

Lightning payments via Nostr Wallet Connect. Send, receive, invoice, check balances, decode bolt11.

zap-send zap-balance zap-make-invoice zap-decode

Relay

5 tools

Per-identity relay lists with NIP-65 management. Query events, fetch relay info, health monitoring.

relay-list relay-set relay-query relay-info

Safety

2 tools

Duress personas for coercion resistance. Alternative identity indistinguishable from a normal persona switch.

safety-configure safety-activate

Blossom

3 tools

Media uploads to Blossom servers. Upload, list, and delete blobs with authenticated requests.

blossom-upload blossom-list blossom-delete

Groups

4 tools

NIP-29 group chat. Fetch metadata, read messages, send to groups, list members.

group-info group-chat group-send group-members

NIPs

2 tools

Publish and read community-proposed Nostr Implementation Possibilities (kind 30817).

nip-publish nip-read

Utility

18 tools

Encode, decode, encrypt, verify, filter, fetch. NIP-44 encryption, NIP-49 key encryption, event verification.

decode nip44-encrypt verify-event key-encrypt fetch count

Signet

7 tools

Progressive identity verification. Fetch badges, issue vouches, run challenges, enforce policy. Four tiers from self-declaration to cryptographic attestation.

signet-badge signet-vouch signet-credentials signet-policy-check signet-policy-set signet-verifiers signet-challenge

Vault

8 tools

Epoch-based encrypted access control via Dominion. Create content tiers, manage members, rotate keys, and revoke access, all without a server or a database.

vault-create vault-encrypt vault-share vault-read vault-revoke vault-members vault-config vault-rotate

Two interfaces.
Same 106 tools.

Use bray as an MCP server for AI agents (Claude, Cursor, Windsurf) or as a standalone CLI. Both share the same handlers, the same identity engine, the same security guarantees.

MCP

AI Agent Mode

// claude_desktop_config.json
// Option A: bunker (safest — key stays in bunker)
{
  "mcpServers": {
    "nostr": {
      "command": "npx",
      "args": ["nostr-bray"],
      "env": {
        "BUNKER_URI": "bunker://<pubkey>?relay=wss://relay.damus.io"
      }
    }
  }
}
// Option B: file-based secret
// Replace BUNKER_URI with:
//   "NOSTR_SECRET_KEY_FILE": "~/.nostr/secret.key",
//   "NOSTR_RELAYS": "wss://relay.damus.io"
CLI

Terminal Mode

# start your bunker (runs in background)
npx nostr-bray bunker &

# connect to it
export BUNKER_URI="bunker://<pubkey>?relay=wss://relay.damus.io"

# go
npx nostr-bray whoami
npx nostr-bray post "hello from bray"
npx nostr-bray persona work
npx nostr-bray prove blind

Privacy by default.
Not by configuration.

Bray assumes a hostile environment. Every default is the most private option. Every key operation has a zeroing path. Secrets never appear in tool responses.

NIP-17 by default

Gift-wrapped DMs hide sender, recipient, and metadata. NIP-04 requires explicit opt-in via environment variable.

NIP-46 bunker auth

Your private key never leaves your signer. Bray connects via NIP-46 remote signing so the agent signs events without ever seeing the nsec.

Key zeroisation

Private keys are cryptographically zeroed from memory on LRU eviction and process shutdown. Minimal exposure window.

No secrets in responses

Tool responses never contain private keys or secret material. Shamir shards are written to files, not returned as text.

Env cleanup

Secrets loaded from files are scrubbed from process.env immediately after parsing. No lingering plaintext in memory.

Signature verification

NIP-65 relay list events are signature-verified before use. Relay information documents are validated against NIP-11.

signet-protocol dominion-protocol nsec-tree @forgesworn/ring-sig @forgesworn/shamir-words nostr-attestations canary-kit spoken-token nostr-tools NIP-44 NIP-49 secp256k1

Standing on shoulders

Bray stands on existing Nostr tooling. It does not replace nostr-tools or nak. It adds a narrow, opinionated identity layer on top.

nostr-tools

838 stars · 1.2M monthly npm downloads

Our primary dependency. Handles event creation, signing, NIP-44 encryption, relay connections, and most protocol-level heavy lifting. If you are building a Nostr client in JavaScript, nostr-tools is the standard.

nak

by fiatjaf (the Nostr protocol creator) · Go

The definitive Nostr Swiss Army knife. Covers far more ground than bray: MuSig2 collaborative signing, built-in relay with negentropy sync, FUSE filesystem, NIP-60 Cashu wallet, smart outbox routing, PoW mining, NIP-86 relay admin, and a full bunker with persistence and QR codes. If you want a power-user CLI for Nostr, nak is it.

What bray adds

A narrow set of capabilities that revolve around one theme: trust-aware Nostr for AI and humans.

Progressive identity verification (Signet)
Encrypted access tiers (Dominion Vault)
WoT-scored feeds and moderation
Hierarchical identity derivation (nsec-tree)
Persona switching mid-session
Ring signatures (anonymous group proofs)
Shamir secret sharing backup
Duress detection (canary-kit)
Verifiable attestations (NIP-VA kind 31000)
Linkage proofs (blind + full)
NWC Lightning payments
Test relay server + NIP-46 bunker
NIP-46 bunker auth (key never leaves signer)

All bundled into a single MCP server with 106 tools, so an AI agent gets a complete trust-aware Nostr identity out of the box without stitching together multiple tools.

Up and running in 60 seconds

1

Install

# no install needed — npx runs it directly
npx nostr-bray --help

# or install globally
npm install -g nostr-bray
2

Authenticate

Three options, safest first:

# RECOMMENDED: NIP-46 bunker (key never touches bray)
# Terminal 1 — start the bunker with your key
npx nostr-bray bunker

# Terminal 2 — connect to it
export BUNKER_URI="bunker://<pubkey>?relay=wss://relay.damus.io"
npx nostr-bray whoami
# GOOD: file-based secret (protected by file permissions)
echo "nsec1..." > ~/.nostr/secret.key
chmod 600 ~/.nostr/secret.key
export NOSTR_SECRET_KEY_FILE="~/.nostr/secret.key"
export NOSTR_RELAYS="wss://relay.damus.io,wss://nos.lol"
# QUICK (testing only): env var
export NOSTR_SECRET_KEY="nsec1..."
export NOSTR_RELAYS="wss://relay.damus.io,wss://nos.lol"
3

Use

# check your identity
npx nostr-bray whoami

# derive a work persona
npx nostr-bray persona work

# post as that persona
npx nostr-bray post "hello from my work identity"

# create a shamir backup
npx nostr-bray backup-shamir --shares 5 --threshold 3