mcp/mcp_router: add initial multiplexing and aggregation supports#42456
Merged
yanavlasov merged 26 commits intoenvoyproxy:mainfrom Dec 12, 2025
Merged
mcp/mcp_router: add initial multiplexing and aggregation supports#42456yanavlasov merged 26 commits intoenvoyproxy:mainfrom
yanavlasov merged 26 commits intoenvoyproxy:mainfrom
Conversation
|
CC @envoyproxy/api-shepherds: Your approval is needed for changes made to |
Signed-off-by: Boteng Yao <boteng@google.com>
61abcf6 to
e2b03ea
Compare
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
yanavlasov
requested changes
Dec 10, 2025
botengyao
commented
Dec 10, 2025
Member
Author
botengyao
left a comment
There was a problem hiding this comment.
Thanks for the review!
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
yanavlasov
requested changes
Dec 11, 2025
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
Signed-off-by: Boteng Yao <boteng@google.com>
yanavlasov
requested changes
Dec 12, 2025
Contributor
yanavlasov
left a comment
There was a problem hiding this comment.
LGTM. Let's just split config into a separate file and will then submit.
/wait
Signed-off-by: Boteng Yao <boteng@google.com>
yanavlasov
approved these changes
Dec 12, 2025
Contributor
|
Bypassing API review as we are changing it very repidly and it will be likely to be quite different in its stable form. Will review API separately once we have stabilized it. |
MayorFaj
pushed a commit
to MayorFaj/envoy
that referenced
this pull request
Dec 15, 2025
…voyproxy#42456) #### MCP Request/Response Handling | Operation | Direction | Handling | |-----------|-----------|----------| | `initialize` | Fanout | Aggregate session IDs into composite | | `tools/list` | Fanout | Aggregate tools, prefix names | | `tools/call` | Targeted | Strip prefix, route to specific backend | | `ping` | Fanout | Return 200 with empty JSON response | | `notification/initialized` | Fanout | Return 202 | #### Key Decisions - Handle the streamable HTTP for MCP POST request. - This PR only handles the `application/json` content, `event/stream` response should also be supported but not this PR. - **Body rewrite for `tools/call`**: Use string search to replace prefixed tool name. -- The mcp decoder could provide a cursor to be more efficient and more robust - **Content-Length handling**: Set explicit length after body modification - **Response aggregation**: Full JSON parsing required for `tools/list` (multiple tool names to prefix) - `mcp-session-id` is the combined one from multiple backends, and there should be a limit. - Capability is gateway default now and should be controlled by the gateway. - Should combine with the mcp_filter. And the request flow is mcp_fitler -> other_filters (attributes aware) -> mcp_router -> backends. <img width="3462" height="1252" alt="82yHuofKFAMcHi2" src="https://github.com/user-attachments/assets/25dfd31b-7f8c-4b3a-8306-650801adf283" /> envoyproxy#39174 ``` static_resources: listeners: - name: mcp_listener address: socket_address: address: 0.0.0.0 port_value: 10001 filter_chains: - filters: - name: envoy.filters.network.http_connection_manager typed_config: "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager stat_prefix: ingress_http route_config: name: local_route virtual_hosts: - name: mcp_gateway domains: ["gateway.com"] routes: - match: path: "/mcp" route: cluster: mcp_service http_filters: - name: envoy.filters.http.mcp typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.mcp.v3.Mcp traffic_mode: REJECT_NO_MCP clear_route_cache: true - name: envoy.filters.http.mcp_router typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.mcp_router.v3.McpRouter servers: - name: echo_one mcp_cluster: cluster: mcp_service path: "/mcp" - name: echo_two mcp_cluster: cluster: mcp_service_2 path: "/mcp" clusters: - name: mcp_service type: STATIC lb_policy: ROUND_ROBIN load_assignment: cluster_name: mcp_service endpoints: - lb_endpoints: - endpoint: address: socket_address: address: 127.0.0.1 port_value: 9000 - name: mcp_service_2 type: STATIC lb_policy: ROUND_ROBIN load_assignment: cluster_name: mcp_service endpoints: - lb_endpoints: - endpoint: address: socket_address: address: 127.0.0.1 port_value: 9001 ``` Commit Message: Additional Description: Risk Level: Testing: Docs Changes: Release Notes: Platform Specific Features: --------- Signed-off-by: Boteng Yao <boteng@google.com> Signed-off-by: MayorFaj <mayorfaj@gmail.com>
grnmeira
pushed a commit
to grnmeira/envoy
that referenced
this pull request
Mar 20, 2026
…voyproxy#42456) #### MCP Request/Response Handling | Operation | Direction | Handling | |-----------|-----------|----------| | `initialize` | Fanout | Aggregate session IDs into composite | | `tools/list` | Fanout | Aggregate tools, prefix names | | `tools/call` | Targeted | Strip prefix, route to specific backend | | `ping` | Fanout | Return 200 with empty JSON response | | `notification/initialized` | Fanout | Return 202 | #### Key Decisions - Handle the streamable HTTP for MCP POST request. - This PR only handles the `application/json` content, `event/stream` response should also be supported but not this PR. - **Body rewrite for `tools/call`**: Use string search to replace prefixed tool name. -- The mcp decoder could provide a cursor to be more efficient and more robust - **Content-Length handling**: Set explicit length after body modification - **Response aggregation**: Full JSON parsing required for `tools/list` (multiple tool names to prefix) - `mcp-session-id` is the combined one from multiple backends, and there should be a limit. - Capability is gateway default now and should be controlled by the gateway. - Should combine with the mcp_filter. And the request flow is mcp_fitler -> other_filters (attributes aware) -> mcp_router -> backends. <img width="3462" height="1252" alt="82yHuofKFAMcHi2" src="https://github.com/user-attachments/assets/25dfd31b-7f8c-4b3a-8306-650801adf283" /> envoyproxy#39174 ``` static_resources: listeners: - name: mcp_listener address: socket_address: address: 0.0.0.0 port_value: 10001 filter_chains: - filters: - name: envoy.filters.network.http_connection_manager typed_config: "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager stat_prefix: ingress_http route_config: name: local_route virtual_hosts: - name: mcp_gateway domains: ["gateway.com"] routes: - match: path: "/mcp" route: cluster: mcp_service http_filters: - name: envoy.filters.http.mcp typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.mcp.v3.Mcp traffic_mode: REJECT_NO_MCP clear_route_cache: true - name: envoy.filters.http.mcp_router typed_config: "@type": type.googleapis.com/envoy.extensions.filters.http.mcp_router.v3.McpRouter servers: - name: echo_one mcp_cluster: cluster: mcp_service path: "/mcp" - name: echo_two mcp_cluster: cluster: mcp_service_2 path: "/mcp" clusters: - name: mcp_service type: STATIC lb_policy: ROUND_ROBIN load_assignment: cluster_name: mcp_service endpoints: - lb_endpoints: - endpoint: address: socket_address: address: 127.0.0.1 port_value: 9000 - name: mcp_service_2 type: STATIC lb_policy: ROUND_ROBIN load_assignment: cluster_name: mcp_service endpoints: - lb_endpoints: - endpoint: address: socket_address: address: 127.0.0.1 port_value: 9001 ``` Commit Message: Additional Description: Risk Level: Testing: Docs Changes: Release Notes: Platform Specific Features: --------- Signed-off-by: Boteng Yao <boteng@google.com> Signed-off-by: Gustavo <grnmeira@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MCP Request/Response Handling
initializetools/listtools/callpingnotification/initializedKey Decisions
application/jsoncontent,event/streamresponse should also be supported but not this PR.tools/call: Use string search to replace prefixed tool name.-- The mcp decoder could provide a cursor to be more efficient and more robust
tools/list(multiple tool names to prefix)mcp-session-idis the combined one from multiple backends, and there should be a limit.#39174
Commit Message:
Additional Description:
Risk Level:
Testing:
Docs Changes:
Release Notes:
Platform Specific Features: