Skip to content

[Agent][MCP] Auto-expose tools from a connected MCP server to the Agent Toolbox #2003

Description

@tacman

Context

Following a Slack discussion with @chr-hertel: with api-platform/mcp (4.3) and the MCP Client now in mcp/sdk (impl #192, docs #259), the publisher side is in good shape. The consumer side still requires hand-written #[AsTool] wrappers per remote tool, duplicating names, descriptions, and schemas that the MCP server already advertises.

@ineersa (Illia Vasylevskyi) shared a working implementation that illustrates the gap:

The wrapper has to redeclare each tool's description because the Toolbox doesn't pull them from the server. Add a remote tool, edit PHP. Rename a description on the server, drift.

Proposal

A bridge that registers MCP-server tools into the Agent Toolbox at runtime, sourcing metadata from the server's tools/list response.

Sketch:

ai:
    agent:
        my_agent:
            mcp_servers:
                api_platform:
                    transport: http
                    url: 'https://shop.example.com/mcp'
                research:
                    transport: stdio
                    command: ['php', 'bin/mcp-research']

At boot (or first call), the bridge calls tools/list on each server, builds Tool metadata from the response, and adds a generic RemoteMcpTool executor to the Toolbox. The Agent sees these alongside #[AsTool]-tagged services with no per-tool PHP.

Open questions worth deciding in the issue

  1. Discovery timing — boot-time (cache friendly, stale on server changes) vs lazy on first call vs tools/listChanged notifications.
  2. Naming collisions across servers — prefix by server alias (api_platform.search_products) seems safest.
  3. Auth passthrough for HTTP transports — user token, service token, or per-server config.
  4. Failure mode when a server is unreachable — skip silently, log, or fail the agent call.

Claude and I are happy to draft the bridge against the mcp/sdk client if the direction is welcome.

Related: #41, #1259.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    AgentIssues & PRs about the AI Agent component

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions