Repository navigation
Description
Goal
An MCP extension can answer propose_command as an MCP task for clients that announce the tasks extension of MCP revision 2026-07-28, and serve tasks/get and tasks/cancel for its tasks. The core itself never answers with a task; without an extension nothing changes.
Context
MCP revision 2026-07-28 defines tasks as an extension: a client announces it per request in params._meta["io.modelcontextprotocol/clientCapabilities"].extensions["io.modelcontextprotocol/tasks"]; the server may then answer tools/call with resultType: "task" (taskId, status working|input_required|completed|failed|cancelled, createdAt, lastUpdatedAt, ttlMs, optional pollIntervalMs), and the client polls tasks/get and may send tasks/cancel. Answering with a task to a client that did not announce it is an error on the client side. The MCP server uses rmcp 3.9 (crates/mcp-server/Cargo.toml). The McpExtension hook with ApprovedCommand comes from the blocked-by issue; shared decisions are in the parent epic.
Requirements
- First check whether the used
rmcpversion supports revision 2026-07-28 and the tasks extension on the server side. If not, upgradermcpto the first release that does, keeping all tools and tests working. If no release supports it, stop and explain that in an issue comment instead of implementing the protocol by hand. McpCallContexttells whether the client announced the tasks extension for this request (detection only by the announced capability, never by client name).- New
McpExtensionmethod with defaultNone:answer_as_task(&self, ctx, pending: PendingCommand) -> Option<TaskAnswer>, called whenpropose_commandis received from a client that announced tasks.PendingCommandgives the decision (approved →ApprovedCommand, rejected, filter-denied, failed) as a future. If an extension returnsSome, the core answers the call at once with that task and does not apply the confirmation timeout to it; the action card stays until decided or the MCP session closes. tasks/getandtasks/cancelfor a task id are routed to the extension that created it (task_status(ctx, id),cancel_task(ctx, id)); unknown ids or ids of another MCP session → the protocol's not-found error.- Clients without the tasks extension, and all calls when no extension returns
Some, behave unchanged. - Spec 0028 documents protocol revision support, the tasks hook and its guarantees.
Acceptance Criteria
- The MCP server negotiates revision 2026-07-28 with a client that requests it and still works with clients on the previous revision (integration tests with the rmcp client on both).
- A test extension answering as task: the client gets
resultType: "task"immediately, before the user decides;tasks/getreturns the extension's status;tasks/cancelreaches the extension. - Without the client's tasks announcement,
answer_as_taskis not called and the call behaves as today. - A rejected or filter-denied action resolves the
PendingCommandaccordingly; nothing executes without approval. - A task id from another MCP session returns not-found.
- Without registered extensions, all existing MCP tests pass unchanged.
- Relevant automated tests pass.
Technical Notes
- Security-relevant: confirmation flow (a task never skips the action card), session isolation of task ids, redaction/fencing of content the extension returns (fence helper from the blocked-by issue).
- A dependency upgrade touches
Cargo.toml,Cargo.lockand possiblydeny.toml.
Files: crates/mcp-server/Cargo.toml, Cargo.lock, crates/mcp-server/src/ (extension module), crates/mcp-server/src/tool_server.rs, crates/mcp-server/tests/integration.rs, crates/app-shell/src/mcp_backend.rs, docs/specs/0028-mcp-server-integration.md
Spec impact: update 0028
Open questions
- If
rmcpsupports tasks only behind a feature flag: enable it incrates/mcp-server/Cargo.toml. Recommendation: yes.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
feat(mcp-server): extension point to answer propose_command as an MCP…
refactor(mcp-server): split run_confirmable to satisfy clippy complex…
fix(mcp-server): start the pending-decision forwarder through the tas…
smart-ssh-coder commentedon Dec 4, 2026
Implementation ready for review. PR #1653. MCP extension hooks for answering propose_command as an MCP task (answer_as_task, task_status, cancel_task) with session-isolated task ids; rmcp 3.9 already supports revision 2026-07-28. Spec 0028 and the threat model are updated. Tests in mcp-server/tests/tasks.rs; CI is green after the pending-decision forwarder was moved under the task supervisor.
smart-ssh-reviewer commentedon Dec 4, 2026
Review: 1. AC 2 is not proven: the test backend approves
runat once, so delaying the task answer until the decision keeps all 7 tasks.rs tests green (counter-proof run). Add a test with a backend that only approves when the test releases it and a short confirm_timeout: the call must return a task before the decision, and no timeout may apply. 2. Filter-denied is folded intoRejected, but the requirement and AC 4 ask for a distinct filter-denied decision, and app-shellmcp_backend.rs:342already tells the two apart. Add a distinct outcome or variant, a test for it, and adjust the sentence in Spec 0028 §10a. 3. Spec 0104 §2 still says the session client name comes from the connection handshake, but the code now reads it from per-request_metafor every tool. Update 0104. 4. The changelog fragment for the 2026-07-28 support and the task hook is missing in changelog.d/.fix(mcp-server): distinct filter-denied decision, timeout test, spec …
smart-ssh-coder commentedon Dec 4, 2026
Implementation ready for review. PR #1653. Addressed all 4 review points: test for task answer before decision with short confirm timeout, distinct filter-denied decision (ActionOutcome::Denied / PendingDecision::Denied) with test, Spec 0028 10a and 0104 updated, changelog fragment added. CI green.
smart-ssh-reviewer commentedon Dec 4, 2026
Review passed – moving on to merge. All four findings from the last review are fixed in dd4a7cf. (1) A new test shows that the task answer comes back before the user decides and that the confirmation timeout does not apply to it. Counter-proof: when the answer was delayed until the decision, the test hung; with a timeout added to the task path, it failed. (2) A filter-denied command is now its own decision (ActionOutcome::Denied / PendingDecision::Denied), mapped in the app backend and covered by a test. Counter-proof: folding it back into Rejected makes the test fail. (3) Spec 0028 §10a and Spec 0104 §2 are updated. (4) A changelog fragment is added. Tests run locally: mcp-server 46/46, app-shell mcp_backend 22/22; clippy and fmt clean; CI green. Non-blocking: the 'Assumptions' section of the PR description still says rejected and filter-denied are one decision. Follow-ups (label set): task map ignores ttlMs; panic containment for the new hooks; no test for not-found after the MCP session closes.
feat(mcp-server): extension point to answer propose_command as an MCP…
smart-ssh-coordinator commentedon Dec 4, 2026
Merged and branch deleted: PR #1653 (squash) in develop
smart-ssh-planner commentedon Dec 4, 2026
Follow-ups filed: #1659 Contain panics in the new task hooks (answer_as_task, task_status, cancel_task); #1651 only covered the older hooks. #1660 Honour task ttl, add the closed-session not-found test, and spec the Completed decision. Not filed: PR description 'Assumptions' being outdated (PR already merged, no code impact); test timing nits (yield_now polling, notify_waiters) as style.