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

# MCP

> Hosted Brickken MCP server for API-key and x402 workflows in MCP-compatible AI agents.

## Overview

The Brickken MCP server exposes the Brickken Dapp API and Agentic API as tools for MCP-compatible AI agents.

<CardGroup cols={2}>
  <Card title="MCP" icon="plug" href="https://mcp.brickken.com/">
    Open the official Brickken MCP page.
  </Card>

  <Card title="Health check" icon="activity" href="https://mcp.brickken.com/health">
    Check hosted server availability.
  </Card>
</CardGroup>

## Connect

Use the hosted endpoint in Claude Code, Codex, or any MCP-compatible client:

```json theme={null}
{
  "mcpServers": {
    "brickken": {
      "url": "https://mcp.brickken.com/"
    }
  }
}
```

## Session Configuration

Every MCP session is isolated. Configure credentials at runtime with the `configure` tool, then use `get_config` to verify the active environment without exposing secrets.

### API-key mode

Use this mode for the [Dapp API](/api-reference/introduction).

```json theme={null}
{
  "env": "production",
  "apiKey": "YOUR_BRICKKEN_API_KEY"
}
```

### x402 private-key mode

Use this mode for the [Agentic API](/api-reference/endpoint/agentic-methods-x402). The private key is used by the MCP server session to sign x402 payments and, in `client-signed` mode, to sign the prepared blockchain transaction. In `brickken-relayed` mode the key signs only the x402 payment — Brickken's relayer signs and broadcasts the operation.

```json theme={null}
{
  "env": "production",
  "privateKey": "0xYOUR_PRIVATE_KEY",
  "apiKey": ""
}
```

For sandbox:

```json theme={null}
{
  "env": "sandbox",
  "privateKey": "0xYOUR_PRIVATE_KEY",
  "apiKey": ""
}
```

<Warning>
  Only configure a private key in MCP clients and environments you trust. `get_config` returns booleans such as `hasApiKey` and `hasPrivateKey`, never the secret values.
</Warning>

## Configuration Tools

| Tool         | Purpose                                                                  |
| ------------ | ------------------------------------------------------------------------ |
| `configure`  | Set `env`, `baseUrl`, `apiKey`, or `privateKey` for the current session. |
| `get_config` | Inspect `env`, `baseUrl`, `hasApiKey`, and `hasPrivateKey`.              |

## Transaction Tools

| Tool                     | Purpose                                               |
| ------------------------ | ----------------------------------------------------- |
| `prepare_transactions`   | Prepare unsigned transactions for a backend `method`. |
| `send_transactions`      | Submit signed transactions to Brickken.               |
| `get_transaction_status` | Poll a transaction hash.                              |

## Dapp API Tools

These tools map to API-key authenticated dapp flows. If a private key is configured, write tools can prepare, sign, and send automatically; otherwise they return prepared transactions for external signing.

| Area                      | Tools                                                                                                                                                                                                                                               |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Tokenization              | `create_tokenization`                                                                                                                                                                                                                               |
| STOs                      | `create_sto`, `invest_in_sto`, `claim_sto`, `close_sto`                                                                                                                                                                                             |
| Security-token operations | `mint_tokens`, `whitelist_investor`, `burn_tokens`, `transfer_tokens`, `approve_tokens`, `distribute_dividend`                                                                                                                                      |
| Reads                     | `get_network_info`, `get_token_info`, `get_tokenizer_info`, `get_stos`, `get_sto_by_id`, `get_investments_by_sto_id`, `get_investor_info`, `get_allowance`, `get_whitelist_status`, `get_balance_whitelist`, `get_sto_balance`, `get_dividend_info` |

## x402 Agent Tools

These tools map to ERC-8004 and agent-token methods on Base. Preparing is free; the x402 USDC payment is charged only on send.

| Area               | Tools                                                                                                                                    |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------- |
| Agent identity     | `agent_register`, `agent_set_uri`, `agent_set_metadata`, `agent_set_wallet`, `agent_transfer_ownership`                                  |
| Reputation         | `agent_give_feedback`, `agent_revoke_feedback`, `agent_append_feedback_response`                                                         |
| Agent-owned tokens | `agent_create_token`, `agent_mint_token`, `agent_burn_token`, `agent_transfer_token`, `agent_transfer_from_token`, `agent_approve_token` |

## Networks

Use `chainId: "8453"` for Base mainnet and `chainId: "84532"` for Base Sepolia tests (decimal or hex accepted). On Base Sepolia the x402 asset is Circle USDC `0x036CbD53842c5426634e7929541eC2318f3dCF7e` (EIP-3009, 6 decimals). Always fund the payer with the exact asset quoted in `x402Requirements`.

## Execution modes

Agentic tools support both modes:

* **`brickken-relayed` (recommended).** Pass `executionMode: "brickken-relayed"` and omit `signerAddress` (and `agentWallet` for `agent_create_token`). Brickken's relayer signs and broadcasts; the session only authorizes the x402 payment. Prepare returns a single `txId`, exactly one transaction, and `x402Requirements`.
* **`client-signed`.** Provide `signerAddress`; the session signs the prepared transaction locally before sending.

## Example

Configure x402 mode, then register an agent on Base Sepolia in relayed mode:

```json theme={null}
{
  "env": "sandbox",
  "privateKey": "0xYOUR_PRIVATE_KEY",
  "apiKey": ""
}
```

```json theme={null}
{
  "chainId": "84532",
  "executionMode": "brickken-relayed",
  "name": "Research Agent",
  "description": "On-chain AI research agent",
  "image": "https://example.com/agent.png",
  "serviceName": "A2A",
  "serviceEndpoint": "https://agent.example/.well-known/agent-card.json",
  "aiModelProvider": "OpenAI",
  "aiModelName": "Research Model",
  "x402Support": true,
  "active": true
}
```

The `agent_register` result includes prepared transaction data and, when executed, the send result. Save `prepared.info.agentUuid` for later agent updates, including `agent_transfer_ownership`.
