@remcp/remcp 0.2.68 → 0.2.70

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/package.json +1 -1
  2. package/src/agent.mjs +30 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remcp/remcp",
3
- "version": "0.2.68",
3
+ "version": "0.2.70",
4
4
  "description": "ReMCP device client: pair a computer with ReMCP and run the outbound-only agent that hosts the local MCP runtime.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/agent.mjs CHANGED
@@ -155,6 +155,13 @@ export async function runAgent(options) {
155
155
  runtimeToolsRetryTimer.unref?.();
156
156
  }
157
157
 
158
+ function applyRuntimeTools(next, { announce = true } = {}) {
159
+ if (next.length === runtimeTools.length && next.every((name, index) => name === runtimeTools[index])) return runtimeTools;
160
+ runtimeTools = next;
161
+ if (announce) send({ type: 'capabilities', runtimeTools });
162
+ return runtimeTools;
163
+ }
164
+
158
165
  async function refreshRuntimeTools(client = mcp, { announce = true } = {}) {
159
166
  if (!client || runtimeDown) return runtimeTools;
160
167
  try {
@@ -162,10 +169,7 @@ export async function runAgent(options) {
162
169
  if (runtimeToolsRetryTimer) clearTimeout(runtimeToolsRetryTimer);
163
170
  runtimeToolsRetryTimer = null;
164
171
  runtimeToolsRetryDelay = RUNTIME_TOOLS_RETRY_BASE_MS;
165
- const next = toolNames(listed);
166
- if (next.length === runtimeTools.length && next.every((name, index) => name === runtimeTools[index])) return runtimeTools;
167
- runtimeTools = next;
168
- if (announce) send({ type: 'capabilities', runtimeTools });
172
+ applyRuntimeTools(toolNames(listed), { announce });
169
173
  } catch (error) {
170
174
  console.error(`ReMCP could not refresh runtime capabilities: ${error instanceof Error ? error.message : String(error)}`);
171
175
  scheduleRuntimeToolsRetry(client);
@@ -191,9 +195,29 @@ export async function runAgent(options) {
191
195
  handleRuntimeExit('missing');
192
196
  return;
193
197
  }
194
- const client = new Client(
198
+ let client;
199
+ client = new Client(
195
200
  { name: 'remcp-agent', version: VERSION },
196
- { versionNegotiation:{ mode:'auto' } },
201
+ {
202
+ versionNegotiation:{ mode:'auto' },
203
+ // MCP 2026-07-28 list changes are subscription-based. Without this, a runtime can gain
204
+ // tools (for example when browser CDP appears) while the paired agent keeps publishing its
205
+ // old capability snapshot. Legacy runtimes are still covered by fallbackNotificationHandler.
206
+ listChanged:{
207
+ tools:{
208
+ autoRefresh:true,
209
+ debounceMs:0,
210
+ onChanged(error, tools) {
211
+ if (error) {
212
+ console.error(`ReMCP runtime tool subscription failed: ${error instanceof Error ? error.message : String(error)}`);
213
+ scheduleRuntimeToolsRetry(client);
214
+ return;
215
+ }
216
+ applyRuntimeTools(toolNames({ tools }));
217
+ },
218
+ },
219
+ },
220
+ },
197
221
  );
198
222
  const stdio = new StdioClientTransport({ command: process.execPath, args: [runtimeEntry], env: runtimeEnv(), maxBufferSize: RUNTIME_STDIO_BUFFER_BYTES });
199
223
  mcp = client;