@battlegrid/mcp-server 3.0.0 → 4.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 +84 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -7,15 +7,19 @@ 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
|
+
## v4 — breaking major (strategy conditions)
|
|
11
11
|
|
|
12
|
-
**
|
|
12
|
+
**v4 pairs with the BattleGrid server's MCP contract v4.0.0.** The package major tracks the server's wire contract, because the proxy announces `battlegrid@<package version>` in its own stdio handshake — the number a client reads has to be the contract it will actually reach. Upgrade the package and the server major together.
|
|
13
|
+
|
|
14
|
+
- **`apply_strategy_plan` requires the conditions axis.** The plan post-state now carries required `conditions` and `conditionVerdicts`; a payload built from the v3 field list is rejected with `plan.conditions: Required`. **Add both fields to the projection you already build** — apply takes an allowlisted projection of `approvedPlan`, never the object itself (`diff`, `viability`, `mismatches`, `signalRules`, `creationSeed`, `proposedRevision`, `bindingImpact`, `authoringCatalogDigest` are all rejected as unknown keys, and so are the `postState` fields apply does not accept: `id`, `scope`, `systemKey`, `visibility`, `cadence`, `isActive`, `forkedFromStrategyId`). The exact field list is step 7 of **Strategy authoring (compile → review → apply)** below. Only a client that forwards post-state fields generically — stripping the derived keys rather than enumerating the kept ones — picks the axis up without an edit. The proxy itself is unchanged: it embeds no schemas, pins no contract version, and forwards `{ request }` verbatim.
|
|
15
|
+
|
|
16
|
+
The v3 authoring contract below is unchanged and still current:
|
|
13
17
|
|
|
14
18
|
- **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
19
|
- **`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
20
|
- **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
21
|
|
|
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).
|
|
22
|
+
> Earlier majors: **v1.x** single/multi-account stdio proxy; **v2.0.0** moved the default `BATTLEGRID_API_URL` to the `/mcp` suffix; **v3.0.0** the strategy-authoring major. See [Rediscovery & versioning](#rediscovery--versioning).
|
|
19
23
|
|
|
20
24
|
## Quick Start
|
|
21
25
|
|
|
@@ -194,7 +198,7 @@ Strategies are authored through one strict, whole-plan workflow. **Compilation w
|
|
|
194
198
|
- **UPDATE** supplies at least one changed axis and `expectedRevision`.
|
|
195
199
|
- **RESTORE** targets an owned inactive revision (with any repair axes).
|
|
196
200
|
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: {
|
|
201
|
+
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), `conditions`, `conditionVerdicts`, `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.
|
|
198
202
|
|
|
199
203
|
`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.
|
|
200
204
|
|
|
@@ -214,7 +218,7 @@ Tools, prompts, and resources are **discovered live** from the connected server
|
|
|
214
218
|
|
|
215
219
|
## Rediscovery & versioning
|
|
216
220
|
|
|
217
|
-
- **Package/server major pairing.** This package's major version pairs with the BattleGrid server's
|
|
221
|
+
- **Package/server major pairing.** This package's major version pairs with the BattleGrid server's published MCP contract version (`MCP_CONTRACT_VERSION`). The pairing is not decorative: the proxy re-announces itself as `battlegrid@<package version>` to the local client, under the same server name the remote handshake uses, so a package major left behind tells clients a contract number that no longer exists. Run matching majors.
|
|
218
222
|
- **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
223
|
- **Restart after key rotation.** API keys are read once at process startup; rotate a key, then restart the proxy.
|
|
220
224
|
|
|
@@ -222,7 +226,81 @@ Tools, prompts, and resources are **discovered live** from the connected server
|
|
|
222
226
|
|---------|---------|
|
|
223
227
|
| 1.x | Single/multi-account stdio proxy, identity discovery, connection retry, capability discovery |
|
|
224
228
|
| 2.0.0 | Default `BATTLEGRID_API_URL` moved to the `/mcp` suffix |
|
|
225
|
-
|
|
|
229
|
+
| 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 |
|
|
230
|
+
| 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 |
|
|
231
|
+
| **4.0.0** | Realigns the package major with the server's MCP contract v4.0.0, which broke on the conditions axis: `apply_strategy_plan` requires `conditions` and `conditionVerdicts` on the plan post-state. No proxy code change — the version is the client-facing signal, and the proxy's handshake carries it |
|
|
232
|
+
|
|
233
|
+
## Maintainer release procedure
|
|
234
|
+
|
|
235
|
+
> [`.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.
|
|
236
|
+
|
|
237
|
+
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.
|
|
238
|
+
|
|
239
|
+
### Release environments and prerequisites
|
|
240
|
+
|
|
241
|
+
| Responsibility | Environment |
|
|
242
|
+
|---|---|
|
|
243
|
+
| Confirm npm publishing trust | npmjs.com package settings |
|
|
244
|
+
| Verify the release and push its tag | Clean `battlegrid-mcp` checkout with GitHub write access |
|
|
245
|
+
| Build, test, pack, and publish | GitHub-hosted `ubuntu-latest`, Node 24 |
|
|
246
|
+
| Verify registry publication | Any shell |
|
|
247
|
+
|
|
248
|
+
Before tagging:
|
|
249
|
+
|
|
250
|
+
- Merge the complete release into `main`; never release a feature-branch commit.
|
|
251
|
+
- Use Node 22 or 24 locally. CI uses Node 24; odd-numbered Node releases are not supported by the test toolchain.
|
|
252
|
+
- Ensure `package.json`, `package-lock.json`, and `src/index.ts`'s exported `VERSION` all contain the intended version.
|
|
253
|
+
- 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`.
|
|
254
|
+
|
|
255
|
+
### Verify and tag the merged commit
|
|
256
|
+
|
|
257
|
+
Run from a clean `battlegrid-mcp` checkout, substituting the intended unused version:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
release_version=4.0.0
|
|
261
|
+
release_tag="mcp-server@${release_version}"
|
|
262
|
+
|
|
263
|
+
git fetch origin --tags
|
|
264
|
+
git switch main
|
|
265
|
+
git pull --ff-only origin main
|
|
266
|
+
|
|
267
|
+
test -z "$(git status --porcelain)"
|
|
268
|
+
test "$(node -p "require('./package.json').version")" = "$release_version"
|
|
269
|
+
test "$(node -p "require('./package-lock.json').version")" = "$release_version"
|
|
270
|
+
test "$(node -p "require('fs').readFileSync('src/index.ts','utf8').match(/VERSION = '([^']+)'/)[1]")" = "$release_version"
|
|
271
|
+
test -z "$(git tag --list "$release_tag")"
|
|
272
|
+
|
|
273
|
+
npm ci
|
|
274
|
+
npm test
|
|
275
|
+
npm run build
|
|
276
|
+
npm pack --dry-run
|
|
277
|
+
|
|
278
|
+
release_commit="$(git rev-parse HEAD)"
|
|
279
|
+
git tag -a "$release_tag" "$release_commit" -m "Publish @battlegrid/mcp-server $release_version"
|
|
280
|
+
git show --no-patch --decorate "$release_tag"
|
|
281
|
+
git push origin "$release_tag"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
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.
|
|
285
|
+
|
|
286
|
+
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`.
|
|
287
|
+
|
|
288
|
+
### Verify publication
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
npm view "@battlegrid/mcp-server@${release_version}" version dist.integrity \
|
|
292
|
+
--json --registry=https://registry.npmjs.org/
|
|
293
|
+
|
|
294
|
+
npm view @battlegrid/mcp-server dist-tags \
|
|
295
|
+
--json --registry=https://registry.npmjs.org/
|
|
296
|
+
|
|
297
|
+
npm view "@battlegrid/mcp-server@${release_version}" dist.attestations \
|
|
298
|
+
--json --registry=https://registry.npmjs.org/
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
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.
|
|
302
|
+
|
|
303
|
+
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.
|
|
226
304
|
|
|
227
305
|
## Skills
|
|
228
306
|
|
package/dist/index.d.ts
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*/
|
|
33
33
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
34
34
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
35
|
-
export declare const VERSION = "
|
|
35
|
+
export declare const VERSION = "4.0.0";
|
|
36
36
|
export declare const DEFAULT_URL = "https://mcp.battlegrid.trade/mcp";
|
|
37
37
|
export interface EnvConfig {
|
|
38
38
|
apiKeys: string[];
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
36
36
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
37
37
|
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
38
38
|
import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
39
|
-
export const VERSION = '
|
|
39
|
+
export const VERSION = '4.0.0';
|
|
40
40
|
export const DEFAULT_URL = 'https://mcp.battlegrid.trade/mcp';
|
|
41
41
|
const MAX_RETRIES = 3;
|
|
42
42
|
const RETRY_DELAYS_MS = [2000, 4000, 8000];
|