# bray MCP server

> Enables AI agents to interact with the Nostr protocol for social networking, direct messaging, identity management, and decentralized payments.

- Repository: https://github.com/forgesworn/bray
- Page: https://hostedmcp.org/servers/forgesworn/bray
- Transport: stdio
- Stars: 1
- License: MIT
- Latest version: 1.27.7

## Install

### Claude Code

```sh
claude mcp add --env 'NOSTR_SECRET_KEY=<YOUR_NOSTR_SECRET_KEY>' --env 'NOSTR_RELAYS=<NOSTR_RELAYS>' --env 'NWC_URI=<YOUR_NWC_URI>' bray -- npx -y nostr-bray
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "bray": {
      "command": "npx",
      "args": [
        "-y",
        "nostr-bray"
      ],
      "env": {
        "NOSTR_SECRET_KEY": "<YOUR_NOSTR_SECRET_KEY>",
        "NOSTR_RELAYS": "<NOSTR_RELAYS>",
        "NWC_URI": "<YOUR_NWC_URI>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "bray": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "nostr-bray"
      ],
      "env": {
        "NOSTR_SECRET_KEY": "<YOUR_NOSTR_SECRET_KEY>",
        "NOSTR_RELAYS": "<NOSTR_RELAYS>",
        "NWC_URI": "<YOUR_NWC_URI>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"bray","type":"stdio","command":"npx","args":["-y","nostr-bray"],"env":{"NOSTR_SECRET_KEY":"<YOUR_NOSTR_SECRET_KEY>","NOSTR_RELAYS":"<NOSTR_RELAYS>","NWC_URI":"<YOUR_NWC_URI>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "bray": {
      "command": "npx",
      "args": [
        "-y",
        "nostr-bray"
      ],
      "env": {
        "NOSTR_SECRET_KEY": "<YOUR_NOSTR_SECRET_KEY>",
        "NOSTR_RELAYS": "<NOSTR_RELAYS>",
        "NWC_URI": "<YOUR_NWC_URI>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add bray --env 'NOSTR_SECRET_KEY=<YOUR_NOSTR_SECRET_KEY>' --env 'NOSTR_RELAYS=<NOSTR_RELAYS>' --env 'NWC_URI=<YOUR_NWC_URI>' -- npx -y nostr-bray
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.bray]
command = "npx"
args = ["-y", "nostr-bray"]

[mcp_servers.bray.env]
NOSTR_SECRET_KEY = "<YOUR_NOSTR_SECRET_KEY>"
NOSTR_RELAYS = "<NOSTR_RELAYS>"
NWC_URI = "<YOUR_NWC_URI>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'NOSTR_SECRET_KEY=<YOUR_NOSTR_SECRET_KEY>' -e 'NOSTR_RELAYS=<NOSTR_RELAYS>' -e 'NWC_URI=<YOUR_NWC_URI>' bray npx -- -y nostr-bray
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "bray": {
      "command": "npx",
      "args": [
        "-y",
        "nostr-bray"
      ],
      "env": {
        "NOSTR_SECRET_KEY": "<YOUR_NOSTR_SECRET_KEY>",
        "NOSTR_RELAYS": "<NOSTR_RELAYS>",
        "NWC_URI": "<YOUR_NWC_URI>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `NOSTR_SECRET_KEY` | yes | yes | Nostr secret key (nsec, hex, or BIP-39 mnemonic) |
| `NOSTR_RELAYS` | yes | no | Comma-separated list of Nostr relay WebSocket URLs |
| `NWC_URI` | no | yes | Nostr Wallet Connect URI for Lightning zaps |
| `BUNKER_URI` | no | no |  |
| `NOSTR_FORBID_PUBKEY` | no | no |  |
| `NOSTR_PUBKEY` | no | no |  |

## FAQ

### Can the server run in a read-only mode?

Yes, if you start the server without a key or bunker, it runs in read-only mode, allowing only lookup tools like feeds, profiles, and search.

### Does bray support AI-to-AI collaboration?

Yes, through the Dispatch system, AI agents can collaborate over encrypted Nostr DMs by sending structured tasks and discovering capabilities via NIP-89.
