Mirror of https://github.com/modelcontextprotocol/inspector — Visual testing tool for MCP servers
  • TypeScript 90.8%
  • JavaScript 8.8%
  • CSS 0.2%
  • HTML 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Cliff Hall 49d6be6987
feat(web): add per-server Roots config + client roots capability (#1425) (#1431)
* feat(web): add per-server Roots config + client roots capability (#1425)

Add MCP roots support to the v2 web Inspector as a per-server config
section in the server settings form (no separate Roots tab/screen).

- Persistence: add `roots: Root[]` to `InspectorServerSettings` and
  `StoredMCPServer`; thread through serverList converters (lift on read,
  drop empty-uri rows / blank names on write, omit when empty) and the
  remote server's read-side drop guard + `validateSettings`.
- Capability: `setupClientForServer` always advertises the roots
  capability (`roots: cleanRoots(savedSettings?.roots ?? [])`) so the
  server can issue `roots/list` and receive `roots/list_changed`.
- Live apply: edits to a connected server's roots are pushed via
  `inspectorClient.setRoots(...)` once, on settings-dialog close — diffed
  against the client's current roots — rather than per keystroke, to
  avoid flooding the server with `roots/list_changed` / `roots/list`.
- Form: new Roots accordion section with a required URI and an optional
  name per row (unlike v1, which was URI-only), + Add Root, and remove.

Tests cover the persistence round-trip (serverList + servers-route),
the form/modal section, and reuse the existing InspectorClient
roots/`setRoots` integration coverage.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* refactor(roots): address review — dedup guards/cleanRoots, preserve extra fields, test live-apply

Responding to the PR #1431 code review:

- Dedup `isRootArray`: drop the copy inside `validateSettings` and reuse the
  module-scope guard the read path uses, so the two can't drift
  (core/mcp/remote/node/server.ts).
- Dedup the clean-roots normalizer: hoist a single exported `cleanRoots`
  into core/mcp/serverList.ts and reuse it from both
  `inspectorSettingsToStoredFields` and App.tsx (drops the local copy).
- Preserve non-form root fields (e.g. `_meta`): `cleanRoots` now spreads the
  carried-through fields and only normalizes uri/name, and the modal's
  `handleRootChange` spreads the existing root on edit — so a hand-edited
  root's `_meta` survives load + persist + edit instead of being silently
  dropped.
- Test the App live-apply-on-close path: new App.test.tsx cases assert
  setRoots is called once with cleaned roots when changed on the active
  server, and not called when the cleaned roots already match what the
  client advertises. Adds a cleanRoots unit test (blank drop + _meta
  preserve).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 11:08:18 -04:00
.claude Add new components, typography, badge contrast, and screen layout refactors 2026-03-28 20:38:04 -04:00
.github/workflows ci(storybook): wire test:storybook into CI (#1251) (#1297) 2026-05-10 15:58:15 -04:00
clients/web feat(web): add per-server Roots config + client roots capability (#1425) (#1431) 2026-06-05 11:08:18 -04:00
core feat(web): add per-server Roots config + client roots capability (#1425) (#1431) 2026-06-05 11:08:18 -04:00
specification feat(servers): move oauthClientSecret and stdio env values to OS keychain (#1356) (#1360) 2026-05-26 10:33:46 -04:00
test-servers fix(storage): await store-file writes instead of polling (#1412) (#1413) 2026-06-02 11:55:24 -04:00
.gitignore feat(servers): persist per-server settings to mcp.json (#1352) (#1353) 2026-05-24 19:23:26 -04:00
AGENTS.md chore(web): silence benign config-load dep warnings in npm run dev (#1408) 2026-06-01 19:48:12 -04:00
CLAUDE.md feat: Add Mantine theme, 12 atom components, and 25 molecule components with Storybook stories 2026-03-17 10:23:56 -04:00
package-lock.json feat(apps): add isAppTool helper in core (#1260) (#1272) 2026-05-01 17:03:11 -04:00
package.json ci(storybook): wire test:storybook into CI (#1251) (#1297) 2026-05-10 15:58:15 -04:00