Skip to main content
Glama

Nostr MCP Server

by AustinKelsay
import { hexToNpub } from './conversion.js'; /** * Format a pubkey for display, converting to npub format * @param pubkey The pubkey in hex format * @param useShortFormat Whether to use a shortened format * @returns The formatted pubkey */ export function formatPubkey(pubkey: string, useShortFormat = false): string { try { if (!pubkey) return 'unknown'; // Convert to npub const npub = hexToNpub(pubkey); // If converting to npub failed, return a shortened hex if (!npub) { return useShortFormat ? `${pubkey.substring(0, 4)}...${pubkey.substring(60)}` : pubkey; } // Return appropriately formatted npub if (useShortFormat) { // For short format, show the first 8 and last 4 characters of the npub return `${npub.substring(0, 8)}...${npub.substring(npub.length - 4)}`; } else { // For regular format, use the full npub return npub; } } catch (error) { console.error('Error formatting pubkey:', error); return 'error'; } }

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/AustinKelsay/nostr-mcp-server'

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