nostr-bray 1.23.1 → 1.25.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.
Files changed (78) hide show
  1. package/README.md +134 -416
  2. package/dist/bunker-context.d.ts +9 -6
  3. package/dist/bunker-context.js +1 -1
  4. package/dist/bunker.d.ts +1 -0
  5. package/dist/bunker.js +65 -0
  6. package/dist/cli.js +7 -7
  7. package/dist/context.d.ts +13 -6
  8. package/dist/context.js +38 -5
  9. package/dist/dispatch/capabilities.d.ts +2 -2
  10. package/dist/dispatch/handlers.d.ts +11 -11
  11. package/dist/format.d.ts +1 -0
  12. package/dist/format.js +21 -0
  13. package/dist/handler/handlers.d.ts +50 -0
  14. package/dist/handler/handlers.js +110 -0
  15. package/dist/handler/tools.d.ts +3 -0
  16. package/dist/handler/tools.js +48 -0
  17. package/dist/heartwood-context.d.ts +35 -0
  18. package/dist/heartwood-context.js +76 -0
  19. package/dist/identity/handlers.d.ts +23 -11
  20. package/dist/identity/handlers.js +55 -8
  21. package/dist/identity/migration.d.ts +3 -3
  22. package/dist/identity/migration.js +5 -2
  23. package/dist/identity/tools.d.ts +2 -2
  24. package/dist/identity/tools.js +39 -7
  25. package/dist/index.d.ts +2 -1
  26. package/dist/index.js +16 -4
  27. package/dist/marketplace/handlers.d.ts +4 -4
  28. package/dist/marketplace/listings.d.ts +3 -3
  29. package/dist/moderation/handlers.d.ts +9 -9
  30. package/dist/privacy/handlers.d.ts +2 -2
  31. package/dist/relay/auth.d.ts +2 -2
  32. package/dist/relay/handlers.d.ts +4 -4
  33. package/dist/relay/intelligence-handlers.d.ts +6 -6
  34. package/dist/safety/canary-handlers.d.ts +5 -5
  35. package/dist/safety/handlers.d.ts +7 -7
  36. package/dist/safety/handlers.js +4 -4
  37. package/dist/safety/tools.js +9 -2
  38. package/dist/serve.js +2 -1
  39. package/dist/signet/handlers.d.ts +4 -4
  40. package/dist/signet/handlers.js +10 -2
  41. package/dist/signing-context.d.ts +22 -0
  42. package/dist/signing-context.js +4 -0
  43. package/dist/social/articles.d.ts +2 -2
  44. package/dist/social/badges.d.ts +4 -4
  45. package/dist/social/blossom.d.ts +6 -6
  46. package/dist/social/calendar.d.ts +3 -3
  47. package/dist/social/communities.d.ts +4 -4
  48. package/dist/social/dm.d.ts +4 -4
  49. package/dist/social/groups.d.ts +2 -2
  50. package/dist/social/handlers.d.ts +9 -9
  51. package/dist/social/nips.d.ts +2 -2
  52. package/dist/social/notifications.d.ts +3 -3
  53. package/dist/social/scheduled.d.ts +2 -2
  54. package/dist/social/wiki.d.ts +2 -2
  55. package/dist/trust/attestation-deep-handlers.d.ts +2 -2
  56. package/dist/trust/handlers.d.ts +6 -6
  57. package/dist/trust/handlers.js +6 -2
  58. package/dist/trust/ring-deep-handlers.d.ts +3 -3
  59. package/dist/trust/ring.d.ts +2 -2
  60. package/dist/trust-context.d.ts +2 -2
  61. package/dist/trust-context.js +1 -2
  62. package/dist/types.d.ts +2 -0
  63. package/dist/types.js +1 -1
  64. package/dist/util/handlers.d.ts +2 -2
  65. package/dist/util/tools.js +3 -5
  66. package/dist/vault/handlers.d.ts +7 -7
  67. package/dist/widgets/dm-thread-handler.d.ts +2 -2
  68. package/dist/widgets/feed-widget-handler.d.ts +2 -2
  69. package/dist/widgets/identity-picker-handler.d.ts +2 -2
  70. package/dist/widgets/identity-picker-handler.js +1 -1
  71. package/dist/workflow/handlers.d.ts +12 -7
  72. package/dist/workflow/handlers.js +12 -5
  73. package/dist/workflow/tools.d.ts +2 -2
  74. package/dist/workflow/tools.js +4 -0
  75. package/dist/zap/handlers.d.ts +8 -8
  76. package/llms-full.txt +752 -147
  77. package/llms.txt +95 -103
  78. package/package.json +1 -1
package/README.md CHANGED
@@ -1,87 +1,21 @@
1
1
  # nostr-bray
2
2
 
3
- **Trust-aware Nostr for AI and humans.**
3
+ **Trust-aware Nostr MCP for AI and humans.** 227 tools. Model-agnostic. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf, or any MCP client.
4
4
 
5
- Three dimensions of trust -- verification, proximity, and access -- woven into every interaction. 185 tools for identity, social, payments, moderation, privacy, and encrypted access control.
6
-
7
- | Dimension | Source | Question |
8
- |-----------|--------|----------|
9
- | **Verification** | Signet | Are they real? |
10
- | **Proximity** | Web of Trust | Do I know them? |
11
- | **Access** | Dominion | What can they see? |
12
-
13
- [![CI](https://github.com/forgesworn/bray/actions/workflows/ci.yml/badge.svg)](https://github.com/forgesworn/bray/actions/workflows/ci.yml)
14
5
  [![npm](https://img.shields.io/npm/v/nostr-bray)](https://www.npmjs.com/package/nostr-bray)
15
- [![coverage](https://img.shields.io/badge/coverage-96%25-brightgreen)](./package.json)
6
+ [![CI](https://github.com/forgesworn/bray/actions/workflows/ci.yml/badge.svg)](https://github.com/forgesworn/bray/actions/workflows/ci.yml)
16
7
  [![licence](https://img.shields.io/npm/l/nostr-bray)](./LICENSE)
17
8
  [![TypeScript](https://img.shields.io/badge/TypeScript-ESM-blue)](./tsconfig.json)
18
9
 
19
- An MCP server that gives AI agents a full Nostr identity: not just a key pair, but a hierarchical identity tree with personas, attestations, ring signatures, encrypted DMs, duress detection, identity verification via Signet, and epoch-based encrypted access control via Dominion. 185 tools across 17 groups.
20
-
21
- ## The Problem
22
-
23
- AI agents interacting with Nostr today are handed a single key pair with no separation of concerns. One compromised session leaks everything. There is no way to rotate keys, prove identity links, or maintain separate personas for different contexts.
24
-
25
- nostr-bray solves this with nsec-tree hierarchical derivation. A single master secret generates unlimited child identities, each with its own key pair, purpose, and relay set. Private keys are zeroed from memory on eviction. Agents can switch personas mid-conversation, prove they control the master without revealing the derivation path, and activate a duress identity if compromised.
26
-
27
- ## How It Works
28
-
29
- Every tool operates as the "active identity." Derive a persona, switch to it, and everything you do is signed by that persona's key -- cryptographically unlinkable to the master unless you publish a proof.
30
-
31
- ```
32
- identity-derive-persona("work") → npub1abc...
33
- identity-switch("work") → now operating as work persona
34
- social-post("Hello from work!") → signed by npub1abc...
35
- identity-switch("master") → back to master
36
- social-post("Back to main") → signed by master npub
37
- ```
38
-
39
- This is not just key management: it is context isolation. Each persona loads its own NIP-65 relay list on switch, signs with its own key, and maintains its own attestation chain. Compromise one and the others remain intact.
40
-
41
- ## Relationship to the Nostr Ecosystem
42
-
43
- nostr-bray stands on the shoulders of the existing Nostr tooling:
44
-
45
- - **[nostr-tools](https://github.com/nbd-wtf/nostr-tools)** (838 stars, 1.2M monthly npm downloads) is our primary dependency. It handles event creation, signing, NIP-44 encryption, relay connections, and most of the protocol-level heavy lifting. If you are building a Nostr client in JavaScript, nostr-tools is the standard.
46
- - **[nak](https://github.com/fiatjaf/nak)** is the definitive Nostr CLI, written in Go by fiatjaf (the Nostr protocol creator). It covers far more ground than nostr-bray does: MuSig2 collaborative signing, a built-in relay server with negentropy sync, a FUSE filesystem, NIP-60 Cashu wallet, smart publishing with outbox routing, PoW mining, NIP-86 relay admin, paginated bulk downloads, and a full bunker (server + client) with persistence and QR codes. If you want a power-user Swiss Army knife for Nostr, nak is it. It also has [MCP support](https://github.com/fiatjaf/nak).
47
-
48
- **What nostr-bray adds** is a narrow, opinionated layer on top: sovereign identity for AI agents. The features that are unique to nostr-bray all revolve around that theme:
49
-
50
- | Capability | What it does |
51
- |-----------|-------------|
52
- | Hierarchical identity (nsec-tree) | Derive unlimited child keys from one master secret |
53
- | Persona switching | Change the active signing identity mid-session |
54
- | Ring signatures | Prove group membership without revealing which member you are |
55
- | Shamir backup | Split the master secret into BIP-39 word shares for social recovery |
56
- | Duress detection | An alternative identity that silently signals coercion |
57
- | Verifiable attestations | NIP-VA kind 31000 creation, verification, and revocation |
58
- | Linkage proofs | Prove (or selectively hide) links between personas |
59
- | Spoken verification | HMAC-based spoken word tokens for in-person identity checks |
60
- | WoT-scored feeds | Trust-filtered social feeds via nostr-veil integration |
61
- | Relay health monitoring | Detect dead or unreliable relays before they lose your data |
62
- | Contact list protection | Safety guard against accidental follow list destruction |
63
-
64
- It also bundles NIP-46 bunker auth (your key never leaves the signer), NWC Lightning payments, NIP-29 groups, and a full social toolkit (post, reply, DM, follow, feed) into a single MCP server, so an AI agent can get a complete Nostr identity out of the box without stitching together multiple tools.
10
+ ## Quick Start
65
11
 
66
- ## Quick Start -- CLI
12
+ Install globally or run via npx:
67
13
 
68
14
  ```bash
69
- # Post a note to Nostr from your terminal
70
- export NOSTR_SECRET_KEY="nsec1..." # env var (least safe -- bunker or file preferred)
71
- export NOSTR_RELAYS="wss://relay.damus.io,wss://nos.lol"
72
-
73
- npx nostr-bray whoami # show your npub
74
- npx nostr-bray post "hello from bray!" # publish a note
75
- npx nostr-bray persona work # derive a work persona
76
- npx nostr-bray prove blind # create a linkage proof
77
- npx nostr-bray --help # see all commands
15
+ npm install -g nostr-bray
78
16
  ```
79
17
 
80
- ## Quick Start -- MCP Server
81
-
82
- Add to your Claude/Cursor/Windsurf MCP config:
83
-
84
- **Recommended -- NIP-46 bunker (safest: key never leaves your device):**
18
+ Add to your MCP client config:
85
19
 
86
20
  ```json
87
21
  {
@@ -90,7 +24,7 @@ Add to your Claude/Cursor/Windsurf MCP config:
90
24
  "command": "npx",
91
25
  "args": ["nostr-bray"],
92
26
  "env": {
93
- "BUNKER_URI": "bunker://...",
27
+ "NOSTR_SECRET_KEY": "nsec1...",
94
28
  "NOSTR_RELAYS": "wss://relay.damus.io,wss://nos.lol"
95
29
  }
96
30
  }
@@ -98,25 +32,9 @@ Add to your Claude/Cursor/Windsurf MCP config:
98
32
  }
99
33
  ```
100
34
 
101
- **Or with an NIP-49 encrypted key (ncryptsec):**
35
+ Then ask your AI to call `whoami` to verify it works.
102
36
 
103
- ```json
104
- {
105
- "mcpServers": {
106
- "nostr": {
107
- "command": "npx",
108
- "args": ["nostr-bray"],
109
- "env": {
110
- "NOSTR_NCRYPTSEC": "ncryptsec1...",
111
- "NOSTR_NCRYPTSEC_PASSWORD": "your-password",
112
- "NOSTR_RELAYS": "wss://relay.damus.io,wss://nos.lol"
113
- }
114
- }
115
- }
116
- }
117
- ```
118
-
119
- **Or with a secret file:**
37
+ For production use, prefer NIP-46 bunker auth (your key never leaves your device):
120
38
 
121
39
  ```json
122
40
  {
@@ -125,7 +43,7 @@ Add to your Claude/Cursor/Windsurf MCP config:
125
43
  "command": "npx",
126
44
  "args": ["nostr-bray"],
127
45
  "env": {
128
- "NOSTR_SECRET_KEY_FILE": "/path/to/secret.key",
46
+ "BUNKER_URI": "bunker://...",
129
47
  "NOSTR_RELAYS": "wss://relay.damus.io,wss://nos.lol"
130
48
  }
131
49
  }
@@ -137,304 +55,109 @@ Auth tier progression (safest to least safe): **bunker** > **ncryptsec** > **fil
137
55
 
138
56
  ## Tool Groups
139
57
 
140
- ### Identity (15 tools) -- create, derive, switch, prove, backup, migrate, and resolve NIP-05 identifiers
141
-
142
- | Tool | Description |
143
- |------|-------------|
144
- | `whoami` | Returns the active identity's npub |
145
- | `identity-create` | Generate a fresh identity with BIP-39 mnemonic |
146
- | `identity-derive` | Derive a child identity by purpose and index |
147
- | `identity-derive-persona` | Derive a named persona (work, personal, anonymous) |
148
- | `identity-switch` | Switch active identity -- all tools operate as the new identity |
149
- | `identity-list` | List all known identities (public info only) |
150
- | `identity-prove` | Create blind/full linkage proof |
151
- | `identity-backup-shamir` | Split master secret into Shamir shard files |
152
- | `identity-restore-shamir` | Reconstruct secret from shard files |
153
- | `identity-backup` | Fetch profile, contacts, relay list as portable bundle |
154
- | `identity-restore` | Re-sign migratable events under the active identity |
155
- | `identity-migrate` | Full migration with preview, confirmation, and linkage proof |
156
- | `nip05-lookup` | Resolve a NIP-05 identifier (user@domain) to a pubkey and relay hints |
157
- | `nip05-verify` | Confirm a pubkey matches a claimed NIP-05 identifier |
158
- | `nip05-relays` | Fetch relay hints from a NIP-05 server for a given identifier |
159
-
160
- ### Social (15 tools) -- post, reply, react, DM, follow, and read feeds
161
-
162
- | Tool | Description |
163
- |------|-------------|
164
- | `social-post` | Post a text note (kind 1) |
165
- | `social-reply` | Reply with correct e-tag and p-tag threading |
166
- | `social-react` | React to an event (kind 7) |
167
- | `social-delete` | Request deletion of your event (kind 5) |
168
- | `social-repost` | Repost/boost an event (kind 6) |
169
- | `social-profile-get` | Fetch and parse a kind 0 profile |
170
- | `social-profile-set` | Set profile with overwrite safety guard |
171
- | `social-notifications` | Fetch mentions, replies, reactions, zap receipts |
172
- | `social-feed` | Fetch kind 1 text note feed |
173
- | `feed-by-name` | Fetch a named persona's feed without switching identity |
174
- | `profile-by-name` | Fetch a named persona's profile without switching identity |
175
- | `contacts-get` | Fetch contact list (kind 3 follows) |
176
- | `contacts-search` | Search contacts by name or NIP-05 identifier |
177
- | `contacts-follow` | Follow a pubkey (publishes updated kind 3) |
178
- | `contacts-unfollow` | Unfollow a pubkey |
179
-
180
- ### Direct Messages (4 tools) -- NIP-17 gift-wrapped DMs and conversation management
181
-
182
- | Tool | Description |
183
- |------|-------------|
184
- | `dm-send` | Send encrypted DM (NIP-17 default, NIP-04 opt-in) |
185
- | `dm-read` | Read and decrypt received DMs |
186
- | `dm-by-name` | Read DMs for a named persona without switching identity |
187
- | `dm-conversation` | Fetch a full conversation thread with a specific pubkey |
188
-
189
- ### Trust (22 tools) -- attestations, ring signatures, linkage proofs, spoken verification
190
-
191
- | Tool | Description |
192
- |------|-------------|
193
- | `trust-attest` | Create kind 31000 verifiable attestation |
194
- | `trust-claim` | Publish a self-signed trust claim |
195
- | `trust-read` | Read attestations by subject/type/attestor |
196
- | `trust-verify` | Validate attestation structure |
197
- | `trust-revoke` | Revoke an attestation (identity check) |
198
- | `trust-request` | Send attestation request via NIP-17 |
199
- | `trust-request-list` | Scan DMs for attestation requests |
200
- | `trust-proof-publish` | Publish linkage proof (kind 30078) with confirmation |
201
- | `trust-ring-prove` | Anonymous group membership proof (SAG ring signature) |
202
- | `trust-ring-verify` | Verify SAG ring signature proof |
203
- | `trust-ring-lsag-sign` | Linkable ring signature (LSAG) -- detects double-signing |
204
- | `trust-ring-lsag-verify` | Verify LSAG ring signature with key-image linkability check |
205
- | `trust-ring-key-image` | Derive the key image for your key in a given ring |
206
- | `trust-spoken-challenge` | Generate spoken verification token |
207
- | `trust-spoken-verify` | Verify spoken token response |
208
- | `trust-spoken-directional` | Generate directional spoken token (sender to recipient binding) |
209
- | `trust-spoken-encode` | Encode a spoken token for transmission |
210
- | `trust-attest-parse` | Parse raw attestation event into structured fields |
211
- | `trust-attest-filter` | Filter a list of attestations by type, issuer, or validity |
212
- | `trust-attest-temporal` | Check attestation validity at a specific point in time |
213
- | `trust-attest-chain` | Resolve a chain of delegated attestations |
214
- | `trust-attest-check-revoked` | Check whether an attestation has been revoked |
215
-
216
- ### Relay (12 tools) -- per-identity relay lists, NIP-65 management, direct queries, and intelligence
217
-
218
- | Tool | Description |
219
- |------|-------------|
220
- | `relay-list` | List relays with shared-relay warnings |
221
- | `relay-set` | Publish kind 10002 relay list |
222
- | `relay-add` | Add relay to active identity (in-memory) |
223
- | `relay-query` | Query events by kind, author, tags, time range, or full-text search (NIP-50) |
224
- | `relay-info` | Fetch NIP-11 relay information document |
225
- | `relay-count` | Count events matching a filter without fetching them (NIP-45) |
226
- | `relay-auth` | Authenticate to a relay that requires NIP-42 AUTH |
227
- | `relay-discover` | Discover relays via NIP-65 relay lists from your network |
228
- | `relay-nip-search` | Find relays that support a specific NIP |
229
- | `relay-compare` | Compare two relay sets for coverage overlap |
230
- | `relay-diversity` | Score a relay set for geographic and operator diversity |
231
- | `relay-recommend` | Recommend relays based on your network's NIP-65 lists |
232
-
233
- ### Zap (7 tools) -- Lightning payments and invoices via Nostr Wallet Connect
234
-
235
- | Tool | Description |
236
- |------|-------------|
237
- | `zap-send` | Pay a Lightning invoice via NWC |
238
- | `zap-balance` | Request wallet balance via NWC |
239
- | `zap-make-invoice` | Generate a Lightning invoice via NWC |
240
- | `zap-lookup-invoice` | Check invoice payment status via NWC |
241
- | `zap-list-transactions` | List recent Lightning transactions |
242
- | `zap-receipts` | Parse zap receipts (amount, sender, message) |
243
- | `zap-decode` | Decode bolt11 invoice fields |
244
-
245
- ### Safety (14 tools) -- duress personas and CANARY liveness proofs
246
-
247
- | Tool | Description |
248
- |------|-------------|
249
- | `safety-configure` | Configure an alternative identity persona |
250
- | `safety-activate` | Switch to alternative identity |
251
- | `canary-session-create` | Create a personal liveness canary (auto-expires) |
252
- | `canary-session-current` | Fetch the current canary token for your session |
253
- | `canary-session-verify` | Verify a canary is still live and un-tripped |
254
- | `canary-group-create` | Create a shared CANARY group with member keys |
255
- | `canary-group-join` | Join an existing CANARY group |
256
- | `canary-group-current` | Fetch the current canary for a group |
257
- | `canary-group-verify` | Verify a group canary is still live |
258
- | `canary-group-members` | List members and admins of a CANARY group |
259
- | `canary-beacon-create` | Publish a CANARY beacon event to Nostr |
260
- | `canary-beacon-check` | Check whether a beacon is still live |
261
- | `canary-duress-signal` | Emit a covert duress signal via canary trip |
262
- | `canary-duress-detect` | Detect whether a canary trip was a duress signal |
263
-
264
- ### Signet (7 tools) -- identity verification and credential checks
265
-
266
- | Tool | Description |
267
- |------|-------------|
268
- | `signet-badge` | Fetch the Signet verification badge for a pubkey |
269
- | `signet-vouch` | Vouch for another identity's Signet credential |
270
- | `signet-credentials` | List credentials associated with a Signet identity |
271
- | `signet-policy-check` | Check whether a pubkey satisfies a verification policy |
272
- | `signet-policy-set` | Set a verification policy for an interaction context |
273
- | `signet-verifiers` | List trusted verifiers in the Signet network |
274
- | `signet-challenge` | Issue a Signet verification challenge |
275
-
276
- ### Vault (9 tools) -- epoch-based encrypted access control via Dominion
277
-
278
- | Tool | Description |
279
- |------|-------------|
280
- | `vault-create` | Create an encrypted vault with Dominion epoch key |
281
- | `vault-encrypt` | Encrypt content into a vault |
282
- | `vault-share` | Share vault access with a pubkey at a given tier |
283
- | `vault-read` | Decrypt and read vault content (own vault) |
284
- | `vault-read-shared` | Decrypt content using a vault key shared by another identity |
285
- | `vault-revoke` | Revoke a pubkey's vault access |
286
- | `vault-members` | List members and their access tiers |
287
- | `vault-config` | View or update vault configuration |
288
- | `vault-rotate` | Rotate the vault epoch key |
289
-
290
- ### Blossom (10 tools) -- media uploads, verification, and server management
291
-
292
- | Tool | Description |
293
- |------|-------------|
294
- | `blossom-upload` | Upload file to a Blossom media server |
295
- | `blossom-list` | List blobs for a pubkey |
296
- | `blossom-delete` | Delete a blob by SHA-256 hash |
297
- | `blossom-mirror` | Mirror a blob to an additional server |
298
- | `blossom-check` | Check whether a blob exists on a server |
299
- | `blossom-discover` | Discover Blossom servers from a pubkey's NIP-96 list |
300
- | `blossom-verify` | Verify a blob's SHA-256 hash matches its content |
301
- | `blossom-repair` | Re-upload a blob to servers that are missing it |
302
- | `blossom-usage` | Report storage usage across all servers |
303
- | `blossom-servers` | List configured Blossom servers |
304
-
305
- ### Groups -- NIP-29 (4 tools) -- group chat, metadata, and membership
306
-
307
- | Tool | Description |
308
- |------|-------------|
309
- | `group-info` | Fetch group metadata |
310
- | `group-chat` | Read group chat messages |
311
- | `group-send` | Send message to a group |
312
- | `group-members` | List group members |
313
-
314
- ### Community NIPs (2 tools) -- publish and read community-proposed NIPs
315
-
316
- | Tool | Description |
317
- |------|-------------|
318
- | `nip-publish` | Publish a community NIP (kind 30817) |
319
- | `nip-read` | Fetch community NIPs |
320
-
321
- ### Moderation (16 tools) -- labels, mute lists, pin lists, follow sets, and bookmarks
322
-
323
- | Tool | Description |
324
- |------|-------------|
325
- | `label-create` | Create a NIP-32 label event (kind 1985) for content or identity |
326
- | `label-self` | Self-label your own content or identity |
327
- | `label-read` | Read labels applied to an event or pubkey |
328
- | `label-search` | Search labels by namespace, value, or target |
329
- | `label-remove` | Delete a label event (kind 5 deletion) |
330
- | `list-mute` | Add a pubkey, event, keyword, or hashtag to your mute list |
331
- | `list-mute-read` | Read your current mute list (NIP-51, kind 10000) |
332
- | `list-check-muted` | Check whether a pubkey or event is in your mute list |
333
- | `list-pin` | Add or remove events from your pin list (NIP-51, kind 10001) |
334
- | `list-pin-read` | Read your pinned events list |
335
- | `list-followset-create` | Create a named follow set (NIP-51, kind 30000) |
336
- | `list-followset-manage` | Add or remove pubkeys from a named follow set |
337
- | `list-followset-read` | Read a named follow set |
338
- | `list-bookmark` | Add an event to your bookmarks list (NIP-51, kind 10003) |
339
- | `list-bookmark-read` | Read your bookmarks list |
340
- | `moderation-filter` | Apply a moderation filter to a list of events or pubkeys |
341
-
342
- ### Privacy (10 tools) -- Pedersen commitments and zero-knowledge range proofs
343
-
344
- | Tool | Description |
345
- |------|-------------|
346
- | `privacy-commit` | Create a Pedersen commitment to a secret value |
347
- | `privacy-open` | Verify a commitment opening (value + blinding factor) |
348
- | `privacy-prove-range` | Prove a value is within [min, max] without revealing it |
349
- | `privacy-verify-range` | Verify a range proof against a commitment |
350
- | `privacy-prove-age` | Prove age is within a range (e.g. "18+") without revealing exact age |
351
- | `privacy-verify-age` | Verify an age range proof |
352
- | `privacy-prove-threshold` | Prove a value exceeds a threshold without revealing the exact value |
353
- | `privacy-verify-threshold` | Verify a threshold proof |
354
- | `privacy-publish-proof` | Publish a range proof as a kind 30078 Nostr event |
355
- | `privacy-read-proof` | Fetch and verify range proof events from relays |
356
-
357
- ### Marketplace (12 tools) -- discover, probe, call, and publish L402/x402 paid services
358
-
359
- | Tool | Description |
360
- |------|-------------|
361
- | `marketplace-discover` | Discover L402/x402 paid API services announced on Nostr (kind 31402) |
362
- | `marketplace-inspect` | Get full details of a specific L402 service by event ID or identifier |
363
- | `marketplace-search` | Full-text search across L402 service names, descriptions, and topics |
364
- | `marketplace-reputation` | Check a service provider's reputation via attestations and zap history |
365
- | `marketplace-compare` | Compare two or more L402 services side-by-side |
366
- | `marketplace-probe` | Test connectivity and response to a paid API endpoint |
367
- | `marketplace-pay` | Pay the L402 challenge for a service and store the credential |
368
- | `marketplace-call` | Call a paid API endpoint using a stored L402 credential |
369
- | `marketplace-announce` | Publish a kind 31402 L402 service announcement |
370
- | `marketplace-update` | Update a previously published service announcement |
371
- | `marketplace-retire` | Retire a service announcement (kind 5 deletion) |
372
- | `marketplace-credentials-clear` | Clear stored L402 credentials for a service |
373
-
374
- ### Utility (19 tools) -- encode, decode, encrypt, verify, filter, fetch, and browse NIPs
375
-
376
- | Tool | Description |
377
- |------|-------------|
378
- | `decode` | Decode npub/nsec/note/nevent/nprofile/naddr |
379
- | `encode-npub` | Encode hex pubkey as npub |
380
- | `encode-note` | Encode hex event ID as note |
381
- | `encode-nprofile` | Encode pubkey + relays as nprofile |
382
- | `encode-nevent` | Encode event ID + relays as nevent |
383
- | `encode-naddr` | Encode addressable event as naddr |
384
- | `encode-nsec` | Encode hex private key as nsec |
385
- | `key-public` | Derive pubkey from secret key |
386
- | `key-encrypt` | Encrypt a secret key with a password (NIP-49 ncryptsec) |
387
- | `key-decrypt` | Decrypt an ncryptsec (NIP-49) with a password |
388
- | `verify-event` | Verify event hash and signature |
389
- | `filter` | Test if an event matches a filter |
390
- | `nip44-encrypt` | NIP-44 encrypt for a recipient |
391
- | `nip44-decrypt` | NIP-44 decrypt from a sender |
392
- | `count` | Count events matching a filter |
393
- | `fetch` | Fetch events by nip19 code |
394
- | `nip-list` | List all official NIPs |
395
- | `nip-show` | Show a specific NIP's content |
396
- | `tombstone` | Publish a kind 5 deletion event for any event you authored |
397
-
398
- ### Workflow (7 tools) -- trust scoring, discovery, verification, identity setup, relay health
399
-
400
- | Tool | Description |
401
- |------|-------------|
402
- | `trust-score` | Compute WoT trust score for any pubkey -- combines NIP-85 assertions, NIP-VA attestations, and social distance |
403
- | `feed-discover` | Discover accounts to follow via trust-adjacent, topic, or activity strategies |
404
- | `verify-person` | Verify identity with attestations, NIP-05, linkage proofs, ring endorsements, and spoken challenges |
405
- | `identity-setup` | Guided safe identity creation -- derives personas, creates Shamir backup, configures relays |
406
- | `identity-recover` | Recover identity from Shamir backup shards with verification |
407
- | `relay-health` | Check relay set health -- reachability, NIP support, event presence, write access |
408
- | `search-actions` | Search across all available tool actions by keyword |
409
-
410
- ## NIP Support
411
-
412
- | NIP | Description | Coverage |
413
- |-----|-------------|----------|
414
- | NIP-01 | Basic protocol, event signing | Full |
415
- | NIP-02 | Follow list (kind 3) | Full |
416
- | NIP-04 | Encrypted DMs (legacy) | Opt-in (`NIP04_ENABLED=1`) |
417
- | NIP-05 | DNS identity verification | Full (lookup, verify, relay hints) |
418
- | NIP-09 | Event deletion (kind 5) | Full |
419
- | NIP-11 | Relay information document | Full |
420
- | NIP-17 | Private DMs (gift wrap) | Full (default) |
421
- | NIP-19 | bech32 encoding (npub, nsec, nprofile, nevent, naddr) | Full |
422
- | NIP-29 | Group chat | Full |
423
- | NIP-32 | Labels (kind 1985) | Full |
424
- | NIP-40 | Expiration tag | Full |
425
- | NIP-42 | Relay authentication | Full (`relay-auth`) |
426
- | NIP-44 | Encrypted payloads v2 | Full (default for DMs and NWC) |
427
- | NIP-45 | Event counts (COUNT) | Full (`relay-count`, with fallback) |
428
- | NIP-46 | Nostr Connect (bunker) | Full |
429
- | NIP-49 | Private key encryption | Full (ncryptsec) |
430
- | NIP-50 | Search capability | Full (`search` param on `relay-query`) |
431
- | NIP-51 | Lists (mute, pin, follow sets, bookmarks) | Full |
432
- | NIP-57 | Lightning zaps | Full |
433
- | NIP-65 | Relay list metadata | Full (per-identity, signature-verified) |
434
- | NIP-78 | Application-specific data | Full (proofs, linkage events) |
435
- | NIP-85 | Trust rankings | Full (WoT scoring) |
436
- | NIP-96 | HTTP file storage | Full (Blossom) |
437
- | NIP-VA | Verifiable attestations (kind 31000) | Full |
58
+ | Group | Tools | Key examples |
59
+ |-------|------:|--------------|
60
+ | **Identity** | 15 | `whoami`, `identity-derive-persona`, `identity-switch`, `identity-prove`, `nip05-lookup` |
61
+ | **Social** | 15 | `social-post`, `social-reply`, `social-feed`, `contacts-follow`, `social-notifications` |
62
+ | **Direct Messages** | 4 | `dm-send`, `dm-read`, `dm-conversation` |
63
+ | **Trust** | 22 | `trust-attest`, `trust-ring-prove`, `trust-spoken-challenge`, `trust-attest-chain` |
64
+ | **Dispatch** | 13 | `dispatch-send`, `dispatch-check`, `dispatch-reply`, `dispatch-capability-discover` |
65
+ | **Relay** | 12 | `relay-query`, `relay-set`, `relay-discover`, `relay-health`, `relay-recommend` |
66
+ | **Moderation** | 16 | `label-create`, `list-mute`, `list-bookmark`, `list-followset-create`, `moderation-filter` |
67
+ | **Marketplace** | 16 | `marketplace-discover`, `marketplace-call`, `listing-create`, `listing-search` |
68
+ | **Safety** | 14 | `canary-session-create`, `canary-group-create`, `canary-duress-signal`, `safety-activate` |
69
+ | **Blossom** | 10 | `blossom-upload`, `blossom-mirror`, `blossom-verify`, `blossom-repair` |
70
+ | **Privacy** | 10 | `privacy-commit`, `privacy-prove-range`, `privacy-prove-age`, `privacy-publish-proof` |
71
+ | **Zap** | 9 | `zap-send`, `zap-balance`, `zap-make-invoice`, `zap-decode` |
72
+ | **Vault** | 9 | `vault-create`, `vault-encrypt`, `vault-share`, `vault-rotate` |
73
+ | **Workflow** | 7 | `trust-score`, `verify-person`, `identity-setup`, `relay-health`, `feed-discover` |
74
+ | **Signet** | 7 | `signet-badge`, `signet-vouch`, `signet-credentials`, `signet-challenge` |
75
+ | **Communities** | 5 | `community-create`, `community-feed`, `community-post`, `community-approve` |
76
+ | **Badges** | 4 | `badge-create`, `badge-award`, `badge-accept`, `badge-list` |
77
+ | **Groups (NIP-29)** | 4 | `group-info`, `group-chat`, `group-send`, `group-members` |
78
+ | **Articles** | 3 | `article-publish`, `article-read`, `article-list` |
79
+ | **Calendar** | 3 | `calendar-create`, `calendar-read`, `calendar-rsvp` |
80
+ | **Wiki** | 3 | `wiki-publish`, `wiki-read`, `wiki-list` |
81
+ | **Search** | 3 | `search-notes`, `search-profiles`, `hashtag-feed` |
82
+ | **Scheduling** | 3 | `post-schedule`, `post-queue-list`, `post-queue-cancel` |
83
+ | **Community NIPs** | 2 | `nip-publish`, `nip-read` |
84
+ | **Utility** | 19 | `decode`, `encode-npub`, `nip44-encrypt`, `verify-event`, `nip-list` |
85
+ | **Catalog** | 2 | `search-actions`, `execute-action` |
86
+
87
+ Use `search-actions` to find tools by keyword, then `execute-action` to run them.
88
+
89
+ ## Dispatch: AI-to-AI Collaboration
90
+
91
+ Dispatch lets AI agents collaborate over encrypted Nostr DMs. Any MCP-capable client can send structured tasks to other agents and receive results back.
92
+
93
+ **13 message types:** send, check, reply, ack, status, cancel, refuse, failure, query, propose, capability-publish, capability-discover, capability-read.
94
+
95
+ **NIP-89 capability discovery:** Agents publish what they can do. Other agents discover capabilities by topic, then route tasks to the right collaborator automatically.
96
+
97
+ ```
98
+ dispatch-send("alice", "think", "Analyse the trade-offs of NIP-44 vs NIP-04")
99
+ dispatch-check() → inbox with pending tasks
100
+ dispatch-reply(taskId, result) → send results back encrypted
101
+ ```
102
+
103
+ All messages are NIP-44 encrypted. Recipients are resolved by name, NIP-05, npub, or hex.
104
+
105
+ ## Identity Resolver
106
+
107
+ Every tool that accepts a recipient uses universal identity resolution. You never need to look up hex pubkeys manually.
108
+
109
+ Accepted formats:
110
+ - **Name** -- `"alice"` (resolved from your dispatch contacts)
111
+ - **NIP-05** -- `"alice@example.com"` (HTTP lookup)
112
+ - **npub** -- `"npub1abc..."` (NIP-19 decode)
113
+ - **Hex** -- `"a1b2c3..."` (64-character passthrough)
114
+
115
+ ## Scheduled Posting
116
+
117
+ Sign events now, publish later. Events are signed immediately with your current key, then held in a queue until the scheduled time.
118
+
119
+ ```
120
+ post-schedule("Good morning!", "2026-04-01T08:00:00Z")
121
+ post-queue-list() → view pending scheduled posts
122
+ post-queue-cancel(id) → cancel before it publishes
123
+ ```
124
+
125
+ ## NIP Coverage
126
+
127
+ nostr-bray implements or integrates the following NIPs:
128
+
129
+ | NIP | What |
130
+ |-----|------|
131
+ | **NIP-01** | Events, signing, relay protocol |
132
+ | **NIP-02** | Follow lists |
133
+ | **NIP-05** | DNS identity (lookup, verify, relay hints) |
134
+ | **NIP-09** | Event deletion |
135
+ | **NIP-11** | Relay information |
136
+ | **NIP-17** | Private DMs (gift wrap, default) |
137
+ | **NIP-19** | bech32 encoding (npub, nsec, nprofile, nevent, naddr) |
138
+ | **NIP-23** | Long-form articles (kind 30023) |
139
+ | **NIP-29** | Group chat |
140
+ | **NIP-32** | Labels |
141
+ | **NIP-40** | Expiration tags |
142
+ | **NIP-42** | Relay auth |
143
+ | **NIP-44** | Encrypted payloads v2 |
144
+ | **NIP-45** | Event counts |
145
+ | **NIP-46** | Nostr Connect (bunker) |
146
+ | **NIP-49** | Private key encryption (ncryptsec) |
147
+ | **NIP-50** | Search |
148
+ | **NIP-51** | Lists (mute, pin, follow sets, bookmarks) |
149
+ | **NIP-52** | Calendar events |
150
+ | **NIP-54** | Wiki pages |
151
+ | **NIP-57** | Lightning zaps |
152
+ | **NIP-58** | Badges |
153
+ | **NIP-65** | Relay list metadata |
154
+ | **NIP-72** | Communities |
155
+ | **NIP-78** | Application-specific data |
156
+ | **NIP-85** | Trust rankings |
157
+ | **NIP-89** | Recommended applications (dispatch capability discovery) |
158
+ | **NIP-96** | HTTP file storage (Blossom) |
159
+ | **NIP-99** | Classified listings |
160
+ | **NIP-VA** | Verifiable attestations (kind 31000) |
438
161
 
439
162
  ## Configuration
440
163
 
@@ -450,48 +173,43 @@ Create `~/.config/bray/config.json` (or `~/.nostr/bray.json`):
450
173
  }
451
174
  ```
452
175
 
453
- Secrets are referenced by **file path** (`bunkerUriFile`, `secretKeyFile`, `nwcUriFile`) so they never appear in the config itself. This avoids exposing secrets in process environment listings.
176
+ Secrets are referenced by **file path** (`bunkerUriFile`, `secretKeyFile`, `nwcUriFile`) so they never appear in the config itself.
454
177
 
455
178
  Search order: `BRAY_CONFIG` env var > `$XDG_CONFIG_HOME/bray/config.json` > `~/.nostr/bray.json`.
456
179
 
457
- MCP server config becomes minimal:
458
-
459
- ```json
460
- {
461
- "mcpServers": {
462
- "nostr-bray": {
463
- "command": "nostr-bray"
464
- }
465
- }
466
- }
467
- ```
468
-
469
180
  ### Environment variables
470
181
 
471
- Env vars override config file values. Use when you need per-invocation overrides.
472
-
473
182
  | Variable | Description |
474
183
  |----------|-------------|
475
- | `BRAY_CONFIG` | Path to config file (overrides default search) |
476
- | `BUNKER_URI` | NIP-46 bunker URL -- safest option, key stays on your device |
477
- | `BUNKER_URI_FILE` | Path to bunker URI file (preferred over env var) |
478
- | `NOSTR_SECRET_KEY` | nsec bech32, 64-char hex, or BIP-39 mnemonic |
479
- | `NOSTR_SECRET_KEY_FILE` | Path to secret key file (takes precedence over env var) |
480
- | `NOSTR_NCRYPTSEC` | NIP-49 encrypted key (requires `NOSTR_NCRYPTSEC_PASSWORD`) |
481
- | `NOSTR_NCRYPTSEC_FILE` | Path to NIP-49 encrypted key file (requires `NOSTR_NCRYPTSEC_PASSWORD`) |
482
- | `NOSTR_NCRYPTSEC_PASSWORD` | Password to decrypt an ncryptsec key |
184
+ | `BRAY_CONFIG` | Path to config file |
185
+ | `BUNKER_URI` | NIP-46 bunker URL (safest) |
186
+ | `BUNKER_URI_FILE` | Path to bunker URI file |
187
+ | `NOSTR_SECRET_KEY` | nsec, hex, or BIP-39 mnemonic |
188
+ | `NOSTR_SECRET_KEY_FILE` | Path to secret key file |
189
+ | `NOSTR_NCRYPTSEC` | NIP-49 encrypted key |
190
+ | `NOSTR_NCRYPTSEC_PASSWORD` | Password for ncryptsec |
483
191
  | `NOSTR_RELAYS` | Comma-separated relay URLs |
484
- | `TOR_PROXY` | SOCKS5h proxy for Tor (blocks clearnet relays by default) |
192
+ | `TOR_PROXY` | SOCKS5h proxy for Tor |
485
193
  | `NIP04_ENABLED` | Set `1` to enable legacy NIP-04 DMs |
486
194
  | `TRANSPORT` | `stdio` (default) or `http` |
487
195
  | `PORT` | HTTP port (default 3000) |
488
196
 
489
197
  All secret env vars are deleted from `process.env` immediately after parsing.
490
198
 
199
+ ## CLI
200
+
201
+ ```bash
202
+ npx nostr-bray whoami # show your npub
203
+ npx nostr-bray post "hello from bray!" # publish a note
204
+ npx nostr-bray persona work # derive a work persona
205
+ npx nostr-bray prove blind # create a linkage proof
206
+ npx nostr-bray --help # see all commands
207
+ ```
208
+
491
209
  ## Documentation
492
210
 
493
- - **[Usage Guide](./docs/guide.md)** -- walkthroughs for identity management, DMs, attestations, NWC payments, and duress
494
- - **[Examples](./examples/)** -- MCP config files (basic, NWC, bunker) and a CLI workflow script
211
+ - **[Usage Guide](./docs/guide.md)** -- walkthroughs for identity, DMs, attestations, payments, and duress
212
+ - **[Examples](./examples/)** -- MCP config files and CLI workflow scripts
495
213
  - **[Contributing](./CONTRIBUTING.md)** -- setup, architecture, testing, and conventions
496
214
 
497
215
  ## For AI Assistants