examples(mcp): enforce an MFS_ALLOWED_SCOPES access boundary#148
Merged
zc277584121 merged 1 commit intoJun 30, 2026
Merged
Conversation
The MCP server could search and read everything the MFS server had indexed. Add an optional MFS_ALLOWED_SCOPES allowlist (comma-separated URI/path prefixes, mirroring Open Tag): search only returns hits under an allowed prefix (an empty scope fans out across the allowed prefixes rather than the whole index) and read refuses any source outside them. Unlike the per-query scope argument the agent chooses, this is enforced in the server, so a client cannot reach past it. Empty = unrestricted. Signed-off-by: Cheney Zhang <chen.zhang@zilliz.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The MFS MCP server could search and read everything the MFS server had indexed — the per-query
scopeargument is only the agent's narrowing, not a boundary.Add an optional
MFS_ALLOWED_SCOPESallowlist (comma-separated URI / path prefixes, the same convention as Open Tag), set on the MCP registration:searchonly returns hits under an allowed prefix; an empty scope fans out across the allowed prefixes instead of the whole index.readrefuses any source outside the allowlist.This is enforced in the server, so an MCP client can't reach past it.
Verified
Against an isolated MFS with two indexed corpora (one allowed, one not), the stdio MCP client confirmed: empty-scope search stays inside the allowed scope (no leak of the forbidden corpus), reading an allowed source works, reading a forbidden source is refused, and an explicit out-of-scope search is refused.
mkdocs build --strictpasses.