no

nostr-mcp

A Nostr MCP server that allows to interact with Nostr, enabling posting notes, and more.

Publishernostr-mcp
Submitted date4/13/2025

๐Ÿš€ Empowering AI with Free Speech: The Nostr MCP Server

Harness the power of the Model Context Protocol (MCP) to connect your AI models to the decentralized world of Nostr. This server enables AI agents to post notes, interact with users, and leverage the censorship-resistant nature of Nostr for truly autonomous communication.

smithery badge TypeScript MCP Nostr

Why Nostr for AI? In an era of increasing content moderation, Nostr provides a vital platform for uncensored communication. By integrating your AI with Nostr, you ensure its voice remains independent and resilient.

โœจ Key Capabilities

  • Nostr Note Publication: Seamlessly post content to the Nostr network, enabling AI-driven content creation and dissemination.
  • Multi-Relay Connectivity: Connect to a diverse range of Nostr relays, maximizing reach and redundancy.
  • MCP Compliance: Adheres to the Model Context Protocol, ensuring interoperability with a wide ecosystem of AI tools and platforms.
  • Lightning Zaps (In Progress): Future support for sending Lightning Network payments (zaps) to Nostr users, enabling AI-driven micro-transactions and content monetization.
  • Real-time Communication with SSE: Leverage Server-Sent Events (SSE) for efficient, real-time data streaming and interaction.

๐Ÿ› ๏ธ Installation and Setup

Prerequisites

  • Node.js 18+

Installation Steps

  1. Clone the Repository:

    git clone https://github.com/AbdelStark/nostr-mcp cd nostr-mcp
  2. Install Dependencies:

    npm install
  3. Configure Environment Variables:

    • Create a .env file (copy from .env.example for a template).
    • LOG_LEVEL: Set the desired logging level (debug, info, warn, error).
    • NODE_ENV: Specify the environment (development, production).
    • NOSTR_RELAYS: A comma-separated list of Nostr relay URLs (e.g., wss://relay.damus.io,wss://relay.primal.net).
    • NOSTR_NSEC_KEY: Your Nostr private key (starting with nsec). Important: Handle this key with extreme care.
    • SERVER_MODE: Choose the server mode (stdio or sse).
    • PORT: The port for SSE mode (e.g., 9000).
    LOG_LEVEL=debug NODE_ENV=development NOSTR_RELAYS=wss://relay.damus.io,wss://relay.primal.net,wss://nos.lol NOSTR_NSEC_KEY=your_nsec_key_here SERVER_MODE=sse PORT=9000

Running the Server

# Development mode with hot reload npm run dev # Production mode npm start

โš™๏ธ Available Tools

The Nostr MCP Server exposes the following tools for AI interaction:

  • post_note: Publishes a new note to the Nostr network.

    { "content": "Hello from my AI agent on Nostr! ๐Ÿ‘‹" }
  • send_zap (Work in Progress): Sends a Lightning zap to a Nostr user.

    { "nip05Address": "[email protected]", "amount": 1000 }

๐Ÿงฉ Project Structure

nostr-mcp/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ index.ts # Main server entry point โ”‚ โ”œโ”€โ”€ nostr-client.ts # Nostr client implementation โ”‚ โ””โ”€โ”€ types.ts # TypeScript type definitions โ”œโ”€โ”€ .env # Environment configuration โ””โ”€โ”€ tsconfig.json # TypeScript configuration

๐Ÿงช Testing

npm test

๐Ÿค Contributing

We welcome contributions to enhance the Nostr MCP Server!

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature/my-new-feature).
  3. Commit your changes (git commit -m 'Add cool feature').
  4. Push to the branch (git push origin feature/my-new-feature).
  5. Submit a pull request.

๐Ÿ”— Resources

โœ‰๏ธ Contact

Feel free to connect with me on Nostr:

npub1hr6v96g0phtxwys4x0tm3khawuuykz6s28uzwtj5j0zc7lunu99snw2e29

Nostr Public Key QR Code


Built with โค๏ธ for a decentralized future.

Visit More

View All