mcpstore-gateway 2.0.1 → 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 +17 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -336,9 +336,16 @@ async function runServer(apiKey) {
336
336
  // 1. Clean up legacy mcpstore-* entries from .mcp.json (v1 → v2 migration)
337
337
  cleanupLegacyEntries();
338
338
  // 2. Create server with listChanged capability
339
- const server = new Server({ name: "MCP Store", version: "2.0.0" }, { capabilities: { tools: { listChanged: true } } });
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;
340
343
  // 3. Handle tools/list
341
344
  server.setRequestHandler(ListToolsRequestSchema, async () => {
345
+ // Wait for the first sync to complete before responding
346
+ if (!firstSyncDone && firstSyncPromise) {
347
+ await firstSyncPromise;
348
+ }
342
349
  const tools = [];
343
350
  // Hosted tools (backend API proxy)
344
351
  for (const ht of hostedTools) {
@@ -425,12 +432,16 @@ async function runServer(apiKey) {
425
432
  // 4. Connect to Claude Code via stdio FIRST (fast — no network calls)
426
433
  const transport = new StdioServerTransport();
427
434
  await server.connect(transport);
428
- // 5. THEN fetch hosted tools + spawn children in background (slow — network + processes)
429
- fetchHostedTools(apiKey).then((tools) => {
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
+ ]);
430
442
  hostedTools = tools;
431
- }).catch(() => { });
432
- // Initial sync — spawn child MCPs, then notify Claude Code
433
- sync(apiKey, server).catch(() => { });
443
+ firstSyncDone = true;
444
+ })();
434
445
  // 6. Periodic re-sync
435
446
  setInterval(() => {
436
447
  sync(apiKey, server).catch(() => { });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mcpstore-gateway",
3
- "version": "2.0.1",
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",