@coinrithm/mcp-trading 0.1.0 → 0.1.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/README.md +1 -17
- package/dist/client.js +6 -0
- package/dist/tools.js +51 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -57,6 +57,7 @@ key upstream. See [`DEPLOY.md`](./DEPLOY.md).
|
|
|
57
57
|
| `get_equity_curve` | read | `GET /api/agent/equity-curve` |
|
|
58
58
|
| `get_my_trades` (venue) | read | `GET /api/agent/trades` |
|
|
59
59
|
| `get_market_context` (coinId) | read | `GET /api/agent/market/:coinId` |
|
|
60
|
+
| `discover_pm_markets` | read | `GET /api/agent/pm/discover` |
|
|
60
61
|
| `get_performance` | read | `GET /api/agent/performance` |
|
|
61
62
|
| `get_arena_leaderboard` | read | `GET /api/arena` |
|
|
62
63
|
| `get_arena_agent` (handle) | read | `GET /api/arena/:handle` |
|
|
@@ -77,20 +78,3 @@ Tool results return the raw HTTP status + JSON body so the model sees real
|
|
|
77
78
|
server responses (including `{ error, blockReasons }` on blocked entries).
|
|
78
79
|
|
|
79
80
|
stdout is the MCP JSON-RPC channel; this server logs only to stderr.
|
|
80
|
-
|
|
81
|
-
## Publishing (maintainers)
|
|
82
|
-
|
|
83
|
-
Published to npm as **`@coinrithm/mcp-trading`** (public scope) so users can run
|
|
84
|
-
`npx -y @coinrithm/mcp-trading` without cloning.
|
|
85
|
-
|
|
86
|
-
```bash
|
|
87
|
-
cd packages/mcp-trading
|
|
88
|
-
npm run build
|
|
89
|
-
npm pack --dry-run # verify the tarball: dist/*.js + README.md + package.json only
|
|
90
|
-
npm publish --access public
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
`prepare` rebuilds on publish and `publishConfig.access` is `public`, so once you
|
|
94
|
-
are authenticated (`npm login`) with publish rights on the `@coinrithm` org,
|
|
95
|
-
`npm publish` is enough. The first publish requires the `@coinrithm` npm org/scope
|
|
96
|
-
to exist and a one-time OTP if 2FA is enabled on the account.
|
package/dist/client.js
CHANGED
|
@@ -145,6 +145,12 @@ export class CoinRithmClient {
|
|
|
145
145
|
getMarketContext(coinId, apiKey) {
|
|
146
146
|
return this.request("GET", `/api/agent/market/${encodeURIComponent(coinId)}`, { apiKey });
|
|
147
147
|
}
|
|
148
|
+
discoverPmMarkets(query, apiKey) {
|
|
149
|
+
return this.request("GET", "/api/agent/pm/discover", {
|
|
150
|
+
query,
|
|
151
|
+
apiKey,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
148
154
|
getPerformance(apiKey) {
|
|
149
155
|
return this.request("GET", "/api/agent/performance", { apiKey });
|
|
150
156
|
}
|
package/dist/tools.js
CHANGED
|
@@ -179,6 +179,50 @@ export function registerTools(server, client) {
|
|
|
179
179
|
.describe('Coin UCID (e.g. "1" = BTC). Use resolve_symbol to find it.'),
|
|
180
180
|
},
|
|
181
181
|
}, async ({ coinId }, extra) => present(await client.getMarketContext(coinId, requestKey(extra))));
|
|
182
|
+
server.registerTool("discover_pm_markets", {
|
|
183
|
+
title: "Discover prediction markets",
|
|
184
|
+
description: "Find active-open, quote-ready-first prediction markets on the mock-PM " +
|
|
185
|
+
"sources (Kalshi + Polymarket by default). Returns source, slug, " +
|
|
186
|
+
"quoteable outcome externalMarketIds, freshness, volume/liquidity/spread, " +
|
|
187
|
+
"and decisionSupport. This is discovery only — call pm_quote with one " +
|
|
188
|
+
"returned outcomeExternalMarketId before open_pm_position because pm_quote " +
|
|
189
|
+
"is the final eligibility source. " +
|
|
190
|
+
PAPER_NOTE,
|
|
191
|
+
inputSchema: {
|
|
192
|
+
q: z
|
|
193
|
+
.string()
|
|
194
|
+
.optional()
|
|
195
|
+
.describe("Optional search text (title, outcome, topic, or related coin)."),
|
|
196
|
+
source: z
|
|
197
|
+
.enum(["all", "kalshi", "polymarket"])
|
|
198
|
+
.optional()
|
|
199
|
+
.describe("Source filter (default all = Kalshi + Polymarket)."),
|
|
200
|
+
limit: z
|
|
201
|
+
.number()
|
|
202
|
+
.int()
|
|
203
|
+
.min(1)
|
|
204
|
+
.max(50)
|
|
205
|
+
.optional()
|
|
206
|
+
.describe("Max rows (1-50, default 20)."),
|
|
207
|
+
offset: z
|
|
208
|
+
.number()
|
|
209
|
+
.int()
|
|
210
|
+
.min(0)
|
|
211
|
+
.optional()
|
|
212
|
+
.describe("Pagination offset (default 0)."),
|
|
213
|
+
sort: z
|
|
214
|
+
.enum([
|
|
215
|
+
"best",
|
|
216
|
+
"volume24h_desc",
|
|
217
|
+
"priceChange24h_desc",
|
|
218
|
+
"priceChange24h_asc",
|
|
219
|
+
"endDate_desc",
|
|
220
|
+
"trending",
|
|
221
|
+
])
|
|
222
|
+
.optional()
|
|
223
|
+
.describe("Prediction-market sort (default best)."),
|
|
224
|
+
},
|
|
225
|
+
}, async ({ q, source, limit, offset, sort }, extra) => present(await client.discoverPmMarkets({ q, source, limit, offset, sort }, requestKey(extra))));
|
|
182
226
|
server.registerTool("get_performance", {
|
|
183
227
|
title: "Get my performance",
|
|
184
228
|
description: "The calling key's own realized performance: total + per-venue realized " +
|
|
@@ -325,9 +369,10 @@ export function registerTools(server, client) {
|
|
|
325
369
|
server.registerTool("open_futures_position", {
|
|
326
370
|
title: "Open futures position",
|
|
327
371
|
description: "Open (or add to) a mock futures position. Requires the trade:futures " +
|
|
328
|
-
"scope
|
|
329
|
-
"idempotencyKey is REQUIRED and must be
|
|
330
|
-
"marginMusd >= 10. Quote first and
|
|
372
|
+
"scope. Enabled now (server-flag gated — returns 403 'not enabled' only " +
|
|
373
|
+
"if CoinRithm later disables it). idempotencyKey is REQUIRED and must be " +
|
|
374
|
+
"unique per intent. leverage 1-20, marginMusd >= 10. Quote first and " +
|
|
375
|
+
"CONFIRM with the user. " +
|
|
331
376
|
PAPER_NOTE,
|
|
332
377
|
inputSchema: {
|
|
333
378
|
coinId: z.string(),
|
|
@@ -366,9 +411,9 @@ export function registerTools(server, client) {
|
|
|
366
411
|
server.registerTool("open_pm_position", {
|
|
367
412
|
title: "Open prediction-market position",
|
|
368
413
|
description: "Open a mock prediction-market position (binary outcomes only). Requires " +
|
|
369
|
-
"the trade:pm scope
|
|
370
|
-
"enabled'
|
|
371
|
-
"CONFIRM with the user. " +
|
|
414
|
+
"the trade:pm scope. Enabled now (server-flag gated — returns 403 'not " +
|
|
415
|
+
"enabled' only if CoinRithm later disables it). idempotencyKey is " +
|
|
416
|
+
"REQUIRED. stakeMusd >= 10. Quote first and CONFIRM with the user. " +
|
|
372
417
|
PAPER_NOTE,
|
|
373
418
|
inputSchema: {
|
|
374
419
|
source: z.string(),
|
package/package.json
CHANGED