nostr-mcp
A read-only MCP server for safely exploring Nostr, enabling agents to resolve identifiers, fetch profiles and events, query notes, and inspect relay metadata. It does not accept private keys or publish events.
README
nostr-mcp
A read-only Model Context Protocol server for exploring Nostr safely. It gives agents semantic tools for resolving Nostr identifiers, reading profiles and events, querying notes, and inspecting relay metadata.
This first release deliberately does not accept private keys or publish events. Signing will be added through a remote signer such as NIP-46, with explicit user approval boundaries.
Tools
| Tool | Purpose |
|---|---|
nostr_resolve_identity |
Decode hex, npub, nprofile, note, nevent, and naddr identifiers |
nostr_get_profile |
Fetch the newest valid kind 0 profile for a pubkey |
nostr_get_event |
Fetch one event by hex ID, note, or nevent |
nostr_query_notes |
Query verified kind 1 notes with bounded filters |
nostr_inspect_relay |
Fetch and normalize a relay's NIP-11 information document |
Every returned event includes the relays that supplied it. Invalid signatures are discarded, duplicate events are merged, and partial relay failures are reported rather than hidden.
Requirements
- Node.js 20.19 or newer
- An MCP host that supports stdio servers
Install for Codex
Install and register the server with one command:
npx -y @diegoyegros/nostr-mcp install
Verify the registration:
npx -y @diegoyegros/nostr-mcp doctor
codex mcp list
The installer stores this stdio command in Codex:
npx -y @diegoyegros/nostr-mcp@latest
Remove the registration with:
npx -y @diegoyegros/nostr-mcp uninstall
Install as a Codex plugin
The repository is also a Codex plugin marketplace containing the MCP server and a bundled Nostr skill:
codex plugin marketplace add DiegoYegros/nostr-mcp --ref master
Open Codex, run /plugins, select Nostr Plugins, and install Nostr MCP. The plugin is read-only and adds guidance for resolving identifiers, querying public notes, inspecting events, and reporting relay provenance.
The direct MCP installer and plugin installation are alternatives. Installing the plugin already provides its bundled MCP server.
Run with any MCP client
After the npm package is published, any stdio-compatible MCP host can launch it with:
npx -y @diegoyegros/nostr-mcp@latest
Example MCP client configuration:
{
"mcpServers": {
"nostr": {
"command": "npx",
"args": ["-y", "@diegoyegros/nostr-mcp@latest"],
"env": {
"NOSTR_RELAYS": "wss://relay.damus.io,wss://nos.lol"
}
}
}
}
Run from source
npm install
npm run build
node dist/index.js
Register a source checkout with Codex:
codex mcp add nostr -- "$(command -v node)" "$PWD/dist/index.js"
Configuration
| Variable | Default | Meaning |
|---|---|---|
NOSTR_RELAYS |
wss://relay.damus.io,wss://nos.lol,wss://relay.primal.net |
Comma-separated default relay URLs |
NOSTR_QUERY_TIMEOUT_MS |
5000 |
Per-query timeout, clamped to 500-30000 ms |
NOSTR_MAX_RELAYS |
8 |
Maximum relays per tool call, clamped to 1-20 |
Only public wss:// relay URLs are accepted by default. URLs containing credentials, fragments, loopback hosts, or private-network IP addresses are rejected.
When a tool call supplies relay_urls, only those relays are queried. Otherwise, safe relay hints from NIP-19 identifiers are tried before the configured defaults.
Development
npm run check
The checks include type checking, 54 unit and integration tests, a modern MCP stdio negotiation smoke test, the installer CLI, plugin metadata consistency, and npm package contents. Relay tests use fake relays and signed fixtures, so they are deterministic and do not depend on public relay availability.
Preview the npm artifact without publishing it:
npm pack --dry-run
Publishing
The npm name is @diegoyegros/nostr-mcp. A manual first release can be published with:
npm login
npm publish --access public
The included prepublishOnly hook runs the full verification suite before publishing. Later releases can be automated by creating a GitHub release after configuring the repository's NPM_TOKEN secret. The release workflow publishes the package with npm provenance.
Security model
- Read-only MCP tool annotations
- No
nsecor raw private-key inputs - Signature verification before events reach the agent
- Strict relay URL validation to reduce SSRF risk
- Bounded relay counts, result sizes, and timeouts
- Relay provenance and per-relay errors in query results
See SECURITY.md for reporting and trust-boundary details.
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。