Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ message ServerInfo {
google.protobuf.StringValue fallback_protocol_version = 3;
}

// Configuration for sending locally-generated responses to tools/list requests.
message ToolsListLocal {
Comment thread
tyxia marked this conversation as resolved.
}

// Configuration for the MCP tool capability of the server.
Comment thread
tyxia marked this conversation as resolved.
message ServerToolConfig {
// List of MCP tools configurations.
Expand All @@ -177,26 +181,48 @@ message ServerToolConfig {
// Whether this server supports notifications for changes to the tool list.
bool list_changed = 2;

// Optional configuration to transcode the tools/list requests to a standard HTTP request.
//
// Note: tools/list should be mapped to a GET request with an empty body.
//
// - If provided: The extension transcodes the request and forwards it down the filter chain.
// The response (whether from an upstream backend, a configured ``direct_response``, or another
// extension) MUST be a JSON body strictly matching the MCP ``ListToolsResult`` schema.
// Ref: https://modelcontextprotocol.io/specification/2025-11-25/schema#listtoolsresult
// - If not provided: The ``tools/list`` request is passed through. This allows subsequent
// extension or the backend itself to handle the tools/list request if they support it.
HttpRule tool_list_http_rule = 3;
// Optional configuration for tools/list requests. If not set: The ``tools/list`` request is
// passed through. This allows subsequent extension or the backend itself to handle the tools/list
// request if they support it.
oneof tool_list_config {
// Configuration to transcode the tools/list requests to a standard HTTP request. If provided:
// The extension transcodes the request and forwards it down the filter chain. The response
// (whether from an upstream backend, a configured ``direct_response``, or another extension)
// MUST be a JSON body strictly matching the MCP ``ListToolsResult`` schema. Ref:
// https://modelcontextprotocol.io/specification/2025-11-25/schema#listtoolsresult
HttpRule tool_list_http_rule = 3;

// If provided: The extension sends a local response, according to each tool's
// ToolsListSpecificConfig.
ToolsListLocal tool_list_local = 4;
Comment thread
tyxia marked this conversation as resolved.
}
}

// Configuration for a tool's entry in tools/list responses.
message ToolsListSpecificConfig {
// Optional, human-readable name of the tool for display purposes.
string title = 1;

// Human-readable description of functionality.
string description = 2 [(validate.rules).string = {min_len: 1}];

// A JSON Schema describing expected parameters, as a serialized JSON string, in the JSON Schema
// 2020-12 dialect. This should be raw JSON, including the "properties" and "required" keys, but
// not "type". Tools with no parameters may omit this to signify a tool with no constraints on the
// parameters object, or set to '"additionalProperties": false' to require empty parameters.
string input_schema = 3;
}

// Configuration for a specific MCP tool.
message ToolConfig {
Comment thread
tyxia marked this conversation as resolved.
// Name of the tool.
// Unique identifier of the tool. Used both for tools/list and tools/call transcoding.
string name = 1 [(validate.rules).string = {min_len: 1}];

// The HTTP configuration rules that apply to the normal backend.
HttpRule http_rule = 2;

Comment thread
tyxia marked this conversation as resolved.
// Config for this tool's entry in a local tools/list response. Used when tool_list_local is set
// in the ServerToolConfig.
ToolsListSpecificConfig tool_list_config = 3;
}

// Defines the schema of the JSON-RPC to REST mapping. It specifies how the "arguments"
Expand Down Expand Up @@ -247,3 +273,8 @@ message HttpRule {
// - If omitted: There is no HTTP request body; fields not in the path become query parameters.
string body = 6;
}

// Per-route override configuration for the MCP JSON REST Bridge filter.
message McpJsonRestBridgePerRoute {
ServerToolConfig tool_config = 1;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Added local response handling for the ``tools/list`` JSON-RPC method in the MCP JSON REST bridge
filter. Configuring ``tools_list_local`` will cause the filter to directly generate and serve the
available tools list response without sending a request upstream. This may be configured on a
per-route basis.
1 change: 1 addition & 0 deletions source/extensions/extensions_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ envoy.filters.http.mcp_json_rest_bridge:
status: alpha
type_urls:
- envoy.extensions.filters.http.mcp_json_rest_bridge.v3.McpJsonRestBridge
- envoy.extensions.filters.http.mcp_json_rest_bridge.v3.McpJsonRestBridgePerRoute
envoy.filters.http.mcp_router:
categories:
- envoy.filters.http
Expand Down
2 changes: 2 additions & 0 deletions source/extensions/filters/http/mcp_json_rest_bridge/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ envoy_cc_library(
":http_request_builder_lib",
"//envoy/http:filter_interface",
"//envoy/server:filter_config_interface",
"//source/common/buffer:buffer_lib",
"//source/common/common:assert_lib",
"//source/common/common:logger_lib",
"//source/common/http:headers_lib",
"//source/common/protobuf",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ McpJsonRestBridgeFilterConfigFactory::createFilterFactoryFromProtoTyped(
};
}

absl::StatusOr<Router::RouteSpecificFilterConfigConstSharedPtr>
McpJsonRestBridgeFilterConfigFactory::createRouteSpecificFilterConfigTyped(
const envoy::extensions::filters::http::mcp_json_rest_bridge::v3::McpJsonRestBridgePerRoute&
proto_config,
Server::Configuration::ServerFactoryContext&, ProtobufMessage::ValidationVisitor&) {
return std::make_shared<McpJsonRestBridgePerRouteConfig>(proto_config);
}

/**
* Static registration for the MCP JSON REST bridge filter. @see RegisterFactory.
*/
Expand Down
10 changes: 9 additions & 1 deletion source/extensions/filters/http/mcp_json_rest_bridge/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ namespace McpJsonRestBridge {
*/
class McpJsonRestBridgeFilterConfigFactory
: public Common::ExceptionFreeFactoryBase<
envoy::extensions::filters::http::mcp_json_rest_bridge::v3::McpJsonRestBridge> {
envoy::extensions::filters::http::mcp_json_rest_bridge::v3::McpJsonRestBridge,
envoy::extensions::filters::http::mcp_json_rest_bridge::v3::McpJsonRestBridgePerRoute> {
public:
McpJsonRestBridgeFilterConfigFactory() : ExceptionFreeFactoryBase(FilterName) {}

Expand All @@ -25,6 +26,13 @@ class McpJsonRestBridgeFilterConfigFactory
const envoy::extensions::filters::http::mcp_json_rest_bridge::v3::McpJsonRestBridge&
proto_config,
const std::string&, Server::Configuration::FactoryContext&) override;

absl::StatusOr<Router::RouteSpecificFilterConfigConstSharedPtr>
createRouteSpecificFilterConfigTyped(
const envoy::extensions::filters::http::mcp_json_rest_bridge::v3::McpJsonRestBridgePerRoute&
proto_config,
Server::Configuration::ServerFactoryContext& context,
ProtobufMessage::ValidationVisitor& validator) override;
};

} // namespace McpJsonRestBridge
Expand Down
Loading
Loading