mcpstore-gateway 2.0.0 → 2.0.2

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.
Files changed (2) hide show
  1. package/dist/index.js +22 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -335,20 +335,17 @@ async function runSetup(apiKey) {
335
335
  async function runServer(apiKey) {
336
336
  // 1. Clean up legacy mcpstore-* entries from .mcp.json (v1 → v2 migration)
337
337
  cleanupLegacyEntries();
338
- // 2. Fetch hosted tools (debate, quick_review — proxied through backend)
339
- hostedTools = await fetchHostedTools(apiKey);
340
- // 3. Create server with listChanged capability
341
- const server = new Server({ name: "MCP Store", version: "2.0.0" }, { capabilities: { tools: { listChanged: true } } });
342
- // 4. Initial spawn — fetch installed MCPs and start child processes
343
- const installed = await fetchInstalledMcps(apiKey);
344
- for (const mcp of installed) {
345
- const child = await spawnChild(mcp);
346
- if (child) {
347
- children.set(mcp.slug, child);
348
- }
349
- }
350
- // 5. Handle tools/list
338
+ // 2. Create server with listChanged capability
339
+ const server = new Server({ name: "MCP Store", version: "2.0.1" }, { capabilities: { tools: { listChanged: true } } });
340
+ // Track first sync completion tools/list will wait for it
341
+ let firstSyncDone = false;
342
+ let firstSyncPromise = null;
343
+ // 3. Handle tools/list
351
344
  server.setRequestHandler(ListToolsRequestSchema, async () => {
345
+ // Wait for the first sync to complete before responding
346
+ if (!firstSyncDone && firstSyncPromise) {
347
+ await firstSyncPromise;
348
+ }
352
349
  const tools = [];
353
350
  // Hosted tools (backend API proxy)
354
351
  for (const ht of hostedTools) {
@@ -432,10 +429,20 @@ async function runServer(apiKey) {
432
429
  };
433
430
  }
434
431
  });
435
- // 7. Connect to Claude Code via stdio
432
+ // 4. Connect to Claude Code via stdio FIRST (fast — no network calls)
436
433
  const transport = new StdioServerTransport();
437
434
  await server.connect(transport);
438
- // 8. Start periodic sync (after connection can now send notifications)
435
+ // 5. THEN fetch hosted tools + spawn children in background
436
+ // The first tools/list request will wait for this to complete
437
+ firstSyncPromise = (async () => {
438
+ const [tools] = await Promise.all([
439
+ fetchHostedTools(apiKey).catch(() => []),
440
+ sync(apiKey, server).catch(() => { }),
441
+ ]);
442
+ hostedTools = tools;
443
+ firstSyncDone = true;
444
+ })();
445
+ // 6. Periodic re-sync
439
446
  setInterval(() => {
440
447
  sync(apiKey, server).catch(() => { });
441
448
  }, SYNC_INTERVAL_MS);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcpstore-gateway",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "MCP Store Gateway — One MCP server for all your installed MCPs from mcpclaudecode.com",
5
5
  "keywords": ["mcp", "claude", "claude-code", "ai", "gateway", "marketplace"],
6
6
  "license": "MIT",