Skip to content

fix(pdf-server): preserve CLI directories during roots refresh - #780

Open
Michael-WhiteCapData wants to merge 1 commit into
modelcontextprotocol:mainfrom
Michael-WhiteCapData:fix/preserve-cli-root-dirs
Open

Michael-WhiteCapData wants to merge 1 commit into
modelcontextprotocol:mainfrom
Michael-WhiteCapData:fix/preserve-cli-root-dirs

Conversation

@Michael-WhiteCapData

Copy link
Copy Markdown

Summary

  • track directories explicitly approved through CLI arguments separately from client-provided roots
  • restore those CLI directories whenever the MCP roots allowlist is refreshed
  • await the initial roots refresh so initialization has deterministic completion semantics
  • add a regression test for a roots-capable client returning an empty root list

This prevents a client capability mismatch from silently removing directories the user explicitly supplied on the command line, while still allowing stale client-provided roots to be revoked.

Closes #644.

Verification

  • bun test examples/pdf-server/server.test.ts — 90 passed, 2 platform-specific skipped
  • npm run --workspace examples/pdf-server build
  • repository pre-push verification — 439 passed, 2 platform-specific skipped; full build passed
  • git diff --check

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.

v1.7.0 refreshRoots() clears allowedLocalDirs when host advertises roots capability but returns empty list — wipes CLI-arg directories

1 participant