Background
#1343 ships the file-backed server list at ~/.mcp-inspector/mcp.json. The browser holds a stale list if the user edits the file by hand — they have to hit Refresh on the Servers screen (via the refresh() returned by useServers).
This issue: watch the file from the backend and push a change event to subscribed clients so the list updates automatically.
Sketch
- Backend (
core/mcp/remote/node/server.ts): watch mcpConfigPath; emit a change event on a new /api/servers/events SSE channel (or piggyback on the existing /api/mcp/events).
- Frontend (
core/react/useServers.ts): subscribe to the channel and re-fetch on event.
Risks
fs.watch semantics differ across OSes (macOS = FSEvents, Linux = inotify, Windows = ReadDirectoryChangesW). Editors that save via temp-file + rename (vim, most IDEs) produce ENOENT + new-inode sequences that bare fs.watch handles poorly. Likely want chokidar to smooth these over.
- Debounce/coalesce: editor saves can fire 2–3 events; ~100–200ms debounce.
- Re-entrancy: the backend's own POST/PUT/DELETE writes will trigger watch events. Either suppress self-fires by tracking last-written mtime, or accept the (harmless) extra refresh.
Out of scope
- File watching of any path other than the active
mcpConfigPath.
Background
#1343 ships the file-backed server list at
~/.mcp-inspector/mcp.json. The browser holds a stale list if the user edits the file by hand — they have to hit Refresh on the Servers screen (via therefresh()returned byuseServers).This issue: watch the file from the backend and push a change event to subscribed clients so the list updates automatically.
Sketch
core/mcp/remote/node/server.ts): watchmcpConfigPath; emit a change event on a new/api/servers/eventsSSE channel (or piggyback on the existing/api/mcp/events).core/react/useServers.ts): subscribe to the channel and re-fetch on event.Risks
fs.watchsemantics differ across OSes (macOS = FSEvents, Linux = inotify, Windows = ReadDirectoryChangesW). Editors that save via temp-file + rename (vim, most IDEs) produce ENOENT + new-inode sequences that barefs.watchhandles poorly. Likely wantchokidarto smooth these over.Out of scope
mcpConfigPath.