Skip to content

Commit 551c831

Browse files
committed
Respond gracefully to mcp/addServer and mcp/removeServer
The remote ECA server doesn't expose REST endpoints for add/remove (both mutate a config file on the host), so reply with a typed 'not_supported' error so the React AddServerForm surfaces it inline instead of hanging.
1 parent 6afa421 commit 551c831

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

src/bridge/outbound-handler.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,24 @@ export async function handleOutbound(
204204
}
205205
break;
206206

207+
case 'mcp/addServer':
208+
case 'mcp/removeServer':
209+
// The remote ECA server doesn't expose REST endpoints for
210+
// add/remove (these mutate a config file on the host running the
211+
// server). Respond with an error-shaped payload so the form in
212+
// the React webview surfaces a clear "not supported" message
213+
// inline instead of spinning forever.
214+
if (data.requestId) {
215+
dispatch(type, {
216+
requestId: data.requestId,
217+
error: {
218+
code: 'not_supported',
219+
message: 'Adding/removing MCP servers is not available in the web client.',
220+
},
221+
});
222+
}
223+
break;
224+
207225
// --- Background Jobs ---
208226
case 'jobs/list': {
209227
const jobsResult = await api.jobsList();

src/bridge/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,8 @@ export type OutboundMessage =
268268
| { type: 'mcp/connectServer'; data: { name: string } }
269269
| { type: 'mcp/logoutServer'; data: { name: string } }
270270
| { type: 'mcp/updateServer'; data: { requestId?: string } }
271+
| { type: 'mcp/addServer'; data: { requestId?: string; name: string; [k: string]: unknown } }
272+
| { type: 'mcp/removeServer'; data: { requestId?: string; name: string } }
271273
| { type: 'server/setTrust'; data: boolean }
272274
| { type: 'jobs/list'; data: { requestId?: string } }
273275
| { type: 'jobs/readOutput'; data: { requestId?: string; jobId: string } }
@@ -332,6 +334,9 @@ export type DispatchType =
332334
| 'server/setTrust'
333335
| 'config/updated'
334336
| 'tool/serversUpdated'
337+
| 'tool/serverRemoved'
338+
| 'mcp/addServer'
339+
| 'mcp/removeServer'
335340
| 'chat/contentReceived'
336341
| 'chat/cleared'
337342
| 'chat/deleted'

0 commit comments

Comments
 (0)