sublime-mcp 1.8.6 → 1.8.8

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/index.js +35 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -174,11 +174,41 @@ function registerFallbackTools() {
174
174
  }
175
175
 
176
176
  // ── startup ───────────────────────────────────────────────────────────────────
177
+ //
178
+ // Only tools the backend actually serves are ever advertised. Until
179
+ // 2026-09-23 a failed discovery registered the fallback catalog instead, so a
180
+ // proxy pointed at a backend that no longer existed still reported 7 working
181
+ // tools (every call then failed). Now a proxy with no backend reports none and
182
+ // keeps looking; when the backend comes up (e.g. an agent started before
183
+ // Sublime), the real tools are registered and the SDK sends
184
+ // notifications/tools/list_changed to the client. registerFallbackTools() and
185
+ // fallback-tools.json are no longer used.
186
+
187
+ const BACKGROUND_RETRY_MS = 5000;
177
188
 
189
+ const transport = new StdioServerTransport();
178
190
  if (!await loadDynamicTools()) {
179
- process.stderr.write('mcp-commander: dynamic discovery failed, using generated fallback catalog\n');
180
- registerFallbackTools();
191
+ process.stderr.write(
192
+ `mcp-commander: backend ${BASE} unreachable; advertising no tools, retrying every ${BACKGROUND_RETRY_MS / 1000}s\n`,
193
+ );
194
+ await server.connect(transport);
195
+ const retry = async () => {
196
+ try {
197
+ const toolsList = await get('/mcp_tools');
198
+ if (!toolsList?.tools) throw new Error('backend returned no tool list');
199
+ for (const tool of toolsList.tools) {
200
+ server.registerTool(
201
+ tool.name,
202
+ { description: tool.description, inputSchema: jsonSchemaToZod(tool.inputSchema) },
203
+ async (args) => ok(await post('/' + tool.name, args ?? {})),
204
+ );
205
+ }
206
+ process.stderr.write(`mcp-commander: backend came up; loaded ${toolsList.tools.length} tools\n`);
207
+ } catch {
208
+ setTimeout(retry, BACKGROUND_RETRY_MS);
209
+ }
210
+ };
211
+ setTimeout(retry, BACKGROUND_RETRY_MS);
212
+ } else {
213
+ await server.connect(transport);
181
214
  }
182
-
183
- const transport = new StdioServerTransport();
184
- await server.connect(transport);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sublime-mcp",
3
- "version": "1.8.6",
3
+ "version": "1.8.8",
4
4
  "description": "MCP server for Sublime Text 4 — exposes editor state and editing tools to AI assistants via the Model Context Protocol.",
5
5
  "type": "module",
6
6
  "bin": {