@50arms/platform-mcp 0.1.488 → 0.1.489

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/dist/index.js CHANGED
@@ -100,7 +100,6 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
100
100
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
101
101
  import { z } from "zod";
102
102
  import { boardRefArgSchema, parseBoardRefText, repoNameArgSchema, } from "./board-id.js";
103
- import { DashboardHttpClient } from "./http-client.js";
104
103
  import { claimSessionAgent, sessionConnect, danxbotApi, danxbotApiList, danxbotApiSpec, attachFile, DANXBOT_API_METHODS, } from "./handlers.js";
105
104
  import { miniAppPublish } from "./mini-app-publish.js";
106
105
  import { miniAppRestore } from "./mini-app-restore.js";
@@ -185,7 +184,7 @@ let sessionHostClaim;
185
184
  * Unset (DX-4555) leaves the server board-less: a call that needs a board must then carry its own `board`
186
185
  * argument, or the dashboard answers 400 (DX-4592: the client no longer refuses on its behalf). A value that is not a positive integer fails loud.
187
186
  */
188
- function boot() {
187
+ async function boot() {
189
188
  const dashboardUrl = readEnvOrDie("DANXBOT_DASHBOARD_URL");
190
189
  const board = readBoardId();
191
190
  const session = readSessionConfig();
@@ -201,6 +200,9 @@ function boot() {
201
200
  // DX-2683 — the working session, when there is one. See below.
202
201
  session,
203
202
  };
203
+ // DX-7895 - loaded here, never at import: the client reads `route-board-scope.generated.ts`, which is rendered from the dashboard's route table, and that render loads
204
+ // the dashboard, which reads the `tool-defs.json` this module's registrations render. Importing this module (the tool-defs generator does) must need neither generated file.
205
+ const { DashboardHttpClient } = await import("./http-client.js");
204
206
  client = new DashboardHttpClient(config);
205
207
  const dashboardClient = client;
206
208
  access = new SessionAccess({
@@ -1253,7 +1255,7 @@ strictTool("restart_notice",
1253
1255
  })));
1254
1256
  // ---------------- main ----------------
1255
1257
  async function main() {
1256
- boot();
1258
+ await boot();
1257
1259
  await syncToolsAfterSignIn();
1258
1260
  stopWhenSessionEnds({
1259
1261
  server: server.server,
@@ -612,7 +612,7 @@ var readOwnManifest = () => JSON.parse(
612
612
  readFileSync(new URL("../../package.json", import.meta.url), "utf8")
613
613
  ).version;
614
614
  var TOOLKIT_VERSION = resolveToolkitVersion(
615
- false ? void 0 : "0.1.488",
615
+ false ? void 0 : "0.1.489",
616
616
  readOwnManifest
617
617
  );
618
618
  function envelope(now) {
package/dist/tool-defs.js CHANGED
@@ -11,9 +11,10 @@
11
11
  *
12
12
  * The danxbot service can NOT take a zod / MCP-SDK runtime dependency (and the
13
13
  * Docker image does not install this package's node_modules), so the service
14
- * reads the COMMITTED `tool-defs.json` produced by `generateToolDefsJson()`
15
- * below — plain data, no runtime deps. `gen-tool-defs.ts` writes that file and
16
- * `tool-defs.test.ts` asserts it is in sync (fail-loud on drift).
14
+ * reads the `tool-defs.json` that `generateToolDefsFile()` below renders — plain
15
+ * data, no runtime deps. The file is not tracked in git (DX-7895): `gen-tool-defs.ts`
16
+ * writes it wherever it is used (`scripts/ensure-platform-mcp-generated.ts`, the
17
+ * dashboard image's `platform-mcp-builder` stage), so it is never stale.
17
18
  */
18
19
  import { Client } from "@modelcontextprotocol/sdk/client/index.js";
19
20
  import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
@@ -45,7 +46,7 @@ export function assertToolDefsWithinTextLimit(tools) {
45
46
  * Introspect `server`'s registered tools via an in-memory `tools/list` — the
46
47
  * exact `{name, description, inputSchema}` the agent's context receives — and
47
48
  * map them to the API's `{name, description, input_schema}` shape, sorted by
48
- * name for a stable committed artifact.
49
+ * name for a stable artifact.
49
50
  */
50
51
  export async function generateToolDefs() {
51
52
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
@@ -75,18 +76,7 @@ export async function generateToolDefs() {
75
76
  export async function generateToolDefsFile() {
76
77
  return { server: DANX_DASHBOARD_SERVER_ID, tools: await generateToolDefs() };
77
78
  }
78
- /** Deterministic 2-space JSON the committed file + the drift test compare. */
79
+ /** Deterministic 2-space JSON for the generated file. */
79
80
  export function serializeToolDefsFile(file) {
80
81
  return JSON.stringify(file, null, 2) + "\n";
81
82
  }
82
- /**
83
- * DX-7439: the one staleness check of the committed `tool-defs.json`, run by `gen-tool-defs --check` and by the landing tree check
84
- * `mcp-tool-defs-current`. Generates the file from the live registrations and compares it with `committed` (the text at `path`); returns the
85
- * message to print when they differ, null when the committed file is current.
86
- */
87
- export async function staleToolDefsMessage(committed, path) {
88
- const fresh = serializeToolDefsFile(await generateToolDefsFile());
89
- return committed === fresh
90
- ? null
91
- : `${path} is stale: run \`npm run gen-tool-defs\` in the platform MCP package and commit the result`;
92
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@50arms/platform-mcp",
3
- "version": "0.1.488",
3
+ "version": "0.1.489",
4
4
  "description": "Stdio MCP server fronting the 50 Arms dashboard API for agents (operator sessions and dispatched workers alike): the generic 50arms_api/50arms_api_list/50arms_api_spec tools reach any route the caller's credential may call, plus dedicated agent-specific tools (session_connect, request_permission, attach_file, and 50arms_slack_reply) (DX-3465, PLN-11 R-25).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,12 +27,14 @@
27
27
  },
28
28
  "scripts": {
29
29
  "prepublishOnly": "bash ../../scripts/assert-tree-contains-origin-main.sh @50arms/platform-mcp",
30
- "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && node -e \"require('fs').chmodSync('dist/index.js', 0o755)\" && node scripts/build-machine-daemon.mjs",
30
+ "generate": "tsx ../../scripts/ensure-platform-mcp-generated.ts ../..",
31
+ "build": "npm run generate && node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && node -e \"require('fs').chmodSync('dist/index.js', 0o755)\" && node scripts/build-machine-daemon.mjs",
31
32
  "prepack": "node scripts/build-machine-daemon.mjs",
32
33
  "verify:boot": "bash scripts/verify-boot.sh",
33
34
  "start": "node dist/index.js",
34
35
  "dev": "tsx src/index.ts",
35
36
  "gen-tool-defs": "tsx scripts/gen-tool-defs.ts",
37
+ "pretest": "npm run generate",
36
38
  "test": "vitest run",
37
39
  "test:watch": "vitest"
38
40
  },