Skip to content

[MCP Bundle] Allow grouping tools into servers by tag, not just by namespace #2426

Description

@wachterjohannes

Follow-up to #2412, which introduced per-server element filtering in the MCP bundle. Raised by @Toflar there, parked so the PR could land.

The use case

Filtering currently takes service ids, FQCNs, namespace prefixes and *:

mcp:
    servers:
        public:
            http: { path: /mcp }
            tools: ['App\Mcp\Public\']

That works when the tools of one server happen to share a namespace. It does not when they are spread across several vendor namespaces, which is the normal case as soon as bundles start shipping tools. @Toflar's proposal is to group by tag instead:

#[McpTool(name: 'current-time', tags: ['foo', 'bar'])]
mcp:
    servers:
        public:
            http: { path: /mcp }
            tools: ['foo']

Beyond namespaces, this would let an application tag a third-party tool into a server from a compiler pass, without touching the vendor code.

The open question

@OskarStark's objection is the thing to solve first: nothing makes a tag unique across vendors. foo from two bundles is the same string, whereas an FQCN or a namespace prefix is unambiguous by construction. A tag design therefore needs a naming convention, or a scoping rule, before it is safe to expose.

Worth deciding:

  • Whether tags are namespaced by convention (acme/public) or scoped to the declaring bundle.
  • What happens on a collision: union, error, or last one wins.
  • Whether a tag can be added from a compiler pass to a tool it does not own, which is the extensibility half of the request.

Why it can wait

The config node is a heterogeneous scalar list, so a tag form can be added additively later, for example as #foo or tag:foo, without changing the meaning of any existing value and without a second BC break. Nothing in #2412 forecloses this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew featureMCP BundleIssues & PRs about the MCP SDK integration bundle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions