@battlegrid/mcp-server 31.2.114 → 32.0.1
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 +74 -2
- package/dist/index.d.ts +32 -24
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -48
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
- package/skills/EXPORT.json +3 -3
- package/skills/battlegrid-radar-deployment/SKILL.md +22 -3
- package/skills/battlegrid-radar-deployment/references/radar-stage-examples.md +4 -1
package/README.md
CHANGED
|
@@ -7,6 +7,20 @@ 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
|
+
## v32 — MCP SDK v2, both protocol eras, Node 20
|
|
11
|
+
|
|
12
|
+
**The proxy now runs on MCP SDK v2 and requires Node.js 20 or newer.** That is the whole reason for the MAJOR: SDK v2
|
|
13
|
+
supports no older Node, and dropping a supported runtime is a break in how the proxy runs, even though nothing about
|
|
14
|
+
how you call it changes.
|
|
15
|
+
|
|
16
|
+
- **Upstream, it negotiates.** The proxy speaks protocol 2026-07-28 to a server that serves it — BattleGrid does from
|
|
17
|
+
contract v116 — in one `server/discover` round trip, and falls back to the 2025 `initialize` handshake with one that
|
|
18
|
+
does not. No release is needed when the server moves.
|
|
19
|
+
- **Downstream, nothing changes.** Your local client connects over stdio as before, every argument but `account` is
|
|
20
|
+
forwarded verbatim, and the announced contract is still read from the upstream handshake.
|
|
21
|
+
- **A transient failure is retried on a fresh connection**, and an authentication failure (HTTP 401 or 403) is
|
|
22
|
+
reported at once, read from the HTTP status rather than from the error's wording.
|
|
23
|
+
|
|
10
24
|
## v31 — the announced contract is read from the server, not declared here
|
|
11
25
|
|
|
12
26
|
**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.
|
|
@@ -24,6 +38,63 @@ Seeing package `31.x` alongside handshake `battlegrid@33.x` — the package **be
|
|
|
24
38
|
|
|
25
39
|
**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
40
|
|
|
41
|
+
## Contract history — v116 (the server moves to MCP SDK v2 and protocol 2026-07-28)
|
|
42
|
+
|
|
43
|
+
**Breaking at v116: `test_generate_deployment_grid` takes its payload at the top level.** v116 is the contract on top
|
|
44
|
+
of v115.1. Reconnect the proxy, or restart it, so discovery reads the new schemas.
|
|
45
|
+
|
|
46
|
+
### Rejected input — something you send is no longer accepted
|
|
47
|
+
|
|
48
|
+
- **`test_generate_deployment_grid` takes `presetId`, `slots`, `simulatedRegime?`, `regimeReferenceCoinId?` and
|
|
49
|
+
`regimeTimeframe?` as top-level arguments.** A call that still wraps them in `request` is refused naming `request`.
|
|
50
|
+
`preview_deployment_resolution`, `preview_radar_resolution` and `get_strategy_section_template` keep their `request`.
|
|
51
|
+
|
|
52
|
+
### Behaviour behind unchanged schemas
|
|
53
|
+
|
|
54
|
+
- **Schemas are JSON Schema 2020-12**, the 2026-07-28 default dialect, and still declare no `$schema`. A named shape
|
|
55
|
+
(`marketGridEntryCellAxis`, `conditionNode`, `conditionColumn`, `conditionHold`) moves from the root `definitions`
|
|
56
|
+
to the root `$defs`, referenced as `#/$defs/<name>`, and a described or optional use publishes as
|
|
57
|
+
`{ $ref, description? }` rather than `{ description?, allOf: [{ $ref }] }`. Acceptance does not move.
|
|
58
|
+
- **The endpoint's own refusals carry new JSON-RPC codes:** `-31401` (no valid credential), `-31403` (no `mcp:read`),
|
|
59
|
+
`-31405` (any method but `POST`) and `-31429` (over the request budget), where each carried `-32000`. The HTTP status
|
|
60
|
+
and `Retry-After` do not move.
|
|
61
|
+
- **An unknown tool name is a JSON-RPC `-32602` error**, where it was an `isError` result, and argument errors name
|
|
62
|
+
each issue as `path: message`.
|
|
63
|
+
- **A 2025-era HTTP client receives each response as a one-event `text/event-stream`**, where it received
|
|
64
|
+
`application/json`; a 2026-07-28 client receives JSON. `GET` and `DELETE` on `/mcp` answer 405.
|
|
65
|
+
- **A random submit that carries reasoning records your client's declared name** on its journal row. Through this proxy
|
|
66
|
+
that name is `battlegrid-proxy`.
|
|
67
|
+
- **Authorization responses carry `iss`** (RFC 9207).
|
|
68
|
+
|
|
69
|
+
## Contract history — v115.1 (the server's schema library moves to Zod 4)
|
|
70
|
+
|
|
71
|
+
**Nothing you send is refused that was accepted at v115.** v115.1 is the contract on top of v115. It deploys together
|
|
72
|
+
with v116, so a connected client reads v116's schemas: the named shapes below sit under `$defs` there. Reconnect the
|
|
73
|
+
proxy, or restart it, so discovery reads the re-published schemas.
|
|
74
|
+
|
|
75
|
+
### Behaviour behind unchanged schemas
|
|
76
|
+
|
|
77
|
+
- **A reused or recursive input shape is named under the root `definitions`**, referenced as `#/definitions/<name>`,
|
|
78
|
+
where it was `#/$defs/<name>`: `marketGridEntryCellAxis` (the 25 `CELL_n` axes of
|
|
79
|
+
`stage_market_grid_entry_draft`), `conditionNode` (the recursive condition tree), `conditionColumn` and
|
|
80
|
+
`conditionHold`. A described or optional use publishes as `{ description?, allOf: [{ $ref }] }`.
|
|
81
|
+
- **Schemas spell more of what they already checked:** a uuid, date-time or email field adds its `pattern`, an
|
|
82
|
+
integer its bounds at ±9,007,199,254,740,991, a discriminated union is `oneOf` and a literal union `anyOf` of
|
|
83
|
+
`const`s. Acceptance does not move.
|
|
84
|
+
- **The slot and condition members of a slot set** (`preview_radar_resolution` and `preview_deployment_resolution`
|
|
85
|
+
`SLOTS`, `test_generate_deployment_grid`) publish without `additionalProperties: false`. They always dropped an
|
|
86
|
+
unknown key, so a slot you read can be sent back as it is.
|
|
87
|
+
- **Validation messages take Zod 4's wording**, in the argument errors and a refusal's `message`: `Required` becomes
|
|
88
|
+
`Invalid input: expected string, received undefined`, and `Unrecognized key(s) in object: 'x'` becomes
|
|
89
|
+
`Unrecognized key: "x"`. Codes, fields and envelope keys do not move.
|
|
90
|
+
|
|
91
|
+
### Widened output
|
|
92
|
+
|
|
93
|
+
- **`get_market_grid_results.playerGrids` states its numeric grid-position keys, and `reasonCodeDetails` on
|
|
94
|
+
`get_signal_log` and `get_public_agent_signal_log_detail` its reason-code keys, as `propertyNames`.** The results
|
|
95
|
+
always carried exactly these keys.
|
|
96
|
+
- **`stage_agent_draft`'s `STRATEGY_BINDING.strategyId`** no longer carries the agent id's description.
|
|
97
|
+
|
|
27
98
|
## Contract history — v114 (every paginated read takes the same cursor)
|
|
28
99
|
|
|
29
100
|
**Breaking at v114: the radar close-decision read pages by cursor, and old cursors expire.** v114 is the contract on
|
|
@@ -3562,7 +3633,7 @@ Tools, prompts, and resources are **discovered live** from the connected server
|
|
|
3562
3633
|
## Rediscovery & versioning
|
|
3563
3634
|
|
|
3564
3635
|
- **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).
|
|
3565
|
-
- **Fails closed, never falls back.** If a connected server announced no `serverInfo` — a
|
|
3636
|
+
- **Fails closed, never falls back.** If a connected server announced no `serverInfo` — a server fault, since BattleGrid announces it on both protocol eras: in the `initialize` result of a 2025-era handshake and in the `server/discover` result of a 2026-07-28 connection — 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.
|
|
3566
3637
|
- **Rediscover after a server cutover.** The proxy resolves its catalog on first use and then caches it for the life of the process; a resolution that *failed* is retried on the next request, but a server deploy is never noticed. Package publication does not refresh it either. Restart/reconnect the proxy and re-run `tools/list`, `prompts/list`, and `resources/list` after the server deploys.
|
|
3567
3638
|
- **Restart after key rotation.** API keys are read once at process startup; rotate a key, then restart the proxy.
|
|
3568
3639
|
|
|
@@ -3720,7 +3791,8 @@ you reach over MCP:
|
|
|
3720
3791
|
> request; `skills/EXPORT.json` records a hash per file and `src/__tests__/skill-provenance.test.ts`
|
|
3721
3792
|
> fails CI on a hand edit. Change the skill upstream and let the export lane bring it here.
|
|
3722
3793
|
|
|
3723
|
-
A client connected to BattleGrid's remote server directly receives its
|
|
3794
|
+
A client connected to BattleGrid's remote server directly receives its instructions in the handshake — the
|
|
3795
|
+
`server/discover` result on protocol 2026-07-28, the `initialize` result on a 2025 revision:
|
|
3724
3796
|
the rules that span tools and one routing line per workflow, each naming the `battlegrid-*` skill
|
|
3725
3797
|
above that holds the full procedure, with the workflow cards in the `battlegrid://guide/workflows`
|
|
3726
3798
|
resource. This proxy does not relay those instructions; the skills
|
package/dist/index.d.ts
CHANGED
|
@@ -34,9 +34,8 @@
|
|
|
34
34
|
* BATTLEGRID_API_KEY (optional) — Single API key (fallback if BATTLEGRID_API_KEYS not set)
|
|
35
35
|
* BATTLEGRID_API_URL (optional) — Override server URL (default: https://mcp.battlegrid.trade/mcp)
|
|
36
36
|
*/
|
|
37
|
-
import { Server } from '@modelcontextprotocol/
|
|
38
|
-
import { Client } from '@modelcontextprotocol/
|
|
39
|
-
import { type Implementation, type Prompt, type Resource } from '@modelcontextprotocol/sdk/types.js';
|
|
37
|
+
import { Server, type Implementation, type Prompt, type Resource, type Tool } from '@modelcontextprotocol/server';
|
|
38
|
+
import { Client, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
|
40
39
|
/**
|
|
41
40
|
* This package's own version — the proxy's code, and nothing else.
|
|
42
41
|
*
|
|
@@ -48,7 +47,7 @@ import { type Implementation, type Prompt, type Resource } from '@modelcontextpr
|
|
|
48
47
|
* being asked. Move it for a change to THIS package — a proxy fix, a dependency bump, a docs
|
|
49
48
|
* correction. Never move it to track the server.
|
|
50
49
|
*/
|
|
51
|
-
export declare const PACKAGE_VERSION = "
|
|
50
|
+
export declare const PACKAGE_VERSION = "32.0.1";
|
|
52
51
|
export declare const DEFAULT_URL = "https://mcp.battlegrid.trade/mcp";
|
|
53
52
|
export interface EnvConfig {
|
|
54
53
|
apiKeys: string[];
|
|
@@ -62,23 +61,29 @@ export interface AccountIdentity {
|
|
|
62
61
|
}
|
|
63
62
|
export declare function validateEnv(env: Record<string, string | undefined>): EnvConfig;
|
|
64
63
|
export declare function discoverIdentities(apiKeys: string[], apiUrl: string): Promise<AccountIdentity[]>;
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
/**
|
|
65
|
+
* The HTTP status an upstream request failed with, or null when the failure carried none (a network error, a
|
|
66
|
+
* timeout). The one reader of it: MCP SDK v2 reports an HTTP failure as `SdkHttpError`, whose `status` is the response
|
|
67
|
+
* status and whose `code` is the SDK's own string, never a number.
|
|
68
|
+
*/
|
|
69
|
+
export declare function httpStatusOf(error: unknown): number | null;
|
|
70
|
+
/** An upstream refusal of the credential itself: retrying cannot succeed, so it is reported at once. */
|
|
71
|
+
export declare function isAuthError(error: unknown): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Connect a fresh client and transport per attempt: a v2 `Client` closes its transport when `connect` fails, and a
|
|
74
|
+
* closed transport cannot be started again, so reusing one would fail every retry with "already started".
|
|
75
|
+
*/
|
|
76
|
+
export declare function connectWithRetry(createClient: () => {
|
|
77
|
+
client: Client;
|
|
78
|
+
transport: StreamableHTTPClientTransport;
|
|
79
|
+
}, apiUrl: string, apiKey: string): Promise<Client>;
|
|
75
80
|
/**
|
|
76
81
|
* Add a required `account` enum to every discovered tool, as a sibling of the
|
|
77
82
|
* existing top-level properties. The server-owned root
|
|
78
83
|
* `additionalProperties:false` and every existing property (unions, required
|
|
79
84
|
* fields, bounds) are preserved by reference, never rewritten.
|
|
80
85
|
*/
|
|
81
|
-
export declare function injectAccountParam(tools:
|
|
86
|
+
export declare function injectAccountParam(tools: Tool[], accountNames: string[]): Tool[];
|
|
82
87
|
/**
|
|
83
88
|
* The identity the local stdio server announces downstream: the upstream server's own, relayed
|
|
84
89
|
* verbatim from the handshake that just completed.
|
|
@@ -96,10 +101,11 @@ export declare function injectAccountParam(tools: ToolDefinition[], accountNames
|
|
|
96
101
|
* `websiteUrl`, `icons`, …). Passing the object through means a field the server adds later reaches
|
|
97
102
|
* local clients without an edit here — the same reason the tool catalog is never enumerated.
|
|
98
103
|
*
|
|
99
|
-
* FAILS CLOSED. `serverInfo`
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
104
|
+
* FAILS CLOSED. The BattleGrid server announces `serverInfo` on both protocol eras: in the `initialize`
|
|
105
|
+
* result a 2025-era handshake requires, and in the `_meta` of the `server/discover` result a 2026-07-28
|
|
106
|
+
* connection reads. A connected client holding none is therefore a server fault rather than a case to
|
|
107
|
+
* design around. Falling back to PACKAGE_VERSION here would reintroduce the exact fiction this function
|
|
108
|
+
* exists to remove, and would do it silently, at the one moment the truth was unavailable.
|
|
103
109
|
*/
|
|
104
110
|
export declare function announcedIdentityOf(serverInfo: Implementation | undefined): Implementation;
|
|
105
111
|
export interface CreateProxyServerOptions {
|
|
@@ -133,7 +139,7 @@ export interface ProxyCatalog {
|
|
|
133
139
|
identities: AccountIdentity[];
|
|
134
140
|
accountNames: string[];
|
|
135
141
|
keyByAccount: Map<string, string>;
|
|
136
|
-
tools:
|
|
142
|
+
tools: Tool[];
|
|
137
143
|
prompts: Prompt[];
|
|
138
144
|
resources: Resource[];
|
|
139
145
|
}
|
|
@@ -164,11 +170,13 @@ export interface ProxyServer {
|
|
|
164
170
|
* Build the local stdio-facing MCP server that proxies to the remote BattleGrid server.
|
|
165
171
|
*
|
|
166
172
|
* ORDERING IS THE POINT. Exactly one upstream operation happens here: the handshake that yields the
|
|
167
|
-
* identity this proxy relays
|
|
168
|
-
*
|
|
169
|
-
*
|
|
173
|
+
* identity this proxy relays — a `server/discover` round trip with a server that serves 2026-07-28, the
|
|
174
|
+
* probe followed by the 2025-era `initialize` exchange with one that does not. `serverInfo` is captured
|
|
175
|
+
* by the SDK at `Server` construction and read when the local handshake (`initialize` or
|
|
176
|
+
* `server/discover`) is answered, with no setter, so relaying the upstream's identity verbatim makes
|
|
177
|
+
* that handshake inherent. Everything else — identity discovery and the three catalog calls —
|
|
170
178
|
* resolves lazily, after the caller has bound the transport, because none of it is needed to answer
|
|
171
|
-
*
|
|
179
|
+
* the handshake and every unit of work placed ahead of the bind is paid by every client on every
|
|
172
180
|
* start.
|
|
173
181
|
*/
|
|
174
182
|
export declare function createProxyServer(options: CreateProxyServerOptions): Promise<ProxyServer>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAGH,OAAO,EAAE,MAAM,EAAE,KAAK,cAAc,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,KAAK,IAAI,EAAE,MAAM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UAAU,EAAE,cAAc,GAAG,SAAS,GAAG,cAAc,CAS1F;AAID,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,cAAc,EAAE,OAAO,CAAC;IACxB,kEAAkE;IAClE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,+FAA+F;IAC/F,iBAAiB,EAAE,MAAM,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;CACrD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IAC1B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,kGAAkG;IAClG,SAAS,EAAE,cAAc,CAAC;IAC1B;;;OAGG;IACH,IAAI,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CAsO/F"}
|
package/dist/index.js
CHANGED
|
@@ -35,11 +35,9 @@
|
|
|
35
35
|
* BATTLEGRID_API_URL (optional) — Override server URL (default: https://mcp.battlegrid.trade/mcp)
|
|
36
36
|
*/
|
|
37
37
|
import { createHash } from 'crypto';
|
|
38
|
-
import { Server } from '@modelcontextprotocol/
|
|
39
|
-
import { StdioServerTransport } from '@modelcontextprotocol/
|
|
40
|
-
import { Client } from '@modelcontextprotocol/
|
|
41
|
-
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
42
|
-
import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
38
|
+
import { Server } from '@modelcontextprotocol/server';
|
|
39
|
+
import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
|
|
40
|
+
import { Client, SdkHttpError, StreamableHTTPClientTransport } from '@modelcontextprotocol/client';
|
|
43
41
|
/**
|
|
44
42
|
* This package's own version — the proxy's code, and nothing else.
|
|
45
43
|
*
|
|
@@ -51,7 +49,7 @@ import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema
|
|
|
51
49
|
* being asked. Move it for a change to THIS package — a proxy fix, a dependency bump, a docs
|
|
52
50
|
* correction. Never move it to track the server.
|
|
53
51
|
*/
|
|
54
|
-
export const PACKAGE_VERSION = '
|
|
52
|
+
export const PACKAGE_VERSION = '32.0.1';
|
|
55
53
|
export const DEFAULT_URL = 'https://mcp.battlegrid.trade/mcp';
|
|
56
54
|
const MAX_RETRIES = 3;
|
|
57
55
|
const RETRY_DELAYS_MS = [2000, 4000, 8000];
|
|
@@ -125,34 +123,38 @@ export async function discoverIdentities(apiKeys, apiUrl) {
|
|
|
125
123
|
return identities;
|
|
126
124
|
}
|
|
127
125
|
// --- Connection with retry ---
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
126
|
+
/**
|
|
127
|
+
* The HTTP status an upstream request failed with, or null when the failure carried none (a network error, a
|
|
128
|
+
* timeout). The one reader of it: MCP SDK v2 reports an HTTP failure as `SdkHttpError`, whose `status` is the response
|
|
129
|
+
* status and whose `code` is the SDK's own string, never a number.
|
|
130
|
+
*/
|
|
131
|
+
export function httpStatusOf(error) {
|
|
132
|
+
return error instanceof SdkHttpError ? error.status : null;
|
|
133
|
+
}
|
|
134
|
+
/** An upstream refusal of the credential itself: retrying cannot succeed, so it is reported at once. */
|
|
135
|
+
export function isAuthError(error) {
|
|
136
|
+
const status = httpStatusOf(error);
|
|
137
|
+
return status === 401 || status === 403;
|
|
137
138
|
}
|
|
138
139
|
function sleep(ms) {
|
|
139
140
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
140
141
|
}
|
|
141
|
-
|
|
142
|
+
/**
|
|
143
|
+
* Connect a fresh client and transport per attempt: a v2 `Client` closes its transport when `connect` fails, and a
|
|
144
|
+
* closed transport cannot be started again, so reusing one would fail every retry with "already started".
|
|
145
|
+
*/
|
|
146
|
+
export async function connectWithRetry(createClient, apiUrl, apiKey) {
|
|
142
147
|
const keyPrefix = apiKey.substring(0, 12);
|
|
143
148
|
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
149
|
+
const { client, transport } = createClient();
|
|
144
150
|
try {
|
|
145
151
|
await client.connect(transport);
|
|
146
|
-
return;
|
|
152
|
+
return client;
|
|
147
153
|
}
|
|
148
154
|
catch (error) {
|
|
149
|
-
// Log full error detail for diagnostics
|
|
150
|
-
const errorCode = error && typeof error === 'object' && 'code' in error
|
|
151
|
-
? error.code
|
|
152
|
-
: undefined;
|
|
153
155
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
154
156
|
if (isAuthError(error)) {
|
|
155
|
-
throw new Error(`Authentication failed for key ${keyPrefix} (HTTP ${
|
|
157
|
+
throw new Error(`Authentication failed for key ${keyPrefix} (HTTP ${httpStatusOf(error)}): ${errorMessage}\n` +
|
|
156
158
|
'This means the server rejected your API key. Possible causes:\n' +
|
|
157
159
|
' 1. Key was revoked (a new key invalidates all previous keys)\n' +
|
|
158
160
|
' 2. Key was corrupted during copy-paste\n' +
|
|
@@ -171,7 +173,9 @@ async function connectWithRetry(client, transport, apiUrl, apiKey) {
|
|
|
171
173
|
await sleep(delay);
|
|
172
174
|
}
|
|
173
175
|
}
|
|
176
|
+
throw new Error('unreachable: the last attempt either returns or throws');
|
|
174
177
|
}
|
|
178
|
+
// --- Multi-account tool augmentation ---
|
|
175
179
|
/**
|
|
176
180
|
* Add a required `account` enum to every discovered tool, as a sibling of the
|
|
177
181
|
* existing top-level properties. The server-owned root
|
|
@@ -213,14 +217,15 @@ export function injectAccountParam(tools, accountNames) {
|
|
|
213
217
|
* `websiteUrl`, `icons`, …). Passing the object through means a field the server adds later reaches
|
|
214
218
|
* local clients without an edit here — the same reason the tool catalog is never enumerated.
|
|
215
219
|
*
|
|
216
|
-
* FAILS CLOSED. `serverInfo`
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
+
* FAILS CLOSED. The BattleGrid server announces `serverInfo` on both protocol eras: in the `initialize`
|
|
221
|
+
* result a 2025-era handshake requires, and in the `_meta` of the `server/discover` result a 2026-07-28
|
|
222
|
+
* connection reads. A connected client holding none is therefore a server fault rather than a case to
|
|
223
|
+
* design around. Falling back to PACKAGE_VERSION here would reintroduce the exact fiction this function
|
|
224
|
+
* exists to remove, and would do it silently, at the one moment the truth was unavailable.
|
|
220
225
|
*/
|
|
221
226
|
export function announcedIdentityOf(serverInfo) {
|
|
222
227
|
if (serverInfo === undefined) {
|
|
223
|
-
throw new Error('Upstream MCP server
|
|
228
|
+
throw new Error('Upstream MCP server connected without announcing serverInfo, so there is no ' +
|
|
224
229
|
'contract version to relay to local clients. This is a protocol violation by the server — ' +
|
|
225
230
|
'not a configuration problem, and not something this proxy will substitute a guess for.');
|
|
226
231
|
}
|
|
@@ -230,11 +235,13 @@ export function announcedIdentityOf(serverInfo) {
|
|
|
230
235
|
* Build the local stdio-facing MCP server that proxies to the remote BattleGrid server.
|
|
231
236
|
*
|
|
232
237
|
* ORDERING IS THE POINT. Exactly one upstream operation happens here: the handshake that yields the
|
|
233
|
-
* identity this proxy relays
|
|
234
|
-
*
|
|
235
|
-
*
|
|
238
|
+
* identity this proxy relays — a `server/discover` round trip with a server that serves 2026-07-28, the
|
|
239
|
+
* probe followed by the 2025-era `initialize` exchange with one that does not. `serverInfo` is captured
|
|
240
|
+
* by the SDK at `Server` construction and read when the local handshake (`initialize` or
|
|
241
|
+
* `server/discover`) is answered, with no setter, so relaying the upstream's identity verbatim makes
|
|
242
|
+
* that handshake inherent. Everything else — identity discovery and the three catalog calls —
|
|
236
243
|
* resolves lazily, after the caller has bound the transport, because none of it is needed to answer
|
|
237
|
-
*
|
|
244
|
+
* the handshake and every unit of work placed ahead of the bind is paid by every client on every
|
|
238
245
|
* start.
|
|
239
246
|
*/
|
|
240
247
|
export async function createProxyServer(options) {
|
|
@@ -311,12 +318,11 @@ export async function createProxyServer(options) {
|
|
|
311
318
|
primaryClient.listPrompts(),
|
|
312
319
|
primaryClient.listResources(),
|
|
313
320
|
]);
|
|
314
|
-
const discovered = toolsResult.tools;
|
|
315
321
|
return {
|
|
316
322
|
identities,
|
|
317
323
|
accountNames,
|
|
318
324
|
keyByAccount,
|
|
319
|
-
tools: isMultiAccount ? injectAccountParam(
|
|
325
|
+
tools: isMultiAccount ? injectAccountParam(toolsResult.tools, accountNames) : toolsResult.tools,
|
|
320
326
|
prompts: promptsResult.prompts,
|
|
321
327
|
resources: resourcesResult.resources,
|
|
322
328
|
};
|
|
@@ -362,11 +368,11 @@ export async function createProxyServer(options) {
|
|
|
362
368
|
// Throws on rejection: ListToolsResult carries only `tools`, so the tools/call in-band
|
|
363
369
|
// `{content, isError}` shape would ship as a SUCCESSFUL result that fails the client's own parse.
|
|
364
370
|
// The SDK maps a thrown handler error to a proper JSON-RPC error.
|
|
365
|
-
localServer.setRequestHandler(
|
|
371
|
+
localServer.setRequestHandler('tools/list', async () => {
|
|
366
372
|
const catalog = await catalogOrThrow();
|
|
367
373
|
return { tools: catalog.tools };
|
|
368
374
|
});
|
|
369
|
-
localServer.setRequestHandler(
|
|
375
|
+
localServer.setRequestHandler('tools/call', async (request) => {
|
|
370
376
|
try {
|
|
371
377
|
let targetKey = primaryKey;
|
|
372
378
|
const args = { ...request.params.arguments };
|
|
@@ -402,22 +408,22 @@ export async function createProxyServer(options) {
|
|
|
402
408
|
}
|
|
403
409
|
});
|
|
404
410
|
// --- Proxy: prompts ---
|
|
405
|
-
localServer.setRequestHandler(
|
|
411
|
+
localServer.setRequestHandler('prompts/list', async () => {
|
|
406
412
|
const catalog = await catalogOrThrow();
|
|
407
413
|
return { prompts: catalog.prompts };
|
|
408
414
|
});
|
|
409
|
-
localServer.setRequestHandler(
|
|
415
|
+
localServer.setRequestHandler('prompts/get', async (request) => {
|
|
410
416
|
return await primaryClient.getPrompt({
|
|
411
417
|
name: request.params.name,
|
|
412
418
|
arguments: request.params.arguments,
|
|
413
419
|
});
|
|
414
420
|
});
|
|
415
421
|
// --- Proxy: resources ---
|
|
416
|
-
localServer.setRequestHandler(
|
|
422
|
+
localServer.setRequestHandler('resources/list', async () => {
|
|
417
423
|
const catalog = await catalogOrThrow();
|
|
418
424
|
return { resources: catalog.resources };
|
|
419
425
|
});
|
|
420
|
-
localServer.setRequestHandler(
|
|
426
|
+
localServer.setRequestHandler('resources/read', async (request) => {
|
|
421
427
|
return await primaryClient.readResource({
|
|
422
428
|
uri: request.params.uri,
|
|
423
429
|
});
|
|
@@ -452,14 +458,14 @@ async function main() {
|
|
|
452
458
|
const hashPrefix = createHash('sha256').update(key).digest('hex').substring(0, 16);
|
|
453
459
|
process.stderr.write(`BattleGrid MCP: Key #${i + 1} prefix=${key.substring(0, 12)} hashPrefix=${hashPrefix} len=${key.length}\n`);
|
|
454
460
|
}
|
|
455
|
-
// Connect a remote MCP client for a given API key, with retry + auth diagnostics.
|
|
456
|
-
|
|
457
|
-
|
|
461
|
+
// Connect a remote MCP client for a given API key, with retry + auth diagnostics. `auto` negotiates protocol
|
|
462
|
+
// 2026-07-28 with a server that serves it and falls back to the 2025-era `initialize` handshake with one that
|
|
463
|
+
// does not, so the proxy reaches either without a release.
|
|
464
|
+
const connect = (apiKey) => connectWithRetry(() => ({
|
|
465
|
+
transport: new StreamableHTTPClientTransport(new URL(config.apiUrl), { requestInit: { headers: { Authorization: `Bearer ${apiKey}` } } }),
|
|
458
466
|
// Upstream is told which proxy build is calling — the one question PACKAGE_VERSION answers.
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
return client;
|
|
462
|
-
};
|
|
467
|
+
client: new Client({ name: 'battlegrid-proxy', version: PACKAGE_VERSION }, { capabilities: {}, versionNegotiation: { mode: 'auto' } }),
|
|
468
|
+
}), config.apiUrl, apiKey);
|
|
463
469
|
let proxy;
|
|
464
470
|
try {
|
|
465
471
|
proxy = await createProxyServer({
|
|
@@ -484,13 +490,13 @@ async function main() {
|
|
|
484
490
|
// --- Start stdio transport, BEFORE any catalog work ---
|
|
485
491
|
//
|
|
486
492
|
// Everything above is the single upstream handshake the relayed serverInfo requires. From here the
|
|
487
|
-
// process answers
|
|
493
|
+
// process answers a local handshake; identity discovery and the three catalog calls happen behind it.
|
|
488
494
|
const stdioTransport = new StdioServerTransport();
|
|
489
495
|
await proxy.server.connect(stdioTransport);
|
|
490
496
|
process.stderr.write('BattleGrid MCP server running on stdio\n');
|
|
491
497
|
// Warm the catalog so the first tools/list joins an in-flight resolution rather than starting one.
|
|
492
498
|
// Deliberately NOT awaited, and the rejection handler is the whole of the guarantee that a
|
|
493
|
-
// background failure cannot kill a process that has already answered
|
|
499
|
+
// background failure cannot kill a process that has already answered its handshake. The failure is
|
|
494
500
|
// reported and absorbed; the next request that needs the catalog retries it.
|
|
495
501
|
void proxy.warm().then((summary) => {
|
|
496
502
|
process.stderr.write(`BattleGrid MCP: ${summary.accountNames.length} account(s) discovered — ${summary.accountNames.join(', ')}\n`);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3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AAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@battlegrid/mcp-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "32.0.1",
|
|
4
4
|
"description": "BattleGrid MCP server — play crypto prediction games from AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
"gaming"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@modelcontextprotocol/
|
|
36
|
+
"@modelcontextprotocol/client": "^2.3.1",
|
|
37
|
+
"@modelcontextprotocol/server": "^2.3.1"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@types/node": "^25.3.3",
|
|
@@ -41,7 +42,7 @@
|
|
|
41
42
|
"vitest": "^4.0.18"
|
|
42
43
|
},
|
|
43
44
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
45
|
+
"node": ">=20"
|
|
45
46
|
},
|
|
46
47
|
"license": "MIT",
|
|
47
48
|
"repository": {
|
package/skills/EXPORT.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"generator": "battlegrid-app/server/scripts/export-mcp-skills.mjs",
|
|
3
|
-
"contractVersion": "
|
|
3
|
+
"contractVersion": "116.0.0",
|
|
4
4
|
"files": {
|
|
5
5
|
"battlegrid-agent-management/SKILL.md": "9dc151c32c3578d06e8895c6752d7a64959bff6a6681a01d62ab65e1ea1590d1",
|
|
6
6
|
"battlegrid-agent-management/references/agent-stage-examples.md": "dffcc353d61dfc7b5bb6a2b3077fc6bf8c760a34c287cafb3b59b99306f24195",
|
|
7
7
|
"battlegrid-arena-play/SKILL.md": "2e37970a66b8738ffbc445a23da90651c1f41b56ce4eef551582ab123517ef74",
|
|
8
8
|
"battlegrid-arena-play/references/entry-stage-examples.md": "0223f3743171ff213e943789d27590b2f65648398e85e10cd24938d5eb6af665",
|
|
9
9
|
"battlegrid-market-analysis/SKILL.md": "fcbe98e30e1edce39bb170c224cdf20181934f62b5f3a26b293787c70eeb6229",
|
|
10
|
-
"battlegrid-radar-deployment/SKILL.md": "
|
|
10
|
+
"battlegrid-radar-deployment/SKILL.md": "cf6664f51f92d40acce21a46f4fb078d9afe46c99c4f4b603bf002e73d4c5a23",
|
|
11
11
|
"battlegrid-radar-deployment/references/arena-stage-examples.md": "d27cfed1f4663f267c4a7ecebe4a6e65a450fc74bd14ce8987fb61af5bbf2ca5",
|
|
12
|
-
"battlegrid-radar-deployment/references/radar-stage-examples.md": "
|
|
12
|
+
"battlegrid-radar-deployment/references/radar-stage-examples.md": "13fc3f55d91d3da9754e1ed7fb27493b7b7ba4d40a6a7e8d1ee0365f90ea10de",
|
|
13
13
|
"battlegrid-strategy-authoring/SKILL.md": "39cfa46b1f640e6800edb7e85a8f2c4b6b8786cddf71bb8244d172a44fc11d75",
|
|
14
14
|
"battlegrid-strategy-authoring/references/strategy-stage-examples.md": "f10ecdc91f3660a708eee7a7bacefce2acbb46c9cf7e0ac1454bd54f839f39fd",
|
|
15
15
|
"battlegrid-strategy-doctor/SKILL.md": "e34e055b0cc9b355bc1adeb5d49d464eaa0756ca3f48dc89ca2ccdda94e1311f",
|
|
@@ -107,7 +107,12 @@ is test-routing a regime. Never carry a fact from a radar conversation into it,
|
|
|
107
107
|
Do not confirm a draft whose diagnostics carry an error: stage a fix.
|
|
108
108
|
3. `preview_radar_resolution({ coinId, request: { kind: "DRAFT", draftVersion } })` at the version that
|
|
109
109
|
read returned. It composes the draft over the deployed policy **exactly as the commit will write it**,
|
|
110
|
-
and refuses a draft no longer at that version with `DRAFT_VERSION_MOVED`.
|
|
110
|
+
and refuses a draft no longer at that version with `DRAFT_VERSION_MOVED`. Its `ruleCloseCoverage`
|
|
111
|
+
counts, for each hours rule, the closes of its agent's `strategyTimeframe` bar the rule's hours let
|
|
112
|
+
it decide through `windowEndAt`. Before asking the player to commit, name every rule whose
|
|
113
|
+
`decidableCloses` is 0: its agent's timeframe, the served `windowEndAt`, and that it is this rule's
|
|
114
|
+
hours alone that hold no close — not the agent, which still decides closes it is on duty for through
|
|
115
|
+
another rule or the default. Never tell the player the agent will not trade.
|
|
111
116
|
|
|
112
117
|
To try a slot set without touching the draft, preview `{ kind: "SLOTS", slots }` — it resolves
|
|
113
118
|
explicit slots and nothing can commit it.
|
|
@@ -122,6 +127,19 @@ from what the player asked for:
|
|
|
122
127
|
| only in named hours and days | a rule with an hours condition |
|
|
123
128
|
| in named regimes during named hours | a rule with one hours condition and one regime condition |
|
|
124
129
|
|
|
130
|
+
When the player names an exchange session — New York, the New York open, London, the London open,
|
|
131
|
+
the London–New York overlap, Tokyo, the Tokyo open — call `get_radar_market_hours` and stage that session's `hours`
|
|
132
|
+
exactly as served, merged with any other session they name; never work session hours out yourself,
|
|
133
|
+
because New York and London shift with daylight saving on their own dates and the overlap changes
|
|
134
|
+
shape on each of those dates. The three opens are one hour wide, so they suit agents on 1h bars or
|
|
135
|
+
faster. The days stay the player's choice. Tell the player the staged hours are UTC, that an hour is
|
|
136
|
+
on duty from :00 through :59, and, when the session carries a `nextShift`, the date its hours change
|
|
137
|
+
and that the rule keeps the hours it was given.
|
|
138
|
+
|
|
139
|
+
Session closes are not presets. Asked for "the New York close" or any other session close, stage only
|
|
140
|
+
the hours the player names, or raise flattening before the session ends as a separate idea — never
|
|
141
|
+
work a close window out yourself.
|
|
142
|
+
|
|
125
143
|
When the ask maps to no single row, or a refusal rules out the construction the player asked for,
|
|
126
144
|
ask the player which construction they mean, naming the rows that fit — never stage one they did not
|
|
127
145
|
choose. Complete stage payloads for every row are in `references/radar-stage-examples.md`.
|
|
@@ -352,8 +370,9 @@ Four reads, cheapest first. Stop as soon as the player's question is answered.
|
|
|
352
370
|
refused it and nothing was traded. It is the only history of not-qualifying closes: the journal
|
|
353
371
|
writes no row for one, and `resolvesNow` keeps only each agent's last decision — the one
|
|
354
372
|
`reading.lastClose` (step 1) carries; this read holds every decision before it. Narrow with
|
|
355
|
-
`agentId
|
|
356
|
-
`
|
|
373
|
+
`agentId`. Each record carries its whole evidence, so keep `limit` small; page back by passing
|
|
374
|
+
the response's `nextCursor` as `cursor`, and stop when `nextCursor` is null — that is the end of
|
|
375
|
+
the history. A bar still
|
|
357
376
|
waiting inside its window has no record yet (`resolvesNow` shows its `closeDecision.state` as
|
|
358
377
|
`DEFERRED`), and records are kept 90 days.
|
|
359
378
|
4. **`get_radar_activity`** only for what steps 2 and 3 cannot do: more rows than its ten, a
|
|
@@ -56,7 +56,10 @@ regime condition is the regime-reading floor, and must be a level one of the sel
|
|
|
56
56
|
|
|
57
57
|
## On duty only in named hours and days
|
|
58
58
|
|
|
59
|
-
Hours are UTC, 0–23. Days run 0 (Sunday) to 6. Each is listed once.
|
|
59
|
+
Hours are UTC, 0–23. Days run 0 (Sunday) to 6. Each is listed once. For a named exchange session —
|
|
60
|
+
including the London and Tokyo opens and the London–New York overlap — stage the `hours` `get_radar_market_hours`
|
|
61
|
+
serves for it rather than a set of your own; the example below is a shape, not a session. No session
|
|
62
|
+
close is served: a close is staged only as hours the player names.
|
|
60
63
|
|
|
61
64
|
```json stage_radar_deployment_draft
|
|
62
65
|
{
|