[Repo Assist] feat: enforce ServerConfig.Tools as an allow-list at registration time#2234
Draft
github-actions[bot] wants to merge 1 commit intomainfrom
Draft
Conversation
…mBackend When a server config specifies a non-empty Tools list, only those named tools are registered with the MCP SDK; all other backend tools are silently filtered at registration time. Previously the Tools field was parsed and stored but never applied — all backend tools were always exposed regardless of configuration (noted in docs/CONFIGURATION.md as a known limitation). Changes: - internal/server/unified.go: apply allow-list filter after parsing tools/list response; log how many tools were filtered out - internal/server/register_tools_from_backend_test.go: add two new tests (ToolsAllowList and EmptyToolsAllowList) covering the new behaviour and the default pass-through case - docs/CONFIGURATION.md: update tools field description to reflect that it is now enforced Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
15 tasks
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.
🤖 This PR was created by Repo Assist, an automated AI assistant.
Summary
The
toolsfield in server configuration was parsed and stored but never applied — all backend tools were always exposed regardless of configuration. This has been documented as a known limitation indocs/CONFIGURATION.md.This PR implements the allow-list enforcement so the
toolsfield works as documented.Root cause
registerToolsFromBackendfetched tools from the backend and registered all of them without consultingserverCfg.Tools.Fix
After unmarshalling the
tools/listresponse, check whether the server config has a non-emptyToolsallow-list. If so, filter the tool slice in-place before the registration loop, keeping only the listed tools.When
Toolsis empty/nil (the default), all backend tools are exposed — existing behaviour is preserved.Changes
internal/server/unified.go— allow-list filtering added toregisterToolsFromBackendinternal/server/register_tools_from_backend_test.go— two new tests:ToolsAllowList(non-empty allow-list filters correctly) andEmptyToolsAllowList(empty list exposes all tools)docs/CONFIGURATION.md— updatedtoolsfield description to reflect enforcementTrade-offs
Test Status
Build and tests require Go 1.25.0, which is unavailable in the sandbox environment (Go 1.24.13 is present but the
go.modrequires ≥ 1.25.0 and the Go toolchain download is blocked by the network firewall). This is an infrastructure limitation — the CI pipeline (which has Go 1.25) should run the tests normally.The logic change is minimal and localised to a single conditional block inserted before the existing registration loop.
Warning
The following domain was blocked by the firewall during workflow execution:
proxy.golang.orgTo allow these domains, add them to the
network.allowedlist in your workflow frontmatter:See Network Configuration for more information.