@apicircle/mcp-server 1.1.0 → 1.1.3

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.
@@ -36,7 +36,7 @@ var init_package = __esm({
36
36
  "package.json"() {
37
37
  package_default = {
38
38
  name: "@apicircle/mcp-server",
39
- version: "1.1.0",
39
+ version: "1.1.3",
40
40
  private: false,
41
41
  type: "module",
42
42
  sideEffects: false,
@@ -5185,6 +5185,7 @@ var init_src2 = __esm({
5185
5185
  // src/bin/mcp-server.ts
5186
5186
  var path2 = __toESM(require("path"), 1);
5187
5187
  var import_node_fs = require("fs");
5188
+ var import_node_crypto = require("crypto");
5188
5189
 
5189
5190
  // src/bin/args.ts
5190
5191
  function hasVersionFlag(args) {
@@ -5263,8 +5264,8 @@ async function main() {
5263
5264
  ]);
5264
5265
  const mock = new InProcessMockController2();
5265
5266
  if (hasRegistry) {
5266
- const workspaces = new MultiWorkspaceProvider2(dir);
5267
- const registry = await workspaces.init();
5267
+ const workspaces2 = new MultiWorkspaceProvider2(dir);
5268
+ const registry = await workspaces2.init();
5268
5269
  if (!registry.activeWorkspaceId) {
5269
5270
  process.stderr.write(
5270
5271
  `apicircle-mcp: registry at ${dir} has no active workspace. Open the desktop app once, or run \`apicircle workspaces create <name>\`.
@@ -5272,33 +5273,46 @@ async function main() {
5272
5273
  );
5273
5274
  process.exit(1);
5274
5275
  }
5275
- const workspace = workspaces.activeProvider();
5276
- const host = createMcpServer2({ workspace, workspaces, mock });
5276
+ const workspace2 = workspaces2.activeProvider();
5277
+ const host2 = createMcpServer2({ workspace: workspace2, workspaces: workspaces2, mock });
5277
5278
  process.stderr.write(
5278
5279
  `apicircle-mcp: multi-workspace mode \xB7 ${registry.workspaces.length} workspace(s) \xB7 active=${registry.activeWorkspaceId}
5279
5280
  `
5280
5281
  );
5281
- await host.connect();
5282
+ await host2.connect();
5282
5283
  return;
5283
5284
  }
5284
5285
  if (hasWorkspaceJson) {
5285
- const workspace = new FileBackedWorkspaceProvider2(dir);
5286
- const workspaces = new SingleWorkspaceAdapter2(workspace, null);
5287
- const host = createMcpServer2({ workspace, workspaces, mock });
5286
+ const workspace2 = new FileBackedWorkspaceProvider2(dir);
5287
+ const workspaces2 = new SingleWorkspaceAdapter2(workspace2, null);
5288
+ const host2 = createMcpServer2({ workspace: workspace2, workspaces: workspaces2, mock });
5288
5289
  process.stderr.write(`apicircle-mcp: single-workspace mode \xB7 ${dir}
5289
5290
  `);
5290
- await host.connect();
5291
+ await host2.connect();
5291
5292
  return;
5292
5293
  }
5293
- process.stderr.write(
5294
- `apicircle-mcp: no workspace found at ${dir}.
5295
- Expected one of:
5296
- \u2022 registry.json (multi-workspace registry root, e.g. ~/.apicircle/)
5297
- \u2022 workspace.json (single workspace or Git-backed .apicircle/ directory)
5298
- Point --workspace at the correct directory, or set APICIRCLE_WORKSPACE.
5299
- `
5300
- );
5301
- process.exit(1);
5294
+ await import_node_fs.promises.mkdir(dir, { recursive: true });
5295
+ const now = (/* @__PURE__ */ new Date()).toISOString();
5296
+ const workspaceId = `ws-${(0, import_node_crypto.randomBytes)(4).toString("hex")}`;
5297
+ const emptySynced = {
5298
+ schemaVersion: 1,
5299
+ workspaceId,
5300
+ collections: { tree: { id: "root", type: "root", children: [] }, requests: {}, folders: {} },
5301
+ environments: { items: {}, activeName: null, priorityOrder: [] },
5302
+ linkedWorkspaces: {},
5303
+ linkedOverrides: { requests: {}, environmentVars: {} },
5304
+ releases: { self: null, perLink: {} },
5305
+ globalAssets: { schemas: {}, graphql: {} },
5306
+ mockServers: {},
5307
+ meta: { createdAt: now, updatedAt: now, appVersion: MCP_PACKAGE_VERSION }
5308
+ };
5309
+ await import_node_fs.promises.writeFile(path2.join(dir, "workspace.json"), JSON.stringify(emptySynced, null, 2) + "\n");
5310
+ const workspace = new FileBackedWorkspaceProvider2(dir);
5311
+ const workspaces = new SingleWorkspaceAdapter2(workspace, null);
5312
+ const host = createMcpServer2({ workspace, workspaces, mock });
5313
+ process.stderr.write(`apicircle-mcp: init new workspace \xB7 ${dir}
5314
+ `);
5315
+ await host.connect();
5302
5316
  }
5303
5317
  main().catch((err) => {
5304
5318
  process.stderr.write(