machine-bridge-mcp 0.9.0 → 0.10.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.
@@ -3,7 +3,7 @@ import toolCatalog from "../shared/tool-catalog.json";
3
3
  import serverMetadata from "../shared/server-metadata.json";
4
4
 
5
5
  const SERVER_NAME = String(serverMetadata.name);
6
- const SERVER_VERSION = "0.9.0";
6
+ const SERVER_VERSION = "0.10.0";
7
7
  const MCP_PROTOCOL_VERSION = String(serverMetadata.protocolVersion);
8
8
  const MCP_SUPPORTED_PROTOCOL_VERSIONS = serverMetadata.supportedProtocolVersions.map((value) => String(value));
9
9
  const JSONRPC_VERSION = "2.0";
@@ -357,6 +357,10 @@ export class BridgeRoom extends DurableObject<BridgeEnv> {
357
357
  const protocolVersion = typeof requested === "string" && MCP_SUPPORTED_PROTOCOL_VERSIONS.includes(requested as typeof MCP_SUPPORTED_PROTOCOL_VERSIONS[number])
358
358
  ? requested
359
359
  : MCP_PROTOCOL_VERSION;
360
+ const bootstrap = this.daemonToolEnabled("session_bootstrap")
361
+ ? await this.callDaemonTool("session_bootstrap", { path: "." }).catch(() => null)
362
+ : null;
363
+ const localInstructions = sessionInstructionText(bootstrap);
360
364
  return rpcResult(request.id, {
361
365
  protocolVersion,
362
366
  capabilities: { tools: { listChanged: false }, logging: {} },
@@ -366,7 +370,7 @@ export class BridgeRoom extends DurableObject<BridgeEnv> {
366
370
  version: SERVER_VERSION,
367
371
  description: "Workspace-scoped local coding tools over authenticated remote relay.",
368
372
  },
369
- instructions: MCP_INSTRUCTIONS,
373
+ instructions: localInstructions ? `${MCP_INSTRUCTIONS}\n\n--- LOCAL SESSION INSTRUCTIONS ---\n${localInstructions}` : MCP_INSTRUCTIONS,
370
374
  });
371
375
  }
372
376
  if (request.method === "notifications/initialized") return null;
@@ -1179,11 +1183,27 @@ function clampNumber(value: unknown, fallback: number, min: number, max: number)
1179
1183
  }
1180
1184
 
1181
1185
  function daemonToolTimeoutMs(name: string, args: Record<string, unknown>): number {
1182
- if (name !== "exec_command" && name !== "run_process") return 60_000;
1183
- const seconds = clampNumber(args.timeout_seconds, 120, 1, 600);
1186
+ if (name === "session_bootstrap") return 10_000;
1187
+ const configurable = new Set([
1188
+ "exec_command", "run_process", "run_local_command", "open_local_application",
1189
+ "inspect_local_application", "operate_local_application", "browser_list_tabs",
1190
+ "browser_get_source", "browser_inspect_page", "browser_action", "browser_fill_form",
1191
+ "browser_screenshot", "browser_upload_files",
1192
+ ]);
1193
+ if (!configurable.has(name)) return 60_000;
1194
+ const seconds = clampNumber(args.timeout_seconds, name === "browser_fill_form" ? 60 : 120, 1, 600);
1184
1195
  return Math.min((seconds + 5) * 1000, 610_000);
1185
1196
  }
1186
1197
 
1198
+ function sessionInstructionText(value: unknown): string {
1199
+ const object = asObject(value);
1200
+ const instructions = typeof object.instructions === "string" ? object.instructions : "";
1201
+ if (!instructions) return "";
1202
+ const bytes = new TextEncoder().encode(instructions);
1203
+ if (bytes.byteLength > 3 * 1024 * 1024) return "";
1204
+ return instructions;
1205
+ }
1206
+
1187
1207
  function validateProtocolVersionHeader(request: Request, body: JsonRpcRequest): Record<string, unknown> | null {
1188
1208
  if (body.method === "initialize") return null;
1189
1209
  const version = request.headers.get("MCP-Protocol-Version");