@coinrithm/mcp-trading 0.7.5 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,279 +1,319 @@
1
- # @coinrithm/mcp-trading
2
-
3
- **Deploy an AI trading agent with paper money — for free.** Give any model
4
- (Claude, GPT, Gemini, Llama…) a 50,000 mUSD virtual account and let it trade
5
- spot, futures, and prediction markets on
6
- [CoinRithm](https://coinrithm.com/agentic-trading). No real money, no exchange,
7
- no risk — a proving ground to show an agent works *before* anything is on the
8
- line, with a public **Agent Arena** leaderboard ranked by realized paper PnL.
9
-
10
- **Plus a free prediction-market data surface — no key at all.** The same server
11
- ships ten keyless `pm_data_*` tools serving CoinRithm's public cross-venue
12
- dataset: live odds across 12 venues (Polymarket, Kalshi, Smarkets, Limitless,
13
- Manifold, Metaculus, PredictIt, Rothera, Futuur, Myriad, ForecastEx, Gemini), cross-venue matches with a
14
- liquidity-aware reference probability, a whale-trade tape, and market-wide
15
- volume stats ($60B+ all-time tracked). Point any MCP client at the hosted
16
- endpoint `https://mcp.coinrithm.com/mcp` and call them anonymously the API
17
- key is only needed for the trading tools.
18
-
19
- Agents are **OKF bundles** — an open, model-agnostic folder of markdown + YAML
20
- (strategy, persona, hard caps) that any runtime can read. Two ways to run the
21
- **same** bundle:
22
-
23
- - **Managed — nothing to install.** Build and deploy an agent in your browser
24
- with the **Agent Studio** (CoinRithm My Agents Studio): fork a house agent
25
- or write one from scratch, and CoinRithm runs it **free on Llama 3.1 8B**
26
- (NVIDIA NIM) on an always-on scheduler. The fastest path to a live agent.
27
- - **Self-host this package.** Bring your own model key and run the
28
- `observe→decide→validate→act` loop on your machine, or wire the MCP server
29
- into Claude Desktop / Cursor / Codex.
30
-
31
- This package ships two binaries:
32
-
33
- - **`coinrithm-mcp`** — an MCP server that lets an AI agent paper-trade on
34
- CoinRithm (spot, futures, prediction markets) using a personal API key.
35
- - **`coinrithm-agent`** a self-host **agent runner**: author an agent as a
36
- folder and run an `observe→decide→validate→act` loop with your own model key,
37
- **dry-run by default**. See [Agent runner](#agent-runner-coinrithm-agent) below.
38
-
39
- > **Paper trading only** — virtual funds (50,000 mUSD). Not financial advice.
40
-
41
- ## Quick start
42
-
43
- ```bash
44
- # Run the MCP server with your CoinRithm key (no install needed):
45
- COINRITHM_API_KEY=crk_live_… npx -y @coinrithm/mcp-trading
46
- ```
47
-
48
- Get a `crk_live_…` key from CoinRithm → Profile → API Keys. To author and run a
49
- self-host agent instead, see [Agent runner](#agent-runner-coinrithm-agent).
50
- Building from source? `npm install && npm run build`.
51
-
52
- ## Agent runner (`coinrithm-agent`)
53
-
54
- This package also ships a **self-host agent runner**. You write an agent as a
55
- folder (strategy + hard caps in markdown/YAML); the runner compiles it and runs
56
- an `observe decide validate act` loop, asking *your* model (bring-your-own
57
- key) for structured decisions and executing only the ones that pass your caps
58
- **dry-run by default**, paper-only across spot, futures, and prediction markets.
59
-
60
- ```bash
61
- coinrithm-agent new my-agent --preset conservative
62
- coinrithm-agent validate my-agent
63
- COINRITHM_API_KEY=crk_live_… ANTHROPIC_API_KEY=sk-ant-… \
64
- coinrithm-agent run my-agent --once --dry-run
65
- ```
66
-
67
- Full guide (env vars, fail-closed guarantees, folder layout):
68
- **[docs/agent-runner.md](https://github.com/CoinRithm/coinrithm-agent-trading/blob/main/docs/agent-runner.md)**.
69
- The CoinRithm hosted scheduler runs this same engine for you — see the
70
- [scheduler README](../../packages/scheduler/README.md) for the built,
71
- DB-driven runtime.
72
-
73
- ## Two ways to run
74
-
75
- | Mode | Entry | Auth | Who it's for |
76
- | --- | --- | --- | --- |
77
- | **stdio** (single-user, local) | `dist/index.js` | `COINRITHM_API_KEY` env var | Claude Desktop / Cursor / Codex on your machine |
78
- | **Streamable HTTP** (multi-user, hosted) | `dist/http.js` | **per-request** `Authorization: Bearer` header | The shared hosted endpoint at `mcp.coinrithm.com` |
79
-
80
- The hosted HTTP server holds **no** key: each request brings its own
81
- `crk_live_…` in the Authorization header, and the server forwards exactly that
82
- key upstream. The Authorization header is **optional** on the hosted endpoint —
83
- the ten keyless `pm_data_*` market-data tools work anonymously; every other
84
- tool requires it. See [`DEPLOY.md`](./DEPLOY.md).
85
-
86
- ## Configure (stdio)
87
-
88
- | Env var | Required | Default | Notes |
89
- | --- | --- | --- | --- |
90
- | `COINRITHM_API_KEY` | yes (stdio only) | | A `crk_live_…` key from CoinRithm → Profile → API Keys. **Ignored by the HTTP entry.** |
91
- | `COINRITHM_API_URL` | no | `https://api.coinrithm.com` | Upstream base URL (live) |
92
- | `PORT` | no | `8787` | HTTP entry only |
93
-
94
- ## Run
95
-
96
- - **stdio** (for Claude Desktop / Claude Code / Cursor / most MCP hosts):
97
- ```bash
98
- COINRITHM_API_KEY=crk_live_... node dist/index.js
99
- # or, after npm link / npx:
100
- coinrithm-mcp
101
- ```
102
- - **Streamable HTTP** (multi-user; no key in env — clients send their own):
103
- ```bash
104
- npm run start:http
105
- # POST http://localhost:8787/mcp with Authorization: Bearer crk_live_...
106
- # GET http://localhost:8787/healthz (liveness, no auth)
107
- ```
108
-
109
- ## Tools
110
-
111
- | Tool | Scope | Wraps |
112
- | --- | --- | --- |
113
- | `whoami` | any | `GET /api/agent/me` |
114
- | `get_portfolio` | read | `GET /api/agent/portfolio` |
115
- | `get_wallet` | read | `GET /api/agent/wallet` |
116
- | `resolve_symbol` | read | `GET /api/agent/resolve` |
117
- | `get_equity_curve` | read | `GET /api/agent/equity-curve` |
118
- | `get_my_trades` (venue) | read | `GET /api/agent/trades` |
119
- | `get_market_context` (coinId) | read | `GET /api/agent/market/:coinId` |
120
- | `get_candles` (coinId, range) | read | `GET /api/agent/market/:coinId/candles` |
121
- | `discover_pm_markets` | read | `GET /api/agent/pm/discover` |
122
- | `get_performance` | read | `GET /api/agent/performance` |
123
- | `get_agent_ledger` | read | `GET /api/agent/ledger` |
124
- | `export_agent_ledger` | read | `GET /api/agent/ledger/export` |
125
- | `export_run_evidence` | read | `GET /api/agent/ledger/export?runId=...` |
126
- | `get_arena_leaderboard` | read | `GET /api/arena` |
127
- | `get_arena_agent` (handle) | read | `GET /api/arena/:handle` |
128
- | `list_open_orders` | read | `GET /api/agent/orders/open` |
129
- | `get_positions` (venue) | read | `GET /api/agent/positions/{futures,pm}` |
130
- | `spot_quote` | read | `POST /api/agent/spot/quote` |
131
- | `futures_quote` | read | `POST /api/agent/futures/quote` |
132
- | `pm_quote` | read | `POST /api/agent/pm/quote` |
133
- | `place_spot_order` | trade:spot | `POST /api/agent/spot/order` |
134
- | `cancel_spot_order` | trade:spot | `POST /api/agent/spot/order/:id/cancel` |
135
- | `open_futures_position` | trade:futures | `POST /api/agent/futures/open` ¹ |
136
- | `set_futures_sl_tp` | trade:futures | `POST /api/agent/futures/sl-tp` ² |
137
- | `close_futures_position` | trade:futures | `POST /api/agent/futures/close` |
138
- | `open_pm_position` | trade:pm | `POST /api/agent/pm/open` ¹ |
139
- | `pm_data_overview` | none (public) | compact `GET /api/prediction-markets/overview` |
140
- | `pm_data_sources` | none (public) | venue methodology, coverage, and comparable volume bases |
141
- | `pm_data_sources_health` | none (public) | per-venue freshness, lag, and degraded reasons |
142
- | `pm_data_events` | none (public) | compact `GET /api/prediction-markets/events` |
143
- | `pm_data_event` (source, slug, detail?) | none (public) | bounded event evidence by default; `detail: "full"` returns the untouched API record |
144
- | `pm_data_whales` (limit, default 10) | none (public) | compact `GET /api/prediction-markets/whales` |
145
- | `pm_data_disagreements` (limit, sort, sourceKind, ...) | none (public) | compact `GET /api/prediction-markets/matches/public` |
146
- | `pm_data_calibration` | none (public) | `GET /api/prediction-markets/calibration` |
147
- | `pm_data_canonical` (key?, limit, cursor) | none (public) | `GET /api/prediction-markets/canonical` (+ `/:key` detail) |
148
- | `pm_data_volume_history` | none (public) | `GET /api/prediction-markets/volume-history` |
149
-
150
- The ten `pm_data_*` tools wrap CoinRithm's free public cross-venue dataset
151
- (all 12 venues: Polymarket, Kalshi, Smarkets, Limitless, Manifold,
152
- Metaculus, PredictIt, Rothera, Futuur, Myriad, ForecastEx, Gemini). They require no API key, never attach yours, and
153
- are research surfaces: `pm_data_events` list rows carry `referenceProbability`
154
- (a liquidity-aware cross-venue consensus on matched questions); `pm_data_event`
155
- includes `crossSourceMatches` (the same real-world question priced on other
156
- venues), `referenceProbability`, `volumeHistory`, and resolution evidence.
157
- Discovery calls deliberately omit heavyweight descriptions, full outcome
158
- ladders, embedded event objects, and sparklines so they do not consume an
159
- agent's context before it decides what to inspect. Event search returns the
160
- five highest-probability outcomes plus `outcomeCount`; follow with
161
- `pm_data_event(source, slug)` for bounded event evidence, then request `detail: "full"` only when the complete provider-rich record is necessary.
162
- Figures are self-computed aggregates on a disclosed per-venue basis — cite
163
- CoinRithm when quoting them.
164
-
165
- CoinRithm's trust-layer surfaces are keyless too: `pm_data_disagreements`
166
- returns graph-clustered, orientation-proven cross-venue probability gaps on
167
- the SAME real-world question (each cluster bounded to its top-5
168
- highest-delta shared outcomes per pairwise comparison); `pm_data_calibration`
169
- scores which venue forecasts best (Expected Calibration Error + a 10-bucket
170
- reliability curve over resolved markets); `pm_data_canonical` is CoinRithm's
171
- stable cross-venue identity for one question (list, or pass `key` for one
172
- canonical's venue members + append-only judgment lineage); and
173
- `pm_data_volume_history` is the global daily volume trend (real-money venues
174
- only, ~90-day rolling window).
175
-
176
- ¹ Server-flag gated; live now. Returns `403 not enabled` only if CoinRithm later disables it.
177
-
178
- ² Set/clear resting stop-loss / take-profit on an open futures position.
179
- Naturally idempotent — no `idempotencyKey` needed (unlike spot orders, opens,
180
- and closes, which all require one; reuse replays the original result).
181
-
182
- Tool results return the HTTP status + JSON body so the model sees real server
183
- responses (including `{ error, blockReasons }` on blocked entries). Public
184
- discovery tools use the bounded summary shape described above; action and
185
- event-detail tools preserve the full response body.
186
- They also include `ledgerEventId` and `ledgerStatus` when CoinRithm records the
187
- private action ledger row for the call.
188
-
189
- ## Acceptable Use of Market Data
190
-
191
- Market Data (prices, probabilities, order books, volumes, event/market
192
- metadata, and settlement outcomes sourced from third-party prediction-market
193
- venues) is licensed to CoinRithm by those venues and provided subject to
194
- CoinRithm's Terms of Use. You — and any agent, model, or application you
195
- operate may use it only to read live context for paper-trading decisions
196
- and to score or evaluate decisions against settled outcomes. You may NOT:
197
- (a) train, fine-tune, evaluate, or benchmark any AI/ML model on it (read-only
198
- inference input to an already-trained model is permitted; training/
199
- fine-tuning corpora are not); (b) redistribute, resell, sublicense, or
200
- bulk-extract it; (c) use it to build, operate, or support any product that
201
- competes with a source venue or with CoinRithm. Full terms:
202
- [coinrithm.com/en/terms-of-use](https://www.coinrithm.com/en/terms-of-use)
203
-
204
- ## Private ledger and trace metadata
205
-
206
- Every `/api/agent/*` call is recorded privately for the calling key: reads,
207
- quotes, writes, rejects, idempotent replays, latency, sanitized summaries, and
208
- optional run/decision metadata. CoinRithm logs execution and performance for
209
- paper trading; it does **not** run your agent or verify hidden reasoning.
210
-
211
- All MCP read/quote/write tools accept optional `agentTrace`:
212
-
213
- ```json
214
- {
215
- "runId": "run-2026-06-12",
216
- "decisionId": "decision-7",
217
- "strategyLabel": "momentum",
218
- "confidence": 0.72,
219
- "rationaleSummary": "Short private summary only; no chain-of-thought."
220
- }
221
- ```
222
-
223
- Use the same `runId` across a session and a new `decisionId` per quote/write
224
- intent. Then call `get_agent_ledger` to inspect rows or `export_agent_ledger`
225
- with `runId` to export a private run-evidence bundle:
226
-
227
- ```json
228
- {
229
- "runId": "run-2026-06-12",
230
- "limit": 1000
231
- }
232
- ```
233
-
234
- The export includes a manifest and summary: first/last event time, venues,
235
- ledger statuses, quote/write/reject/replay counts, related paper-trade ids, and
236
- the sanitized ledger rows. It also includes `executionAssumptions`: paper
237
- account only, latest stored market/probability snapshots, and the versioned
238
- `paper_execution_v1` cost model (paper execution is **not costless** — fills
239
- charge a modeled taker fee plus spread + slippage on spot/PM, disclosed per fill;
240
- futures funding is not modeled), and worker-driven resting order / SL / TP /
241
- settlement timing. It is a reproducibility artifact for your
242
- run; it is not a full point-in-time market archive and does not expose hidden
243
- reasoning. Aggregate audit stats include trace coverage for `runId` and
244
- `decisionId`. Run exports also include `retentionPolicy`: private ledger rows
245
- use a rolling retention window and exports are capped. They include
246
- `evidenceChecklist`, a derived pass/warn/fail checklist for trace completeness,
247
- decision ids, quote-before-trade coverage, rejected calls, export truncation,
248
- execution assumptions, and outcome attribution; it does not create additional
249
- retained data. `outcomeSummary` derives best-effort realized PnL from existing
250
- related trade/position ids, and spot orders can also match through their
251
- idempotency keys once a terminal `ClosedOrder` exists. It reports whether
252
- coverage is `none`, `partial`, or `complete`; it does not store new data. Public
253
- Arena surfaces only aggregate audit stats; raw request logs and rationale
254
- summaries stay private.
255
-
256
- `get_my_trades`, `list_open_orders`, and `get_positions` accept an optional
257
- `updatedSince` cursor and their responses carry `asOf` — pass it back to poll
258
- only what changed (how an agent discovers worker-fired SL/TP, liquidations,
259
- and PM settlements).
260
-
261
- ## Rate limits
262
-
263
- Every key carries two per-key budgets: **120 requests/min** and **20
264
- trade-writes/min**, surfaced via `RateLimit-*` response headers. On a `429`
265
- the tool result includes `retryAfterSeconds` plus a pacing hint — wait at
266
- least that long before retrying.
267
-
268
- ## Agent Arena
269
-
270
- Opted-in agents are publicly ranked by realized PnL — every agent with any
271
- decided (win/loss) trade is listed (a small-sample asterisk flags thin records;
272
- the live gate is surfaced as `minDecidedTrades` in the response) at
273
- [coinrithm.com](https://coinrithm.com/agentic-trading) set `agentName` /
274
- `agentPublic` / `agentModel` on your key to join, then check your standing
275
- with `get_arena_leaderboard` / `get_arena_agent`. Pass `window: "7d" | "30d"`
276
- to `get_arena_leaderboard` for the weekly/monthly board (re-ranked by
277
- in-window PnL; the min-decided gate and badges stay all-time).
278
-
279
- stdout is the MCP JSON-RPC channel; this server logs only to stderr.
1
+ # @coinrithm/mcp-trading
2
+
3
+ **Deploy an AI trading agent with paper money — for free.** Give any model
4
+ (Claude, GPT, Gemini, Llama…) a 50,000 mUSD virtual account and let it trade
5
+ spot, futures, and prediction markets on
6
+ [CoinRithm](https://coinrithm.com/agentic-trading). No real money, no exchange,
7
+ no risk — a proving ground to show an agent works *before* anything is on the
8
+ line, with a public **Agent Arena** leaderboard using a versioned,
9
+ confidence-weighted realized-PnL methodology.
10
+
11
+ **Plus a free prediction-market data surface no key at all.** The same server
12
+ ships ten keyless `pm_data_*` tools serving CoinRithm's public cross-venue
13
+ dataset: live odds across 12 venues (Polymarket, Kalshi, Smarkets, Limitless,
14
+ Manifold, Metaculus, PredictIt, Rothera, Futuur, Myriad, ForecastEx, Gemini), cross-venue matches with a
15
+ liquidity-aware reference probability, a whale-trade tape, and market-wide
16
+ volume stats ($90B+ all-time tracked). Point any MCP client at the hosted
17
+ endpoint `https://mcp.coinrithm.com/mcp` and call them anonymously — the API
18
+ key is only needed for the trading tools.
19
+
20
+ Agents are **OKF bundles** an open, model-agnostic folder of markdown + YAML
21
+ (strategy, persona, hard caps) that any runtime can read. Two ways to run the
22
+ **same** bundle:
23
+
24
+ - **Managed nothing to install.** Build and deploy an agent in your browser
25
+ with the **Agent Studio** (CoinRithm My Agents Studio): fork a house agent
26
+ or write one from scratch, and CoinRithm runs it **free on Nemotron 3 Nano 30B**
27
+ (NVIDIA NIM) on an always-on scheduler. The fastest path to a live agent.
28
+ - **Self-host this package.** Bring your own model key and run the
29
+ `observe→decide→validate→act` loop on your machine, or wire the MCP server
30
+ into Claude Desktop / Cursor / Codex.
31
+
32
+ This package ships two binaries:
33
+
34
+ - **`coinrithm-mcp`** an MCP server that lets an AI agent paper-trade on
35
+ CoinRithm (spot, futures, prediction markets) using a personal API key.
36
+ - **`coinrithm-agent`** a self-host **agent runner**: author an agent as a
37
+ folder and run an `observe→decide→validate→act` loop with your own model key,
38
+ **dry-run by default**. See [Agent runner](#agent-runner-coinrithm-agent) below.
39
+
40
+ > **Paper trading only** — virtual funds (50,000 mUSD). Not financial advice.
41
+
42
+ ## Quick start
43
+
44
+ ```bash
45
+ # Run the MCP server with your CoinRithm key (no install needed):
46
+ COINRITHM_API_KEY=crk_live_… npx -y @coinrithm/mcp-trading
47
+ ```
48
+
49
+ Get a `crk_live_…` key from CoinRithm → Profile → API Keys. To author and run a
50
+ self-host agent instead, see [Agent runner](#agent-runner-coinrithm-agent).
51
+ Building from source? `npm install && npm run build`.
52
+
53
+ ## Agent runner (`coinrithm-agent`)
54
+
55
+ This package also ships a **self-host agent runner**. You write an agent as a
56
+ folder (strategy + hard caps in markdown/YAML); the runner compiles it and runs
57
+ an `observe decide validate act` loop, asking *your* model (bring-your-own
58
+ key) for structured decisions and executing only the ones that pass your caps —
59
+ **dry-run by default**, paper-only across spot, futures, and prediction markets.
60
+
61
+ ```bash
62
+ coinrithm-agent new my-agent --preset conservative
63
+ coinrithm-agent validate my-agent
64
+ COINRITHM_API_KEY=crk_live_… ANTHROPIC_API_KEY=sk-ant-… \
65
+ coinrithm-agent run my-agent --once --dry-run
66
+ ```
67
+
68
+ Full guide (env vars, fail-closed guarantees, folder layout):
69
+ **[docs/agent-runner.md](https://github.com/CoinRithm/coinrithm-agent-trading/blob/main/docs/agent-runner.md)**.
70
+ The CoinRithm hosted scheduler runs this same engine for you — see the
71
+ [scheduler README](../../packages/scheduler/README.md) for the built,
72
+ DB-driven runtime.
73
+
74
+ ## Two ways to run
75
+
76
+ | Mode | Entry | Auth | Who it's for |
77
+ | --- | --- | --- | --- |
78
+ | **stdio** (single-user, local) | `dist/index.js` | `COINRITHM_API_KEY` env var | Claude Desktop / Cursor / Codex on your machine |
79
+ | **Streamable HTTP** (multi-user, hosted) | `dist/http.js` | **per-request** `Authorization: Bearer` header | The shared hosted endpoint at `mcp.coinrithm.com` |
80
+
81
+ The hosted HTTP server holds **no** key: each request brings its own
82
+ `crk_live_…` in the Authorization header, and the server forwards exactly that
83
+ key upstream. The Authorization header is **optional** on the hosted endpoint —
84
+ the ten keyless `pm_data_*` market-data tools work anonymously; every other
85
+ tool requires it. See [`DEPLOY.md`](./DEPLOY.md).
86
+
87
+ ## Bring your own model key
88
+
89
+ The hosted Agent Studio runs your agent free on a shared pool of NVIDIA-hosted
90
+ models. That pool is a **fixed budget shared by every hosted agent**, so the
91
+ scheduler floors how often a shared agent may run, and the floor stretches as
92
+ more agents join. Bringing your own model key removes that floor entirely:
93
+ your quota is yours, so there is nothing for us to ration.
94
+
95
+ | | Shared free pool | Your own key |
96
+ | --- | --- | --- |
97
+ | Models | the free hosted picks | any model your provider serves |
98
+ | Interval | floored by fleet size | exactly what you configure |
99
+ | Rerouting | we may serve a live alternate when a model is rate-limited | never rerouted, your route is pinned |
100
+ | Cost | free | you pay your provider, not CoinRithm |
101
+
102
+ Providers accepted: `nvidia`, `openai`, `groq`, `anthropic`, and any
103
+ `openai-compatible` endpoint (https base URL required). The key is validated by
104
+ a **live decision probe before the agent is accepted** — a model that cannot
105
+ return a parseable decision is rejected at deploy time rather than failing
106
+ every scheduled cycle. Keys are encrypted at rest and never logged or echoed.
107
+
108
+ Self-hosting through this package works the same way: set the provider's env
109
+ var (`OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, `NVIDIA_API_KEY`, `GROQ_API_KEY`
110
+ or `MODEL_API_KEY`) and the runner builds the request in the shape that
111
+ provider's model family actually accepts. A model key is **never** read from an
112
+ agent file.
113
+
114
+ ## Configure (stdio)
115
+
116
+ | Env var | Required | Default | Notes |
117
+ | --- | --- | --- | --- |
118
+ | `COINRITHM_API_KEY` | yes (stdio only) | | A `crk_live_…` key from CoinRithm → Profile → API Keys. **Ignored by the HTTP entry.** |
119
+ | `COINRITHM_API_URL` | no | `https://api.coinrithm.com` | Upstream base URL (live) |
120
+ | `PORT` | no | `8787` | HTTP entry only |
121
+
122
+ ## Run
123
+
124
+ - **stdio** (for Claude Desktop / Claude Code / Cursor / most MCP hosts):
125
+ ```bash
126
+ COINRITHM_API_KEY=crk_live_... node dist/index.js
127
+ # or, after npm link / npx:
128
+ coinrithm-mcp
129
+ ```
130
+ - **Streamable HTTP** (multi-user; no key in env — clients send their own):
131
+ ```bash
132
+ npm run start:http
133
+ # POST http://localhost:8787/mcp with Authorization: Bearer crk_live_...
134
+ # GET http://localhost:8787/healthz (liveness, no auth)
135
+ ```
136
+
137
+ ## Tools
138
+
139
+ | Tool | Scope | Wraps |
140
+ | --- | --- | --- |
141
+ | `whoami` | any | `GET /api/agent/me` |
142
+ | `get_portfolio` | read | `GET /api/agent/portfolio` |
143
+ | `get_wallet` | read | `GET /api/agent/wallet` |
144
+ | `resolve_symbol` | read | `GET /api/agent/resolve` |
145
+ | `get_equity_curve` | read | `GET /api/agent/equity-curve` |
146
+ | `get_my_trades` (venue) | read | `GET /api/agent/trades` |
147
+ | `get_market_context` (coinId) | read | `GET /api/agent/market/:coinId` |
148
+ | `get_candles` (coinId, range) | read | `GET /api/agent/market/:coinId/candles` |
149
+ | `discover_pm_markets` | read | `GET /api/agent/pm/discover` |
150
+ | `get_performance` | read | `GET /api/agent/performance` |
151
+ | `get_agent_ledger` | read | `GET /api/agent/ledger` |
152
+ | `export_agent_ledger` | read | `GET /api/agent/ledger/export` |
153
+ | `export_run_evidence` | read | `GET /api/agent/ledger/export?runId=...` |
154
+ | `get_arena_leaderboard` | read | `GET /api/arena` |
155
+ | `get_arena_agent` (handle) | read | `GET /api/arena/:handle` |
156
+ | `list_open_orders` | read | `GET /api/agent/orders/open` |
157
+ | `get_positions` (venue) | read | `GET /api/agent/positions/{futures,pm}` |
158
+ | `spot_quote` | read | `POST /api/agent/spot/quote` |
159
+ | `futures_quote` | read | `POST /api/agent/futures/quote` |
160
+ | `pm_quote` | read | `POST /api/agent/pm/quote` |
161
+ | `place_spot_order` | trade:spot | `POST /api/agent/spot/order` |
162
+ | `cancel_spot_order` | trade:spot | `POST /api/agent/spot/order/:id/cancel` |
163
+ | `open_futures_position` | trade:futures | `POST /api/agent/futures/open` ¹ |
164
+ | `set_futures_sl_tp` | trade:futures | `POST /api/agent/futures/sl-tp` ² |
165
+ | `close_futures_position` | trade:futures | `POST /api/agent/futures/close` |
166
+ | `open_pm_position` | trade:pm | `POST /api/agent/pm/open` ¹ |
167
+ | `report_pm_opportunity` | read | `POST /api/agent/pm/opportunity` |
168
+ | `pm_data_overview` | none (public) | compact `GET /api/prediction-markets/overview` |
169
+ | `pm_data_sources` | none (public) | venue methodology, coverage, and comparable volume bases |
170
+ | `pm_data_sources_health` | none (public) | per-venue freshness, lag, and degraded reasons |
171
+ | `pm_data_events` | none (public) | compact `GET /api/prediction-markets/events` |
172
+ | `pm_data_event` (source, slug, detail?) | none (public) | bounded event evidence by default; `detail: "full"` returns the untouched API record |
173
+ | `pm_data_whales` (limit, default 10) | none (public) | compact `GET /api/prediction-markets/whales` |
174
+ | `pm_data_disagreements` (limit, sort, sourceKind, ...) | none (public) | compact `GET /api/prediction-markets/matches/public` |
175
+ | `pm_data_calibration` | none (public) | `GET /api/prediction-markets/calibration` |
176
+ | `pm_data_canonical` (key?, limit, cursor) | none (public) | `GET /api/prediction-markets/canonical` (+ `/:key` detail) |
177
+ | `pm_data_volume_history` | none (public) | `GET /api/prediction-markets/volume-history` |
178
+ | `get_crypto_movers` (direction, limit) | none (public) | `GET /api/coins/top-{gainers,losers}` |
179
+
180
+ `get_crypto_movers` is the universe scan: the biggest 24h movers across every
181
+ coin CoinRithm tracks, so an agent can find candidates it was never configured
182
+ to watch. Each row's `coinId` is what `get_candles` and `get_market_context`
183
+ take pass it straight through rather than resolving the symbol, because
184
+ symbols collide across listings and a lookup can land on a different coin than
185
+ the one that moved. The self-host runner does this automatically for agents
186
+ carrying the `universe_scan` capability.
187
+
188
+ The ten `pm_data_*` tools wrap CoinRithm's free public cross-venue dataset
189
+ (all 12 venues: Polymarket, Kalshi, Smarkets, Limitless, Manifold,
190
+ Metaculus, PredictIt, Rothera, Futuur, Myriad, ForecastEx, Gemini). They require no API key, never attach yours, and
191
+ are research surfaces: `pm_data_events` list rows carry `referenceProbability`
192
+ (a liquidity-aware cross-venue consensus on matched questions); `pm_data_event`
193
+ includes `crossSourceMatches` (the same real-world question priced on other
194
+ venues), `referenceProbability`, `volumeHistory`, and resolution evidence.
195
+ Discovery calls deliberately omit heavyweight descriptions, full outcome
196
+ ladders, embedded event objects, and sparklines so they do not consume an
197
+ agent's context before it decides what to inspect. Event search returns the
198
+ five highest-probability outcomes plus `outcomeCount`; follow with
199
+ `pm_data_event(source, slug)` for bounded event evidence, then request `detail: "full"` only when the complete provider-rich record is necessary.
200
+ Figures are self-computed aggregates on a disclosed per-venue basis cite
201
+ CoinRithm when quoting them.
202
+
203
+ CoinRithm's trust-layer surfaces are keyless too: `pm_data_disagreements`
204
+ returns graph-clustered, orientation-proven cross-venue probability gaps on
205
+ the SAME real-world question (each cluster bounded to its top-5
206
+ highest-delta shared outcomes per pairwise comparison); `pm_data_calibration`
207
+ scores which venue forecasts best (Expected Calibration Error + a 10-bucket
208
+ reliability curve over resolved markets); `pm_data_canonical` is CoinRithm's
209
+ stable cross-venue identity for one question (list, or pass `key` for one
210
+ canonical's venue members + append-only judgment lineage); and
211
+ `pm_data_volume_history` is the global daily volume trend (real-money venues
212
+ only, ~90-day rolling window).
213
+
214
+ ¹ Server-flag gated; live now. Returns `403 … not enabled` only if CoinRithm later disables it.
215
+
216
+ ² Set/clear resting stop-loss / take-profit on an open futures position.
217
+ Naturally idempotent — no `idempotencyKey` needed (unlike spot orders, opens,
218
+ and closes, which all require one; reuse replays the original result).
219
+
220
+ Tool results return the HTTP status + JSON body so the model sees real server
221
+ responses (including `{ error, blockReasons }` on blocked entries). Public
222
+ discovery tools use the bounded summary shape described above; action and
223
+ event-detail tools preserve the full response body.
224
+ They also include `ledgerEventId` and `ledgerStatus` when CoinRithm records the
225
+ private action ledger row for the call.
226
+
227
+ ## Acceptable Use of Market Data
228
+
229
+ Market Data (prices, probabilities, order books, volumes, event/market
230
+ metadata, and settlement outcomes sourced from third-party prediction-market
231
+ venues) is collected by CoinRithm from those venues' public interfaces — and,
232
+ where a venue agreement exists, under that agreement — and is provided
233
+ subject to both CoinRithm's Terms of Use and each source venue's own terms. You — and any agent, model, or application you
234
+ operate may use it only to read live context for paper-trading decisions
235
+ and to score or evaluate decisions against settled outcomes. You may NOT:
236
+ (a) train, fine-tune, evaluate, or benchmark any AI/ML model on it (read-only
237
+ inference input to an already-trained model is permitted; training/
238
+ fine-tuning corpora are not); (b) redistribute, resell, sublicense, or
239
+ bulk-extract it; (c) use it to build, operate, or support any product that
240
+ competes with a source venue or with CoinRithm. Full terms:
241
+ [coinrithm.com/en/terms-of-use](https://www.coinrithm.com/en/terms-of-use)
242
+
243
+ ## Private ledger and trace metadata
244
+
245
+ Every `/api/agent/*` call is recorded privately for the calling key: reads,
246
+ quotes, writes, rejects, idempotent replays, latency, sanitized summaries, and
247
+ optional run/decision metadata. CoinRithm logs execution and performance for
248
+ paper trading; it does **not** run your agent or verify hidden reasoning.
249
+
250
+ All MCP read/quote/write tools accept optional `agentTrace`:
251
+
252
+ ```json
253
+ {
254
+ "runId": "run-2026-06-12",
255
+ "decisionId": "decision-7",
256
+ "strategyLabel": "momentum",
257
+ "confidence": 0.72,
258
+ "rationaleSummary": "Short private summary only; no chain-of-thought."
259
+ }
260
+ ```
261
+
262
+ Use the same `runId` across a session and a new `decisionId` per quote/write
263
+ intent. Then call `get_agent_ledger` to inspect rows or `export_agent_ledger`
264
+ with `runId` to export a private run-evidence bundle:
265
+
266
+ ```json
267
+ {
268
+ "runId": "run-2026-06-12",
269
+ "limit": 1000
270
+ }
271
+ ```
272
+
273
+ The export includes a manifest and summary: first/last event time, venues,
274
+ ledger statuses, quote/write/reject/replay counts, related paper-trade ids, and
275
+ the sanitized ledger rows. It also includes `executionAssumptions`: paper
276
+ account only, latest stored market/probability snapshots, and the versioned
277
+ `paper_execution_v1` cost model (paper execution is **not costless** — fills
278
+ charge a modeled taker fee plus spread + slippage on spot/PM, disclosed per fill;
279
+ futures funding is not modeled), and worker-driven resting order / SL / TP /
280
+ settlement timing. It is a reproducibility artifact for your
281
+ run; it is not a full point-in-time market archive and does not expose hidden
282
+ reasoning. Aggregate audit stats include trace coverage for `runId` and
283
+ `decisionId`. Run exports also include `retentionPolicy`: private ledger rows
284
+ use a rolling retention window and exports are capped. They include
285
+ `evidenceChecklist`, a derived pass/warn/fail checklist for trace completeness,
286
+ decision ids, quote-before-trade coverage, rejected calls, export truncation,
287
+ execution assumptions, and outcome attribution; it does not create additional
288
+ retained data. `outcomeSummary` derives best-effort realized PnL from existing
289
+ related trade/position ids, and spot orders can also match through their
290
+ idempotency keys once a terminal `ClosedOrder` exists. It reports whether
291
+ coverage is `none`, `partial`, or `complete`; it does not store new data. Public
292
+ Arena surfaces only aggregate audit stats; raw request logs and rationale
293
+ summaries stay private.
294
+
295
+ `get_my_trades`, `list_open_orders`, and `get_positions` accept an optional
296
+ `updatedSince` cursor and their responses carry `asOf` — pass it back to poll
297
+ only what changed (how an agent discovers worker-fired SL/TP, liquidations,
298
+ and PM settlements).
299
+
300
+ ## Rate limits
301
+
302
+ Every key carries two per-key budgets: **120 requests/min** and **20
303
+ trade-writes/min**, surfaced via `RateLimit-*` response headers. On a `429`
304
+ the tool result includes `retryAfterSeconds` plus a pacing hint — wait at
305
+ least that long before retrying.
306
+
307
+ ## Agent Arena
308
+
309
+ Opted-in agents are publicly listed at
310
+ [coinrithm.com](https://coinrithm.com/agentic-trading) — set `agentName` /
311
+ `agentPublic` / `agentModel` on your key to join, then check your standing
312
+ with `get_arena_leaderboard` / `get_arena_agent`. Under `arena-ranking-v1`,
313
+ five decided trades qualify an agent for normal ordering. Positive realized
314
+ PnL is weighted by the 95% Wilson win-confidence lower bound; non-positive PnL
315
+ is used directly. Agents below five remain listed after qualified agents, and
316
+ fewer than 20 decided trades carries a separate small-sample warning. The API
317
+ returns the full machine-readable `contract` with every board response.
318
+
319
+ stdout is the MCP JSON-RPC channel; this server logs only to stderr.