> For the complete documentation index, see [llms.txt](https://fourohtwo.gitbook.io/fourohtwo-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fourohtwo.gitbook.io/fourohtwo-docs/agents/mcp-server.md). Agents can also search and read this documentation through its [MCP server](https://fourohtwo.gitbook.io/fourohtwo-docs/~gitbook/mcp).

# MCP server

`fourohtwo-mcp` lets Claude, Cursor, Codex and other MCP clients find paid APIs and pay for them from one agent wallet: Fourohtwo APIs plus every endpoint in the x402 directory, paid in USDG on Robinhood Chain or USDC on Base.

## Configure

Add this to your client's MCP config (for example `claude_desktop_config.json` or `.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "fourohtwo": {
      "command": "npx",
      "args": ["-y", "fourohtwo-mcp"],
      "env": {
        "AGENT_KEY": "0x…",
        "MAX_PER_CALL_USD": "0.05",
        "MAX_DAILY_USD": "2"
      }
    }
  }
}
```

| Variable            | Default          | Description                                                             |
| ------------------- | ---------------- | ----------------------------------------------------------------------- |
| `AGENT_KEY`         |                  | Agent wallet private key. Without it the server can search but not pay. |
| `MAX_PER_CALL_USD`  | `0.10`           | Refuse calls above this price.                                          |
| `MAX_DAILY_USD`     | `5`              | Refuse calls past this daily total.                                     |
| `NETWORKS`          | `robinhood,base` | Chains the agent may pay on, in order of preference.                    |
| `PAY_WITH`          | none             | `ETH` or a token address to swap into USDG from.                        |
| `ROBINHOOD_RPC_URL` | public RPC       | Custom Robinhood Chain RPC.                                             |
| `BASE_RPC_URL`      | public RPC       | Custom Base RPC.                                                        |

## Tools

| Tool            | What it does                                                                               |
| --------------- | ------------------------------------------------------------------------------------------ |
| `search_apis`   | Searches Fourohtwo and the x402 directory. Filters: network, answering now, highest price. |
| `get_api`       | Price, parameters, uptime and rating of one Fourohtwo API.                                 |
| `call_api`      | Calls any x402 API and pays in USDG or USDC within your limits.                            |
| `wallet_status` | Balances on both chains, spend in the last 24 hours and limits.                            |

Directory descriptions are written by each provider. The tool tells the agent to treat them as information, not instructions.

Spending rules set on [fourohtwo.xyz/agents](https://fourohtwo.xyz/agents) apply here too.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://fourohtwo.gitbook.io/fourohtwo-docs/agents/mcp-server.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
