> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tentaclepay.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Connecting agents

> Expose the tpay wallet to Claude and other MCP clients.

`tpay` runs as a [Model Context Protocol](https://modelcontextprotocol.io) server, so an agent can pay for APIs and read balances as tools — no shell access required. This is the cleanest way to give an LLM-based agent a wallet.

## The MCP tools

`tpay mcp` exposes the active wallet over stdio with two tools:

<ResponseField name="pay" type="tool">
  Makes an HTTP request from the wallet. If the endpoint responds with `402 Payment Required`, `tpay` settles the payment and retries automatically. The user is asked to approve the payment (Touch ID on macOS) before it is signed. Returns the upstream status, headers, and body, plus a receipt when a payment was made.

  Parameters: `url` (required), `method`, `headers`, `body`.
</ResponseField>

<ResponseField name="get_balance" type="tool">
  Returns the wallet's balances for known stablecoins and SUI on the given network.

  Parameters: `network` (`mainnet` or `testnet`, defaults to `mainnet`).
</ResponseField>

<Note>
  The agent proposes a payment, but it settles only after you approve it on your device. The model never sees or holds the secret key.
</Note>

## Run with Claude

The fastest path is `tpay claude`, which launches the Claude CLI with the active wallet already wired in as an MCP server. It forwards every Claude flag:

```sh theme={null}
tpay claude
```

Ask Claude to call a paid endpoint and it will use the `pay` tool, pausing for your approval before spending.

<Note>
  `tpay claude` requires the Claude CLI to be installed and on your `PATH`.
</Note>

## Add to any MCP client

To wire the wallet into another MCP client (Claude Desktop, Cursor, and others), register `tpay mcp` as a stdio server. The exact file differs per client, but the server entry looks the same:

```json mcp config theme={null}
{
  "mcpServers": {
    "tpay": {
      "command": "tpay",
      "args": ["mcp"]
    }
  }
}
```

The server acts on whichever wallet is currently active. To pin a specific wallet, set it as the default first with `tpay account default <label>`.

## Run the server directly

You can also start the server yourself — useful for custom agent runtimes that speak MCP over stdio:

```sh theme={null}
tpay mcp
```

<Warning>
  `tpay mcp` reserves stdout for the MCP JSON-RPC stream. Don't pipe other output into it.
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="CLI reference" icon="terminal" href="/wallet/cli-reference">
    Every command and flag.
  </Card>

  <Card title="Agent skills" icon="robot" href="/skills">
    Let your coding agent install `tpay` and wire up MCP for you.
  </Card>
</CardGroup>
