CortexCloud MCP
# @cortexcloud/mcp
MCP server for the **CortexCloud API** — pay-per-call AI generation, data and RPC endpoints through the [x402](https://x402.org) protocol. No API keys, no subscriptions; every tool call is billed in **USDC on Base** and settles to the operator's wallet.
## Quick start (hosted)
No install required — point any MCP client at the public Streamable HTTP endpoint:
```
https://api.cortexcloud.org/mcp
```
Your MCP client handles the x402 payment handshake automatically; each call pays from the wallet your agent is authorized to spend.
## Running it yourself
### Streamable HTTP server (like the hosted one)
```bash
npm run build
EVM_PRIVATE_KEY=0x... node dist/http.js # signs + pays calls; defaults to port 3200
# listening on http://localhost:3200/mcp
```
| Env | Default | Meaning |
|-----|---------|---------|
| `EVM_PRIVATE_KEY` | — | Wallet that signs + pays each x402 call. **Required.** |
| `PORT` | `3200` | HTTP listen port |
| `CORTEXCLOUD_URL` | `https://api.cortexcloud.org` | Upstream CortexCloud API base |
| `CORTEXCLOUD_PAYTO` | `"0x5a03…ea143"` | Wallet where call revenue settles |
### stdio (Claude Desktop / CLI)
```json
{
"mcpServers": {
"cortexcloud": {
"command": "npx",
"args": ["-y", "@cortexcloud/mcp"],
"env": { "EVM_PRIVATE_KEY": "0x..." }
}
}
}
```
## Tools (22)
**AI** — `chat_completions` `responses` `embeddings` `models` `image_generation` `text_to_speech`
**Search & news** — `web_search` `search_contents` `news`
**Market/data** — `prices` `coins_search` `crypto_history` `fx_list` `fx_price` `defi_yields` `defi_protocols`
**Chain** — `base_balance` `base_token_balance` `eth_balance` `ethereum_rpc` `dex_search` `dex_pairs`
Schema for every tool is exposed via MCP's `tools/list` — no docs drift, what a client sees is what runs.
## How x402 works under the hood
Each call performs an x402 HTTP exchange against the CortexCloud API: request → payment challenge → signed `TransferWithAuthorization` → valid data. The SDK core handles the handshake; `@x402/evm` builds + signs the transfer; `@x402/fetch` drives the HTTP loop. Money in is trustless — cold settlement on-chain, no API-key storage, no subscriptions, no per-seat licensing.
## License
MITTDQS
Scored across 4 tools
Each tool has a distinct role: estimate analyzes a problem, optimize submits a paid job, get_job polls results, and list_backends shows available solvers. The descriptions clearly separate them, reducing any chance of misselection.
All tools share the 'cortex_' prefix and follow a consistent verb-first snake_case pattern (estimate_optimization, optimize, get_job, list_backends). This makes the toolset predictable and easy to navigate.
With 4 tools, the server covers its core workflow (estimate, solve, poll, list backends) without bloat. The count is well within the ideal range and each tool serves a necessary function for the stated purpose.
The core lifecycle of estimating, starting, and retrieving optimization jobs is fully covered. A minor gap is the lack of job cancellation or history management, but for the intended use case this is not a critical omission.