Skip to content

examples(mcp): enforce an MFS_ALLOWED_SCOPES access boundary#148

Merged
zc277584121 merged 1 commit into
zilliztech:mainfrom
zc277584121:examples/mcp-allowed-scopes
Jun 30, 2026
Merged

examples(mcp): enforce an MFS_ALLOWED_SCOPES access boundary#148
zc277584121 merged 1 commit into
zilliztech:mainfrom
zc277584121:examples/mcp-allowed-scopes

Conversation

@zc277584121

Copy link
Copy Markdown
Collaborator

The MFS MCP server could search and read everything the MFS server had indexed — the per-query scope argument is only the agent's narrowing, not a boundary.

Add an optional MFS_ALLOWED_SCOPES allowlist (comma-separated URI / path prefixes, the same convention as Open Tag), set on the MCP registration:

  • search only returns hits under an allowed prefix; an empty scope fans out across the allowed prefixes instead of the whole index.
  • read refuses any source outside the allowlist.
  • Empty / unset = unrestricted (unchanged default).

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 --strict passes.

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>
@zc277584121 zc277584121 merged commit ba99ee0 into zilliztech:main Jun 30, 2026
10 checks passed
@zc277584121 zc277584121 deleted the examples/mcp-allowed-scopes branch June 30, 2026 13:03
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