fix(mcp): pin the tools/list cache hint to private - #533
Open
keysersoft wants to merge 1 commit into
Open
Conversation
`tools/list` is now filtered per caller — by organization and by MCP role — so its result must never be cached and reused for a different principal. A 'public' hint invites a client or proxy to do exactly that, which would serve one tenant's tool inventory to another and silently undo the scoping the previous commit added. 'private' is already the default, so this changes no behaviour. It is pinned because the consequence of changing it is invisible from the call site that depends on it: nothing in McpEndpointController would fail, and no test would break — the leak would simply reappear at whichever cache sits in front. mcp-nest does warn when the hint is 'public' while the list varies by caller, but that warning only fires at startup and only if someone reads the logs.
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.
Follow-up to #532, which made
tools/liston the global/mcpendpoint filter by the caller's organization and MCP roles.A per-caller list must never be cached and reused for a different principal.
server/discoveradvertises acacheScopefortools/list, and apublicvalue invites a client or proxy to do exactly that — serving one tenant's tool inventory to another and silently undoing the scoping.privateis already the default, so this changes no behaviour. It is pinned because the consequence of changing it is invisible from the code that depends on it: nothing inMcpEndpointControllerwould fail and no test would break — the leak would simply reappear at whichever cache sits in front.mcp-nest does warn when the hint is
publicwhile the list varies by caller, but that warning fires once at startup and only helps if someone reads the logs.Verified
tools/liststill returns the caller's own tools only. 3853 tests pass.Also checked while looking for the same class of problem
resources/list,prompts/list,resources/templates/list→Method not found. The server declares neither capability and registers no dynamic resources or prompts, so there is nothing to scope.server/discoverreturns capabilities, versions and cache metadata only — no tool list.Cache-Controlis set on MCP responses;Vary: Originonly.