@coinrithm/mcp-trading 0.7.0 → 0.7.2
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/CHANGELOG.md +28 -0
- package/README.md +238 -225
- package/dist/agent/runner.js +10 -4
- package/dist/http.js +26 -0
- package/dist/tools.js +21 -13
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,34 @@ ships two binaries — `coinrithm-mcp` (the MCP server) and `coinrithm-agent` (t
|
|
|
5
5
|
self-host agent runner) — versioned together. The CoinRithm **API contract** is
|
|
6
6
|
versioned separately (see `openapi.yaml` `info.version`, currently `1.5.0`).
|
|
7
7
|
|
|
8
|
+
## 0.7.1
|
|
9
|
+
|
|
10
|
+
Docs + registry-metadata release; no tool behavior changes.
|
|
11
|
+
|
|
12
|
+
- **README refresh**: the keyless `pm_data_*` data surface is now front and
|
|
13
|
+
center — 8 venues (Polymarket, Kalshi, Smarkets, Limitless, Manifold,
|
|
14
|
+
Metaculus, PredictIt, Rothera — the "seven venues" line predated Rothera),
|
|
15
|
+
the anonymous hosted-endpoint path, and the `referenceProbability` /
|
|
16
|
+
`volumeHistory` fields the data tools return.
|
|
17
|
+
- **`server.json`**: hosted endpoint's `Authorization` header marked optional
|
|
18
|
+
(the `pm_data_*` tools work anonymously — verified live) and the server
|
|
19
|
+
description now leads with the keyless data surface.
|
|
20
|
+
- Ships the post-0.7.0 commits: `pm_data_event` advertises `volumeHistory`,
|
|
21
|
+
`pm_data_events` advertises `referenceProbability` on list items, and the
|
|
22
|
+
hosted MCP root (`GET /`) serves a self-describing JSON landing (with a
|
|
23
|
+
405 + hint on `GET /mcp`).
|
|
24
|
+
|
|
25
|
+
## 0.7.0
|
|
26
|
+
|
|
27
|
+
(Retroactive entry — released 2026-07-05 without a changelog note.)
|
|
28
|
+
|
|
29
|
+
- **Four keyless `pm_data_*` tools** — CoinRithm's free public cross-venue
|
|
30
|
+
prediction-market dataset over MCP, no API key required and yours is never
|
|
31
|
+
attached: `pm_data_overview` (market-wide stats), `pm_data_events`
|
|
32
|
+
(cross-venue event list), `pm_data_event` (detail incl.
|
|
33
|
+
`crossSourceMatches` + resolution evidence), `pm_data_whales`
|
|
34
|
+
(large-trade tape).
|
|
35
|
+
|
|
8
36
|
## 0.5.0
|
|
9
37
|
|
|
10
38
|
Agent-runner quality + reliability release. `coinrithm-agent` got materially
|
package/README.md
CHANGED
|
@@ -1,225 +1,238 @@
|
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
key
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
|
112
|
-
|
|
|
113
|
-
| `
|
|
114
|
-
| `
|
|
115
|
-
| `
|
|
116
|
-
| `
|
|
117
|
-
| `
|
|
118
|
-
| `
|
|
119
|
-
| `
|
|
120
|
-
| `
|
|
121
|
-
| `
|
|
122
|
-
| `
|
|
123
|
-
| `
|
|
124
|
-
| `
|
|
125
|
-
| `
|
|
126
|
-
| `
|
|
127
|
-
| `
|
|
128
|
-
| `
|
|
129
|
-
| `
|
|
130
|
-
| `
|
|
131
|
-
| `
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
the
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
related trade
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
`
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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 four keyless `pm_data_*` tools serving CoinRithm's public cross-venue
|
|
12
|
+
dataset: live odds across 10 venues (Polymarket, Kalshi, Smarkets, Limitless,
|
|
13
|
+
Manifold, Metaculus, PredictIt, Rothera, Futuur, Myriad), 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 four 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) | `GET /api/prediction-markets/overview` |
|
|
140
|
+
| `pm_data_events` | none (public) | `GET /api/prediction-markets/events` |
|
|
141
|
+
| `pm_data_event` (source, slug) | none (public) | `GET /api/prediction-markets/events/:source/:slug` |
|
|
142
|
+
| `pm_data_whales` | none (public) | `GET /api/prediction-markets/whales` |
|
|
143
|
+
|
|
144
|
+
The four `pm_data_*` tools wrap CoinRithm's free public cross-venue dataset
|
|
145
|
+
(all ten venues: Polymarket, Kalshi, Smarkets, Limitless, Manifold,
|
|
146
|
+
Metaculus, PredictIt, Rothera, Futuur, Myriad). They require no API key, never attach yours, and
|
|
147
|
+
are research surfaces: `pm_data_events` list rows carry `referenceProbability`
|
|
148
|
+
(a liquidity-aware cross-venue consensus on matched questions); `pm_data_event`
|
|
149
|
+
includes `crossSourceMatches` (the same real-world question priced on other
|
|
150
|
+
venues), `referenceProbability`, `volumeHistory`, and resolution evidence.
|
|
151
|
+
Figures are self-computed aggregates on a disclosed per-venue basis — cite
|
|
152
|
+
CoinRithm when quoting them.
|
|
153
|
+
|
|
154
|
+
¹ Server-flag gated; live now. Returns `403 … not enabled` only if CoinRithm later disables it.
|
|
155
|
+
|
|
156
|
+
² Set/clear resting stop-loss / take-profit on an open futures position.
|
|
157
|
+
Naturally idempotent — no `idempotencyKey` needed (unlike spot orders, opens,
|
|
158
|
+
and closes, which all require one; reuse replays the original result).
|
|
159
|
+
|
|
160
|
+
Tool results return the raw HTTP status + JSON body so the model sees real
|
|
161
|
+
server responses (including `{ error, blockReasons }` on blocked entries).
|
|
162
|
+
They also include `ledgerEventId` and `ledgerStatus` when CoinRithm records the
|
|
163
|
+
private action ledger row for the call.
|
|
164
|
+
|
|
165
|
+
## Private ledger and trace metadata
|
|
166
|
+
|
|
167
|
+
Every `/api/agent/*` call is recorded privately for the calling key: reads,
|
|
168
|
+
quotes, writes, rejects, idempotent replays, latency, sanitized summaries, and
|
|
169
|
+
optional run/decision metadata. CoinRithm logs execution and performance for
|
|
170
|
+
paper trading; it does **not** run your agent or verify hidden reasoning.
|
|
171
|
+
|
|
172
|
+
All MCP read/quote/write tools accept optional `agentTrace`:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"runId": "run-2026-06-12",
|
|
177
|
+
"decisionId": "decision-7",
|
|
178
|
+
"strategyLabel": "momentum",
|
|
179
|
+
"confidence": 0.72,
|
|
180
|
+
"rationaleSummary": "Short private summary only; no chain-of-thought."
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Use the same `runId` across a session and a new `decisionId` per quote/write
|
|
185
|
+
intent. Then call `get_agent_ledger` to inspect rows or `export_agent_ledger`
|
|
186
|
+
with `runId` to export a private run-evidence bundle:
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"runId": "run-2026-06-12",
|
|
191
|
+
"limit": 1000
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The export includes a manifest and summary: first/last event time, venues,
|
|
196
|
+
ledger statuses, quote/write/reject/replay counts, related paper-trade ids, and
|
|
197
|
+
the sanitized ledger rows. It also includes `executionAssumptions`: paper
|
|
198
|
+
account only, latest stored market/probability snapshots, no explicit
|
|
199
|
+
commission/slippage in v1, no futures funding/fees, and worker-driven resting
|
|
200
|
+
order / SL / TP / settlement timing. It is a reproducibility artifact for your
|
|
201
|
+
run; it is not a full point-in-time market archive and does not expose hidden
|
|
202
|
+
reasoning. Aggregate audit stats include trace coverage for `runId` and
|
|
203
|
+
`decisionId`. Run exports also include `retentionPolicy`: private ledger rows
|
|
204
|
+
use a rolling retention window and exports are capped. They include
|
|
205
|
+
`evidenceChecklist`, a derived pass/warn/fail checklist for trace completeness,
|
|
206
|
+
decision ids, quote-before-trade coverage, rejected calls, export truncation,
|
|
207
|
+
execution assumptions, and outcome attribution; it does not create additional
|
|
208
|
+
retained data. `outcomeSummary` derives best-effort realized PnL from existing
|
|
209
|
+
related trade/position ids, and spot orders can also match through their
|
|
210
|
+
idempotency keys once a terminal `ClosedOrder` exists. It reports whether
|
|
211
|
+
coverage is `none`, `partial`, or `complete`; it does not store new data. Public
|
|
212
|
+
Arena surfaces only aggregate audit stats; raw request logs and rationale
|
|
213
|
+
summaries stay private.
|
|
214
|
+
|
|
215
|
+
`get_my_trades`, `list_open_orders`, and `get_positions` accept an optional
|
|
216
|
+
`updatedSince` cursor and their responses carry `asOf` — pass it back to poll
|
|
217
|
+
only what changed (how an agent discovers worker-fired SL/TP, liquidations,
|
|
218
|
+
and PM settlements).
|
|
219
|
+
|
|
220
|
+
## Rate limits
|
|
221
|
+
|
|
222
|
+
Every key carries two per-key budgets: **120 requests/min** and **20
|
|
223
|
+
trade-writes/min**, surfaced via `RateLimit-*` response headers. On a `429`
|
|
224
|
+
the tool result includes `retryAfterSeconds` plus a pacing hint — wait at
|
|
225
|
+
least that long before retrying.
|
|
226
|
+
|
|
227
|
+
## Agent Arena
|
|
228
|
+
|
|
229
|
+
Opted-in agents are publicly ranked by realized PnL — every agent with any
|
|
230
|
+
decided (win/loss) trade is listed (a small-sample asterisk flags thin records;
|
|
231
|
+
the live gate is surfaced as `minDecidedTrades` in the response) at
|
|
232
|
+
[coinrithm.com](https://coinrithm.com/agentic-trading) — set `agentName` /
|
|
233
|
+
`agentPublic` / `agentModel` on your key to join, then check your standing
|
|
234
|
+
with `get_arena_leaderboard` / `get_arena_agent`. Pass `window: "7d" | "30d"`
|
|
235
|
+
to `get_arena_leaderboard` for the weekly/monthly board (re-ranked by
|
|
236
|
+
in-window PnL; the min-decided gate and badges stay all-time).
|
|
237
|
+
|
|
238
|
+
stdout is the MCP JSON-RPC channel; this server logs only to stderr.
|
package/dist/agent/runner.js
CHANGED
|
@@ -310,7 +310,9 @@ export async function runCycle(deps) {
|
|
|
310
310
|
return {
|
|
311
311
|
decision: "skip",
|
|
312
312
|
skipReason: `model output invalid: ${parsed.error}`,
|
|
313
|
-
|
|
313
|
+
// Never persist raw model text (no-CoT privacy policy) — the parse error
|
|
314
|
+
// in skipReason is the diagnostic; the malformed output is not stored.
|
|
315
|
+
rawModelOutput: undefined,
|
|
314
316
|
planned: [],
|
|
315
317
|
modelFailed: true,
|
|
316
318
|
live,
|
|
@@ -323,11 +325,15 @@ export async function runCycle(deps) {
|
|
|
323
325
|
state.consecutiveModelFailures = 0;
|
|
324
326
|
const decision = parsed.decision;
|
|
325
327
|
// Reasoning captured for the Arena terminal (keystone transparency): the
|
|
326
|
-
// model's
|
|
327
|
-
//
|
|
328
|
+
// model's PARSED, sanitized short analysis + decision confidence. We do NOT
|
|
329
|
+
// persist the full raw model text — a response can carry prose reasoning
|
|
330
|
+
// around the JSON, and the privacy promise (frontend copy + CLAUDE.md
|
|
331
|
+
// data-retention) is that raw model reasoning traces are NEVER stored, only
|
|
332
|
+
// the sanitized rationale summary. Shared across the skip + act return paths.
|
|
328
333
|
const rationale = decision.rationale;
|
|
329
334
|
const confidence = decision.confidence;
|
|
330
|
-
|
|
335
|
+
// undefined (not the raw text) → db.ts stores NULL for raw_model_output.
|
|
336
|
+
const rawModelOutput = undefined;
|
|
331
337
|
if (decision.decision === "skip" || decision.actions.length === 0) {
|
|
332
338
|
state.consecutiveRejectCycles += 1;
|
|
333
339
|
saveState(stateFile, state);
|
package/dist/http.js
CHANGED
|
@@ -49,6 +49,32 @@ async function main() {
|
|
|
49
49
|
app.get("/healthz", (_req, res) => {
|
|
50
50
|
res.json({ ok: true, service: "coinrithm-mcp", transport: "streamable-http" });
|
|
51
51
|
});
|
|
52
|
+
// Self-describing landing for humans and validate-before-recommend agents.
|
|
53
|
+
// GET / and GET /mcp used to 404, which reads as a dead service to anyone
|
|
54
|
+
// probing the published URL (GEO audit 2026-07-07). The MCP endpoint itself
|
|
55
|
+
// is POST-only streamable HTTP — say so instead of 404ing.
|
|
56
|
+
app.get("/", (_req, res) => {
|
|
57
|
+
res.json({
|
|
58
|
+
service: "CoinRithm MCP",
|
|
59
|
+
version: SERVER_VERSION,
|
|
60
|
+
description: "Model Context Protocol server for CoinRithm: keyless public prediction-market data tools (pm_data_*) plus paper-trading tools (spot, futures, prediction markets) with a crk_live_ API key. Paper only — never real money.",
|
|
61
|
+
endpoint: { url: "https://mcp.coinrithm.com/mcp", method: "POST", transport: "streamable-http" },
|
|
62
|
+
connect: "Point any MCP client at the endpoint above. Data tools need no key; trading tools take Authorization: Bearer crk_live_… (mint one at coinrithm.com → Settings → API Keys).",
|
|
63
|
+
localAlternative: "npx -y @coinrithm/mcp-trading",
|
|
64
|
+
docs: {
|
|
65
|
+
quickstart: "https://www.coinrithm.com/en/agentic-trading",
|
|
66
|
+
openapi: "https://www.coinrithm.com/openapi.yaml",
|
|
67
|
+
repo: "https://github.com/CoinRithm/coinrithm-agent-trading",
|
|
68
|
+
dataApi: "https://www.coinrithm.com/en/prediction-markets/api",
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
app.get("/mcp", (_req, res) => {
|
|
73
|
+
res.status(405).json({
|
|
74
|
+
error: "method_not_allowed",
|
|
75
|
+
message: "This is a POST-only streamable-HTTP MCP endpoint. Connect with an MCP client, or GET / for service info.",
|
|
76
|
+
});
|
|
77
|
+
});
|
|
52
78
|
app.post("/mcp", async (req, res) => {
|
|
53
79
|
// Per-request auth: read THIS caller's key from the Authorization header,
|
|
54
80
|
// or from Smithery's non-reserved forwarding header.
|
package/dist/tools.js
CHANGED
|
@@ -859,8 +859,11 @@ export function registerTools(server, client) {
|
|
|
859
859
|
title: "Cross-venue prediction-market statistics",
|
|
860
860
|
description: "Free public cross-venue prediction-market statistics: total/open/" +
|
|
861
861
|
"closed market counts, total volume, 24h volume, and liquidity " +
|
|
862
|
-
"aggregated across Polymarket, Kalshi,
|
|
863
|
-
"Limitless, Manifold,
|
|
862
|
+
"aggregated across all ten venues (Polymarket, Kalshi, Rothera, " +
|
|
863
|
+
"Limitless, Smarkets, Manifold, Metaculus, PredictIt, Futuur, Myriad), plus market " +
|
|
864
|
+
"highlights. Freshness is SOURCE-AWARE — each venue ingests " +
|
|
865
|
+
"independently; per-venue health (freshness tier, lag, stale reason) " +
|
|
866
|
+
"is at /api/prediction-markets/sources/health. Volume is " +
|
|
864
867
|
"reported on each venue's own basis (see the methodology at " +
|
|
865
868
|
"https://coinrithm.com/en/prediction-markets/stats) and monetary " +
|
|
866
869
|
"totals cover real-money venues only — these are self-computed " +
|
|
@@ -876,20 +879,23 @@ export function registerTools(server, client) {
|
|
|
876
879
|
}, async ({ fiat }) => present(await client.getPublicPmOverview({ fiat })));
|
|
877
880
|
server.registerTool("pm_data_events", {
|
|
878
881
|
title: "Search prediction markets across all venues",
|
|
879
|
-
description: "Free public search over prediction-market events across ALL
|
|
880
|
-
"venues (Polymarket, Kalshi,
|
|
881
|
-
"Manifold,
|
|
882
|
+
description: "Free public search over prediction-market events across ALL ten " +
|
|
883
|
+
"venues (Polymarket, Kalshi, Rothera, Limitless, Smarkets, " +
|
|
884
|
+
"Manifold, Metaculus, PredictIt, Futuur, Myriad) — broader than discover_pm_markets, which is " +
|
|
882
885
|
"scoped to the paper-tradeable venues. Returns titles, probabilities, " +
|
|
883
|
-
"volume/liquidity, status, and source per event
|
|
884
|
-
"
|
|
885
|
-
"
|
|
886
|
+
"volume/liquidity, status, and source per event, plus " +
|
|
887
|
+
"referenceProbability when present (CoinRithm's canonical cross-venue " +
|
|
888
|
+
"number for open events matched across venues — probability, " +
|
|
889
|
+
"venueCount, spreadPoints, and outcomeName for multi-outcome " +
|
|
890
|
+
"leaders). Research/data only: to trade, use discover_pm_markets + " +
|
|
891
|
+
"pm_quote instead. No API key required.",
|
|
886
892
|
inputSchema: {
|
|
887
893
|
q: z.string().optional().describe("Optional search text."),
|
|
888
894
|
source: z
|
|
889
895
|
.string()
|
|
890
896
|
.optional()
|
|
891
|
-
.describe("Optional venue filter: polymarket, kalshi,
|
|
892
|
-
"
|
|
897
|
+
.describe("Optional venue filter: polymarket, kalshi, rothera, limitless, " +
|
|
898
|
+
"smarkets, manifold, metaculus, predictit, futuur, or myriad."),
|
|
893
899
|
status: z
|
|
894
900
|
.string()
|
|
895
901
|
.optional()
|
|
@@ -934,14 +940,16 @@ export function registerTools(server, client) {
|
|
|
934
940
|
"number: the liquidity-weighted median Yes probability across matched " +
|
|
935
941
|
"real-money venues, with venueCount and spreadPoints — quote all " +
|
|
936
942
|
"three together, venues disagree and the spread says by how much), " +
|
|
937
|
-
"recent whale trades on the event, related events,
|
|
943
|
+
"recent whale trades on the event, related events, related news, and " +
|
|
944
|
+
"volumeHistory when present (daily volume points captured since " +
|
|
945
|
+
"2026-07-02 — read the event's volume trend directly from it). " +
|
|
938
946
|
"This is the cross-venue research view; for tradability use pm_quote. " +
|
|
939
947
|
"No API key required.",
|
|
940
948
|
inputSchema: {
|
|
941
949
|
source: z
|
|
942
950
|
.string()
|
|
943
|
-
.describe("Venue slug: polymarket, kalshi,
|
|
944
|
-
"manifold, or
|
|
951
|
+
.describe("Venue slug: polymarket, kalshi, rothera, limitless, smarkets, " +
|
|
952
|
+
"manifold, metaculus, predictit, futuur, or myriad."),
|
|
945
953
|
slug: z.string().describe("Event slug on that venue."),
|
|
946
954
|
fiat: z
|
|
947
955
|
.string()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinrithm/mcp-trading",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"mcpName": "io.github.CoinRithm/mcp-trading",
|
|
5
5
|
"description": "CoinRithm paper-trading toolkit: an MCP server (coinrithm-mcp) AND a self-host agent runner (coinrithm-agent) for spot, futures, and prediction markets with a user-minted API key.",
|
|
6
6
|
"type": "module",
|