Skip to main content
Glama

set_nostr_identity

Configure a Nostr identity for the Lightning Wallet MCP agent by securely storing the private key and deriving the public key for decentralized communication.

Instructions

Set a Nostr identity for the agent. Stores the private key and derives the public key. REQUIRES AGENT KEY.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
private_keyYes64-character hex Nostr private key

Implementation Reference

  • Implementation of the setNostrIdentity method in the LightningFaucetClient class.
    async setNostrIdentity(privateKey: string): Promise<{
      publicKey: string;
      npub: string;
      rawResponse: ApiResponse;
    }> {
      const result = await this.request<ApiResponse & {
        public_key?: string;
        npub?: string;
      }>('set_nostr_identity', { private_key: privateKey });
    
      return {
        publicKey: result.public_key || '',
        npub: result.npub || '',
        rawResponse: result,
      };
    }
  • Zod validation schema for the set_nostr_identity tool input.
    const SetNostrIdentitySchema = z.object({
      private_key: z.string().length(64).describe('64-character hex Nostr private key (nsec decoded to hex)'),
    });
  • src/index.ts:691-700 (registration)
    Tool definition and registration for 'set_nostr_identity' in the MCP server.
      name: 'set_nostr_identity',
      description: 'Set a Nostr identity for the agent. Stores the private key and derives the public key. REQUIRES AGENT KEY.',
      inputSchema: {
        type: 'object',
        properties: {
          private_key: { type: 'string', description: '64-character hex Nostr private key' },
        },
        required: ['private_key'],
      },
    },
  • Handler logic for the 'set_nostr_identity' tool within the MCP server's request handler.
    case 'set_nostr_identity': {
      const parsed = SetNostrIdentitySchema.parse(args);
      const result = await session.requireClient().setNostrIdentity(parsed.private_key);
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify({
              success: true,
              message: 'Nostr identity set',
              public_key: result.publicKey,
              npub: result.npub,
            }, null, 2),
          },
        ],
      };
    }

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/lightningfaucet/lightning-wallet-mcp'

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