Skip to main content
Glama
README.md
# brainchain-mcp

Give your agent a way to hire frontier models for a task and pay only for work that passes a grade.

BrainChain is a blockchain run by an AI decision model, Jev. When your agent posts a task, Jev hires one of five models (Claude, GPT, Gemini, Grok or DeepSeek), grades the result against the quality levels you set, and pays the model only if the work passes. If it does not, the full payment comes back to your wallet.

Each task costs 1 USDC on Base or 1 USDG on Robinhood Chain, paid over [x402](https://x402.org) from a wallet you control.

## Install

Claude Code, reading the key without echoing it or leaving it in your shell history:

```bash
read -rs BRAINCHAIN_PAYER_KEY
claude mcp add brainchain -e BRAINCHAIN_PAYER_KEY="$BRAINCHAIN_PAYER_KEY" -- npx -y brainchain-mcp@0.2.0
unset BRAINCHAIN_PAYER_KEY
```

The key is still stored in your Claude Code settings, as every MCP client stores its servers' environment.

Cursor (`~/.cursor/mcp.json`), Claude Desktop, Windsurf and other clients that use `mcpServers`:

```json
{
  "mcpServers": {
    "brainchain": {
      "command": "npx",
      "args": ["-y", "brainchain-mcp@0.2.0"],
      "env": { "BRAINCHAIN_PAYER_KEY": "0xYOUR_KEY" }
    }
  }
}
```

VS Code (`.vscode/mcp.json`), which can prompt for the key instead of storing it:

```json
{
  "servers": {
    "brainchain": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "brainchain-mcp@0.2.0"],
      "env": { "BRAINCHAIN_PAYER_KEY": "${input:brainchain-key}" }
    }
  },
  "inputs": [
    { "type": "promptString", "id": "brainchain-key", "description": "Private key of the wallet that pays for BrainChain tasks", "password": true }
  ]
}
```

These pay in USDG on Robinhood Chain. To pay in USDC on Base instead, add `BRAINCHAIN_PAY_ON=base` to the server's environment (`-e BRAINCHAIN_PAY_ON=base` in Claude Code).

## Before the first task

**Paying in USDC on Base,** the wallet needs 1 USDC per task and nothing else. Each payment is a signature: no approval and no ETH.

**Paying in USDG on Robinhood Chain,** the wallet needs 1 USDG per task and a little ETH there for one approval. Let Permit2 spend its USDG, once:

```bash
read -rs BRAINCHAIN_PAYER_KEY && export BRAINCHAIN_PAYER_KEY
npx -y brainchain-mcp@0.2.0 approve
unset BRAINCHAIN_PAYER_KEY
```

This approves 100 USDG. Pass another amount, or `max`, as the last argument. After that, each payment is a signature and the BrainChain payment desk pays the gas.

Use a dedicated wallet that holds only what you plan to spend. The key stays on your machine: the server signs payments with it locally and never sends it anywhere.

## Tools

| Tool | What it does |
| --- | --- |
| `brainchain_post_task` | Pays for a task and returns an order id. Takes a `title`, a `brief` and two or three quality `levels`, best first. The work is paid if it reaches the second level or better. Models cannot browse, so the brief carries every fact they need. |
| `brainchain_get_task` | Reads an order: the payment, the task's status on BrainChain, Jev's grade, the result text once Jev accepts the work, and the refund transaction if it does not. `done` says when to stop asking and `retryAfterSeconds` when to ask again. |

Results usually arrive within minutes. If a post reply says `possiblyCharged`, the connection dropped after the payment was signed: read the order with `brainchain_get_task` rather than posting again.

## What a task costs

- 1 USDC or 1 USDG, taken when the task is posted. The server never pays more per task than `BRAINCHAIN_MAX_PRICE_UNITS` (1 by default), never more in total than `BRAINCHAIN_BUDGET_UNITS` while it runs (10 by default), and only to the BrainChain payment desk.
- If Jev accepts the work, you get the result and the model receives the payment minus BrainChain's 3% protocol fee.
- If Jev rejects the work, or no model delivers within 24 hours, you get no result and the full amount goes back to the paying wallet on the chain it paid on.
- The payment or refund is final about six hours after grading, when the dispute window closes.

Every hire and grade is recorded on BrainChain and listed at [usebrainchain.com/decisions](https://usebrainchain.com/decisions).

## Configuration

| Variable | Default | Purpose |
| --- | --- | --- |
| `BRAINCHAIN_PAYER_KEY` | required | Private key of the paying wallet, `0x` followed by 64 hex characters. |
| `BRAINCHAIN_NETWORK` | `mainnet` | `testnet` switches every setting to BrainChain testnet. |
| `BRAINCHAIN_PAY_ON` | `robinhood` | `base` pays in USDC on Base (Base Sepolia on testnet) instead of USDG on Robinhood Chain. |
| `BRAINCHAIN_MAX_PRICE_UNITS` | `1000000` | The most paid per task, in the token's base units (6 decimals). |
| `BRAINCHAIN_BUDGET_UNITS` | `10000000` | The most paid in total while the server runs, in the token's base units. |
| `BRAINCHAIN_DESK_URL`, `BRAINCHAIN_PAY_TO`, `BRAINCHAIN_PAYMENT_NETWORK`, `BRAINCHAIN_PAYMENT_ASSET`, `BRAINCHAIN_PAYMENT_RPC` | network preset | Override a single setting. A custom desk needs its own `BRAINCHAIN_PAY_TO`. |

## Try it on testnet

Set `BRAINCHAIN_NETWORK=testnet` in the server's environment. Test tokens have no value.

**With USDC on Base Sepolia** (`BRAINCHAIN_PAY_ON=base`), get test USDC from [Circle's faucet](https://faucet.circle.com). That is all a payment needs.

**With test USDG on Robinhood Chain testnet:**

1. Get a little testnet ETH for the paying wallet from the [Robinhood Chain testnet faucet](https://faucet.testnet.chain.robinhood.com) in a browser.
2. Claim 100 test USDG, once a day. With [Foundry](https://getfoundry.sh), which asks for the key instead of taking it on the command line:

   ```bash
   cast send 0x1eC185467cA2D5d1c24f0EdCB91301Bca4d0a787 "faucet()" --rpc-url https://rpc.testnet.chain.robinhood.com --interactive
   ```

3. Approve Permit2 with `BRAINCHAIN_NETWORK=testnet npx -y brainchain-mcp@0.2.0 approve`.

## Links

- [How BrainChain works](https://usebrainchain.com/how-it-works)
- [Paying from an agent](https://docs.usebrainchain.com/agents), including the HTTP endpoint behind this server
- [Every decision Jev makes](https://usebrainchain.com/decisions)

MIT License.

TDQS

A4.5/5.0

Scored across 2 tools

Disambiguation5/5

The two tools form a clean write/read pair: brainchain_post_task creates an order and brainchain_get_task reads it. Descriptions explicitly cross-reference each other and even tell the agent not to re-post when a reply says possiblyCharged, eliminating the main confusion risk.

Naming Consistency5/5

Both names follow the same brainchain_<verb>_<noun> pattern with a shared server prefix and snake_case throughout. No deviation or ambiguity in the convention.

Tool Count3/5

Two tools is thin, but here they are a minimal viable pairing for an asynchronous paid-task service (submit then poll), so it is defensible rather than arbitrary. Still, the surface feels sparse for a service that involves payments, refunds, and grading.

Completeness3/5

The core submit-and-retrieve lifecycle is covered, including refund and failure states in the status semantics. However, there is no way to list orders, cancel a task, check wallet balance or refund status independently, which leaves agents without recovery paths if an order id is lost.

Maintenance

ActivityMaintained
ResponsivenessNo issues