nostr-ops-mcp
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-ops-mcp publish a text note saying 'Hello from my agent!'"
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-ops-mcp
A NOSTR identity for your LLM agent. MCP server that exposes NOSTR protocol primitives — sign, publish, query, NIP-19 encode/decode, NIP-05 lookup, encrypted DMs — as tools your agent can call. Drop it into Claude Desktop, Claude Code, Cursor, or any MCP-speaking client. Hand the agent a NIP-46 bunker key (not a raw nsec). Set a kind allowlist. Let it post on your behalf within rails you control.
v0.1 — full read + write + DM surface. 16 tools wrapped in a defense-in-depth safety stack: kind allowlist (deny-by-default), recipient allowlist, rate limits, optional two-step confirmation, structured audit log. Supports both nsec (dev) and NIP-46 bunker (production).
What you can do with this
A bot that publishes kind:1 notes from your npub — daily summaries, scheduled posts, programmatic reactions to incoming events.
A NOSTR sales agent — pair with
marketplace-mcpto publish NIP-15 stalls + products as the same identity.Profile management —
nostr_publish_metadatafor kind:0 (always demands confirmation — overwriting your profile is irreversible without older relay data).DM-driven workflows — a storefront agent that watches incoming DMs (with
nostr_list_dms), decrypts orders, and replies vianostr_send_dm. Default-off behindNOSTR_DM_TOOLS_ENABLED.Cross-server identity — share the same NIP-46 bunker URI across
nostr-ops-mcpandmarketplace-mcp. One key, one identity, two specialized tool surfaces.
The safety stack is the load-bearing reason this is usable in production: an agent with the keys to publish as you can ruin your reputation in seconds if unconstrained. The server enforces what kinds it'll sign, what rate, optional second-step confirmation, and writes every call to a structured audit log.
Related MCP server: nostr-bray
The sixteen tools
Read-only — local (no network, no signer needed)
Tool | Purpose |
| Parse NIP-19 strings (npub / nsec / note / nevent / naddr / nprofile). |
| Build NIP-19 strings from raw fields. |
Read-only — network (no signer needed for query/profile/nip05)
Tool | Purpose |
| Returns the signer's pubkey + npub. Errors clearly if no signer configured. |
| Configured relay pool + each relay's connection status. |
| The workhorse. NIP-01 filters: |
| Fetch + parse kind:0 metadata for a pubkey or npub. Returns the parsed JSON content (name, about, picture, nip05, lud16, …). |
| Resolve |
Write (require signer; gated by KindAllowlist + RateLimiter + optional confirm)
Tool | Purpose |
| The primitive write tool. Pass kind / content / tags. |
| Convenience for kind:1. Reply/mention/hashtag shortcuts auto-assemble into NIP-10 tags. |
| Kind:0 profile. Always demands two-step confirmation regardless of |
| Kinds 30000–39999 (replaceable). Sets the |
| NIP-09 kind:5 soft delete. Best-effort — relays may ignore. |
| Execute a token-gated publish. Single-use; safety pipeline re-runs. |
DMs (highest-risk; default-off via NOSTR_DM_TOOLS_ENABLED=true)
Tool | Purpose |
| NIP-04 (kind:4) DM with NIP-44 encryption by default; NIP-04 supported for legacy compat. Gated by |
| Fetch + decrypt the thread with a counterparty. Auto-detects NIP-44 vs NIP-04 per event. |
| Decrypt a single ciphertext (when you already have the event from elsewhere). |
NIP-17 sealed/gift-wrapped DMs are not yet supported — deferred to a future v0.2 (rumor events + gift-wrapping add nontrivial complexity).
Requirements
Node 20+
A NOSTR signer — strongly preferred: a NIP-46 bunker URI from Amber (Android), nsec.app (web), or any other NIP-46 implementation. Legacy path: a raw nsec in
.env. The server logs a stderr warning at startup when nsec-on-disk is detected.
Install
# From npm (once published)
npx -y nostr-ops-mcp
# From source
git clone <repo>
cd nostr-ops-mcp
corepack enable pnpm
pnpm install
pnpm buildConfigure
cp .env.example .env
# edit .env: set NOSTR_NIP46_URI (recommended) OR NOSTR_PRIVATE_KEY
# set NOSTR_RELAYS (comma-separated wss://)
# set NOSTR_ALLOWED_KINDS (required when a signer is configured)The server auto-loads .env from this binary's own directory (next to dist/) — deliberately NOT from cwd, to avoid env-var collision when multiple MCP servers run in the same Claude Code session.
Required
Var | Purpose |
| Comma-separated |
| Comma-separated event-kind numbers the server may sign. Required when a signer is configured. Example: |
Signer — provide AT MOST one
Var | Purpose |
|
|
| Raw |
Optional safety knobs
Var | Default | Purpose |
|
| Force read-only — disables all write tools. |
|
| Opt-in for |
| unset | Hex pubkeys allowed as DM recipients. Empty = |
|
| Two-step confirm: write tools return a token, |
|
| Rolling 60s rate limit on writes. |
|
| Same but for DMs. |
|
| Allow |
|
| Server log path. |
|
| Structured audit log (one JSON line per tool call). |
Wire into an MCP client
Claude Code (project-scoped)
claude mcp add nostr-ops -s project node "$(pwd)/dist/index.js"Claude Desktop / Cursor / other clients
{
"mcpServers": {
"nostr-ops": {
"command": "npx",
"args": ["-y", "nostr-ops-mcp"],
"env": {}
}
}
}Because the server loads its own .env, leave the env block empty in the client config — keep secrets out of any committed file.
Safety model
Every write tool runs the pipeline in this order:
NOSTR_READ_ONLYgate — refuse outright.Signer presence — refuse if neither nsec nor NIP-46 URI is configured.
KindAllowlist — refuse if the event kind isn't in
NOSTR_ALLOWED_KINDS.RateLimiter — refuse if the rolling 60s
eventsbucket is full.Confirm gate — if
NOSTR_REQUIRE_CONFIRM=true(or the tool always-confirms, likepublish_metadata), return a 16-byte hex token instead of signing.Sign + publish — via NDK; the signer handshake completes lazily on first use (relevant for NIP-46 where the bunker handshake is async).
Audit log — append-only JSON line for every attempt (ok / blocked / error).
DM tools add three more checks on top: NOSTR_DM_TOOLS_ENABLED, DmAllowlist (per-recipient), and a separate dms rate bucket.
The floor is your signer. If using NIP-46, the bunker can refuse any sign request — that's the strongest safety boundary. This server's checks are belt-and-suspenders on top.
Verifying calls actually went through
tail -n 5 nostr-mcp-audit.logSuccessful publish: {"ts":"...","tool":"nostr_publish_text_note","outcome":"ok","result":{"event_id":"...","relays_accepted":[...]}}. Blocked / error lines are equally structured. The audit log is append-only by intent — rotate it as part of your operational hygiene.
Testing
pnpm typecheck # tsc --noEmit
pnpm test # 13 vitest cases (KindAllowlist, RateLimiter, nip19 roundtrip)
pnpm build # dist/index.js (~58 KB ESM bundle)For end-to-end testing against live relays, configure a throwaway nsec + a couple of public relays (damus.io, nos.lol) and run a small loop: nostr_publish_text_note → nostr_query_events to confirm the note round-tripped. The nostr_send_dm → nostr_list_dms loop validates the DM path (you can DM yourself for a closed-loop check).
Companion servers
nwc-mcp— Lightning wallet over NWC. Pair these to build sats-spending NOSTR agents.marketplace-mcp— NIP-15 marketplace publish (Shopstr-compatible). Uses the same signer setup as this server.
License
MIT — see LICENSE.
Contact / Issues
Built by LLMOps.Pro.
NOSTR:
npub1hdg932jvwc3jdvkqywgqv0ue4nn60exrf92asy8mtazt3hjg7d2s2yw0nw— follow, DM, zap.Lightning Address:
sovereigncitizens@getalby.com— for support zaps and "this was useful" tips.Bug reports / feature requests: open a GitHub issue (link forthcoming).
Security issues: please disclose privately via NOSTR DM before opening a public issue.
Available Tools
16 toolsnostr_confirm_publishA
Execute a previously-prepared signed publish, identified by its one-time token. Only meaningful when NOSTR_REQUIRE_CONFIRM=true, or when called after publish_metadata (which always confirms). Token is consumed (single-use); the safety pipeline (read-only, signer, kind allowlist, rate limit, dm allowlist) re-runs before signing. Dispatches to the right execute path based on which tool issued the token (publish_event variants OR send_dm).
Inputs: token (required).
nostr_decodeA
Decode a NIP-19 bech32-encoded identifier (npub / nsec / note / nevent / naddr / nprofile) into its raw fields. Local-only — no network call. Refuses nsec unless NOSTR_ALLOW_NSEC_DECODE=true; guards against accidentally surfacing a private key in tool output.
Inputs: bech32 (required).
nostr_decrypt_dmA
Decrypt a single DM ciphertext using the signer's encrypt/decrypt interface. Useful when you already have a kind:4 event from elsewhere (e.g., nostr_query_events) and just need the plaintext. Auto-detects NIP-44 vs NIP-04 by default. Same NOSTR_DM_TOOLS_ENABLED gate as send/list — reading plaintext is still a confidentiality surface.
Inputs: ciphertext (required), sender_pubkey (required), version.
nostr_delete_eventA
Publish a NIP-09 kind:5 deletion request for a previously-published event. Soft delete — relays may or may not honor it, and copies on relays you didn't reach stay. Requires kind 5 to be in NOSTR_ALLOWED_KINDS.
Inputs: event_id (required), reason.
nostr_encodeA
Encode a raw NIP-19 record (npub / note / nevent / naddr / nprofile) into its bech32 form. Local-only — no network call. Does NOT support nsec encoding (private keys must not transit the agent).
Inputs: type (required), kind, relays, author_hex, +3 more.
nostr_get_profileA
Fetch and parse a NOSTR profile (kind:0 metadata) for the given pubkey or npub. Convenience wrapper over nostr_query_events with kinds=[0], limit=1. Returns the parsed JSON content (name, about, picture, nip05, lud16, etc.) plus the source event id and timestamp. Returns profile: null if no kind:0 event was found for that pubkey on the configured relay pool.
Inputs: pubkey_or_npub (required).
nostr_get_pubkeyA
Return the configured signer's public key as hex + npub. Errors clearly if no signer is configured (server is in read-only mode). For NIP-46 signers, this blocks until the bunker handshake completes.
Inputs: no named parameters.
nostr_list_dmsA
Fetch + decrypt the DM thread between the configured signer and a counterparty. Pulls kind:4 events in both directions (sent and received), decrypts each via the signer's encrypt/decrypt interface (auto-selects NIP-44 or NIP-04 based on the ciphertext), and returns the thread sorted oldest-first. Decryption failures are surfaced per-event instead of failing the whole call.
Inputs: counterparty (required), limit, since.
nostr_list_relaysA
List the configured relay pool with each relay's current connection status.
Inputs: no named parameters.
nostr_publish_addressable_eventA
Publish a parameterized-replaceable / addressable event (kind 30000–39999). The marketplace MCP's load-bearing bridge — NIP-15 stalls (kind 30017) and products (kind 30018) flow through this. Sets the d tag automatically from the d_tag input. Republishing with the same (kind, pubkey, d_tag) replaces the prior version on relays that honor replaceability.
Inputs: kind (required), d_tag (required), content (required), tags.
nostr_publish_eventA
Sign and broadcast a raw NOSTR event of any allowed kind. The primitive write tool — other publish_* tools are convenience wrappers around this. Runs the full safety pipeline: read-only gate, signer presence, kind allowlist, rate limit, optional two-step confirmation.
Inputs: kind (required), content (required), tags, created_at.
nostr_publish_metadataA
Publish a kind:0 profile metadata event. Always demands two-step confirmation (regardless of NOSTR_REQUIRE_CONFIRM) because it overwrites your public profile and is hard to reason about safely from an LLM context. Requires kind 0 to be in NOSTR_ALLOWED_KINDS — explicitly opt in.
Inputs: name, about, lud16, nip05, +4 more.
nostr_publish_text_noteA
Convenience wrapper for publishing a kind:1 text note. Builds the e / p / t tags from the structured inputs (replies, mentions, hashtags) so the agent doesn't have to assemble them. Requires kind 1 to be in NOSTR_ALLOWED_KINDS.
Inputs: content (required), hashtags, mention_pubkeys, reply_to_author, +1 more.
nostr_query_eventsA
Query events from the configured relay pool using NIP-01 filters. Supports kinds, authors, since/until/limit, and tag filters (#e, #p, #d, #t). Returns an array of events as plain objects (id, kind, pubkey, created_at, content, tags, sig). The workhorse read tool.
Inputs: d_tag, e_tag, kinds, limit, +5 more.
nostr_send_dmA
Encrypt + send a NIP-04 (kind:4) direct message. Defaults to NIP-44 encryption (current standard); pass version="nip04" only for legacy compatibility. Gated by NOSTR_DM_TOOLS_ENABLED + NOSTR_DM_ALLOWLIST + rate limit. For modern sealed DMs (NIP-17) wait for the next version.
Inputs: content (required), to_pubkey (required), version.
nostr_verify_nip05A
Verify a NIP-05 identifier resolves to the expected pubkey. Fetches https://{domain}/.well-known/nostr.json?name={name} and looks up names[name]. If expected_pubkey is provided, returns verified=true only if the resolved pubkey matches; otherwise returns verified=true on any successful resolution + the resolved pubkey. Also surfaces the recipient's relay hints if the well-known doc advertises them (NIP-65 outbox path).
Inputs: identifier (required), expected_pubkey.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 16 tools
Most tools have distinct purposes, but the publish wrappers (publish_text_note, publish_metadata, publish_addressable_event) around the primitive publish_event could cause minor confusion if descriptions aren't read carefully.
All tools follow a consistent snake_case pattern with 'nostr_' prefix and verb_noun format (e.g., nostr_get_profile, nostr_publish_text_note). No deviations.
16 tools is well-scoped for a Nostr operations server, covering basic CRUD, DMs, utilities, and marketplace-specific events without being excessive.
Covers essential operations: event query/publish/delete, profile management, DMs, encoding/decoding, relay listing, and NIP-05 verification. Adequate for its stated marketplace focus.
Maintenance
Related MCP Connectors
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
MCP server for secureFlows: token-free URL builders and integration-linting tools for AI agents.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server enabling AI models to interact with the Nostr network, facilitating note posting and interaction with the freedom of speech protocol.39MIT
- 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.1,027 npm1MIT
- AlicenseAqualityDmaintenanceMCP server exposing a Lightning wallet to LLM agents over Nostr Wallet Connect (NIP-47): balance, invoices, LN address/LNURL payments, batch pay, and keysend. All spend tools are wrapped in a defense-in-depth safety stack — budget caps, allowlist, two-step confirmation, audit log.1351 npmMIT
- 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