Skip to content

MCP: offer client roots so servers can write files - #139

Merged
ayman3000 merged 1 commit into
mainfrom
mcp-client-roots
Oct 12, 2026
Merged

ayman3000 merged 1 commit into
mainfrom
mcp-client-roots

Conversation

@ayman3000

Copy link
Copy Markdown
Owner

MCPManager(roots:) declares the MCP roots capability and answers roots/list with the given folders.

Why: chrome-devtools-mcp only writes files (e.g. take_screenshot filePath) inside the client's roots. With none offered, every path failed with "is not within any of the configured workspace roots", and agents burned many calls on workarounds.

  • Empty roots (the default) keeps the old behavior — no capability declared.
  • Unit test: folders → file:// directory URIs.
  • Live test (SAK_LIVE_TESTS=1): chrome-devtools-mcp --isolated --headless writes a screenshot inside an offered root; verified the same test fails with the access-denied error when no roots are offered.

🤖 Generated with Claude Code

MCPManager(roots:) declares the MCP `roots` capability and answers
roots/list with the given folders. chrome-devtools-mcp refuses every
file path outside the client's roots ("is not within any of the
configured workspace roots"), so take_screenshot's filePath failed for
every location the agent picked. Empty roots keep the old behavior.

Live test checks both ways: with a root the screenshot is written; with
none the server returns the access-denied error.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@ayman3000
ayman3000 merged commit 4b75727 into main Oct 12, 2026
1 of 2 checks passed
@ayman3000
ayman3000 deleted the mcp-client-roots branch October 12, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant