Skip to main content
Glama

signNote

Sign Nostr events with private keys to authenticate and publish content on decentralized networks.

Instructions

Sign a note event

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
unsignedEventYesThe unsigned event to sign
privateKeyNoPrivate key (nsec or hex). Optional when NOSTR_BUNKER_URI is configured.

Implementation Reference

  • The signNote tool handler logic that signs a note event, either using a provided private key or by calling signEventWithBunker if in bunker mode.
    export async function signNote({ unsignedEvent, privateKey }: z.infer<typeof signNoteSchema>): Promise<VerifiedEvent> {
      if (isBunkerMode()) {
        const template: EventTemplate = {
          kind: unsignedEvent.kind,
          content: unsignedEvent.content,
          tags: unsignedEvent.tags,
          created_at: unsignedEvent.created_at,
        };
        return signEventWithBunker(template);
      }
      if (!privateKey) throw new Error('privateKey is required when NOSTR_BUNKER_URI is not configured');
      const sk = normalizePrivateKey(privateKey);
      return finalizeEvent({
        kind: unsignedEvent.kind,
        content: unsignedEvent.content,
        tags: unsignedEvent.tags,
        created_at: unsignedEvent.created_at,
      }, sk);
    }
  • The Zod schema defining the input parameters for the signNote tool.
    export const signNoteSchema = z.object({
      unsignedEvent: z.object({
        kind: z.number(),
        content: z.string(),
        tags: z.array(z.array(z.string())),
        created_at: z.number(),
        pubkey: z.string(),
      }).describe('The unsigned event to sign'),
      privateKey: z.string().optional().describe(privateKeyDesc),
    });
  • src/index.ts:61-63 (registration)
    The registration of the signNote tool in the MCP server.
    server.tool('signNote', 'Sign a note event', signNoteSchema.shape, async (params) => {
      return textResult(await signNote(params));
    });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jorgenclaw/nostr-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server