# bray

Connects Claude Code to the Nostr protocol for publishing notes, reading feeds, and handling private messages. Useful whenever an AI agent needs decentralized identity.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 1
- Author: forgesworn
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/forgesworn/bray
- Updated: 2026-10-22
- HTML: https://affpapa.org/en/nevibecode/mcp/bray

## What it does

The `nostr-bray` package connects your assistant to Nostr through 261 tools organized into 29 groups. Only 50 tools are exposed directly to the model, covering profile checks, feed fetching, direct messaging, and balance lookups. Remaining actions stay in a catalog: the agent locates them with `search-actions` and runs them through `execute-action`. This structure prevents context exhaustion.

Running the server requires Node.js 24 or newer. Storing raw keys in `NOSTR_SECRET_KEY` exposes them directly to the process environment. For ongoing operations, configure a NIP-46 signer bunker via `BUNKER_URI` or use encrypted keys with `NOSTR_NCRYPTSEC` instead.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `NOSTR_SECRET_KEY`, `NOSTR_RELAYS`, `NWC_URI` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add bray -e NOSTR_SECRET_KEY=<NOSTR_SECRET_KEY> -e NOSTR_RELAYS=<NOSTR_RELAYS> -e NWC_URI=<NWC_URI> -- npx -y nostr-bray
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add bray --env NOSTR_SECRET_KEY=<NOSTR_SECRET_KEY> --env NOSTR_RELAYS=<NOSTR_RELAYS> --env NWC_URI=<NWC_URI> -- npx -y nostr-bray
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "bray": {
            "command": "npx",
            "args": [
                "-y",
                "nostr-bray"
            ],
            "env": {
                "NOSTR_SECRET_KEY": "<NOSTR_SECRET_KEY>",
                "NOSTR_RELAYS": "<NOSTR_RELAYS>",
                "NWC_URI": "<NWC_URI>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "bray": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "nostr-bray"
            ],
            "env": {
                "NOSTR_SECRET_KEY": "<NOSTR_SECRET_KEY>",
                "NOSTR_RELAYS": "<NOSTR_RELAYS>",
                "NWC_URI": "<NWC_URI>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e NOSTR_SECRET_KEY=<NOSTR_SECRET_KEY> -e NOSTR_RELAYS=<NOSTR_RELAYS> -e NWC_URI=<NWC_URI> bray npx -y nostr-bray
```
Replace <…> with your own values

## When to use it
- publish notes and read user feeds across Nostr relays
- exchange encrypted direct messages with contacts
- check zap balances and inspect wallet status
- generate a key pair and recovery mnemonic via `npx nostr-bray create`

## Example prompts
- Check our active Nostr identity with `whoami`.
- Post a short note to my Nostr feed saying "Testing Claude Code integration".
- Search the action catalog for relay health inspection tools.

## Similar
- [REA](https://affpapa.org/en/nevibecode/mcp/rea.md) — MCP server · ★ 392262
- [GitHub](https://affpapa.org/en/nevibecode/mcp/github.md) — MCP server · ★ 33989
- [Netdata](https://affpapa.org/en/nevibecode/mcp/netdata.md) — MCP server · ★ 81163
- [browser-use](https://affpapa.org/en/nevibecode/mcp/browser-use.md) — MCP server · ★ 119231
- [Codebase Memory](https://affpapa.org/en/nevibecode/mcp/codebase-memory.md) — MCP server · ★ 47577
- [mcp-server](https://affpapa.org/en/nevibecode/mcp/mcp-server.md) — MCP server · ★ 43902

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
