Skip to content

feat: add allow/block-list of servers to the mcp_catalog tool#2928

Merged
dgageot merged 8 commits into
docker:mainfrom
dgageot:board/389ebaa46c454e0b
May 29, 2026
Merged

feat: add allow/block-list of servers to the mcp_catalog tool#2928
dgageot merged 8 commits into
docker:mainfrom
dgageot:board/389ebaa46c454e0b

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented May 29, 2026

The mcp_catalog builtin tool now supports allow-listing and block-listing of MCP servers. This lets agents enforce a curated set of available integrations and prevent access to specific servers—useful for compliance, security policies, or ensuring a focused set of tools in multi-agent deployments.

Configuration is straightforward: set allowed_servers (optional) to whitelist specific catalog server IDs, and blocked_servers (optional) to exclude them. Block-list takes precedence if a server appears in both. Filtering applies to all catalog operations: search, enable, and reset_auth. Empty or whitespace-only entries are rejected at validation time, and a warning is logged if a configuration references unknown server IDs, helping catch typos early.

An example configuration can be found in examples/mcp_catalog_filtered.yaml. All changes are backward compatible—existing configurations without these fields work unchanged.

@dgageot dgageot requested a review from a team as a code owner May 29, 2026 11:04
Copy link
Copy Markdown

@docker-agent docker-agent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assessment: 🟢 APPROVE

The allow/block-list filtering implementation for mcp_catalog is correct and well-structured. Core logic is sound: block-list takes precedence over allow-list, filtering runs at construction time (no shared-state mutation), unknown server IDs emit a warning at startup, and config validation rejects empty/whitespace entries. Wiring through registry.go and the schema update are both correct. All changes are backward compatible.

Low-severity observations (no action required, noted for awareness):

  • toIDSet nil-vs-empty-map contract (mcpcatalog.go:237): toIDSet(nil) returns nil while toIDSet([]string{" "}) returns a non-nil empty map. Callers gate on len(set) > 0 so observable behavior is identical today. Validation already rejects whitespace entries upstream, making this path unreachable in production—safe but subtly inconsistent.
  • TestSearchRespectsAllowList substring risk (mcpcatalog_test.go:324): The test verifies that searching for the dropped server's ID returns an error. If that ID becomes a substring of an allowed server's title or description as the embedded catalog evolves, the test could produce a false pass. Low risk given the test's controlled server IDs, but worth watching.
  • Noisy warnings for future-proofed block-lists (mcpcatalog.go:175): IDs in blocked_servers that don't exist in today's catalog generate a slog.Warn—intentional for catching typos, but could be noisy for operators who proactively block anticipated-future server IDs.

@aheritier aheritier added area/mcp MCP protocol, MCP tool servers, integration kind/feat PR adds a new feature (maps to feat: commit prefix) labels May 29, 2026
- hugging-face
- gitmcp
# ...minus any explicitly blocked one (block wins over allow).
blocked_servers:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad example because blocked_servers doesn't do anything here since only the allowed ones are allowed

@dgageot dgageot merged commit c117fcc into docker:main May 29, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mcp MCP protocol, MCP tool servers, integration kind/feat PR adds a new feature (maps to feat: commit prefix)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants