@battlegrid/mcp-server 30.0.0 → 31.0.0
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 +106 -100
- package/dist/index.d.ts +43 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,13 +7,26 @@ MCP server for [BattleGrid](https://battlegrid.trade) — play crypto prediction
|
|
|
7
7
|
|
|
8
8
|
It is a thin, authenticated **stdio proxy** to BattleGrid's remote MCP server (Stripe `@stripe/mcp` pattern — no business logic). It discovers tools, prompts, and resources live from the server and re-exposes them to local MCP clients (Claude Desktop, Claude Code, Cursor). Capabilities are always **discovered live** — this package never hardcodes the tool catalog.
|
|
9
9
|
|
|
10
|
-
##
|
|
10
|
+
## v31 — the announced contract is read from the server, not declared here
|
|
11
11
|
|
|
12
|
-
**
|
|
12
|
+
**The package version no longer tracks the server's contract, and no longer claims to.** Through v30 it did: the proxy announced `battlegrid@<package version>` downstream, so the published number was read as the contract a client would reach, and keeping the two in step was a manual release chore. It did not hold — the package sat at `11.0.0` against a deployed contract of `19.3.0` for ten days, `5.1.0` was declared here and never published at all, and four of the last five releases were version bumps carrying no code change.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
From v31 the proxy reads the contract version out of the upstream handshake at connect time and relays it verbatim. What a local client reads is therefore what the connected server just announced — correct by construction, on every connection, with no release involved.
|
|
15
15
|
|
|
16
|
-
**
|
|
16
|
+
**Two versions, two meanings, and they are expected to differ:**
|
|
17
|
+
|
|
18
|
+
| | What it describes | Where to read it |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| Package version | This proxy's own code — a fix here, a dependency bump, a docs correction | `npm view @battlegrid/mcp-server version` |
|
|
21
|
+
| Contract version | The server's wire contract, live | The stdio handshake (`battlegrid@<contract>`), or `GET /mcp/version` |
|
|
22
|
+
|
|
23
|
+
Seeing package `31.0.0` alongside handshake `battlegrid@30.0.0` is the system working. Both are printed to stderr at startup, labelled.
|
|
24
|
+
|
|
25
|
+
**What this changes for you:** nothing about how you call anything. Upgrading the package no longer waits on a server deploy, and a server deploy no longer strands you on a package that names the wrong contract — reconnect and the announcement follows. **Contract breaking-change notes are no longer keyed to package versions**, since a contract move is no longer a release here; the v11-and-earlier notes below are kept as history, and the live vocabulary is always discovery.
|
|
26
|
+
|
|
27
|
+
## Contract history — v12 → v30
|
|
28
|
+
|
|
29
|
+
These are the server contract breaks between contract 12 and contract 30 — the span that shipped while the package sat at `11.0.0`. They are **contract** history, not package releases: from v31 the announced contract is relayed live and a contract move is no longer a release here. Grouped by what a client observes, with the contract version that introduced each.
|
|
17
30
|
|
|
18
31
|
**The proxy itself is unchanged.** It embeds no schemas, pins no contract version, and forwards `{ request }` verbatim. Every break below lands on whatever *authors* the payload or *reads* the result, never on the proxy.
|
|
19
32
|
|
|
@@ -25,10 +38,36 @@ This release absorbs **eighteen** breaking contract majors at once. The publishe
|
|
|
25
38
|
|
|
26
39
|
- **The stop-loss ceiling changed unit** (30.0.0). `maxStopLossPct` (a percent of entry) becomes `maxStopLossAtrMultiple` (a multiple of ATR), and the accepted range narrows from `(0, 100]` to `(0, 3]`. It is a rename **and** a re-denomination — mapping the old value onto the new key sends a number one to two orders of magnitude too large. The objects are `.strict()`, so a 29.x client sending `maxStopLossPct` is rejected with an unknown-key error. A new cross-field rule comes with it: `minStopLossAtrMultiple < maxStopLossAtrMultiple` is now a real comparison and is enforced.
|
|
27
40
|
- **The grid-confidence and trade-conviction bars left the agent** (28.0.0, `remove-agent-rule-defaults`). `tradingConfig.gridMinConfidence` and `minTradeConviction` are removed from the shared `.strict()` config; a bar is declared on the arena slot or radar slot that fires.
|
|
28
|
-
- **
|
|
41
|
+
- **The agent no longer carries either entry guard** (26.0.0). `create_agent` and `update_agent` stop
|
|
42
|
+
accepting `tradingConfig.signalTimeoutMinutes` and `tradingConfig.maxEntryDeviationAtrMultiple`.
|
|
43
|
+
The schema is `.strict()`, so a client still sending either is **rejected**, not silently ignored.
|
|
44
|
+
Neither has a replacement key on any surface: unlike the strategy-owned fields below, these have no
|
|
45
|
+
owning surface at all beneath the platform. One `platform_config` value governs the entry-price
|
|
46
|
+
drift budget for every decision, read at evaluation time; one governs how long an entry may stay
|
|
47
|
+
unfilled, snapshotted onto the position at creation. **Remove both keys and send nothing in their
|
|
48
|
+
place.**
|
|
29
49
|
- **The arena stopped granting trade authority** (25.0.0, `remove-arena-trade-permissions`). `upsert_deployment_policy` and `preview_deployment_resolution` stop accepting `tradingEnabled`, `minConviction` and `coinRules[]` on a slot.
|
|
30
|
-
- **
|
|
31
|
-
|
|
50
|
+
- **The agent no longer carries an exit policy** (24.0.0). `create_agent` and `update_agent` stop
|
|
51
|
+
accepting `tradingConfig.positionManagement`. The schema is `.strict()`, so a client still sending
|
|
52
|
+
it is **rejected**, not silently ignored. The twelve dials that decide how a stop MOVES after entry
|
|
53
|
+
— break-even arming, trailing engagement and giveback, time-decay tightening — are denominated in
|
|
54
|
+
the setup's own payoff shape (multiples of the trade's initial risk, fractions of take-profit
|
|
55
|
+
distance, minutes since entry) and read no balance, leverage or exposure, so they belong to the
|
|
56
|
+
thesis rather than to the account running it. **Author them on the strategy instead**, through
|
|
57
|
+
`compile_strategy_plan` / `apply_strategy_plan`: the post-state gains the same twelve keys beside
|
|
58
|
+
the trade-level trio, and the plan diff gains a `positionManagement` axis. An agent inherits the
|
|
59
|
+
policy from the strategy it binds. **The umbrella `enabled` flag is deleted rather than moved** —
|
|
60
|
+
each mechanism's toggle is now the whole truth for that mechanism, so "trailing on, management
|
|
61
|
+
off" is no longer expressible, a state the server's own monitor and boot recovery already
|
|
62
|
+
disagreed about.
|
|
63
|
+
- **The agent-level trading mode is gone** (23.0.0). `create_agent` and `update_agent` stop
|
|
64
|
+
accepting `tradingConfig.tradingMode`. The schema is `.strict()`, so a client still sending it is
|
|
65
|
+
**rejected**, not silently ignored. Trading on/off is now scoped per deployment — a radar policy's
|
|
66
|
+
`enabled`, an arena slot's `tradingEnabled`, a per-coin `tradeEnabled` — and approval-before-
|
|
67
|
+
execution is the conversational surface's own contract, so the account-level switch that sat above
|
|
68
|
+
both is removed rather than renamed. To stop an agent trading, turn its deployment off (or halt
|
|
69
|
+
the agent); to make one trade autonomously, arm a radar coin or switch trading on for an arena
|
|
70
|
+
slot. **A newly authored arena slot now starts with trading off.**
|
|
32
71
|
- **Trailing gained a required threshold** (22.0.0, `add-trailing-trigger-r`). `positionManagement` gains `trailingTriggerR` as REQUIRED (`0`–`2.0`, `0.01` precision, `0` = trail from entry); the object is `.strict()` all-required, so sending `positionManagement` without it is rejected.
|
|
33
72
|
- **The strategy regime timeframe became derived** (19.0.0, `remove-strategy-regime-override`). It stops being an authored axis anywhere on the contract and is served read-only.
|
|
34
73
|
- **Conditions gained a required `required`** (16.0.0, `add-condition-enforcement-gate`). A condition entry omitting the boolean is REJECTED rather than defaulted.
|
|
@@ -39,11 +78,46 @@ This release absorbs **eighteen** breaking contract majors at once. The publishe
|
|
|
39
78
|
### Moved or reshaped output — a field you read is somewhere else
|
|
40
79
|
|
|
41
80
|
- **`get_radar_activity` gained an `EDGE_REARM` variant** (29.0.0, `add-radar-anchor-rearm`), and every member gained five `rearm*` margin keys plus a `rearmReasons` discriminator. Breaking on both counts if you parse the union strictly.
|
|
42
|
-
-
|
|
81
|
+
- **`get_trading_config_catalog` drops four trade-default seeds** (27.0.0) — `defaultMinAtrPct`,
|
|
82
|
+
`defaultMinStopLossPct`, `defaultMaxStopLossPct` and `defaultMinRiskRewardRatio` leave `defaults`.
|
|
83
|
+
Each seeded a per-agent field that is now **strategy-owned**: the shared `.strict()`
|
|
84
|
+
`TradingConfigSchema` already rejected all four as unknown keys, so the catalog was advertising
|
|
85
|
+
defaults no request could apply. A client that wants the stop-loss band, the ATR floor or the
|
|
86
|
+
risk-reward minimum reads them from the bound **strategy**, which owns and materializes them.
|
|
87
|
+
Nothing is added in their place. `defaultMaxEntryDeviationAtrMultiple` and `defaultTtlMinutes` are
|
|
88
|
+
untouched — those are not seeds but the platform values that govern.
|
|
43
89
|
- **`get_radar_activity` gained `blockReasonCode` on every member** (21.0.0, `fix-block-reason-attribution`) — non-null only on `BLOCKED_BEFORE_EVALUATION` rows written after 2026-08-17.
|
|
44
90
|
- **`signal_pipeline`'s decision became a discriminated union** (20.0.0, `add-decision-skip-attribution`). `ENTER`/`GATED` carry the seven level fields as REQUIRED; `SKIP` omits them entirely rather than sending nulls, so reading `entryPrice` without narrowing the verdict finds the key absent.
|
|
45
91
|
- **`get_radar_activity` gained an `EVALUATION_OUTCOME` member** (18.0.0, `add-radar-fire-outcome-journal`), and every existing member gained `evaluationOutcome` + `screenReason`.
|
|
46
92
|
- **Scalar families became placeable modules** (13.0.0, `add-scalar-family-modules`); six opt-in scalar headers moved off the shared `session-field` section key.
|
|
93
|
+
- **Both entry guards leave every agent-returning shape** (26.0.0) — the read side of the input
|
|
94
|
+
removal above. `AgentTradingConfigDTO` drops `signalTimeoutMinutes` and
|
|
95
|
+
`maxEntryDeviationAtrMultiple` on every tool that serves an agent, and the explorer trading spec
|
|
96
|
+
and the agent-review payload drop them too. `get_trading_config_catalog` drops
|
|
97
|
+
`defaultSignalTimeoutMinutes` from its defaults and the
|
|
98
|
+
`minimumMaxEntryDeviationAtrMultiple` / `maximumMaxEntryDeviationAtrMultiple` pair from its bounds —
|
|
99
|
+
a bound pair that constrained a per-agent field which no longer exists.
|
|
100
|
+
`defaultMaxEntryDeviationAtrMultiple` and `defaultTtlMinutes` **stay**, and are now the values that
|
|
101
|
+
actually govern rather than seeds a new agent copies. A client reading these objects strictly must
|
|
102
|
+
drop the removed keys.
|
|
103
|
+
- **`positionManagement` leaves every agent-returning shape** (24.0.0) — the read side of the input
|
|
104
|
+
removal above. `AgentTradingConfigDTO` drops the nested block on every tool that serves an agent,
|
|
105
|
+
and the explorer trading spec drops it too. A client reading these objects strictly must drop the
|
|
106
|
+
key; one that wants the policy reads it from the bound strategy.
|
|
107
|
+
- **`get_trading_config_catalog` drops `positionManagementPresets`** (24.0.0) — the pistol ladder
|
|
108
|
+
(COLT / WEBLEY / BERETTA / LUGER / WALTHER) is **retired, not renamed**. Once the values live on
|
|
109
|
+
the strategy, the strategy IS the named bundle, with its own name, description and revision
|
|
110
|
+
history; a parallel vocabulary of anonymous bundles beside it would be a second name for the same
|
|
111
|
+
thing. There is no replacement enum to migrate to — list strategies instead. The catalog's
|
|
112
|
+
`defaultPositionMgmt*` trading defaults go with it, for the same reason: nothing seeds an agent's
|
|
113
|
+
exit policy any more.
|
|
114
|
+
- **`tradingMode` leaves every agent-returning shape** (23.0.0) — the read side of the input
|
|
115
|
+
removal above. `AgentTradingConfigDTO` drops it on every tool that serves an agent, and so do the
|
|
116
|
+
agents-hub permission envelope, the explorer entry, and both public-profile shapes. A client
|
|
117
|
+
reading these objects strictly must drop the key.
|
|
118
|
+
- **`DeploymentResolvedResolutionDTO` drops `agentTradingMode`** (23.0.0) — the field 10.0.0 added,
|
|
119
|
+
now unnecessary: with no account layer to overlay, the resolved `tradingEnabled` is the whole
|
|
120
|
+
answer about whether the previewed deployment trades.
|
|
47
121
|
|
|
48
122
|
### Widened enum — new members your own copy rejects
|
|
49
123
|
|
|
@@ -59,9 +133,11 @@ Nothing in the proxy changes. No configuration, no environment variable, no call
|
|
|
59
133
|
|
|
60
134
|
`27.1.0` exit-policy authoring input on `compile_strategy_plan` · `19.2.0` `get_account_state` account identity · `19.1.0` Standing Orders marker authoring · `18.4.0` `list_gate_blocks` summary groups · `18.3.0` radar maintenance pause · `18.1.0` protection geometry · `17.2.0` break-even/trailing status · `17.1.0` `get_signal_log` condition evaluation · `13.1.0` four owner-scoped read tools · `12.1.0` cross-venue spot price metrics · `11.1.0` discoverable rate limit.
|
|
61
135
|
|
|
62
|
-
## v11 —
|
|
136
|
+
## v11 and earlier — contract history (v6 → v11)
|
|
137
|
+
|
|
138
|
+
> **Historical.** These notes are keyed to the package versions that once paired with contract versions. That pairing ended at v31 (above); the breaks themselves are still real, and still describe the server's contract as it moved from 6.0.0 to 11.0.0.
|
|
63
139
|
|
|
64
|
-
**v11
|
|
140
|
+
**v11 paired with the BattleGrid server's MCP contract v11.x.** Under the pairing rule then in force, the package version tracked the server's wire contract because the proxy announced `battlegrid@<package version>` in its own stdio handshake.
|
|
65
141
|
|
|
66
142
|
This release absorbs **six** breaking contract majors at once. The published package went from `5.0.0` straight to `11.0.0`, so no `6.x` through `10.x` client exists to upgrade from — the breaks are therefore grouped by **what you will observe**, with the contract version that introduced each, so a client hitting a specific rejection can find it here.
|
|
67
143
|
|
|
@@ -69,35 +145,6 @@ This release absorbs **six** breaking contract majors at once. The published pac
|
|
|
69
145
|
|
|
70
146
|
### Rejected input — something you author is no longer accepted
|
|
71
147
|
|
|
72
|
-
- **The agent no longer carries either entry guard** (26.0.0). `create_agent` and `update_agent` stop
|
|
73
|
-
accepting `tradingConfig.signalTimeoutMinutes` and `tradingConfig.maxEntryDeviationAtrMultiple`.
|
|
74
|
-
The schema is `.strict()`, so a client still sending either is **rejected**, not silently ignored.
|
|
75
|
-
Neither has a replacement key on any surface: unlike the strategy-owned fields below, these have no
|
|
76
|
-
owning surface at all beneath the platform. One `platform_config` value governs the entry-price
|
|
77
|
-
drift budget for every decision, read at evaluation time; one governs how long an entry may stay
|
|
78
|
-
unfilled, snapshotted onto the position at creation. **Remove both keys and send nothing in their
|
|
79
|
-
place.**
|
|
80
|
-
- **The agent no longer carries an exit policy** (24.0.0). `create_agent` and `update_agent` stop
|
|
81
|
-
accepting `tradingConfig.positionManagement`. The schema is `.strict()`, so a client still sending
|
|
82
|
-
it is **rejected**, not silently ignored. The twelve dials that decide how a stop MOVES after entry
|
|
83
|
-
— break-even arming, trailing engagement and giveback, time-decay tightening — are denominated in
|
|
84
|
-
the setup's own payoff shape (multiples of the trade's initial risk, fractions of take-profit
|
|
85
|
-
distance, minutes since entry) and read no balance, leverage or exposure, so they belong to the
|
|
86
|
-
thesis rather than to the account running it. **Author them on the strategy instead**, through
|
|
87
|
-
`compile_strategy_plan` / `apply_strategy_plan`: the post-state gains the same twelve keys beside
|
|
88
|
-
the trade-level trio, and the plan diff gains a `positionManagement` axis. An agent inherits the
|
|
89
|
-
policy from the strategy it binds. **The umbrella `enabled` flag is deleted rather than moved** —
|
|
90
|
-
each mechanism's toggle is now the whole truth for that mechanism, so "trailing on, management
|
|
91
|
-
off" is no longer expressible, a state the server's own monitor and boot recovery already
|
|
92
|
-
disagreed about.
|
|
93
|
-
- **The agent-level trading mode is gone** (23.0.0). `create_agent` and `update_agent` stop
|
|
94
|
-
accepting `tradingConfig.tradingMode`. The schema is `.strict()`, so a client still sending it is
|
|
95
|
-
**rejected**, not silently ignored. Trading on/off is now scoped per deployment — a radar policy's
|
|
96
|
-
`enabled`, an arena slot's `tradingEnabled`, a per-coin `tradeEnabled` — and approval-before-
|
|
97
|
-
execution is the conversational surface's own contract, so the account-level switch that sat above
|
|
98
|
-
both is removed rather than renamed. To stop an agent trading, turn its deployment off (or halt
|
|
99
|
-
the agent); to make one trade autonomously, arm a radar coin or switch trading on for an arena
|
|
100
|
-
slot. **A newly authored arena slot now starts with trading off.**
|
|
101
148
|
- **Challenge participation is no longer a field you set** (10.0.0). `create_agent` and `update_agent` stop accepting `arenaChallengeEnabled`, and a deployment policy's slot rules and per-coin rules stop accepting `challengeEnabled`. All four schemas are `.strict()`, so a client still sending any of them is **rejected**, not silently ignored. Challenge participation is now *identical* to effective trade permission, resolved per coin: to stop an agent taking challenges at a venue, turn that venue's trading off — at the slot, or per coin for finer grain — using fields you already have.
|
|
102
149
|
- **`VOLUME_RATIO` is retired and replaced by `RVOL`** (6.0.0). `MetricKeySchema` auto-derives from the server's metric catalog, so the published enum simply stops accepting the old key: a column authored with `metric: 'VOLUME_RATIO'` is rejected against the enum. **No alias exists** — deliberately. The catalog audit adjudicated the old name as a name-level lie (the value is current volume ÷ its 20-period average, a *multiple*), and the correction was made at the root rather than grandfathered. If you hit an enum rejection naming `VOLUME_RATIO`, this note is the match.
|
|
103
150
|
- **`BB_WIDTH` can no longer be ranked** (8.0.0). `{ metric: 'BB_WIDTH', transformId: 'rank' }` is now rejected. `BBwidth` is a price-unit spread (`upper − lower`) that had falsely declared `percent`, and that declaration was the only thing admitting it to exchange-wide ranking — the ordinal it produced sorted by token denomination rather than by compression. It re-declares `signedPrice` and leaves the ranked contract. **Rank `BB_WIDTH_PCT` (`bbWidthPct`) instead**, which ships in the same release: the capability moved, it was not removed.
|
|
@@ -121,34 +168,6 @@ This is the failure mode with no error attached to it. Nothing is rejected; your
|
|
|
121
168
|
|
|
122
169
|
Each mismatch also carries a **required** `data: CoverageDatum[]` — the `(metric, rung)` pairs the mismatch is about: every MISSING datum for the not-in-report code, the PRESENT data for the signal-off code, empty for `REQUIRED_SIGNAL_UNAVAILABLE`. A client switching exhaustively on the old code strings stops matching. Behaviourally, coverage is now decided by whether the report renders a signal's declared metrics at the **rung** that signal reads, not by whether its module appears anywhere — so expect warnings you never saw before, and the disappearance of warnings no composition could clear. Mismatches remain advisory and non-blocking; nothing about apply gates on them.
|
|
123
170
|
- **`IntelligenceAgentDTO` drops `arenaChallengeEnabled`** (10.0.0) — the read side of the input removal above. `ResolvedSlotRulesDTO.challengeEnabled` **stays and keeps its shape**; it is now derived server-side, carrying the same value and provenance as `tradingEnabled`, so a client reading the resolved bundle needs no change.
|
|
124
|
-
- **Both entry guards leave every agent-returning shape** (26.0.0) — the read side of the input
|
|
125
|
-
removal above. `AgentTradingConfigDTO` drops `signalTimeoutMinutes` and
|
|
126
|
-
`maxEntryDeviationAtrMultiple` on every tool that serves an agent, and the explorer trading spec
|
|
127
|
-
and the agent-review payload drop them too. `get_trading_config_catalog` drops
|
|
128
|
-
`defaultSignalTimeoutMinutes` from its defaults and the
|
|
129
|
-
`minimumMaxEntryDeviationAtrMultiple` / `maximumMaxEntryDeviationAtrMultiple` pair from its bounds —
|
|
130
|
-
a bound pair that constrained a per-agent field which no longer exists.
|
|
131
|
-
`defaultMaxEntryDeviationAtrMultiple` and `defaultTtlMinutes` **stay**, and are now the values that
|
|
132
|
-
actually govern rather than seeds a new agent copies. A client reading these objects strictly must
|
|
133
|
-
drop the removed keys.
|
|
134
|
-
- **`positionManagement` leaves every agent-returning shape** (24.0.0) — the read side of the input
|
|
135
|
-
removal above. `AgentTradingConfigDTO` drops the nested block on every tool that serves an agent,
|
|
136
|
-
and the explorer trading spec drops it too. A client reading these objects strictly must drop the
|
|
137
|
-
key; one that wants the policy reads it from the bound strategy.
|
|
138
|
-
- **`get_trading_config_catalog` drops `positionManagementPresets`** (24.0.0) — the pistol ladder
|
|
139
|
-
(COLT / WEBLEY / BERETTA / LUGER / WALTHER) is **retired, not renamed**. Once the values live on
|
|
140
|
-
the strategy, the strategy IS the named bundle, with its own name, description and revision
|
|
141
|
-
history; a parallel vocabulary of anonymous bundles beside it would be a second name for the same
|
|
142
|
-
thing. There is no replacement enum to migrate to — list strategies instead. The catalog's
|
|
143
|
-
`defaultPositionMgmt*` trading defaults go with it, for the same reason: nothing seeds an agent's
|
|
144
|
-
exit policy any more.
|
|
145
|
-
- **`tradingMode` leaves every agent-returning shape** (23.0.0) — the read side of the input
|
|
146
|
-
removal above. `AgentTradingConfigDTO` drops it on every tool that serves an agent, and so do the
|
|
147
|
-
agents-hub permission envelope, the explorer entry, and both public-profile shapes. A client
|
|
148
|
-
reading these objects strictly must drop the key.
|
|
149
|
-
- **`DeploymentResolvedResolutionDTO` drops `agentTradingMode`** (23.0.0) — the field 10.0.0 added,
|
|
150
|
-
now unnecessary: with no account layer to overlay, the resolved `tradingEnabled` is the whole
|
|
151
|
-
answer about whether the previewed deployment trades.
|
|
152
171
|
- **`range` is no longer a tuple** (11.0.0). The closed positional pair `[min, max]` becomes the half-open object **`{ min: number; max?: number }`**. It travels through `ScalarSchema`, so this lands on `list_strategy_vocabulary`, `query_report_catalog`, and `get_metric_construction_hints` alike.
|
|
153
172
|
|
|
154
173
|
**This one fails silently.** A client reading `range[0]` / `range[1]` gets `undefined` with no error raised — read `range.min` / `range.max` instead, and treat a missing `max` as unbounded above. The tuple could not state the truth about the volume/trade-count family, which is non-negative and unbounded above, and `Infinity` serializes to `null` on the wire. Those six metrics now declare `{ min: 0 }`, and as a consequence their **`far`/`near` rank orderings are no longer offered** — on a non-negative value that pair is a synonym pair under the magnitude gate's documented semantics.
|
|
@@ -168,7 +187,7 @@ Nothing here is a break, but a client that enumerates these vocabularies will wa
|
|
|
168
187
|
- **Four metric keys** join the catalog — `SPOT_CVD`, `PERP_SPOT_FLOW`, `PERP_SPOT_STRENGTH`, `PERP_SPOT_CONFIRMS` — and `includePerpSpotFlow` joins the context-source key set as its 23rd member, opt-in (5.2.0).
|
|
169
188
|
- **Two prompt-section `kind`s** join the union: `perp-spot-flow` (5.2.0) and `session-field` (5.1.0). Only a client that switches exhaustively on `kind` needs a default branch; one that renders `content` generically needs nothing.
|
|
170
189
|
- **The transform vocabulary grows 15 → 17** (11.0.0) — `efficiency` and `maxShare` join, and both join the chain-outer enum that `chainSuccessors` is served as. Only a client that switches exhaustively on `transformId` needs new branches; one that renders the served labels generically needs nothing.
|
|
171
|
-
-
|
|
190
|
+
- **The deployment-policy resolution DTO gains `agentTradingMode`** (10.0.0) — the preview previously reported trade rules for an agent whose *account-level* trading was off, and the account gate is not part of rule resolution. Read it to tell "this rule permits the trade" from "this account can trade at all".
|
|
172
191
|
- **`PlatformSectionDTO` gains `columns`** (6.1.0) — a platform section's composition in the same wire shape a custom section's columns already travel in, empty for a registry-declared special. **Not a copy source**, which is where it differs from the identically-shaped `CustomSectionTemplateDTO.columns`: six platform columns pair a metric with `classifyState`, a deliberate composability exclusion that authoring rejects at construction. A client that round-trips these into a custom section will be refused, and that refusal is correct.
|
|
173
192
|
|
|
174
193
|
## v5 — breaking major (conditions/verdicts fusion)
|
|
@@ -416,7 +435,8 @@ Tools, prompts, and resources are **discovered live** from the connected server
|
|
|
416
435
|
|
|
417
436
|
## Rediscovery & versioning
|
|
418
437
|
|
|
419
|
-
- **
|
|
438
|
+
- **The announced contract is relayed, not declared.** The proxy reads the upstream server's identity from the handshake it just completed and re-announces it verbatim to the local client. A local client therefore always reads the contract it will actually reach, and the package version is free to mean only what it should: this proxy's own code. **There is no pairing rule to keep, and no publish-time deploy gate** — a released package makes no claim about the server, so there is no ordering between a release here and a deploy there. This replaces the `MAJOR.MINOR` pairing that held through v11; see [v12](#v12--the-announced-contract-is-read-from-the-server-not-declared-here).
|
|
439
|
+
- **Fails closed, never falls back.** If a connected server announced no `serverInfo` — a protocol violation, since it is required in a successful `initialize` result — the proxy refuses to start rather than substituting its own version. There is no honest number to announce in that case, and announcing a dishonest one silently is the failure this design removes.
|
|
420
440
|
- **Rediscover after a server cutover.** Package publication does not refresh a running proxy's cached startup snapshot. Restart/reconnect the proxy and re-run `tools/list`, `prompts/list`, and `resources/list` after the server deploys.
|
|
421
441
|
- **Restart after key rotation.** API keys are read once at process startup; rotate a key, then restart the proxy.
|
|
422
442
|
|
|
@@ -436,8 +456,7 @@ Tools, prompts, and resources are **discovered live** from the connected server
|
|
|
436
456
|
| 8.0.0 | Server contract v8.0.0, **breaking**, on two axes. `BB_WIDTH × rank` is no longer authorable: `BBwidth` is a price-unit spread that falsely declared `percent`, which was the only thing admitting it to exchange-wide ranking, so it re-declares `signedPrice` and leaves the ranked contract — `{metric: 'BB_WIDTH', transformId: 'rank'}` is rejected and `BBwidth_rank_lo` stops matching, with `BB_WIDTH_PCT` (`bbWidthPct`) shipping as the comparable replacement. Separately the published `unit` enum **widens** with `ratio` and `fraction`, and `RVOL`, `BUY_PRESSURE`, `BB_PCT_B` emit them instead of `percent` — a break for a client holding its own closed copy of that enum, which is the opposite direction from an input narrowing. Values are not rescaled: `buyPres` and `pctB` stay 0–1. Never published as a package version |
|
|
437
457
|
| **9.0.0** | Server contract v9.0.0, **breaking**: `compile_strategy_plan`'s `approvedPlan.mismatches` changes on both axes. Both report-coverage codes are renamed off "module" (`ACTIVE_SIGNAL_MODULE_NOT_IN_REPORT` → `ACTIVE_SIGNAL_DATA_NOT_IN_REPORT`, `REPORT_MODULE_SIGNAL_OFF` → `REPORT_DATA_SIGNAL_OFF`), and each mismatch carries a required `data: CoverageDatum[]` — the `(metric, rung)` pairs it is about. A client switching exhaustively on the old code strings stops matching. Coverage is now decided by whether the report renders a signal's declared metrics at the rung that signal reads, so expect warnings never seen before and the disappearance of warnings no composition could clear; mismatches stay advisory and non-blocking. Never published as a package version |
|
|
438
458
|
| 10.0.0 | Server contract v10.0.0, **breaking**: challenge participation stops being a declared setting anywhere and becomes identical to effective trade permission, resolved per coin. `create_agent`/`update_agent` stop accepting `arenaChallengeEnabled`, and a deployment policy's slot and per-coin rule shapes stop accepting `challengeEnabled` — all four are `.strict()`, so a client still sending them is rejected rather than ignored, the same input-acceptance narrowing that made v4, v5, v6 and v8 majors. `IntelligenceAgentDTO` drops `arenaChallengeEnabled`; `ResolvedSlotRulesDTO.challengeEnabled` stays and keeps its shape, now derived server-side with the same value and provenance as `tradingEnabled`. The resolution DTO also gains `agentTradingMode` — the preview previously reported trade rules for an agent whose account-level trading was off. Never published as a package version |
|
|
439
|
-
| **11.0.0** | Server contract v11.0.0, **breaking**: a catalogued numeric output's `range` changes shape — the closed positional tuple `[min, max]` becomes the half-open object `{ min: number; max?: number }`, travelling through `ScalarSchema` into `list_strategy_vocabulary`, `query_report_catalog` and `get_metric_construction_hints`. A client reading `range[0]`/`range[1]` gets `undefined` **with no error**, which is the silent failure mode a version exists to prevent. The driver: the tuple could not state the truth about the volume/trade-count family — non-negative and unbounded above — and `Infinity` serializes to `null` on the wire; those six metrics now declare `{ min: 0 }` and no longer offer `far`/`near` rank orderings, which on a non-negative value are a synonym pair. Additive alongside it: the transform vocabulary grows 15 → 17 (`efficiency`, `maxShare`), both joining the chain-outer enum served as `chainSuccessors`. **
|
|
440
|
-
| 11.1.0 | Server contract v11.1.0, **additive**: the per-user request budget becomes discoverable rather than only enforceable |
|
|
459
|
+
| **11.0.0** | Server contract v11.0.0, **breaking**: a catalogued numeric output's `range` changes shape — the closed positional tuple `[min, max]` becomes the half-open object `{ min: number; max?: number }`, travelling through `ScalarSchema` into `list_strategy_vocabulary`, `query_report_catalog` and `get_metric_construction_hints`. A client reading `range[0]`/`range[1]` gets `undefined` **with no error**, which is the silent failure mode a version exists to prevent. The driver: the tuple could not state the truth about the volume/trade-count family — non-negative and unbounded above — and `Infinity` serializes to `null` on the wire; those six metrics now declare `{ min: 0 }` and no longer offer `far`/`near` rank orderings, which on a non-negative value are a synonym pair. Additive alongside it: the transform vocabulary grows 15 → 17 (`efficiency`, `maxShare`), both joining the chain-outer enum served as `chainSuccessors`. **The last version published under the pairing rule.** No proxy code change — the version was the client-facing signal, and the proxy's handshake carried it |
|
|
441
460
|
| 12.0.0 | Server contract v12.0.0, **breaking**: radar's wall-clock condition changes shape (`unify-deployment-hours-as-sets`) |
|
|
442
461
|
| 12.1.0 | Server contract v12.1.0, **additive**: `SPOT_CLOSE_CB` / `SPOT_CLOSE_BN` join the metric catalog |
|
|
443
462
|
| 13.0.0 | Server contract v13.0.0, **breaking**: scalar families become placeable modules; six scalar headers leave the `session-field` key |
|
|
@@ -472,12 +491,7 @@ Tools, prompts, and resources are **discovered live** from the connected server
|
|
|
472
491
|
| 23.0.0 | Server contract v23.0.0, **breaking**: the agent-level trading mode is retired. `create_agent`/`update_agent` stop accepting `tradingConfig.tradingMode` on the shared `.strict()` `TradingConfigSchema`, so a client still sending it is rejected rather than ignored — the same input-acceptance narrowing that made v4, v5, v6, v8 and v10 majors. On the read side `AgentTradingConfigDTO` drops `tradingMode` on every agent-returning tool, and so do the agents-hub permission envelope, the explorer entry and both public-profile shapes; `DeploymentResolvedResolutionDTO` drops `agentTradingMode`, the field v10.0.0 added, because with no account layer to overlay the resolved `tradingEnabled` is the whole answer. Trading on/off is now scoped per deployment (radar policy `enabled`, arena slot `tradingEnabled`, per-coin `tradeEnabled`) and a newly authored arena slot starts with trading **off**; approval-before-execution is the conversational surface's own contract, so `accept_entry_decision` / `cancel_entry_decision` / `list_pending_approvals` are unchanged on the wire but now carry conversational proposals exclusively — a deployed agent never queues for approval. Never published as a package version |
|
|
473
492
|
| 24.0.0 | Server contract v24.0.0, **breaking**: the post-entry exit policy moves from the agent to the strategy. `create_agent`/`update_agent` stop accepting `tradingConfig.positionManagement` on the shared `.strict()` `TradingConfigSchema`, so a client still sending it is rejected rather than ignored — the same input-acceptance narrowing that made v4, v5, v6, v8, v10 and v23 majors. On the read side `AgentTradingConfigDTO` drops the nested block on every agent-returning tool and the explorer trading spec drops it too; `get_trading_config_catalog` drops `positionManagementPresets` and the `defaultPositionMgmt*` trading defaults. The pistol-preset ladder (COLT / WEBLEY / BERETTA / LUGER / WALTHER) is **retired, not renamed** — once the values live on the strategy, the strategy is the named bundle. Additive on the authoring surface in the same bump: `compile_strategy_plan`/`apply_strategy_plan` post-state gains the twelve authored keys beside the trade-level trio, and the plan diff gains a `positionManagement` axis. Behaviourally the umbrella `enabled` flag is **deleted** rather than moved: each mechanism toggle is the whole truth for that mechanism, so a client can no longer express "trailing on, management off". Never published as a package version |
|
|
474
493
|
| 26.0.0 | Server contract v26.0.0, **breaking**: both entry-lifecycle guards stop being agent configuration. `create_agent`/`update_agent` stop accepting `tradingConfig.signalTimeoutMinutes` and `tradingConfig.maxEntryDeviationAtrMultiple` on the shared `.strict()` `TradingConfigSchema`, so a client still sending either is rejected rather than ignored — the same input-acceptance narrowing that made v4, v5, v6, v8, v10, v23 and v24 majors. Neither has a replacement key: one `platform_config` value governs the entry-price drift budget for every decision (read at evaluation time, so an admin edit applies to the next evaluation), and one governs how long an entry may stay unfilled (snapshotted onto the position at creation, so an edit can never cancel an order already resting on the book). On the read side `AgentTradingConfigDTO` drops both fields on every agent-returning tool, and so do the explorer trading spec and the agent-review payload; `get_trading_config_catalog` drops `defaultSignalTimeoutMinutes` and the `minimum_`/`maximum_maxEntryDeviationAtrMultiple` bound pair, while `defaultMaxEntryDeviationAtrMultiple` and `defaultTtlMinutes` stay and become the values that actually govern. Behaviourally a conversational entry and an autonomous entry on the same setup now receive the **identical** unfilled lifetime — the mode-selecting fallback that chose between a per-agent timeout and a hardcoded 15-minute resting window is gone, and the three-way timeout enum with it. Never published as a package version |
|
|
475
|
-
|
|
476
|
-
> **Gap: contract 25.0.0 is not recorded in this table.** It shipped server-side as
|
|
477
|
-
> `remove-arena-trade-permissions` (the arena stops granting trade authority; `upsert_deployment_policy`
|
|
478
|
-
> and `preview_deployment_resolution` stop accepting `tradingEnabled` / `minConviction` / `coinRules[]`
|
|
479
|
-
> on a slot, and `DeploymentSlotDTO` reshapes). Its row belongs to that change and is left for it to
|
|
480
|
-
> write rather than reconstructed here.
|
|
494
|
+
| **31.0.0** | **Proxy change, and the end of the pairing rule.** The version announced downstream is now read from the upstream handshake at connect time and relayed verbatim, instead of being a constant compiled into this package. A local client reads the contract it will actually reach, on every connection, with no release involved. Breaking because the package number now means something different — this proxy's own code, not the server's contract — so `npm view` and the handshake legitimately differ, and code keyed to them being equal is wrong. Retired with it: the publish-time deploy gate (`scripts/assert-deployed-contract.mjs`) and the `MAJOR.MINOR` pairing rule, both of which existed only because the two numbers could disagree. Fails closed if a connected server announces no `serverInfo` rather than substituting its own version. Contract moves no longer produce a release here |
|
|
481
495
|
|
|
482
496
|
## Maintainer release procedure
|
|
483
497
|
|
|
@@ -485,7 +499,9 @@ Tools, prompts, and resources are **discovered live** from the connected server
|
|
|
485
499
|
|
|
486
500
|
Publishing runs only in GitHub-hosted Actions. Never run `npm publish` from the BattleGrid application VM or a maintainer workstation.
|
|
487
501
|
|
|
488
|
-
**A version change on `main` is the release.** Merge a pull request that changes `package.json`'s version and the workflow does the rest: it confirms that version is not already on the registry, verifies every value expressing it agrees,
|
|
502
|
+
**A version change on `main` is the release.** Merge a pull request that changes `package.json`'s version and the workflow does the rest: it confirms that version is not already on the registry, verifies every value expressing it agrees, tests, builds, packs, publishes with npm provenance, and tags what shipped. There is no manual tag step — the tag is an output of a successful publish, not its prerequisite.
|
|
503
|
+
|
|
504
|
+
**Release whenever this package's code is ready.** Since v12 the package makes no claim about the server's contract, so there is no deploy to sequence against and no gate asserting one. Publishing before, during, or after a server deploy is equally correct.
|
|
489
505
|
|
|
490
506
|
That inversion is deliberate. Publication used to be triggered by a tag, which meant a version bump with no tag published nothing **and reported nothing** — how `5.1.0` came to be declared in this repository and absent from the registry, caught by no check at all.
|
|
491
507
|
|
|
@@ -498,34 +514,24 @@ That inversion is deliberate. Publication used to be triggered by a tag, which m
|
|
|
498
514
|
| Check, build, publish, and tag | GitHub-hosted `ubuntu-latest`, Node 24 |
|
|
499
515
|
| Verify registry publication | Any shell |
|
|
500
516
|
|
|
501
|
-
**The
|
|
517
|
+
**The workflow needs no BattleGrid credential.** It never contacts the BattleGrid server at all. The deploy gate that used to (reading `GET /mcp/version`, unauthenticated by design) was retired in v12 along with the pairing rule that motivated it. Its no-credential property is worth keeping in mind if a future check ever needs the contract version: every BattleGrid MCP API key carries `mcp:wager` and there is no read-only variant, so a credentialed check would mean this workflow holding authority to submit wagers and close live positions in order to read a version number. `GET /mcp/version` exists precisely so that trade never has to be made.
|
|
502
518
|
|
|
503
519
|
Also confirm npm's Trusted Publisher for `@battlegrid/mcp-server` is GitHub Actions with organization `playbattlegrid`, repository `battlegrid-mcp`, workflow filename `publish.yml`, no environment name, and `npm publish` allowed. The workflow uses short-lived OIDC credentials; do not add a long-lived `NPM_TOKEN`.
|
|
504
520
|
|
|
505
521
|
### Preparing the version change
|
|
506
522
|
|
|
507
|
-
- **
|
|
508
|
-
- **Move all
|
|
509
|
-
- **
|
|
510
|
-
|
|
511
|
-
### What tells you a pairing is owed
|
|
512
|
-
|
|
513
|
-
[`.github/workflows/contract-drift.yml`](.github/workflows/contract-drift.yml) runs daily, reads the same unauthenticated `GET /mcp/version` the deploy assertion reads, compares the same `MAJOR.MINOR` contract line, and **opens a bump PR when they diverge**. Merge it and the release follows, because a version change on `main` IS the release.
|
|
514
|
-
|
|
515
|
-
It exists because the deploy assertion could not do this job. `scripts/assert-deployed-contract.mjs` runs only when a publish is ATTEMPTED, so it can refuse a release someone started and cannot say one is owed. Between 2026-08-07 and 2026-08-23 no publish was attempted while the server advanced from contract `11.0` to `30.0`, and this package spent sixteen days announcing `battlegrid@11.0.0` to every client — the exact failure the pairing section above describes. It was also unpublishable for that whole period, since its own gate would have refused `11.0` against `30.0`.
|
|
516
|
-
|
|
517
|
-
Reading the DEPLOYED endpoint rather than the app repo's merged manifest is deliberate: it makes the watch fire only once the deploy has landed, which is the ordering *Preparing the version change* already requires.
|
|
518
|
-
|
|
519
|
-
The PR it opens moves all four version values, and its body says what a human still owes — the README release section describing what changed for clients. The bump is mechanical; the changelog is judgement, which is why this opens a PR instead of merging one.
|
|
523
|
+
- **Version this package's own code, and nothing else.** Since v12 the number describes this proxy's build — a fix here, a dependency bump, a documentation correction — and makes no statement about the server. **Do not move it because the server's contract moved**; that used to be the whole job and is now a category error. Ordinary semver against the proxy's own surface: MAJOR for a break in how the proxy behaves or what its number means, MINOR for proxy features, PATCH for fixes and docs.
|
|
524
|
+
- **Move all three values together** — `package.json`, both `package-lock.json` version fields (the root `version` and the self-referencing `packages[""].version`), and `PACKAGE_VERSION` in `src/index.ts`. The workflow compares all of them and fails closed on any disagreement.
|
|
525
|
+
- **No deploy to wait for.** A release here is independent of the server's deploy schedule in both directions.
|
|
520
526
|
|
|
521
|
-
###
|
|
527
|
+
### What a server contract move needs from this package
|
|
522
528
|
|
|
523
|
-
|
|
529
|
+
**Nothing.** That is the point of v12. When the server's contract moves, connected proxies announce the new version on their next connection, with no publish, no version bump, and no coordination.
|
|
524
530
|
|
|
525
|
-
|
|
526
|
-
- **A proxy-only release** — a fix in this package's own code, a dependency bump, a documentation correction. Move the **PATCH**, which is the package's own space: the contract has never carried a non-zero patch, so a patch bump makes no claim about the server and needs no deploy. This is the historical norm, not an edge case — `1.0.1`, `1.0.2`, `1.1.2`, `1.1.4` and `3.0.1` were all proxy-only, and `3.0.1` is recorded in the version table above as *"Docs only — … No proxy behavior change"*.
|
|
531
|
+
Two things do still need doing, neither of them a release:
|
|
527
532
|
|
|
528
|
-
|
|
533
|
+
- **Reconnect** to pick up the new contract — the announcement and the capability snapshot are both read once at startup (see [Rediscovery & versioning](#rediscovery--versioning)).
|
|
534
|
+
- **Document the break** where the contract is documented, in `battlegrid-app`. Contract breaking-change notes are no longer keyed to package versions in this README, because a contract move is no longer a release here.
|
|
529
535
|
|
|
530
536
|
### Verify publication
|
|
531
537
|
|
|
@@ -548,11 +554,11 @@ Require the exact version, `latest` pointing at that version, and a provenance a
|
|
|
548
554
|
|
|
549
555
|
There is no separate registry-reconciliation step to remember. "Is this version already published?" is the workflow's own first question — it decides whether the run publishes at all — so a bump can no longer sit in the repository unpublished and unreported the way `5.1.0` did.
|
|
550
556
|
|
|
551
|
-
**The server-side release canary is not evidence about this package.** `battlegrid-app`'s `server/scripts/release-canary-mcp.ts` connects to the deployed endpoint and compares `client.getServerVersion()` against the server's own imported `MCP_CONTRACT_VERSION` — **both sides are server-side, and it never queries npm.** It passes with this package at any version, including one that was never published. Package-side evidence is exactly
|
|
557
|
+
**The server-side release canary is not evidence about this package.** `battlegrid-app`'s `server/scripts/release-canary-mcp.ts` connects to the deployed endpoint and compares `client.getServerVersion()` against the server's own imported `MCP_CONTRACT_VERSION` — **both sides are server-side, and it never queries npm.** It passes with this package at any version, including one that was never published. Package-side evidence is exactly two things: the workflow's version-integrity gate, and the registry checks above with `gitHead` matching the release commit.
|
|
552
558
|
|
|
553
|
-
|
|
559
|
+
**A reconnect no longer proves which package version is running**, and this is the one verification v12 took away rather than improved. The stdio handshake now shows `battlegrid@<contract>` — the *server's* number — so it is identical whether the local proxy is 12.0.0 or a stale 11.0.0 from a cached `npx`. Read `PACKAGE_VERSION` from the installed `dist/index.js`, or the trailing `proxy <version>` field in the startup stderr line, to confirm which build is running.
|
|
554
560
|
|
|
555
|
-
If a run fails, inspect it before taking action. An `ENEEDAUTH` failure means the npm Trusted Publisher fields do not match the workflow — fix the publisher configuration and re-run the job
|
|
561
|
+
If a run fails, inspect it before taking action. An `ENEEDAUTH` failure means the npm Trusted Publisher fields do not match the workflow — fix the publisher configuration and re-run the job; nothing was published and no tag was created, so there is nothing to move or reuse. Never mutate a published release with `npm audit fix`; dependency remediation goes through a new reviewed commit and version.
|
|
556
562
|
|
|
557
563
|
## Skills
|
|
558
564
|
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
* the nested request — the server owns every required field, bound, union
|
|
20
20
|
* discriminator, and `additionalProperties:false` constraint.
|
|
21
21
|
*
|
|
22
|
+
* Versions (two of them, describing two different things):
|
|
23
|
+
* - PACKAGE_VERSION — this proxy's own code. Sent UPSTREAM as the client identity.
|
|
24
|
+
* - the announced contract — read from the upstream handshake at connect time and relayed
|
|
25
|
+
* DOWNSTREAM verbatim. Never a constant compiled into this package. See `announcedIdentityOf`.
|
|
26
|
+
*
|
|
22
27
|
* Architecture: Matches Stripe's @stripe/mcp pattern — thin authenticated proxy.
|
|
23
28
|
*
|
|
24
29
|
* Usage:
|
|
@@ -32,7 +37,19 @@
|
|
|
32
37
|
*/
|
|
33
38
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
34
39
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
35
|
-
|
|
40
|
+
import { type Implementation } from '@modelcontextprotocol/sdk/types.js';
|
|
41
|
+
/**
|
|
42
|
+
* This package's own version — the proxy's code, and nothing else.
|
|
43
|
+
*
|
|
44
|
+
* It deliberately does NOT describe the server's wire contract. That number is read from the
|
|
45
|
+
* upstream handshake on every connection and relayed downstream (`announcedIdentityOf`), so the two
|
|
46
|
+
* cannot drift: there is no second place to update and no release needed when the contract moves.
|
|
47
|
+
*
|
|
48
|
+
* Sent upstream as the CLIENT identity, where "which proxy build is calling" is exactly the question
|
|
49
|
+
* being asked. Move it for a change to THIS package — a proxy fix, a dependency bump, a docs
|
|
50
|
+
* correction. Never move it to track the server.
|
|
51
|
+
*/
|
|
52
|
+
export declare const PACKAGE_VERSION = "31.0.0";
|
|
36
53
|
export declare const DEFAULT_URL = "https://mcp.battlegrid.trade/mcp";
|
|
37
54
|
export interface EnvConfig {
|
|
38
55
|
apiKeys: string[];
|
|
@@ -65,13 +82,34 @@ export interface ToolDefinition {
|
|
|
65
82
|
* required fields, bounds) are preserved by reference, never rewritten.
|
|
66
83
|
*/
|
|
67
84
|
export declare function injectAccountParam(tools: ToolDefinition[], accountNames: string[]): ToolDefinition[];
|
|
85
|
+
/**
|
|
86
|
+
* The identity the local stdio server announces downstream: the upstream server's own, relayed
|
|
87
|
+
* verbatim from the handshake that just completed.
|
|
88
|
+
*
|
|
89
|
+
* WHY RELAY RATHER THAN DECLARE. A local client reads this handshake as a statement about the
|
|
90
|
+
* contract it is about to call. Announcing a constant compiled into this package makes that
|
|
91
|
+
* statement on the server's behalf and then depends on a human keeping the two in step — which is
|
|
92
|
+
* how the package sat at `11.0.0` against a deployed contract of `19.3.0` for ten days, how `5.1.0`
|
|
93
|
+
* came to be declared in this repository and absent from the registry, and why four of the last five
|
|
94
|
+
* releases were version bumps carrying no code change at all. Reading the number off the connection
|
|
95
|
+
* that will actually serve the calls makes the pairing true by construction, on every connection,
|
|
96
|
+
* with no release involved.
|
|
97
|
+
*
|
|
98
|
+
* VERBATIM, NOT RECONSTRUCTED. `Implementation` also carries optional display metadata (`title`,
|
|
99
|
+
* `websiteUrl`, `icons`, …). Passing the object through means a field the server adds later reaches
|
|
100
|
+
* local clients without an edit here — the same reason the tool catalog is never enumerated.
|
|
101
|
+
*
|
|
102
|
+
* FAILS CLOSED. `serverInfo` is required in a successful MCP `initialize` result, so a connected
|
|
103
|
+
* client holding none is a protocol violation rather than a case to design around. Falling back to
|
|
104
|
+
* PACKAGE_VERSION here would reintroduce the exact fiction this function exists to remove, and would
|
|
105
|
+
* do it silently, at the one moment the truth was unavailable.
|
|
106
|
+
*/
|
|
107
|
+
export declare function announcedIdentityOf(serverInfo: Implementation | undefined): Implementation;
|
|
68
108
|
export interface CreateProxyServerOptions {
|
|
69
109
|
/** Discovered account identities (index 0 is the primary key used for capability discovery). */
|
|
70
110
|
identities: AccountIdentity[];
|
|
71
111
|
/** Connect (or reuse) a remote MCP client for a given API key. Called once per key, lazily. */
|
|
72
112
|
connect: (apiKey: string) => Promise<Client>;
|
|
73
|
-
/** Advertised server version; defaults to VERSION. */
|
|
74
|
-
version?: string;
|
|
75
113
|
}
|
|
76
114
|
export interface ProxyServer {
|
|
77
115
|
server: Server;
|
|
@@ -80,6 +118,8 @@ export interface ProxyServer {
|
|
|
80
118
|
resourceCount: number;
|
|
81
119
|
isMultiAccount: boolean;
|
|
82
120
|
accountNames: string[];
|
|
121
|
+
/** The upstream identity relayed downstream — the contract a local client will actually reach. */
|
|
122
|
+
announced: Implementation;
|
|
83
123
|
}
|
|
84
124
|
/**
|
|
85
125
|
* Build the local stdio-facing MCP server that proxies to the remote BattleGrid
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,oCAAoC,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,WAAW,qCAAqC,CAAC;AAM9D,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,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AO,CAAC;IACxB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,kGAAkG;IAClG,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CAmI/F"}
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
* the nested request — the server owns every required field, bound, union
|
|
20
20
|
* discriminator, and `additionalProperties:false` constraint.
|
|
21
21
|
*
|
|
22
|
+
* Versions (two of them, describing two different things):
|
|
23
|
+
* - PACKAGE_VERSION — this proxy's own code. Sent UPSTREAM as the client identity.
|
|
24
|
+
* - the announced contract — read from the upstream handshake at connect time and relayed
|
|
25
|
+
* DOWNSTREAM verbatim. Never a constant compiled into this package. See `announcedIdentityOf`.
|
|
26
|
+
*
|
|
22
27
|
* Architecture: Matches Stripe's @stripe/mcp pattern — thin authenticated proxy.
|
|
23
28
|
*
|
|
24
29
|
* Usage:
|
|
@@ -36,7 +41,18 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
36
41
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
37
42
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
38
43
|
import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
39
|
-
|
|
44
|
+
/**
|
|
45
|
+
* This package's own version — the proxy's code, and nothing else.
|
|
46
|
+
*
|
|
47
|
+
* It deliberately does NOT describe the server's wire contract. That number is read from the
|
|
48
|
+
* upstream handshake on every connection and relayed downstream (`announcedIdentityOf`), so the two
|
|
49
|
+
* cannot drift: there is no second place to update and no release needed when the contract moves.
|
|
50
|
+
*
|
|
51
|
+
* Sent upstream as the CLIENT identity, where "which proxy build is calling" is exactly the question
|
|
52
|
+
* being asked. Move it for a change to THIS package — a proxy fix, a dependency bump, a docs
|
|
53
|
+
* correction. Never move it to track the server.
|
|
54
|
+
*/
|
|
55
|
+
export const PACKAGE_VERSION = '31.0.0';
|
|
40
56
|
export const DEFAULT_URL = 'https://mcp.battlegrid.trade/mcp';
|
|
41
57
|
const MAX_RETRIES = 3;
|
|
42
58
|
const RETRY_DELAYS_MS = [2000, 4000, 8000];
|
|
@@ -174,6 +190,37 @@ export function injectAccountParam(tools, accountNames) {
|
|
|
174
190
|
},
|
|
175
191
|
}));
|
|
176
192
|
}
|
|
193
|
+
// --- Announced identity (exported for testing) ---
|
|
194
|
+
/**
|
|
195
|
+
* The identity the local stdio server announces downstream: the upstream server's own, relayed
|
|
196
|
+
* verbatim from the handshake that just completed.
|
|
197
|
+
*
|
|
198
|
+
* WHY RELAY RATHER THAN DECLARE. A local client reads this handshake as a statement about the
|
|
199
|
+
* contract it is about to call. Announcing a constant compiled into this package makes that
|
|
200
|
+
* statement on the server's behalf and then depends on a human keeping the two in step — which is
|
|
201
|
+
* how the package sat at `11.0.0` against a deployed contract of `19.3.0` for ten days, how `5.1.0`
|
|
202
|
+
* came to be declared in this repository and absent from the registry, and why four of the last five
|
|
203
|
+
* releases were version bumps carrying no code change at all. Reading the number off the connection
|
|
204
|
+
* that will actually serve the calls makes the pairing true by construction, on every connection,
|
|
205
|
+
* with no release involved.
|
|
206
|
+
*
|
|
207
|
+
* VERBATIM, NOT RECONSTRUCTED. `Implementation` also carries optional display metadata (`title`,
|
|
208
|
+
* `websiteUrl`, `icons`, …). Passing the object through means a field the server adds later reaches
|
|
209
|
+
* local clients without an edit here — the same reason the tool catalog is never enumerated.
|
|
210
|
+
*
|
|
211
|
+
* FAILS CLOSED. `serverInfo` is required in a successful MCP `initialize` result, so a connected
|
|
212
|
+
* client holding none is a protocol violation rather than a case to design around. Falling back to
|
|
213
|
+
* PACKAGE_VERSION here would reintroduce the exact fiction this function exists to remove, and would
|
|
214
|
+
* do it silently, at the one moment the truth was unavailable.
|
|
215
|
+
*/
|
|
216
|
+
export function announcedIdentityOf(serverInfo) {
|
|
217
|
+
if (serverInfo === undefined) {
|
|
218
|
+
throw new Error('Upstream MCP server completed initialize without announcing serverInfo, so there is no ' +
|
|
219
|
+
'contract version to relay to local clients. This is a protocol violation by the server — ' +
|
|
220
|
+
'not a configuration problem, and not something this proxy will substitute a guess for.');
|
|
221
|
+
}
|
|
222
|
+
return serverInfo;
|
|
223
|
+
}
|
|
177
224
|
/**
|
|
178
225
|
* Build the local stdio-facing MCP server that proxies to the remote BattleGrid
|
|
179
226
|
* server. Discovers remote capabilities through the primary client, augments
|
|
@@ -182,7 +229,6 @@ export function injectAccountParam(tools, accountNames) {
|
|
|
182
229
|
*/
|
|
183
230
|
export async function createProxyServer(options) {
|
|
184
231
|
const { identities, connect } = options;
|
|
185
|
-
const version = options.version ?? VERSION;
|
|
186
232
|
const isMultiAccount = identities.length > 1;
|
|
187
233
|
const accountNames = identities.map(id => id.username);
|
|
188
234
|
// Build lookup: username → apiKey
|
|
@@ -193,6 +239,9 @@ export async function createProxyServer(options) {
|
|
|
193
239
|
// Primary client (first key) is used for capability discovery and non-tool proxying.
|
|
194
240
|
const primaryKey = identities[0].apiKey;
|
|
195
241
|
const primaryClient = await connect(primaryKey);
|
|
242
|
+
// What this proxy announces downstream is what the upstream just announced to it — read here,
|
|
243
|
+
// from the completed handshake, so it can never be a stale constant.
|
|
244
|
+
const announced = announcedIdentityOf(primaryClient.getServerVersion());
|
|
196
245
|
// Discover remote capabilities
|
|
197
246
|
const [toolsResult, promptsResult, resourcesResult] = await Promise.all([
|
|
198
247
|
primaryClient.listTools(),
|
|
@@ -203,8 +252,8 @@ export async function createProxyServer(options) {
|
|
|
203
252
|
const exposedTools = isMultiAccount
|
|
204
253
|
? injectAccountParam(toolsResult.tools, accountNames)
|
|
205
254
|
: toolsResult.tools;
|
|
206
|
-
// Create local stdio server
|
|
207
|
-
const localServer = new Server(
|
|
255
|
+
// Create local stdio server, announcing the upstream's identity rather than one of our own.
|
|
256
|
+
const localServer = new Server(announced, {
|
|
208
257
|
capabilities: {
|
|
209
258
|
tools: {},
|
|
210
259
|
prompts: {},
|
|
@@ -284,6 +333,7 @@ export async function createProxyServer(options) {
|
|
|
284
333
|
resourceCount: resourcesResult.resources.length,
|
|
285
334
|
isMultiAccount,
|
|
286
335
|
accountNames,
|
|
336
|
+
announced,
|
|
287
337
|
};
|
|
288
338
|
}
|
|
289
339
|
// --- Main ---
|
|
@@ -315,7 +365,8 @@ async function main() {
|
|
|
315
365
|
// Lazily connect a remote MCP client per API key, with retry + auth diagnostics.
|
|
316
366
|
const connect = async (apiKey) => {
|
|
317
367
|
const transport = new StreamableHTTPClientTransport(new URL(config.apiUrl), { requestInit: { headers: { Authorization: `Bearer ${apiKey}` } } });
|
|
318
|
-
|
|
368
|
+
// Upstream is told which proxy build is calling — the one question PACKAGE_VERSION answers.
|
|
369
|
+
const client = new Client({ name: 'battlegrid-proxy', version: PACKAGE_VERSION }, { capabilities: {} });
|
|
319
370
|
await connectWithRetry(client, transport, config.apiUrl);
|
|
320
371
|
return client;
|
|
321
372
|
};
|
|
@@ -327,6 +378,11 @@ async function main() {
|
|
|
327
378
|
process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
328
379
|
process.exit(1);
|
|
329
380
|
}
|
|
381
|
+
// Both numbers, labelled. They describe different things and are EXPECTED to differ — printing
|
|
382
|
+
// only one leaves an operator to guess which, and printing neither is how the last drift went
|
|
383
|
+
// unnoticed for ten days.
|
|
384
|
+
process.stderr.write(`BattleGrid MCP: announcing ${proxy.announced.name}@${proxy.announced.version} ` +
|
|
385
|
+
`(server contract, read from the upstream handshake) — proxy ${PACKAGE_VERSION}\n`);
|
|
330
386
|
process.stderr.write(`BattleGrid MCP: ${proxy.toolCount} tools, ${proxy.promptCount} prompts, ${proxy.resourceCount} resources\n`);
|
|
331
387
|
// --- Start stdio transport ---
|
|
332
388
|
const stdioTransport = new StdioServerTransport();
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAE5C,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,kCAAkC,CAAC;AAC9D,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,eAAe,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAgB3C,wDAAwD;AAExD,MAAM,UAAU,WAAW,CAAC,GAAuC;IACjE,MAAM,MAAM,GAAG,GAAG,CAAC,kBAAkB,IAAI,WAAW,CAAC;IAErD,yDAAyD;IACzD,MAAM,OAAO,GAAG,GAAG,CAAC,mBAAmB,CAAC;IACxC,IAAI,OAAiB,CAAC;IAEtB,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAClE,CAAC;SAAM,CAAC;QACN,MAAM,SAAS,GAAG,GAAG,CAAC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