Skip to content

[Platform] Using MCP Remote servers as Tools #636

@lochmueller

Description

@lochmueller

Hey everyone,

currently, it is not possible to use remote MCP servers in as Tools for requests to the models.
It is possible to run this requests against the responses API: https://cookbook.openai.com/examples/mcp/mcp_tool_guide
As result the Model will directly call the MCP server and do not get in a "ping pong" conversation with symfony/aiI.

Example:

        $data = [
            "model" => 'gpt-4',
            "input" => 'Wann kommt der Restmüll an dieser Adresse: Schürhornweg 1, 33649 Bielefeld, DE?',
            "tools" => [
                [
                    "type" => "mcp",
                    "server_label" => "dmcp",
                    "server_description" => "Get the garbage information for addresses in germany.",
                    "server_url" => "https://xn--mll-hoa.io/mcp", // This is müll.io
                    "require_approval" => "never",
                    "allowed_tools" => ["fetch-garbage-information-via-address"],
                ]
            ],
        ];

        $this->httpClient->request('POST', \sprintf('%s/v1/responses', '.........'), [
            'json' => $data,
            'headers' => [
                'Authorization' => 'Bearer .........',
                'Content-Type' => 'application/json',
            ],
        ]);

       // Output is: "Der nächste Abholtermin für den Restmüll an der Adresse Schürhornweg 1, 33649 Bielefeld, DE ist am 30.09.2025."

I think about an integration, but have no idea how to start in the right way. Any ideas? Currently, there is the AsTool attribute, but an Attribute is only useful, if there is an integration. So the remote MCP is just configuration? Or a new Attribute like AsMcpRemoteServerTool incl. the needed parameters. Furthermore, I have to integrate the /responses-endpoint in separated client for a Bridge?!? Should I keep platform->invoke with a new Input object instead of Messages?

Any ideas are welcome :)

Regards,
Tim

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRFC = Request For Comments (proposals about features that you want to be discussed)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions