nostr-bray 1.18.2 → 1.19.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.
@@ -6,6 +6,14 @@ import { handleBackupShamir, handleRestoreShamir } from './shamir.js';
6
6
  import { hexId } from '../validation.js';
7
7
  import { handleIdentityBackup, handleIdentityRestore, handleIdentityMigrate } from './migration.js';
8
8
  export function registerIdentityTools(server, deps) {
9
+ server.registerTool('whoami', {
10
+ description: 'Returns the active identity\'s npub. The simplest way to check which identity is currently in use.',
11
+ annotations: { readOnlyHint: true },
12
+ }, async () => {
13
+ return {
14
+ content: [{ type: 'text', text: deps.ctx.activeNpub }],
15
+ };
16
+ });
9
17
  server.registerTool('identity_create', {
10
18
  description: 'Generate a fresh Nostr identity with a BIP-39 mnemonic seed. Returns { npub, mnemonic }. Store the mnemonic securely — it will not be shown again. Use this when the user needs a brand new identity unrelated to the current one.',
11
19
  annotations: { readOnlyHint: false },
@@ -57,7 +65,7 @@ export function registerIdentityTools(server, deps) {
57
65
  server.registerTool('identity_list', {
58
66
  description: 'List all known identities (master + all derived). Returns array of { npub, purpose, index, personaName }. Never includes private keys. Use this to see what identities are available before switching.',
59
67
  inputSchema: {
60
- output: z.enum(['json', 'human']).default('json').describe('Response format'),
68
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
61
69
  },
62
70
  annotations: { readOnlyHint: true },
63
71
  }, async ({ output }) => {
package/dist/index.js CHANGED
@@ -32,9 +32,10 @@ export const deps = { ctx: ctx, pool, nip65, nwcUri: config.nwcUri };
32
32
  config.secretKey = '';
33
33
  config.nwcUri = undefined;
34
34
  config.bunkerUri = undefined;
35
- // Load master identity relay list
36
- const masterRelays = await nip65.loadForIdentity(ctx.activeNpub);
37
- pool.reconfigure(ctx.activeNpub, masterRelays);
35
+ // Load master identity relay list in the background — don't block tool registration
36
+ nip65.loadForIdentity(ctx.activeNpub).then(masterRelays => {
37
+ pool.reconfigure(ctx.activeNpub, masterRelays);
38
+ }).catch(e => console.error('NIP-65 relay load failed:', e.message));
38
39
  const server = new McpServer({ name: 'nostr-bray', version: '0.1.0' });
39
40
  // Phase 2: Identity tools
40
41
  registerIdentityTools(server, deps);
@@ -8,7 +8,7 @@ export function registerRelayTools(server, deps) {
8
8
  description: 'List the relay set (read/write) for the active identity. Optionally check for shared relays with another identity.',
9
9
  inputSchema: {
10
10
  compareWithNpub: z.string().optional().describe('Compare shared relays with this npub'),
11
- output: z.enum(['json', 'human']).default('json').describe('Response format'),
11
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
12
12
  },
13
13
  annotations: { readOnlyHint: true },
14
14
  }, async ({ compareWithNpub, output }) => {
@@ -92,7 +92,7 @@ export function registerSocialTools(server, deps) {
92
92
  inputSchema: {
93
93
  pubkeyHex: hexId.describe('Hex pubkey to fetch profile for'),
94
94
  npub: z.string().optional().describe('Bech32 npub (used for relay routing, defaults to active identity)'),
95
- output: z.enum(['json', 'human']).default('json').describe('Response format'),
95
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
96
96
  },
97
97
  annotations: { readOnlyHint: true },
98
98
  }, async ({ pubkeyHex, npub, output }) => {
@@ -163,7 +163,7 @@ export function registerSocialTools(server, deps) {
163
163
  server.registerTool('dm_read', {
164
164
  description: 'Read direct messages addressed to the active identity. Decrypts both NIP-17 (gift wrap) and NIP-04 (legacy). Each message includes { from, content, protocol, decrypted }. Gracefully handles decryption failures without crashing.',
165
165
  inputSchema: {
166
- output: z.enum(['json', 'human']).default('json').describe('Response format'),
166
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
167
167
  },
168
168
  annotations: { readOnlyHint: true },
169
169
  }, async ({ output }) => {
@@ -175,7 +175,7 @@ export function registerSocialTools(server, deps) {
175
175
  inputSchema: {
176
176
  since: z.number().optional().describe('Unix timestamp — only fetch notifications after this time'),
177
177
  limit: z.number().int().min(1).max(200).default(50).describe('Max notifications to return'),
178
- output: z.enum(['json', 'human']).default('json').describe('Response format'),
178
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
179
179
  },
180
180
  annotations: { readOnlyHint: true },
181
181
  }, async ({ since, limit, output }) => {
@@ -188,7 +188,7 @@ export function registerSocialTools(server, deps) {
188
188
  authors: z.array(hexId).optional().describe('Hex pubkeys to filter by'),
189
189
  since: z.number().optional().describe('Unix timestamp — only fetch posts after this time'),
190
190
  limit: z.number().int().min(1).max(100).default(20).describe('Max posts to return'),
191
- output: z.enum(['json', 'human']).default('json').describe('Response format'),
191
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
192
192
  },
193
193
  annotations: { readOnlyHint: true },
194
194
  }, async ({ authors, since, limit, output }) => {
@@ -200,7 +200,7 @@ export function registerSocialTools(server, deps) {
200
200
  inputSchema: {
201
201
  pubkeyHex: hexId.describe('Hex pubkey to fetch contacts for'),
202
202
  npub: z.string().optional().describe('Bech32 npub for relay routing (defaults to active identity)'),
203
- output: z.enum(['json', 'human']).default('json').describe('Response format'),
203
+ output: z.enum(['json', 'human']).default('human').describe('Response format'),
204
204
  },
205
205
  annotations: { readOnlyHint: true },
206
206
  }, async ({ pubkeyHex, npub, output }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nostr-bray",
3
- "version": "1.18.2",
3
+ "version": "1.19.0",
4
4
  "description": "MCP server giving AI agents sovereign Nostr identities — key derivation, personas, attestations, duress detection, zaps",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",