Skip to content

Nostr MCP Integration

The Nostr Model Context Protocol (MCP) integration allows AI tools and agents to directly access structured Nostr documentation programmatically. This eliminates the need for AI tools to scrape documentation or rely solely on their training data, providing more accurate and up-to-date information about the Nostr protocol.

What is MCP?

Model Context Protocol (MCP) is a standard that allows AI tools to access external data and functionality through a defined interface. The Nostr MCP integration implements this protocol specifically for Nostr documentation, enabling AI assistants to read NIPs, understand event kinds, explore tags, and more.

Available Tools

When the Nostr MCP extension is enabled, AI agents gain access to the following tools:

ToolDescriptionParameters
read_nip(nip)Fetches and reads a NIP in markdown from the official Nostr NIPs repositorynip: NIP number (e.g., "01", "C7")
read_kind(kind)Fetches and reads a kind documentation from nostrbook.devkind: Kind number (e.g., 0, 1, 30023)
read_tag(tag)Fetches and reads a tag documentation from nostrbook.devtag: Tag name (e.g., "e", "p")
read_protocol(doc)Fetches and reads a protocol document from nostrbook.devdoc: One of "event", "filter", "client", "relay", or "index"
read_nips_index()Fetches and reads the NIPs README to get a full list of NIPs, kinds and tagsNone

Installation

The Nostr MCP integration requires Deno, a secure runtime for JavaScript and TypeScript. Install Deno on your system before continuing:

bash
curl -fsSL https://deno.land/install.sh | sh

For VSCode Users

If you're using Visual Studio Code with GitHub Copilot, you can integrate Nostr MCP by creating a .vscode/mcp.json file in your project:

json
{
  "servers": {
    "nostr": {
      "type": "stdio",
      "command": "deno",
      "args": ["run", "-A", "jsr:@nostrbook/mcp"]
    }
  }
}

This allows Copilot to access Nostr documentation directly. For more information, see Use MCP servers in VS Code.

For Goose Users

Goose is an open-source AI interface developed by Block. To install the Nostr MCP as a Goose extension:

  1. Run goose configure
  2. Choose "Add Extension"
  3. Choose "Command-line Extension"
  4. Enter "nostr" as the name
  5. Enter deno run -A jsr:@nostrbook/mcp as the command

Benefits for Developers

The Nostr MCP integration provides several benefits:

  1. Up-to-date information: AI tools can access the latest Nostr documentation, not limited by training data cutoffs
  2. Structured data: Information is provided in well-structured markdown format
  3. Accuracy: Direct access to official documentation reduces misinterpretations
  4. Comprehensive coverage: Access to all NIPs, kinds, tags, and protocol documentation
  5. Seamless integration: Works within existing AI tooling workflows

Example Usage

When integrated with your AI assistant, you can ask questions like:

What is the structure of a Nostr Kind 1 event?

And the AI can use the MCP to fetch the exact, current documentation for Kind 1 events:

Let me check the current documentation for Nostr Kind 1 events.
[AI uses read_kind(1) to fetch the latest documentation]
...

This ensures that AI responses about Nostr are accurate and up-to-date, even as the protocol evolves.

For AI and Extension Developers

The Nostr MCP is built with:

The source code is available under the AGPL v3.0 license.

Contribute

To contribute to the Nostr MCP extension:

  1. Visit the repository
  2. Install Deno
  3. Run deno task dev to launch the MCP Inspector for testing
  4. Submit pull requests with improvements