@battlegrid/mcp-server 2.0.0 → 3.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 CHANGED
@@ -3,7 +3,19 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@battlegrid/mcp-server)](https://www.npmjs.com/package/@battlegrid/mcp-server)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- MCP server for [BattleGrid](https://battlegrid.trade) — play crypto prediction games from AI agents.
6
+ MCP server for [BattleGrid](https://battlegrid.trade) — play crypto prediction games, author trading strategies, and manage intelligence agents from AI agents.
7
+
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
+
10
+ ## v3 — breaking major (strategy authoring)
11
+
12
+ **v3 is a breaking major that pairs with the BattleGrid server's strategy-authoring release.** Upgrade the package and the server major together.
13
+
14
+ - **Strict authoring envelopes.** `get_strategy_section_template`, `update_strategy_signal_rule`, `compile_strategy_plan`, and `apply_strategy_plan` publish one strict server-owned object, `{ request: canonicalPayload }`. In multi-account mode the proxy adds `account` **only** as a sibling of `request`, producing exactly `{ account, request }`; on a call it strips only `account` and forwards the unchanged `{ request }`. It never descends into, flattens, or reconstructs the nested request.
15
+ - **`create_strategy` is retired.** Direct strategy creation no longer exists. Author strategies with the compile → review → apply workflow below, and bind them to agents at agent-creation time (`create_intelligence_agent({ …, strategyId })`). There is no alias, shim, or flat-payload fallback.
16
+ - **Rediscover after deployment.** Publishing the package does **not** refresh a running proxy's cached capability snapshot. After the server cutover, restart/reconnect the proxy process and re-run `tools/list`, `prompts/list`, and `resources/list`.
17
+
18
+ > Earlier majors: **v1.x** single/multi-account stdio proxy; **v2.0.0** moved the default `BATTLEGRID_API_URL` to the `/mcp` suffix. See [Rediscovery & versioning](#rediscovery--versioning).
7
19
 
8
20
  ## Quick Start
9
21
 
@@ -19,7 +31,7 @@ BATTLEGRID_API_KEY=bg_live_xxx npx @battlegrid/mcp-server
19
31
  BATTLEGRID_API_KEYS=bg_live_alice_key,bg_live_bob_key npx @battlegrid/mcp-server
20
32
  ```
21
33
 
22
- When multiple keys are provided, the server discovers each account's identity and injects an `account` parameter into every tool so the AI agent can choose which account to act as.
34
+ When multiple keys are provided, the server discovers each account's identity and injects a required `account` parameter into every tool so the AI agent can choose which account to act as.
23
35
 
24
36
  ### Remote server (streamable-http transport)
25
37
 
@@ -83,8 +95,6 @@ export BATTLEGRID_API_KEYS=bg_live_alice_key,bg_live_bob_key
83
95
 
84
96
  ### Cursor
85
97
 
86
- **Single account:**
87
-
88
98
  ```json
89
99
  {
90
100
  "mcpServers": {
@@ -99,108 +109,102 @@ export BATTLEGRID_API_KEYS=bg_live_alice_key,bg_live_bob_key
99
109
  }
100
110
  ```
101
111
 
102
- **Multiple accounts:**
112
+ Use `BATTLEGRID_API_KEYS` (comma-separated) for multiple accounts.
103
113
 
104
- ```json
105
- {
106
- "mcpServers": {
107
- "battlegrid": {
108
- "command": "npx",
109
- "args": ["@battlegrid/mcp-server"],
110
- "env": {
111
- "BATTLEGRID_API_KEYS": "bg_live_alice_key,bg_live_bob_key"
112
- }
113
- }
114
- }
115
- }
116
- ```
114
+ ### ChatGPT Desktop
115
+
116
+ ChatGPT Desktop connects via **OAuth 2.1** — no npm package or API key needed. ChatGPT handles the OAuth flow automatically.
117
117
 
118
- ## Account Management
118
+ 1. Open ChatGPT Desktop → **Settings** → **MCP Servers** → **Add Server**
119
+ 2. Enter the MCP endpoint URL: `https://mcp.battlegrid.trade/mcp`
120
+ 3. Select **OAuth** as the authentication method
121
+ 4. ChatGPT discovers OAuth endpoints, registers as a client (Dynamic Client Registration), and opens BattleGrid's consent page
122
+ 5. Log in to BattleGrid and click **Authorize**
119
123
 
120
- ### Single Account
124
+ | | Claude Desktop / Cursor | ChatGPT Desktop |
125
+ |---|---|---|
126
+ | **Transport** | stdio proxy (`@battlegrid/mcp-server`) | Direct HTTPS |
127
+ | **Auth** | API key (`bg_live_*`) | OAuth 2.1 (Bearer token) |
128
+ | **Setup** | npm package + env vars | URL + OAuth consent |
129
+ | **Multi-account** | `BATTLEGRID_API_KEYS` env var | One OAuth grant per account |
121
130
 
122
- Set `BATTLEGRID_API_KEY` with one API key. All tool calls use that account — no extra parameters needed.
131
+ ## Account management
123
132
 
124
- ### Multiple Accounts
133
+ ### Single account
125
134
 
126
- Set `BATTLEGRID_API_KEYS` with a comma-separated list of API keys (one per BattleGrid account). On startup the server:
135
+ Set `BATTLEGRID_API_KEY` with one API key. All tool calls use that account, and the tools are exactly the server-native shapes — the authoring tools take the strict `{ request }` envelope with no `account` field.
136
+
137
+ ### Multiple accounts
138
+
139
+ Set `BATTLEGRID_API_KEYS` with a comma-separated list of API keys (one per BattleGrid account). On startup the proxy:
127
140
 
128
141
  1. Calls `GET /mcp/identity` for each key to discover the account username
129
- 2. Injects a required `account` enum parameter into every tool
130
- 3. Routes each tool call to the correct account using the matching Bearer token
142
+ 2. Injects a required `account` enum parameter into every tool — as a **sibling** of the existing input, never nested inside it
143
+ 3. Routes each tool call to the correct account using the matching Bearer token, stripping only `account` before forwarding
131
144
 
132
- The AI agent sees tools like this:
145
+ For the strict authoring tools, the multi-account input is exactly `{ account, request }`:
133
146
 
134
147
  ```json
135
148
  {
136
- "name": "get_account_balance",
149
+ "name": "compile_strategy_plan",
137
150
  "inputSchema": {
151
+ "type": "object",
138
152
  "properties": {
139
153
  "account": {
140
154
  "type": "string",
141
155
  "enum": ["alice", "bob"],
142
156
  "description": "Which BattleGrid account to use for this action"
157
+ },
158
+ "request": {
159
+ "oneOf": [
160
+ { "properties": { "operation": { "const": "CREATE" } } },
161
+ { "properties": { "operation": { "const": "UPDATE" } } },
162
+ { "properties": { "operation": { "const": "RESTORE" } } }
163
+ ]
143
164
  }
144
165
  },
145
- "required": ["account"]
166
+ "required": ["account", "request"],
167
+ "additionalProperties": false
146
168
  }
147
169
  }
148
170
  ```
149
171
 
150
- If a key fails identity discovery (revoked, invalid), it is skipped with a warning. If all keys fail, the process exits.
172
+ The proxy consumes only the outer `account` and forwards the unchanged `{ request }` upstream. Never put `account` inside `request`, and never flatten request fields beside it.
151
173
 
152
- `BATTLEGRID_API_KEYS` takes precedence over `BATTLEGRID_API_KEY` when both are set.
174
+ If a key fails identity discovery (revoked, invalid), it is skipped with a warning. If all keys fail, the process exits. `BATTLEGRID_API_KEYS` takes precedence over `BATTLEGRID_API_KEY` when both are set.
153
175
 
154
- ### Getting an API Key
176
+ ### Getting an API key
155
177
 
156
178
  1. Go to [battlegrid.trade](https://battlegrid.trade) → **Profile** → **MCP** tab
157
179
  2. Generate an API key (format: `bg_live_*`)
158
180
  3. Copy the key immediately — it is shown only once
159
181
 
160
- Each account supports one active key at a time. Generating a new key automatically revokes the previous one.
182
+ Each account supports one active key at a time. Generating a new key automatically revokes the previous one — restart any running proxy process afterward, since keys are read once at startup.
161
183
 
162
- For paid games, enable **Server-Signed Wagers** in the MCP tab to allow the agent to submit entries on your behalf.
184
+ For paid games and autonomous wagering, enable **Server-Signed Wagers** in the MCP tab (`mcp:wager` scope). Strategy discovery and non-financial configuration writes only need `mcp:read`.
163
185
 
164
- ## Skills
186
+ ## Strategy authoring (compile → review → apply)
165
187
 
166
- Install the BattleGrid skill for AI agent instructions:
188
+ Strategies are authored through one strict, whole-plan workflow. **Compilation writes nothing; `apply_strategy_plan` is the only write.** Always review the exact returned plan before confirming.
167
189
 
168
- ```bash
169
- npx skills add playbattlegrid/battlegrid-mcp
170
- ```
171
-
172
- ## Capabilities
173
-
174
- ### Tools (28)
190
+ 1. **Choose the operation and revision.** `list_strategies` (add `includeInactive:true` when preparing a RESTORE) and `get_strategy` return the current `revision`; thread it into the next revisioned call.
191
+ 2. **Discover the report vocabulary live.** Walk `list_strategy_categories` → `list_strategy_vocabulary` → `get_metric_construction_hints` → `get_strategy_column_contract`, and use `get_strategy_section_template` / `preview_strategy_report`. Do not guess metric, transform, parameter, template, or enabled-timeframe facts — they are server-discovered.
192
+ 3. **Compile one complete plan.** Call `compile_strategy_plan({ request })` where the nested request is exactly one strict branch plus a bounded `coinSelection`, `intentSummary`, and `assumptions`:
193
+ - **CREATE** supplies the full new strategy.
194
+ - **UPDATE** supplies at least one changed axis and `expectedRevision`.
195
+ - **RESTORE** targets an owned inactive revision (with any repair axes).
196
+ 4. **Review before confirming.** Inspect the returned `approvedPlan` (complete post-state, proposed revision, diff, bound-agent impact, expiry) and `reviewContext` (column contracts, point-in-time report preview, open positions, quota/name admission). The plan token expires after five minutes; recompile after expiry or drift.
197
+ 5. **Apply only the exact reviewed plan.** After explicit user approval, call `apply_strategy_plan({ request: { plan, planToken, confirm: true } })`. Build `plan` from the compiled `approvedPlan` by copying, byte-identical: `operation`; `postState.id` as `strategyId`; `expiresAt`; `expectedRevision` for UPDATE/RESTORE; `explicitRuleOverrides` as `rules`; and from `postState` — `name`, `description`, `tagline`, `timeframe`, `regimeAutoDerive`, `regimeTimeframe`, `marketReadText`, `sections` (including every generated `custom:` key), `minAggregateScore`, `minRequiredCount`, `minAtrPct`. Send nothing else — the server re-derives the scorecard, diff, viability, mismatches, seed, revision, and bound-agent impact, and rejects `diff`, `viability`, `mismatches`, `signalRules`, `creationSeed`, `proposedRevision`, `bindingImpact`, `authoringCatalogDigest`, and `reviewContext` as unknown keys. Changed configuration propagates to every bound agent immediately.
175
198
 
176
- | Category | Tools |
177
- |----------|-------|
178
- | **Market Grid** (7) | `list_market_grid_sessions`, `get_market_grid_session`, `check_market_grid_submission`, `submit_market_grid`, `get_market_grid_results`, `get_market_grid_player_grid`, `update_market_grid` |
179
- | **Coin Grid** (6) | `list_coin_grid_sessions`, `get_coin_grid_session`, `check_coin_grid_submission`, `submit_coin_grid`, `get_coin_grid_results`, `get_coin_grid_player_grid` |
180
- | **Account** (6) | `get_account_balance`, `get_user_profile`, `get_user_stats`, `list_user_favorites`, `add_user_favorite_preset`, `remove_user_favorite_preset` |
181
- | **Leaderboard** (3) | `get_leaderboard`, `get_market_grid_leaderboard`, `get_hall_of_fame` |
182
- | **Market Data** (4) | `get_coin_overview`, `get_recent_candles`, `get_top_ranked_coins`, `list_game_presets` |
183
- | **Intelligence Agent** (2) | `list_intelligence_agents`, `get_intelligence_agent` |
199
+ `update_strategy_signal_rule({ request })` is the thin, focused one-rule edit. In multi-account mode every one of these calls uses the `{ account, request }` sibling envelope.
184
200
 
185
- ### Prompts (5)
201
+ **Strategy-bound agents.** Bind a strategy to an intelligence agent at creation time — `create_intelligence_agent({ …, strategyId })` (discover `strategyId` via `list_strategies`). Rebinding via `update_intelligence_agent` requires `confirm:true`. There is no direct `create_strategy` operation.
186
202
 
187
- | Prompt | Description |
188
- |--------|-------------|
189
- | `play-market-grid` | End-to-end workflow for playing a Market Grid prediction game |
190
- | `play-coin-grid` | End-to-end workflow for playing a Coin Grid prediction game |
191
- | `analyze-market` | Deep market analysis for informed predictions |
192
- | `check-performance` | Review your game results, stats, and leaderboard standing |
193
- | `strategy-guide` | Learn BattleGrid game mechanics, rules, and strategies |
194
-
195
- ### Resources (3)
203
+ ## Capabilities
196
204
 
197
- | Resource | URI |
198
- |----------|-----|
199
- | Game Rules | `battlegrid://rules/overview` |
200
- | Grid Format Reference | `battlegrid://reference/grid-format` |
201
- | Quick Start Guide | `battlegrid://guide/quick-start` |
205
+ Tools, prompts, and resources are **discovered live** from the connected server via `tools/list`, `prompts/list`, and `resources/list`. This package intentionally does not copy the server's catalog, formulas, signal IDs, or defaults — inspect the live connection for the authoritative, current surface. Broadly, the server exposes game play (Market Grid), market context, account state, leaderboards, intelligence agents and automation, strategy discovery/authoring, and trading signals/decisions.
202
206
 
203
- ## Environment Variables
207
+ ## Environment variables
204
208
 
205
209
  | Variable | Required | Description |
206
210
  |----------|----------|-------------|
@@ -208,6 +212,99 @@ npx skills add playbattlegrid/battlegrid-mcp
208
212
  | `BATTLEGRID_API_KEY` | One of these | Single API key (fallback if `BATTLEGRID_API_KEYS` not set) |
209
213
  | `BATTLEGRID_API_URL` | No | Override server URL (default: `https://mcp.battlegrid.trade/mcp`) |
210
214
 
215
+ ## Rediscovery & versioning
216
+
217
+ - **Package/server major pairing.** This package's major version pairs with the BattleGrid server's strategy-authoring major. Run matching majors.
218
+ - **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.
219
+ - **Restart after key rotation.** API keys are read once at process startup; rotate a key, then restart the proxy.
220
+
221
+ | Version | Changes |
222
+ |---------|---------|
223
+ | 1.x | Single/multi-account stdio proxy, identity discovery, connection retry, capability discovery |
224
+ | 2.0.0 | Default `BATTLEGRID_API_URL` moved to the `/mcp` suffix |
225
+ | 3.0.0 | Strategy-authoring major: strict `{ account, request }` authoring envelopes with strip-only-account routing, compile → review → apply workflow, strategy-bound agent creation, and removal of the retired `create_strategy` operation |
226
+ | **3.0.1** | Docs only — `apply_strategy_plan` now takes `{ plan, planToken, confirm }` instead of `{ approvedPlan, … }`; the server re-derives every planner-derived field and rejects resubmitted ones as unknown keys. No proxy behavior change |
227
+
228
+ ## Maintainer release procedure
229
+
230
+ > [`.github/workflows/publish.yml`](.github/workflows/publish.yml) is the executable release authority. If this recipe and the workflow diverge, correct them together before creating a release tag.
231
+
232
+ Publishing runs only in GitHub-hosted Actions. Never run `npm publish` from the BattleGrid application VM or a maintainer workstation. The maintainer's shell prepares and pushes one immutable tag; the workflow checks out that pinned commit, tests, builds, packs, and publishes it with npm provenance.
233
+
234
+ ### Release environments and prerequisites
235
+
236
+ | Responsibility | Environment |
237
+ |---|---|
238
+ | Confirm npm publishing trust | npmjs.com package settings |
239
+ | Verify the release and push its tag | Clean `battlegrid-mcp` checkout with GitHub write access |
240
+ | Build, test, pack, and publish | GitHub-hosted `ubuntu-latest`, Node 24 |
241
+ | Verify registry publication | Any shell |
242
+
243
+ Before tagging:
244
+
245
+ - Merge the complete release into `main`; never release a feature-branch commit.
246
+ - Use Node 22 or 24 locally. CI uses Node 24; odd-numbered Node releases are not supported by the test toolchain.
247
+ - Ensure `package.json`, `package-lock.json`, and `src/index.ts`'s exported `VERSION` all contain the intended version.
248
+ - 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`.
249
+
250
+ ### Verify and tag the merged commit
251
+
252
+ Run from a clean `battlegrid-mcp` checkout, substituting the intended unused version:
253
+
254
+ ```bash
255
+ release_version=3.0.1
256
+ release_tag="mcp-server@${release_version}"
257
+
258
+ git fetch origin --tags
259
+ git switch main
260
+ git pull --ff-only origin main
261
+
262
+ test -z "$(git status --porcelain)"
263
+ test "$(node -p "require('./package.json').version")" = "$release_version"
264
+ test "$(node -p "require('./package-lock.json').version")" = "$release_version"
265
+ test "$(node -p "require('fs').readFileSync('src/index.ts','utf8').match(/VERSION = '([^']+)'/)[1]")" = "$release_version"
266
+ test -z "$(git tag --list "$release_tag")"
267
+
268
+ npm ci
269
+ npm test
270
+ npm run build
271
+ npm pack --dry-run
272
+
273
+ release_commit="$(git rev-parse HEAD)"
274
+ git tag -a "$release_tag" "$release_commit" -m "Publish @battlegrid/mcp-server $release_version"
275
+ git show --no-patch --decorate "$release_tag"
276
+ git push origin "$release_tag"
277
+ ```
278
+
279
+ A tag matching `mcp-server@*` starts the [publish workflow](https://github.com/playbattlegrid/battlegrid-mcp/actions/workflows/publish.yml). Wait for that exact tag run to complete successfully before querying npm; a temporary registry `E404` while the workflow is still running is not a publication failure.
280
+
281
+ The workflow fails closed unless the tag version, package version, lockfile version, and source handshake version are identical. It then runs the test suite, TypeScript build, and package dry run before `npm publish --access public --provenance`.
282
+
283
+ ### Verify publication
284
+
285
+ ```bash
286
+ npm view "@battlegrid/mcp-server@${release_version}" version dist.integrity \
287
+ --json --registry=https://registry.npmjs.org/
288
+
289
+ npm view @battlegrid/mcp-server dist-tags \
290
+ --json --registry=https://registry.npmjs.org/
291
+
292
+ npm view "@battlegrid/mcp-server@${release_version}" dist.attestations \
293
+ --json --registry=https://registry.npmjs.org/
294
+ ```
295
+
296
+ Require the exact version, `latest` pointing at that version, and a provenance attestation. Record the release tag and commit. Restart/reconnect running proxies and rediscover `tools/list`, `prompts/list`, and `resources/list`; publication alone does not refresh their startup cache.
297
+
298
+ If publishing fails, inspect the tag's workflow before taking action. An `ENEEDAUTH` failure means the npm Trusted Publisher fields do not match the workflow. Fix the publisher configuration and rerun the failed job without moving the tag. Never retarget or reuse a published tag, and never mutate a tagged release with `npm audit fix`; dependency remediation goes through a new reviewed commit and version.
299
+
300
+ ## Skills
301
+
302
+ Install the BattleGrid skill for AI agent instructions:
303
+
304
+ ```bash
305
+ npx skills add playbattlegrid/battlegrid-mcp
306
+ ```
307
+
211
308
  ## License
212
309
 
213
310
  [MIT](LICENSE)
package/dist/index.d.ts CHANGED
@@ -11,6 +11,14 @@
11
11
  * enum parameter is injected into every tool so the AI agent can choose
12
12
  * which account to act as. Tool calls are routed with the matching Bearer token.
13
13
  *
14
+ * Strategy authoring (v3): the strategy-authoring tools publish one strict
15
+ * server-owned outer object, `{ request: canonicalPayload }`. In multi-account
16
+ * mode the proxy adds `account` only as a sibling of `request`, producing
17
+ * exactly `{ account, request }`; on a call it strips only `account` and
18
+ * forwards the unchanged `{ request }`. It never descends into or reconstructs
19
+ * the nested request — the server owns every required field, bound, union
20
+ * discriminator, and `additionalProperties:false` constraint.
21
+ *
14
22
  * Architecture: Matches Stripe's @stripe/mcp pattern — thin authenticated proxy.
15
23
  *
16
24
  * Usage:
@@ -22,7 +30,9 @@
22
30
  * BATTLEGRID_API_KEY (optional) — Single API key (fallback if BATTLEGRID_API_KEYS not set)
23
31
  * BATTLEGRID_API_URL (optional) — Override server URL (default: https://mcp.battlegrid.trade/mcp)
24
32
  */
25
- export declare const VERSION = "2.0.0";
33
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
34
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
35
+ export declare const VERSION = "3.0.1";
26
36
  export declare const DEFAULT_URL = "https://mcp.battlegrid.trade/mcp";
27
37
  export interface EnvConfig {
28
38
  apiKeys: string[];
@@ -36,4 +46,46 @@ export interface AccountIdentity {
36
46
  }
37
47
  export declare function validateEnv(env: Record<string, string | undefined>): EnvConfig;
38
48
  export declare function discoverIdentities(apiKeys: string[], apiUrl: string): Promise<AccountIdentity[]>;
49
+ export interface ToolDefinition {
50
+ name: string;
51
+ description?: string;
52
+ inputSchema: {
53
+ type: string;
54
+ properties?: Record<string, unknown>;
55
+ required?: string[];
56
+ [key: string]: unknown;
57
+ };
58
+ }
59
+ /**
60
+ * Add a required `account` enum to every discovered tool, as a sibling of the
61
+ * existing top-level properties. For the strict authoring tools whose schema is
62
+ * `{ request: canonicalPayload }`, this produces exactly `{ account, request }`
63
+ * with `required: ["account", "request"]`; the server-owned root
64
+ * `additionalProperties:false` and the entire nested `request` (unions,
65
+ * required fields, bounds) are preserved by reference, never rewritten.
66
+ */
67
+ export declare function injectAccountParam(tools: ToolDefinition[], accountNames: string[]): ToolDefinition[];
68
+ export interface CreateProxyServerOptions {
69
+ /** Discovered account identities (index 0 is the primary key used for capability discovery). */
70
+ identities: AccountIdentity[];
71
+ /** Connect (or reuse) a remote MCP client for a given API key. Called once per key, lazily. */
72
+ connect: (apiKey: string) => Promise<Client>;
73
+ /** Advertised server version; defaults to VERSION. */
74
+ version?: string;
75
+ }
76
+ export interface ProxyServer {
77
+ server: Server;
78
+ toolCount: number;
79
+ promptCount: number;
80
+ resourceCount: number;
81
+ isMultiAccount: boolean;
82
+ accountNames: string[];
83
+ }
84
+ /**
85
+ * Build the local stdio-facing MCP server that proxies to the remote BattleGrid
86
+ * server. Discovers remote capabilities through the primary client, augments
87
+ * tools with the `account` enum when multiple accounts resolved, and wires
88
+ * strip-only-account routing to a lazily-populated per-key client pool.
89
+ */
90
+ export declare function createProxyServer(options: CreateProxyServerOptions): Promise<ProxyServer>;
39
91
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAgBH,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,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,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAID,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CA+B9E;AAID,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EAAE,EACjB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,eAAe,EAAE,CAAC,CA6C5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAWnE,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,WAAW,qCAAqC,CAAC;AAM9D,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAA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AAE,MAAM,EAAE,CAAC;CACxB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,WAAW,CAAC,CA+H/F"}
package/dist/index.js CHANGED
@@ -11,6 +11,14 @@
11
11
  * enum parameter is injected into every tool so the AI agent can choose
12
12
  * which account to act as. Tool calls are routed with the matching Bearer token.
13
13
  *
14
+ * Strategy authoring (v3): the strategy-authoring tools publish one strict
15
+ * server-owned outer object, `{ request: canonicalPayload }`. In multi-account
16
+ * mode the proxy adds `account` only as a sibling of `request`, producing
17
+ * exactly `{ account, request }`; on a call it strips only `account` and
18
+ * forwards the unchanged `{ request }`. It never descends into or reconstructs
19
+ * the nested request — the server owns every required field, bound, union
20
+ * discriminator, and `additionalProperties:false` constraint.
21
+ *
14
22
  * Architecture: Matches Stripe's @stripe/mcp pattern — thin authenticated proxy.
15
23
  *
16
24
  * Usage:
@@ -28,7 +36,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
28
36
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
29
37
  import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
30
38
  import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
31
- export const VERSION = '2.0.0';
39
+ export const VERSION = '3.0.1';
32
40
  export const DEFAULT_URL = 'https://mcp.battlegrid.trade/mcp';
33
41
  const MAX_RETRIES = 3;
34
42
  const RETRY_DELAYS_MS = [2000, 4000, 8000];
@@ -141,7 +149,15 @@ async function connectWithRetry(client, transport, apiUrl) {
141
149
  }
142
150
  }
143
151
  }
144
- function injectAccountParam(tools, accountNames) {
152
+ /**
153
+ * Add a required `account` enum to every discovered tool, as a sibling of the
154
+ * existing top-level properties. For the strict authoring tools whose schema is
155
+ * `{ request: canonicalPayload }`, this produces exactly `{ account, request }`
156
+ * with `required: ["account", "request"]`; the server-owned root
157
+ * `additionalProperties:false` and the entire nested `request` (unions,
158
+ * required fields, bounds) are preserved by reference, never rewritten.
159
+ */
160
+ export function injectAccountParam(tools, accountNames) {
145
161
  return tools.map(tool => ({
146
162
  ...tool,
147
163
  inputSchema: {
@@ -158,31 +174,15 @@ function injectAccountParam(tools, accountNames) {
158
174
  },
159
175
  }));
160
176
  }
161
- // --- Main ---
162
- async function main() {
163
- let config;
164
- try {
165
- config = validateEnv(process.env);
166
- }
167
- catch (error) {
168
- process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
169
- process.exit(1);
170
- }
171
- // Log key diagnostics for cross-referencing with server logs
172
- for (let i = 0; i < config.apiKeys.length; i++) {
173
- const key = config.apiKeys[i];
174
- const hashPrefix = createHash('sha256').update(key).digest('hex').substring(0, 16);
175
- process.stderr.write(`BattleGrid MCP: Key #${i + 1} prefix=${key.substring(0, 12)} hashPrefix=${hashPrefix} len=${key.length}\n`);
176
- }
177
- // Discover identities for all keys
178
- let identities;
179
- try {
180
- identities = await discoverIdentities(config.apiKeys, config.apiUrl);
181
- }
182
- catch (error) {
183
- process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
184
- process.exit(1);
185
- }
177
+ /**
178
+ * Build the local stdio-facing MCP server that proxies to the remote BattleGrid
179
+ * server. Discovers remote capabilities through the primary client, augments
180
+ * tools with the `account` enum when multiple accounts resolved, and wires
181
+ * strip-only-account routing to a lazily-populated per-key client pool.
182
+ */
183
+ export async function createProxyServer(options) {
184
+ const { identities, connect } = options;
185
+ const version = options.version ?? VERSION;
186
186
  const isMultiAccount = identities.length > 1;
187
187
  const accountNames = identities.map(id => id.username);
188
188
  // Build lookup: username → apiKey
@@ -190,43 +190,27 @@ async function main() {
190
190
  for (const id of identities) {
191
191
  keyByAccount.set(id.username, id.apiKey);
192
192
  }
193
- process.stderr.write(`BattleGrid MCP: ${identities.length} account(s) discovered — ${accountNames.join(', ')}\n`);
194
- // Connect to remote using the first key (for capability discovery)
193
+ // Primary client (first key) is used for capability discovery and non-tool proxying.
195
194
  const primaryKey = identities[0].apiKey;
196
- const primaryTransport = new StreamableHTTPClientTransport(new URL(config.apiUrl), { requestInit: { headers: { Authorization: `Bearer ${primaryKey}` } } });
197
- const primaryClient = new Client({ name: 'battlegrid-proxy', version: VERSION }, { capabilities: {} });
198
- try {
199
- await connectWithRetry(primaryClient, primaryTransport, config.apiUrl);
200
- }
201
- catch (error) {
202
- process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
203
- process.exit(1);
204
- }
195
+ const primaryClient = await connect(primaryKey);
205
196
  // Discover remote capabilities
206
197
  const [toolsResult, promptsResult, resourcesResult] = await Promise.all([
207
198
  primaryClient.listTools(),
208
199
  primaryClient.listPrompts(),
209
200
  primaryClient.listResources(),
210
201
  ]);
211
- process.stderr.write(`BattleGrid MCP: ${toolsResult.tools.length} tools, ` +
212
- `${promptsResult.prompts.length} prompts, ` +
213
- `${resourcesResult.resources.length} resources\n`);
214
202
  // Augment tools with account parameter if multi-account
215
203
  const exposedTools = isMultiAccount
216
204
  ? injectAccountParam(toolsResult.tools, accountNames)
217
205
  : toolsResult.tools;
218
206
  // Create local stdio server
219
- const localServer = new Server({ name: 'battlegrid', version: VERSION }, {
207
+ const localServer = new Server({ name: 'battlegrid', version }, {
220
208
  capabilities: {
221
209
  tools: {},
222
210
  prompts: {},
223
211
  resources: {},
224
212
  },
225
213
  });
226
- // --- Proxy: tools ---
227
- localServer.setRequestHandler(ListToolsRequestSchema, async () => ({
228
- tools: exposedTools,
229
- }));
230
214
  // Keep a pool of remote clients keyed by API key for routing
231
215
  const clientPool = new Map();
232
216
  clientPool.set(primaryKey, primaryClient);
@@ -234,12 +218,14 @@ async function main() {
234
218
  const existing = clientPool.get(apiKey);
235
219
  if (existing)
236
220
  return existing;
237
- const transport = new StreamableHTTPClientTransport(new URL(config.apiUrl), { requestInit: { headers: { Authorization: `Bearer ${apiKey}` } } });
238
- const client = new Client({ name: 'battlegrid-proxy', version: VERSION }, { capabilities: {} });
239
- await connectWithRetry(client, transport, config.apiUrl);
221
+ const client = await connect(apiKey);
240
222
  clientPool.set(apiKey, client);
241
223
  return client;
242
224
  }
225
+ // --- Proxy: tools ---
226
+ localServer.setRequestHandler(ListToolsRequestSchema, async () => ({
227
+ tools: exposedTools,
228
+ }));
243
229
  localServer.setRequestHandler(CallToolRequestSchema, async (request) => {
244
230
  try {
245
231
  let targetKey = primaryKey;
@@ -256,7 +242,7 @@ async function main() {
256
242
  };
257
243
  }
258
244
  targetKey = keyByAccount.get(selectedAccount);
259
- delete args.account; // Strip before forwarding to remote
245
+ delete args.account; // Strip ONLY account before forwarding; request is forwarded unchanged
260
246
  }
261
247
  const client = await getClientForKey(targetKey);
262
248
  return await client.callTool({
@@ -291,9 +277,60 @@ async function main() {
291
277
  uri: request.params.uri,
292
278
  });
293
279
  });
280
+ return {
281
+ server: localServer,
282
+ toolCount: toolsResult.tools.length,
283
+ promptCount: promptsResult.prompts.length,
284
+ resourceCount: resourcesResult.resources.length,
285
+ isMultiAccount,
286
+ accountNames,
287
+ };
288
+ }
289
+ // --- Main ---
290
+ async function main() {
291
+ let config;
292
+ try {
293
+ config = validateEnv(process.env);
294
+ }
295
+ catch (error) {
296
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
297
+ process.exit(1);
298
+ }
299
+ // Log key diagnostics for cross-referencing with server logs
300
+ for (let i = 0; i < config.apiKeys.length; i++) {
301
+ const key = config.apiKeys[i];
302
+ const hashPrefix = createHash('sha256').update(key).digest('hex').substring(0, 16);
303
+ process.stderr.write(`BattleGrid MCP: Key #${i + 1} prefix=${key.substring(0, 12)} hashPrefix=${hashPrefix} len=${key.length}\n`);
304
+ }
305
+ // Discover identities for all keys
306
+ let identities;
307
+ try {
308
+ identities = await discoverIdentities(config.apiKeys, config.apiUrl);
309
+ }
310
+ catch (error) {
311
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
312
+ process.exit(1);
313
+ }
314
+ process.stderr.write(`BattleGrid MCP: ${identities.length} account(s) discovered — ${identities.map(id => id.username).join(', ')}\n`);
315
+ // Lazily connect a remote MCP client per API key, with retry + auth diagnostics.
316
+ const connect = async (apiKey) => {
317
+ const transport = new StreamableHTTPClientTransport(new URL(config.apiUrl), { requestInit: { headers: { Authorization: `Bearer ${apiKey}` } } });
318
+ const client = new Client({ name: 'battlegrid-proxy', version: VERSION }, { capabilities: {} });
319
+ await connectWithRetry(client, transport, config.apiUrl);
320
+ return client;
321
+ };
322
+ let proxy;
323
+ try {
324
+ proxy = await createProxyServer({ identities, connect });
325
+ }
326
+ catch (error) {
327
+ process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
328
+ process.exit(1);
329
+ }
330
+ process.stderr.write(`BattleGrid MCP: ${proxy.toolCount} tools, ${proxy.promptCount} prompts, ${proxy.resourceCount} resources\n`);
294
331
  // --- Start stdio transport ---
295
332
  const stdioTransport = new StdioServerTransport();
296
- await localServer.connect(stdioTransport);
333
+ await proxy.server.connect(stdioTransport);
297
334
  process.stderr.write('BattleGrid MCP server running on stdio\n');
298
335
  }
299
336
  // Only run when executed directly (not when imported for testing)
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;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,0BA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AAC,cAAc,CAAC,CAAC;IAE3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;AACnE,CAAC;AAED,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC,CAAC;AAEzF,IAAI,iBAAiB,EAAE,CAAC;IACtB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;QACrB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,KAAK,IAAI,CAAC,CAAC;QAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,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": "2.0.0",
3
+ "version": "3.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",