# Connect your AI tool with MCP

import McpServers from '/snippets/McpServers.jsx';

Connect [Claude Code](https://code.claude.com/docs/en/overview) to the BSV docs through MCP, the [Model Context Protocol](https://modelcontextprotocol.io/) an AI tool uses to call an outside server for information. With it, your agent searches and reads these pages before it writes BSV code. Use it when an AI agent builds your BSV app. Without a source, the agent can pick the wrong network or put a private key in your code. At the end, the docs server is connected to your project, and you know what Simple MCP adds and where its code needs care.

## Before you begin

- [Claude Code](https://code.claude.com/docs/en/overview) installed. This guide was tested with Claude Code 2.1.286.
- Node.js 18 or newer, only for Simple MCP, which runs through `npx`.

## How it works

Two MCP servers give the agent BSV knowledge in different ways. The BSV docs server runs at `https://bsv.writedocs.io/mcp`, and Simple MCP is the `@bsv/simple-mcp` package:

<McpServers />

- BSV docs server: gives search and full pages of these docs, as Markdown. Use it for answers and code that follow these guides, starting on testnet.
- Simple MCP: gives API notes and code generators for `@bsv/simple`. Use it for looking up the `@bsv/simple` API, and check its code before you run it.

Claude Code adds each server to the current project only, so run the commands in your project folder.

## Connect the BSV docs server

The docs server runs on this site and needs no login or API key:

<Steps>
  <Step title="Add the server">
    Add the server under the name `bsv-docs`:

    ```bash
    claude mcp add --transport http bsv-docs https://bsv.writedocs.io/mcp
    ```

    ```text
    Added HTTP MCP server bsv-docs with URL: https://bsv.writedocs.io/mcp to local config
    ```

    The name is the one Claude Code shows for the server, so you can pick another.
  </Step>
  <Step title="Check the connection">
    List the servers in the project:

    ```bash
    claude mcp list
    ```

    ```text
    bsv-docs: https://bsv.writedocs.io/mcp (HTTP) - ✔ Connected
    ```
  </Step>
</Steps>

The agent now has three tools to read the docs:

| Tool | What it does |
|------|--------------|
| `list_docs` | Lists every page with its title, path, address and description |
| `search_docs` | Searches the docs by keywords and returns the best matching pages with a snippet of each, 5 by default and up to 20 |
| `get_doc` | Returns one or more pages in full, as Markdown, by path or address |

Ask Claude Code a BSV question in the same project, and it calls `search_docs` and `get_doc` before it answers. For a first payment, the docs lead the agent to [Send a payment from a web app](/docs/get-started/quick-start-browser/), where a testnet wallet in [BSV Desktop](https://desktop.bsvb.tech/) approves the payment and no private key goes in your code.

<Callout type="note">
  The page addresses in the results use `docs.bsvblockchain.org`. To read a page, the agent passes its path to `get_doc`, which works with or without the site address.
</Callout>

## Add Simple MCP

[Simple MCP](https://github.com/bsv-blockchain/simple-mcp) is a separate server for `@bsv/simple`, a library built on top of the BSV SDK. This section uses version 0.0.2 of the `@bsv/simple-mcp` package, which writes code for `@bsv/simple` 0.2.x, while npm has 0.7.0. Its server wallet setup uses a random private key when the `SERVER_PRIVATE_KEY` variable is not set. Its payment code failed in our test on testnet with `@bsv/simple` 0.7.0, since the payment was sent but never reached the recipient.

<Callout type="warning">
  Simple MCP writes Mainnet code only, so a payment it generates spends real BSV and cannot be undone. Read and adapt anything it generates before you run it.
</Callout>

<Steps>
  <Step title="Add the server">
    Add the server with the command from its README:

    ```bash
    claude mcp add simple-mcp -- npx -y @bsv/simple-mcp
    ```

    ```text
    Added stdio MCP server simple-mcp with command: npx -y @bsv/simple-mcp to local config
    ```

    Claude Code starts the server through `npx`, which downloads the package the first time.
  </Step>
  <Step title="Check the connection">
    List the servers again:

    ```bash
    claude mcp list
    ```

    ```text
    simple-mcp: npx -y @bsv/simple-mcp - ✔ Connected
    ```
  </Step>
</Steps>

Simple MCP gives the agent three kinds of content:

| Kind | What it offers |
|------|----------------|
| Resources | 11 `simple://` pages: the `@bsv/simple` API for wallets, tokens, inscriptions, MessageBox, certification, DID, credentials and overlays, plus guides for Next.js, common mistakes and patterns. The DID and credentials pages describe tooling that `@bsv/simple` 0.7.0 removed |
| Tools | 9 code generators: `scaffold_nextjs_config`, `generate_wallet_setup`, `generate_payment_handler`, `generate_token_handler`, `generate_inscription_handler`, `generate_messagebox_setup`, `generate_server_route`, `generate_credential_issuer` and `generate_did_integration` |
| Prompts | 3 prompts: `integrate_simple`, `add_bsv_feature` and `debug_simple` |

## Remove a server

Run the command with the name you gave the server:

```bash
claude mcp remove simple-mcp -s local
```

```text
Removed MCP server simple-mcp from local config
```

## Next steps

With the docs server connected, ask your agent to build a first payment from the guides, then check it on the explorer:

- [Send a payment from a web app](/docs/get-started/quick-start-browser/)
- [Verify your payment on the explorer](/docs/get-started/verify/)