Skip to main content
Glama

publishNostrEvent

Publish signed events to Nostr relays for AI agents to share content, reply, react, or send encrypted messages on the decentralized 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 for 'publishNostrEvent' which publishes a signed event to relays using 'publishEvent'.
    export async function publishNostrEvent({ signedEvent, relays }: z.infer<typeof publishNostrEventSchema>) {
      return publishEvent(signedEvent as any, relays ?? DEFAULT_RELAYS);
    }
  • The Zod schema defining the input parameters for the 'publishNostrEvent' tool.
    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)
    Registration of the 'publishNostrEvent' tool in the MCP server.
    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