Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.

Conversation

@fashxp
Copy link

@fashxp fashxp commented Sep 12, 2025

fixes #21

I used a quiet Friday afternoon and gave it a try to implement support for multiple MCP servers (with a little help of Claude).

Configuration of servers

mcp_server:
  # Default server configuration (backwards compatible)
  server:
    name: 'Main Server'
    title: 'Main MCP Server'
    version: '1.0.0'
  
  # Additional servers
  servers:
    api_server:
      name: 'API Server'
      title: 'External API Integration Server'
      version: '1.0.0'
    data_server:
      name: 'Data Server'
      title: 'Data Processing Server'
      version: '1.0.0'

Assigning Tools, Resources, and Prompts to Servers

#[AsTool(
    name: 'process_data',
    description: 'Processes large datasets',
    server: 'data_server' // Assign to data_server
)]
class ProcessDataTool
{
    public function __invoke(ProcessDataSchema $schema): ToolResult
    {
        // Tool logic here
    }
}

Routing to Different Servers

# Default server route
mcp_default:
  path: /mcp
  controller: mcp_server.entrypoint_controller
  defaults:
    serverKey: default
# API server route
mcp_api_server:
  path: /mcp/api
  controller: mcp_server.entrypoint_controller
  defaults:
    serverKey: api_server
# Data server route
mcp_data_server:
  path: /vendorB/data
  controller: mcp_server.entrypoint_controller
  defaults:
    serverKey: data_server

I'm not sure how you 'public' you see the services of this bundle. Strictly speaking, adding parameters to methods of diverse services could be seen as BC break.
If they are seen as BC breaks, we also could cleanup InitializeMethodHandler.php a bit more.

Any feedback welcome...

@fashxp fashxp marked this pull request as ready for review September 17, 2025 06:50
@EdouardCourty
Copy link
Owner

fixes #21

I used a quiet Friday afternoon and gave it a try to implement support for multiple MCP servers (with a little help of Claude).

Configuration of servers

mcp_server:
  # Default server configuration (backwards compatible)
  server:
    name: 'Main Server'
    title: 'Main MCP Server'
    version: '1.0.0'
  
  # Additional servers
  servers:
    api_server:
      name: 'API Server'
      title: 'External API Integration Server'
      version: '1.0.0'
    data_server:
      name: 'Data Server'
      title: 'Data Processing Server'
      version: '1.0.0'

Assigning Tools, Resources, and Prompts to Servers

#[AsTool(
    name: 'process_data',
    description: 'Processes large datasets',
    server: 'data_server' // Assign to data_server
)]
class ProcessDataTool
{
    public function __invoke(ProcessDataSchema $schema): ToolResult
    {
        // Tool logic here
    }
}

Routing to Different Servers

# Default server route
mcp_default:
  path: /mcp
  controller: mcp_server.entrypoint_controller
  defaults:
    serverKey: default
# API server route
mcp_api_server:
  path: /mcp/api
  controller: mcp_server.entrypoint_controller
  defaults:
    serverKey: api_server
# Data server route
mcp_data_server:
  path: /vendorB/data
  controller: mcp_server.entrypoint_controller
  defaults:
    serverKey: data_server

I'm not sure how you 'public' you see the services of this bundle. Strictly speaking, adding parameters to methods of diverse services could be seen as BC break. If they are seen as BC breaks, we also could cleanup InitializeMethodHandler.php a bit more.

Any feedback welcome...

Hi, thanks a lot for your contribution!
I will take a look at your implementation and come back to you :)

@fashxp
Copy link
Author

fashxp commented Oct 1, 2025

@EdouardCourty just wanted to ask if you already had the time to have a look? Thx very much!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RFC] Option to define multiple mcp servers with a differnt set of tools/resources/prompts each

2 participants