# Add npubmail to your agent

npubmail gives your agent its own email address ({name}@npubmail.com). The agent's Nostr key is the account: no signup, no API key, nothing to paste. The mailbox and key are created the first time the agent uses a tool.

Receiving and replying are free. Mailing someone who never wrote to you costs 10 sats per recipient, paid per message over Lightning.

## 1. Install the MCP server

Pick one:

- **One click (Claude Desktop and other MCPB clients):** download `npubmail-mcp-0.2.0.mcpb` from https://github.com/obvioussummer46/npubmail/releases/latest and open it. Skip step 2.
- **Installer:** `curl -fsSL https://npubmail.com/install -o install.sh`, read it, then `sh install.sh`. It puts `npubmail` and `npubmail-mcp` in `~/.local/bin` and verifies checksums.
- **Binaries:** https://npubmail.com/dl/SHA256SUMS lists them; e.g. https://npubmail.com/dl/npubmail-mcp-linux-amd64, `-darwin-arm64`, `-windows-amd64.exe`.
- **Go:** `go install github.com/obvioussummer46/npubmail/cmd/npubmail-mcp@latest`

Optional: set `NPUBMAIL_NAME` to the mailbox name you want (e.g. `myagent` gives myagent@npubmail.com if free). Without it the agent still gets its permanent npub1…@npubmail.com address.

## 2. Connect it

### Claude Desktop

`~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
  "mcpServers": {
    "npubmail": {
      "command": "npubmail-mcp",
      "env": { "NPUBMAIL_NAME": "myagent" }
    }
  }
}
```

Use the full path (e.g. `/Users/you/.local/bin/npubmail-mcp`) if Claude cannot find it. Restart Claude.

### Claude Code

```sh
claude mcp add npubmail -e NPUBMAIL_NAME=myagent -- npubmail-mcp
```

### Cursor

`~/.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "npubmail": { "command": "npubmail-mcp", "env": { "NPUBMAIL_NAME": "myagent" } }
  }
}
```

### VS Code (Copilot agent mode)

`.vscode/mcp.json`:

```json
{
  "servers": {
    "npubmail": { "type": "stdio", "command": "npubmail-mcp", "env": { "NPUBMAIL_NAME": "myagent" } }
  }
}
```

### Hermes Agent

`~/.hermes/config.yaml`:

```yaml
mcp_servers:
  npubmail:
    command: npubmail-mcp
    env:
      NPUBMAIL_NAME: myagent
    timeout: 660        # wait_for_code can block up to 600 s
```

Skill (teaches the agent when and how to use it): `hermes skills install well-known:https://npubmail.com/.well-known/skills/npubmail`

### OpenClaw, Goose, Windsurf, others

Any MCP client that runs stdio servers: command `npubmail-mcp`, no arguments, optional env `NPUBMAIL_NAME`. Raise the tool timeout to about 11 minutes if the client allows it, because `wait_for_code` and `wait_for_email` block until mail arrives.

## 3. Try it

Ask your agent:

> What is my email address?

Then:

> Create an alias for signing up at example.com and wait for the verification code.

## The key

The key is stored in `~/.config/npubmail/` (mode 600). It is the mailbox: back it up, and do not share it. Mail at rest is sealed to this key, so we cannot read it, and nobody can recover it without the key.

## Without MCP

- CLI: `npubmail init myagent`, `npubmail alias --ttl 1`, `npubmail code --timeout 120`, `npubmail send --to … --subject … --text …`
- HTTP API (NIP-98 signed): https://npubmail.com/api
- Full plain-text guide for agents: https://npubmail.com/llms.txt

Listed in the official MCP Registry as `com.npubmail/npubmail`. Clients are open source (MIT): https://github.com/obvioussummer46/npubmail
