nostr-mcp
nostr-mcp
Nostr を安全に探索するための読み取り専用の Model Context Protocol サーバーです。エージェントに、Nostr 識別子の解決、プロフィールやイベントの読み取り、ノートの照会、リレーメタデータの検査を行うためのセマンティックなツールを提供します。
この最初のリリースは、意図的に秘密鍵を受け入れず、イベントを公開しません。署名は、NIP-46 などのリモートサイナーを通じて、明示的なユーザー承認の境界を設けて追加される予定です。
ツール
ツール | 目的 |
| hex、 |
| pubkey の最新の有効な kind |
| hex ID、 |
| 検証済みの kind |
| リレーの NIP-11 情報ドキュメントを取得して正規化する |
返されるすべてのイベントには、それを提供したリレーが含まれます。無効な署名は破棄され、重複するイベントはマージされ、部分的なリレー障害は隠蔽されずに報告されます。
Related MCP server: stellar-agent-search
要件
Node.js 20.19 以降
stdio サーバーをサポートする MCP ホスト
Codex へのインストール
次の 1 つのコマンドでサーバーをインストールして登録します:
npx -y @diegoyegros/nostr-mcp install登録を確認する:
npx -y @diegoyegros/nostr-mcp doctor
codex mcp listインストーラーはこの stdio コマンドを Codex に保存します:
npx -y @diegoyegros/nostr-mcp@latest登録を削除するには:
npx -y @diegoyegros/nostr-mcp uninstallCodex プラグインとしてインストール
このリポジトリは、MCP サーバーとバンドルされた Nostr スキルを含む Codex プラグインマーケットプレイスでもあります:
codex plugin marketplace add DiegoYegros/nostr-mcp --ref masterCodex を開き、/plugins を実行して、Nostr Plugins を選択し、Nostr MCP をインストールします。このプラグインは読み取り専用で、識別子の解決、公開ノートの照会、イベントの検査、リレーの来歴の報告に関するガイダンスを追加します。
直接の MCP インストーラーとプラグインのインストールは代替手段です。プラグインをインストールすると、バンドルされた MCP サーバーが提供されます。
任意の MCP クライアントで実行
npm パッケージが公開された後、stdio 互換の MCP ホストは次のコマンドで起動できます:
npx -y @diegoyegros/nostr-mcp@latestMCP クライアント設定の例:
{
"mcpServers": {
"nostr": {
"command": "npx",
"args": ["-y", "@diegoyegros/nostr-mcp@latest"],
"env": {
"NOSTR_RELAYS": "wss://relay.damus.io,wss://nos.lol"
}
}
}
}ソースから実行
npm install
npm run build
node dist/index.jsソースチェックアウトを Codex に登録する:
codex mcp add nostr -- "$(command -v node)" "$PWD/dist/index.js"設定
変数 | デフォルト | 意味 |
|
| カンマ区切りのデフォルトのリレー URL |
|
| クエリごとのタイムアウト。500〜30000 ms にクランプされます |
|
| ツール呼び出しごとの最大リレー数。1〜20 にクランプされます |
デフォルトでは、公開された wss:// リレー URL のみが受け入れられます。資格情報、フラグメント、ループバックホスト、またはプライベートネットワークの IP アドレスを含む URL は拒否されます。
ツール呼び出しが relay_urls を指定した場合、そのリレーのみが照会されます。それ以外の場合、設定されたデフォルトの前に、NIP-19 識別子からの安全なリレーヒントが試行されます。
開発
npm run checkチェックには、型チェック、54 のユニットテストと統合テスト、最新の MCP stdio ネゴシエーションスモークテスト、インストーラー CLI、プラグインメタデータの整合性、npm パッケージの内容が含まれます。リレーテストはフェイクリレーと署名済みフィクスチャを使用するため、決定的であり、公開リレーの可用性に依存しません。
公開せずに npm アーティファクトをプレビューする:
npm pack --dry-run公開
npm 名は @diegoyegros/nostr-mcp です。手動での最初のリリースは次のコマンドで公開できます:
npm login
npm publish --access public同梱の prepublishOnly フックは、公開前に完全な検証スイートを実行します。以降のリリースは、リポジトリの NPM_TOKEN シークレットを設定した後、GitHub リリースを作成することで自動化できます。リリースワークフローは、npm の来歴情報付きでパッケージを公開します。
セキュリティモデル
読み取り専用の MCP ツールアノテーション
nsecや生の秘密鍵の入力はありませんイベントがエージェントに到達する前の署名検証
SSRF リスクを低減するための厳格なリレー URL 検証
リレー数、結果サイズ、タイムアウトの制限
クエリ結果におけるリレーの来歴とリレーごとのエラー
報告方法と信頼境界の詳細については、SECURITY.md を参照してください。
ライセンス
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, no-auth MCP server over Human x AI's Content Hub and confirmed 2027 facts.
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.
Related MCP Servers
- 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.1365 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
- AlicenseNot gradedqualityDmaintenanceRead-only MCP server that provides tools to fetch SealChat public protocol docs, manifest, channel counts, and chat messages via the HTTP Agent API, without write access or database access.MIT