@coinrithm/mcp-trading 0.7.10 → 0.7.12
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 +34 -2
- package/README.md +9 -8
- package/dist/agent/engine.d.ts +1 -1
- package/dist/agent/opportunityReporter.d.ts +2 -1
- package/dist/agent/opportunityReporter.js +31 -10
- package/dist/agent/runner.js +6 -0
- package/dist/agent/types.d.ts +6 -0
- package/dist/tools.js +43 -31
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,37 @@ 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.7.0`).
|
|
7
7
|
|
|
8
|
+
## 0.7.12 — 2026-09-15
|
|
9
|
+
|
|
10
|
+
Clarify `whoami`, `cancel_spot_order` and `report_pm_opportunity` descriptions,
|
|
11
|
+
removing execution-cost prose unrelated to these operations. Document actual
|
|
12
|
+
authentication, side effects, result fields and retry behavior.
|
|
13
|
+
|
|
14
|
+
Spot cancellation now advertises its existing idempotent behavior. Opportunity
|
|
15
|
+
reporting no longer advertises unconditional idempotency: duplicate protection
|
|
16
|
+
requires `decisionId` (or `agentTrace.decisionId`) under the same API key; the
|
|
17
|
+
first stored record wins. Reporting remains a write despite requiring only the
|
|
18
|
+
`read` scope, and its evidence remains explicitly self-reported.
|
|
19
|
+
|
|
20
|
+
Tool names, accepted inputs and execution behavior are unchanged. This source
|
|
21
|
+
entry does not establish registry publication, deployment or a new Glama score.
|
|
22
|
+
|
|
23
|
+
## 0.7.11 — 2026-09-15
|
|
24
|
+
|
|
25
|
+
Fix opportunity reporting that previously treated resolved API failures as
|
|
26
|
+
successful submissions. Only `ok: true` confirms a report. HTTP errors remain
|
|
27
|
+
unconfirmed; transport failures and exceptions have an unknown delivery outcome.
|
|
28
|
+
|
|
29
|
+
`CycleResult.opportunity` now contains confirmed reports only. The additive
|
|
30
|
+
`opportunityReport` field preserves the attempted payload, outcome and status,
|
|
31
|
+
without API error bodies or exception details. Existing consumers should use
|
|
32
|
+
this field when they need attempted rather than confirmed evidence.
|
|
33
|
+
|
|
34
|
+
The reporter retains its one-invocation-per-cycle latch and adds no retries.
|
|
35
|
+
Focused regressions compare successful and failed reporting in skip/act cycles
|
|
36
|
+
and verify unchanged trading results and runner state. SDK versions are unchanged.
|
|
37
|
+
This source entry does not establish registry publication or hosted deployment.
|
|
38
|
+
|
|
8
39
|
## 0.7.10 — 2026-09-15
|
|
9
40
|
|
|
10
41
|
Source changes following the published 0.7.9 release. The TypeScript SDK remains
|
|
@@ -26,8 +57,9 @@ Source changes following the published 0.7.9 release. The TypeScript SDK remains
|
|
|
26
57
|
- Pin workflow actions and verify release-tool checksums. Add installed-package
|
|
27
58
|
compatibility and restart smoke checks across operating systems and runtimes.
|
|
28
59
|
|
|
29
|
-
|
|
30
|
-
|
|
60
|
+
0.7.10 was published and deployed on 2026-09-15. Registry and GitHub downloads
|
|
61
|
+
matched the CI-tested archive; hosted MCP and scheduler deployments finished.
|
|
62
|
+
See the [release record](https://github.com/CoinRithm/coinrithm-agent-trading/releases/tag/mcp-trading-v0.7.10).
|
|
31
63
|
|
|
32
64
|
## 0.7.9 - 2026-09-15
|
|
33
65
|
|
package/README.md
CHANGED
|
@@ -42,14 +42,15 @@ This package ships two binaries:
|
|
|
42
42
|
|
|
43
43
|
> **Paper trading only** — virtual funds (50,000 mUSD). Not financial advice.
|
|
44
44
|
|
|
45
|
-
## Version 0.7.
|
|
46
|
-
|
|
47
|
-
This
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
[CHANGELOG.md](./CHANGELOG.md).
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
## Version 0.7.12
|
|
46
|
+
|
|
47
|
+
This patch clarifies `whoami`, `cancel_spot_order` and `report_pm_opportunity`
|
|
48
|
+
for MCP clients. Cancellation is marked safe to repeat; opportunity reporting
|
|
49
|
+
is a write whose duplicate protection requires a decision ID. Tool names,
|
|
50
|
+
accepted inputs and execution behavior are unchanged. See [CHANGELOG.md](./CHANGELOG.md).
|
|
51
|
+
This source entry does not establish publication. Check
|
|
52
|
+
`npm view @coinrithm/mcp-trading version` for the latest published version;
|
|
53
|
+
hosted deployments and npm releases are separate.
|
|
53
54
|
|
|
54
55
|
Runner API operations have a 30-second total deadline, including response
|
|
55
56
|
bodies and 429 retry waits. Timeout and cancellation results remain unconfirmed;
|
package/dist/agent/engine.d.ts
CHANGED
|
@@ -12,4 +12,4 @@ export { newState, rollDay, loadState, saveState } from "./state.js";
|
|
|
12
12
|
export { makeRunId } from "./runEvidence.js";
|
|
13
13
|
export { parseCadenceMs } from "./util.js";
|
|
14
14
|
export { BENCHMARK_AGENTS, BENCHMARK_STRATEGIES, decideMechanical, isBenchmarkStrategy, type BenchmarkStrategy, type BenchmarkAgentDefinition, } from "./mechanical.js";
|
|
15
|
-
export type { AgentSpec, RunState, CycleResult, PlannedAction, Venue, ProviderName, ModelConfig, } from "./types.js";
|
|
15
|
+
export type { AgentSpec, RunState, CycleResult, OpportunityReport, PostedOpportunity, PlannedAction, Venue, ProviderName, ModelConfig, } from "./types.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CoinRithmClient, ProvenanceReport } from "./client.js";
|
|
2
|
-
import type { AgentSpec, AgentTrace, PostedOpportunity } from "./types.js";
|
|
2
|
+
import type { AgentSpec, AgentTrace, OpportunityReport, PostedOpportunity } from "./types.js";
|
|
3
3
|
export declare function createOpportunityReporter({ client, spec, live, enabled, runId, decisionId, provenance, baseTrace, log, }: {
|
|
4
4
|
client: CoinRithmClient;
|
|
5
5
|
spec: AgentSpec;
|
|
@@ -13,4 +13,5 @@ export declare function createOpportunityReporter({ client, spec, live, enabled,
|
|
|
13
13
|
}): {
|
|
14
14
|
post: (o: PostedOpportunity) => Promise<void>;
|
|
15
15
|
readonly posted: PostedOpportunity | undefined;
|
|
16
|
+
readonly report: OpportunityReport | undefined;
|
|
16
17
|
};
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
export function createOpportunityReporter({ client, spec, live, enabled, runId, decisionId, provenance, baseTrace, log, }) {
|
|
2
|
-
let
|
|
3
|
-
let
|
|
2
|
+
let attempted = false;
|
|
3
|
+
let report;
|
|
4
4
|
const post = async (o) => {
|
|
5
|
-
if (!enabled || !live ||
|
|
5
|
+
if (!enabled || !live || attempted)
|
|
6
6
|
return;
|
|
7
|
-
|
|
8
|
-
postedOpportunity = o;
|
|
7
|
+
attempted = true;
|
|
9
8
|
try {
|
|
10
|
-
await client.reportPmOpportunity({
|
|
9
|
+
const result = await client.reportPmOpportunity({
|
|
11
10
|
kind: o.kind,
|
|
12
11
|
source: o.source,
|
|
13
12
|
slug: o.slug,
|
|
@@ -23,16 +22,38 @@ export function createOpportunityReporter({ client, spec, live, enabled, runId,
|
|
|
23
22
|
runId,
|
|
24
23
|
provenance,
|
|
25
24
|
}, baseTrace);
|
|
26
|
-
|
|
25
|
+
report = {
|
|
26
|
+
opportunity: o,
|
|
27
|
+
outcome: result.ok
|
|
28
|
+
? "confirmed"
|
|
29
|
+
: result.status === 0
|
|
30
|
+
? "unknown"
|
|
31
|
+
: "http_error",
|
|
32
|
+
status: result.status,
|
|
33
|
+
};
|
|
34
|
+
if (result.ok) {
|
|
35
|
+
log(`reported ${o.kind} opportunity (universe ${o.universeSize ?? "?"})`);
|
|
36
|
+
}
|
|
37
|
+
else if (result.status === 0) {
|
|
38
|
+
log("opportunity report outcome unknown (transport failure)");
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
log(`opportunity report received HTTP ${result.status}; delivery unconfirmed`);
|
|
42
|
+
}
|
|
27
43
|
}
|
|
28
|
-
catch
|
|
29
|
-
|
|
44
|
+
catch {
|
|
45
|
+
report = { opportunity: o, outcome: "unknown", status: 0 };
|
|
46
|
+
// Exceptions and API error bodies may contain private request details.
|
|
47
|
+
log("opportunity report outcome unknown (exception)");
|
|
30
48
|
}
|
|
31
49
|
};
|
|
32
50
|
return {
|
|
33
51
|
post,
|
|
34
52
|
get posted() {
|
|
35
|
-
return
|
|
53
|
+
return report?.outcome === "confirmed" ? report.opportunity : undefined;
|
|
54
|
+
},
|
|
55
|
+
get report() {
|
|
56
|
+
return report;
|
|
36
57
|
},
|
|
37
58
|
};
|
|
38
59
|
}
|
package/dist/agent/runner.js
CHANGED
|
@@ -866,6 +866,9 @@ async function runCycleCore(deps, capture) {
|
|
|
866
866
|
writeAttempted: decision.actions.length,
|
|
867
867
|
writeAccepted: 0,
|
|
868
868
|
...(opportunities.posted ? { opportunity: opportunities.posted } : {}),
|
|
869
|
+
...(opportunities.report
|
|
870
|
+
? { opportunityReport: opportunities.report }
|
|
871
|
+
: {}),
|
|
869
872
|
...observationReceipt,
|
|
870
873
|
};
|
|
871
874
|
}
|
|
@@ -1276,6 +1279,9 @@ async function runCycleCore(deps, capture) {
|
|
|
1276
1279
|
writeAttempted: decision.actions.length,
|
|
1277
1280
|
writeAccepted: planned.filter((p) => p.accepted).length,
|
|
1278
1281
|
...(opportunities.posted ? { opportunity: opportunities.posted } : {}),
|
|
1282
|
+
...(opportunities.report
|
|
1283
|
+
? { opportunityReport: opportunities.report }
|
|
1284
|
+
: {}),
|
|
1279
1285
|
...observationReceipt,
|
|
1280
1286
|
};
|
|
1281
1287
|
}
|
package/dist/agent/types.d.ts
CHANGED
|
@@ -504,6 +504,12 @@ export interface CycleResult {
|
|
|
504
504
|
writeAttempted?: number;
|
|
505
505
|
writeAccepted?: number;
|
|
506
506
|
opportunity?: PostedOpportunity;
|
|
507
|
+
opportunityReport?: OpportunityReport;
|
|
508
|
+
}
|
|
509
|
+
export interface OpportunityReport {
|
|
510
|
+
opportunity: PostedOpportunity;
|
|
511
|
+
outcome: "confirmed" | "http_error" | "unknown";
|
|
512
|
+
status: number;
|
|
507
513
|
}
|
|
508
514
|
export interface PostedOpportunity {
|
|
509
515
|
kind: "abstained" | "forecast_only" | "quote_expired";
|
package/dist/tools.js
CHANGED
|
@@ -604,12 +604,14 @@ export function registerTools(server, client) {
|
|
|
604
604
|
// ---------------- identity ----------------
|
|
605
605
|
server.registerTool("whoami", {
|
|
606
606
|
title: "Who am I (CoinRithm)",
|
|
607
|
-
description: "
|
|
608
|
-
"
|
|
609
|
-
"
|
|
610
|
-
"
|
|
611
|
-
"
|
|
612
|
-
|
|
607
|
+
description: "Check the caller's CoinRithm API-key identity and permissions before " +
|
|
608
|
+
"using account or trading tools. Returns userId, keyId, scopes, usage, " +
|
|
609
|
+
"and nullable agentName/agentModel labels; agentModel is self-reported, " +
|
|
610
|
+
"not verified runtime identity. Any valid configured or per-request key " +
|
|
611
|
+
"works; no additional scope is required. Missing or invalid keys return " +
|
|
612
|
+
"401. Omit agentTrace for a simple check. Does not change permissions " +
|
|
613
|
+
"or paper balances; requests update usage/last-used metadata and may " +
|
|
614
|
+
"be privately logged.",
|
|
613
615
|
inputSchema: {
|
|
614
616
|
agentTrace: AGENT_TRACE_SCHEMA,
|
|
615
617
|
},
|
|
@@ -1176,16 +1178,26 @@ export function registerTools(server, client) {
|
|
|
1176
1178
|
}, requestKey(extra))));
|
|
1177
1179
|
server.registerTool("cancel_spot_order", {
|
|
1178
1180
|
title: "Cancel spot order",
|
|
1179
|
-
description: "Cancel
|
|
1180
|
-
"trade:spot scope
|
|
1181
|
-
|
|
1181
|
+
description: "Cancel the unfilled remainder of your paper spot order and release " +
|
|
1182
|
+
"its reserved funds. Requires trade:spot scope; get orderId from " +
|
|
1183
|
+
"list_open_orders. Does not reverse filled trades. Safe to repeat with " +
|
|
1184
|
+
"the same orderId: an order not open under your key returns " +
|
|
1185
|
+
"body.alreadyClosed=true, which does not distinguish a fill from an " +
|
|
1186
|
+
"earlier cancellation or an unknown order. Use get_my_trades to check " +
|
|
1187
|
+
"fills. API failures return ok=false and httpStatus; on 429, respect " +
|
|
1188
|
+
"retryAfterSeconds when provided.",
|
|
1182
1189
|
inputSchema: {
|
|
1183
|
-
orderId: z
|
|
1190
|
+
orderId: z
|
|
1191
|
+
.number()
|
|
1192
|
+
.int()
|
|
1193
|
+
.positive()
|
|
1194
|
+
.describe("Your paper spot order id from list_open_orders."),
|
|
1184
1195
|
agentTrace: AGENT_TRACE_SCHEMA,
|
|
1185
1196
|
},
|
|
1186
1197
|
outputSchema: API_RESULT_OUTPUT_SCHEMA,
|
|
1187
1198
|
annotations: mutatingAnnotations("Cancel spot order", {
|
|
1188
1199
|
destructive: true,
|
|
1200
|
+
idempotent: true,
|
|
1189
1201
|
}),
|
|
1190
1202
|
}, async ({ orderId, agentTrace }, extra) => present(await client.cancelSpotOrder(orderId, requestKey(extra), agentTrace)));
|
|
1191
1203
|
server.registerTool("open_futures_position", {
|
|
@@ -1375,21 +1387,19 @@ export function registerTools(server, client) {
|
|
|
1375
1387
|
}, requestKey(extra))));
|
|
1376
1388
|
server.registerTool("report_pm_opportunity", {
|
|
1377
1389
|
title: "Report a non-opened PM opportunity",
|
|
1378
|
-
description: "
|
|
1379
|
-
"
|
|
1380
|
-
"
|
|
1381
|
-
"
|
|
1382
|
-
"
|
|
1383
|
-
"
|
|
1384
|
-
"
|
|
1385
|
-
"
|
|
1386
|
-
"
|
|
1387
|
-
"
|
|
1388
|
-
"
|
|
1389
|
-
"
|
|
1390
|
-
"
|
|
1391
|
-
"to make a retry idempotent. " +
|
|
1392
|
-
PAPER_NOTE,
|
|
1390
|
+
description: "Save a durable SELF-REPORT of a prediction-market evaluation for a " +
|
|
1391
|
+
"decision that did not open a position. This WRITES an evidence record " +
|
|
1392
|
+
"but never moves paper funds; authorization requires the read scope. " +
|
|
1393
|
+
"It does not independently verify your evaluation. Choose abstained, " +
|
|
1394
|
+
"forecast_only (requires your own forecastProbability, 1-99), or " +
|
|
1395
|
+
"quote_expired. Report once per decision cycle; cohort.universeSize " +
|
|
1396
|
+
"records its breadth. Supply a non-empty decisionId and reuse it with " +
|
|
1397
|
+
"the same API key on retries: the first stored record wins. " +
|
|
1398
|
+
"agentTrace.decisionId is a fallback; omitting both creates separate " +
|
|
1399
|
+
"records. Success returns " +
|
|
1400
|
+
"body.decisionUuid and, on replay, body.idempotentReplay=true. Check " +
|
|
1401
|
+
"ok/httpStatus before treating delivery as confirmed; a network error " +
|
|
1402
|
+
"does not prove rejection. Use open_pm_position to place a paper trade.",
|
|
1393
1403
|
inputSchema: {
|
|
1394
1404
|
kind: z
|
|
1395
1405
|
.enum(["abstained", "forecast_only", "quote_expired"])
|
|
@@ -1410,8 +1420,8 @@ export function registerTools(server, client) {
|
|
|
1410
1420
|
.min(1)
|
|
1411
1421
|
.max(99)
|
|
1412
1422
|
.optional()
|
|
1413
|
-
.describe("Your OWN probability (1-99)
|
|
1414
|
-
"
|
|
1423
|
+
.describe("Your OWN forecast probability (1-99). REQUIRED for forecast_only; " +
|
|
1424
|
+
"optional for other kinds. Never echo the market price."),
|
|
1415
1425
|
marketProbability: z
|
|
1416
1426
|
.number()
|
|
1417
1427
|
.min(0)
|
|
@@ -1442,15 +1452,17 @@ export function registerTools(server, client) {
|
|
|
1442
1452
|
decisionId: z
|
|
1443
1453
|
.string()
|
|
1444
1454
|
.optional()
|
|
1445
|
-
.describe("
|
|
1455
|
+
.describe("Non-empty id for this decision, unique within your API key. " +
|
|
1456
|
+
"Reuse for retries. Falls back to agentTrace.decisionId; " +
|
|
1457
|
+
"omitting both creates a new record on each call."),
|
|
1446
1458
|
runId: z.string().optional().describe("Your own run id for grouping."),
|
|
1447
1459
|
provenance: PROVENANCE_REPORT_SCHEMA,
|
|
1448
1460
|
agentTrace: AGENT_TRACE_SCHEMA,
|
|
1449
1461
|
},
|
|
1450
1462
|
outputSchema: API_RESULT_OUTPUT_SCHEMA,
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1463
|
+
// Idempotency is conditional on decisionId; it is not a safe default
|
|
1464
|
+
// for the entire tool because the field remains optional.
|
|
1465
|
+
annotations: mutatingAnnotations("Report a non-opened PM opportunity"),
|
|
1454
1466
|
}, async ({ kind, source, slug, outcomeExternalMarketId, forecastProbability, marketProbability, reasonCode, cohort, decisionId, runId, provenance, agentTrace, }, extra) => present(await client.reportPmOpportunity({
|
|
1455
1467
|
kind,
|
|
1456
1468
|
source,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coinrithm/mcp-trading",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.12",
|
|
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",
|