nostr-mcp
This server is an MCP bridge that lets agents read verified public Nostr data and act on Nostr while keeping private keys out of the conversation.
Resolve any Nostr identifier (npub, note, nevent, naddr, NIP-05) and reject private-key identifiers.
Fetch verified profiles and events with relay provenance; invalid signatures are discarded.
Query kind 1 notes with author/time/text/event-reference/pubkey-mention filters.
Inspect relay NIP-11 documents (public wss:// only, no redirects).
Publish notes with reply threading, reactions, reposts, ownership-checked deletes, profile edits, and long-form markdown articles.
Manage encrypted local drafts.
Send sealed-sender private messages over NIP-17.
Upload media via Blossom with imeta tags.
Send Lightning zaps through Nostr Wallet Connect with a server-side spend cap.
Runs read-only when no identity is configured; write tools explain how to enable themselves.
Allows sending Lightning zaps via Nostr Wallet Connect using an Alby wallet, with server-enforced spend caps.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@nostr-mcp Resolve this npub and fetch the profile."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
nostr-mcp
A Model Context Protocol server for Nostr. Agents can read verified public data and act on Nostr: post notes and replies, react, repost, publish articles, manage drafts, send encrypted direct messages, upload media, and send Lightning zaps. Private keys stay out of the conversation because signing happens inside the server process.
Reads report relay provenance. Invalid signatures are discarded, duplicate events are merged, and partial relay failures show up in results instead of being hidden.
Quick start
# Register with Codex (or point any MCP host at the stdio command below)
npx -y @diegoaly_/nostr-mcp@latest install
# Create an encrypted identity (NIP-49 key file, passphrase prompted)
npx -y @diegoaly_/nostr-mcp@latest key generate// Any MCP host. Signing activates when NOSTR_KEY_PASSPHRASE is present.
{
"mcpServers": {
"nostr": {
"command": "npx",
"args": ["-y", "@diegoaly_/nostr-mcp@latest"],
"env": { "NOSTR_KEY_PASSPHRASE": "{your-passphrase}" }
}
}
}With no identity configured the server runs read-only, and every write tool explains how to enable itself when called. If you would rather not hold keys locally at all, use a NIP-46 bunker: set NOSTR_BUNKER_URI=bunker://... from Amber on Android, and the key never touches this machine.
Related MCP server: nostr-read-mcp
What it can do
Read & discover. Resolve any identifier (npub, note, nevent, naddr, NIP-05 handles), fetch profiles and events with relay provenance, reconstruct full threads, run full-text search over NIP-50 relays, look up NIP-65 relay lists, inspect NIP-11 relay documents.
Publish. Notes with automatic reply threading, reactions, reposts, deletes that check ownership first, profile editing that preserves unknown fields, and long-form markdown articles where republishing a slug edits the article.
Drafts, DMs, media, money. Encrypted local drafts. Sealed-sender private messages over NIP-17. Blossom media uploads that return ready-made imeta tags. Lightning zaps through Nostr Wallet Connect, capped by a server-side spend limit.
The complete tool reference lives in docs/tools.md, and the protocol coverage matrix in docs/nips.md.
Identity options
Option | Setup | Key location |
Encrypted key file (recommended) |
| This machine, NIP-49-encrypted |
Remote signer / Amber (NIP-46) |
| Off-machine; signer approves each request |
Raw env var (automation only) |
| Process environment |
Zaps additionally need a wallet URI (NOSTR_WALLET_NWC, from Alby/Primal/Coinos). Per-zap spending is capped by NOSTR_MAX_ZAP_MSAT regardless of what an agent tries.
Full details in docs/configuration.md.
Documentation
Doc | Contents |
All 31 tools: inputs, outputs, capability gating | |
Supported NIPs: implemented, internal, excluded | |
Every environment variable, identity setup, wallet setup | |
Layer structure, key interfaces, read/publish pipelines, secret handling | |
Dev workflow, testing principles, releasing | |
Trust boundaries and vulnerability reporting |
Requirements
Node.js 20.19 or newer
An MCP host that supports stdio servers
Development
npm run checkType checking, the offline test suite, build, a real-stdio smoke test, and npm package validation. See docs/development.md.
Security model
Signing happens inside the server process; keys never appear in tool inputs, outputs, or logs
NIP-49 encrypted keys at rest; NIP-46 bunker mode keeps keys off the machine entirely
Server-enforced zap spend cap; destructive tools are annotated and gated behind explicit configuration
Signature verification before events reach the agent; strict relay URL validation against SSRF
Bounded relay counts, result sizes, and timeouts; per-relay errors reported, never swallowed
License
MIT
Available Tools
5 toolsnostr_get_eventGet Nostr eventARead-onlyIdempotent
Fetch one signature-verified Nostr event by hex ID, note, or nevent and report which relays supplied it.
Inputs: event (required), relay_urls.
nostr_get_profileGet Nostr profileARead-onlyIdempotent
Fetch the newest signature-verified, valid JSON kind 0 profile for an npub, nprofile, or hex pubkey.
Inputs: identity (required), relay_urls.
nostr_inspect_relayInspect Nostr relayARead-onlyIdempotent
Fetch a relay's NIP-11 information document without following redirects. Only public wss:// relay URLs are accepted.
Inputs: relay_url (required), timeout_ms.
nostr_query_notesQuery Nostr notesARead-onlyIdempotent
Query signature-verified kind 1 notes with bounded author, time, text-search, event-reference, and pubkey-mention filters.
Inputs: limit, since, until, search, +4 more.
nostr_resolve_identityResolve Nostr identityARead-onlyIdempotent
Decode a hex, npub, nprofile, note, nevent, or naddr identifier. nsec and encrypted private-key identifiers are rejected.
Inputs: identifier (required), expected.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct Nostr operation: identifier resolution, profile fetch, specific event fetch, note querying, and relay inspection. No two tools overlap in purpose; boundaries are clear.
All tools use the consistent prefix 'nostr_' followed by a verb_noun pattern (resolve_identity, get_profile, get_event, query_notes, inspect_relay). Perfectly uniform and predictable.
With 5 tools, the server is well-scoped for a read-oriented Nostr client. Each tool provides a distinct capability without redundancy, fitting the typical 3-15 range ideal.
The surface covers core read operations: identity decoding, profiles, single events, filtered note queries, and relay metadata. Missing publishing and multi-event/list fetching, but these are minor gaps for a query-focused server.
Maintenance
Related MCP Connectors
Public read-only MCP server for HODLXXI agent identity, trust, receipts, and verification.
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
Read-only MCP gateway. Paid verify is $0.01 USDC on Base.
Read-only Remote MCP for externally grounded AI agent trust receipts.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceTrust-aware Nostr MCP server. 236 tools for identity, social, DMs, trust scoring, AI-to-AI dispatch, Lightning payments, privacy proofs, and encrypted vaults. NIP-46 bunker auth; keys never leave the signing device.220 npm1MIT
- AlicenseNot gradedqualityDmaintenanceA read-only MCP server for AI agents to access Nostr profiles, notes, search, and relay lists through user-chosen relays, without requiring an account or keys.MIT
- AlicenseAqualityBmaintenanceRead-only MCP server for discovering and ranking on-chain agents on Stellar mainnet via natural language search, reputation probes, and profile lookups.1352 npm1MIT
- AlicenseNot gradedqualityBmaintenanceRead-only MCP server for the Dant3 social network, exposing public feeds, rooms, agents, jobs, and platform stats to AI agents with no write capabilities.1MIT No Attribution