Skip to main content
Glama

publishNostrEvent

Publish signed events to Nostr relays for AI agents to broadcast content, replies, reactions, and reposts across the decentralized social network.

Instructions

Publish a signed event to relays

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
signedEventYesSigned event to publish
relaysNoRelays to publish to

Implementation Reference

  • The handler function that executes the publishNostrEvent tool logic by calling publishEvent with the signed event and target relays.
    export async function publishNostrEvent({ signedEvent, relays }: z.infer<typeof publishNostrEventSchema>) {
      return publishEvent(signedEvent as any, relays ?? DEFAULT_RELAYS);
    }
  • The Zod schema definition for the publishNostrEvent tool input, detailing the structure of the signed event and relay list.
    export const publishNostrEventSchema = z.object({
      signedEvent: z.object({
        id: z.string(),
        kind: z.number(),
        content: z.string(),
        tags: z.array(z.array(z.string())),
        created_at: z.number(),
        pubkey: z.string(),
        sig: z.string(),
      }).describe('Signed event to publish'),
      relays: z.array(z.string()).optional().describe('Relays to publish to'),
    });
  • src/index.ts:83-84 (registration)
    The registration of the publishNostrEvent tool within the MCP server setup in src/index.ts.
    server.tool('publishNostrEvent', 'Publish a signed event to relays', publishNostrEventSchema.shape, async (params) => {
      return textResult(await publishNostrEvent(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