Repository navigation
mcp tasks support - #2745
mcp tasks support#2745
Conversation
Signed-off-by: Steven Landow <[email protected]>
There was a problem hiding this comment.
Pull request overview
Adds end-to-end support for MCP task methods (SEP-2663) in AgentGateway, including routing, multiplex-safe task IDs, RBAC/CEL integration, and correct capability forwarding across protocol versions.
Changes:
- Routes
tasks/get,tasks/update, andtasks/cancelto the owning upstream by parsing/rewriting task IDs and threads task IDs into theMcp-Nameheader. - Enforces RBAC on task methods via a new
taskresource type and CEL context (mcp.task.*), and rewrites task IDs in upstream responses/notifications for round-tripping. - Updates capability forwarding behavior and adds comprehensive tests covering single-target, multiplexing, legacy vs modern capability stripping, and RBAC denial behavior.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| schema/config.json | Clarifies that McpPrefixMode does not affect task ID namespacing under multiplexing. |
| schema/cel.md | Documents new CEL context fields for mcp.task.*. |
| schema/cel.json | Adds JSON schema entries for mcp.task context object. |
| crates/agentgateway/src/mcp/upstream/openapi/mod.rs | Adjusts OpenAPI upstream behavior for task methods (now treated as invalid params / unknown task). |
| crates/agentgateway/src/mcp/streamablehttp.rs | Ensures Mcp-Name header is derived from task IDs for task methods. |
| crates/agentgateway/src/mcp/session.rs | Implements task-method dispatch, task ID de/multiplexing, and task RBAC checks; refines capability stripping for legacy clients. |
| crates/agentgateway/src/mcp/rbac.rs | Introduces ResourceType::Task into RBAC/CEL dynamic typing. |
| crates/agentgateway/src/mcp/mod.rs | Adds task operation/logging support via MCPOperation::Task and MCPInfo.task. |
| crates/agentgateway/src/mcp/mcp_tests.rs | Adds/extends tests for capability forwarding, task round-trips, multiplexed task IDs, and RBAC denial on task methods. |
| crates/agentgateway/src/mcp/handler.rs | Rewrites task IDs in responses/notifications and adds parsing of namespaced task IDs for multiplex routing. |
| crates/agentgateway/src/cel/types.rs | Extends CEL example executor context to include mcp.task. |
Comments suppressed due to low confidence (1)
schema/cel.json:1004
mcp.task.nameis documented as "The name of the resource" but this field is the task ID. Updating the description will make CEL/RBAC policy intent clearer.
"name": {
"description": "The name of the resource",
"type": "string",
"default": ""
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Steven Landow <[email protected]>
Signed-off-by: Steven Landow <[email protected]>
howardjohn
left a comment
There was a problem hiding this comment.
Overall looks good at first glance
| .map(|tool| tool.name.as_str()) | ||
| .or_else(|| self.prompt.as_ref().map(ResourceId::name)) | ||
| .or_else(|| self.resource.as_ref().map(ResourceId::name)) | ||
| .or_else(|| self.task.as_ref().map(MCPTask::name)) |
There was a problem hiding this comment.
I think this is a problem name in all the others is a static thing, you probably have like 1-50 tools maybe. We put it in prometheus metric mcp_requests. So we prob need to opt out there... maybe we use it in some places ike CEL and logs but metrics has a different path
There was a problem hiding this comment.
Fixed this. Theoretically we could have this problem with resource templates too, right?
Signed-off-by: Steven Landow <[email protected]>
fixes #2554
note this isn't well supported by the SDKs, it only last week made it into rust-sdk:
so I don't think merging this is super urgent