Repository navigation
.NET: [BREAKING] fix(dotnet): revalidate MCP tool approvals #10243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Vincent Biret (baywet)
wants to merge
15
commits into
main
Choose a base branch
from
fix/approval-binding
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,800
−122
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
927bbe9
fix(dotnet): revalidate MCP tool approvals
baywet 8d266ca
fix(dotnet): preserve MCP approval boundaries
baywet 5d38af4
fix(dotnet): cover MCP annotation changes
baywet 74e4d39
fix(dotnet): simplify MCP metadata iteration
baywet f61a282
fix(dotnet): validate MCP tool input schemas
baywet f4f37e1
fix(dotnet): preserve MCP approval checkpoints and notices
baywet 2fe2698
docs(dotnet): clarify MCP approval revalidation
baywet 98dd67e
docs(dotnet): clarify approval branch checks
baywet 075870a
Fix MCP approval context and retry handling
baywet e2fb77e
Fix approval checkpoint recovery after downstream failure
baywet 30d7eb8
Simplify workflow checkpoint condition
baywet 5b3ddf7
Apply batched suggestions from code review
baywet 8263e83
fix(workflows): use compatible request null validation
baywet 81c80a8
fix(workflows): track wrapped response consumer completion
baywet 37b5f38
fix(workflows): isolate MCP approval fingerprinting
baywet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
92 changes: 92 additions & 0 deletions
92
docs/decisions/0056-dotnet-declarative-mcp-discovery-approval.md
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| --- | ||
| status: proposed | ||
| contact: baywet | ||
| date: 2026-11-10 | ||
| deciders: [baywet, westey-m] | ||
| informed: [rhurey] | ||
| --- | ||
|
|
||
| # Separate MCP discovery consent from tool invocation approval | ||
|
|
||
| ## Context and Problem Statement | ||
|
|
||
| An approval-gated declarative MCP action needs the current tool definition before | ||
| it can bind an invocation approval to that definition. Obtaining the definition | ||
| is itself a network operation using the configured endpoint and transport | ||
| settings. Approval to invoke a tool and permission to contact its server are | ||
| different decisions. | ||
|
|
||
| The executor cannot determine whether discovery will carry credentials merely by | ||
| checking workflow headers: managed connections, custom handlers, and configured | ||
| HTTP clients may also supply them. Workflow expressions can change while an | ||
| approval is pending, and headers must not become durable checkpoint state. | ||
|
|
||
| ## Decision Drivers | ||
|
|
||
| - Obtain consent before contacting a server for an approval-gated action. | ||
| - Bind each consent to its captured destination, workflow headers, and connection reference. | ||
| - Require invocation approval after discovering the current published definition. | ||
| - Preserve request isolation, replay handling, and credential nonpersistence. | ||
| - Support custom handlers and all supported .NET targets. | ||
|
|
||
| ## Considered Options | ||
|
|
||
| - Discover with configured transport settings before requesting tool approval. | ||
| Good: one approval interaction and discovery works with authenticated servers. | ||
| Neutral: metadata discovery remains a separate handler invocation. | ||
| Bad: discovery contacts the destination before any consent. | ||
| - Discover without workflow headers before requesting tool approval. | ||
| Good: explicit workflow headers are not sent during discovery. | ||
| Neutral: the executor still performs a network operation before consent. | ||
| Bad: authenticated discovery can fail, and other credential sources remain. | ||
| - Obtain discovery consent, then obtain a definition-bound invocation approval. | ||
| Good: no handler invocation occurs before discovery consent, including when | ||
| authentication is supplied outside workflow headers. | ||
| Neutral: discovery and invocation remain separate, invocation-owned MCP calls. | ||
| Bad: approval-gated tool calls require two interactions rather than one. | ||
|
|
||
| ## Decision Outcome | ||
|
|
||
| Chosen option: "Obtain discovery consent, then obtain a definition-bound invocation | ||
| approval", because it does not depend on the executor detecting every possible | ||
| credential source. | ||
|
|
||
| For approval-gated actions, the initial request authorizes `tools/list` against | ||
| the displayed destination using the configured transport settings. The destination, | ||
| workflow headers, and connection reference are captured; host-managed transport | ||
| credentials remain subject to the handler's lifecycle. Discovery consent does not | ||
| authorize the requested tool invocation. After consent, discovery produces a | ||
| separate approval for the captured tool name and arguments. That approval includes | ||
| a fingerprint of the complete published tool definition in its internal snapshot. | ||
| Before invocation, the executor discovers the definition again and requests fresh | ||
| invocation approval if it differs or the previous snapshot lacks a fingerprint. | ||
| Changed metadata does not authorize an invocation. | ||
|
|
||
| The reserved `tools/list` action is discovery itself: its single approval | ||
| authorizes that operation, without requiring it to appear in the tool catalog. | ||
| Actions without approval retain their existing direct-invocation behavior. | ||
|
|
||
| Each stage uses a distinct request identifier. Responses use captured invocation | ||
| parameters rather than reevaluating them. Headers remain in memory only. Approval | ||
| snapshots include a keyed fingerprint of captured workflow headers, but neither | ||
| the header values nor the key are persisted. Hosts can provide a stable, | ||
| cryptographically random key of at least 32 bytes to support cross-process | ||
| restoration. When omitted, a process-local key is used; a checkpoint cannot be | ||
| resumed after that key is lost. After restoration, changed headers require fresh | ||
| discovery consent, while a missing or changed fingerprint key fails closed until | ||
| the original key is restored. Older snapshots without a header fingerprint | ||
| restart discovery approval. Denied or consumed requests cannot authorize a later | ||
| stage. | ||
|
|
||
| Handlers must return structured `tools/list` output containing complete protocol | ||
| tool definitions, including annotations and metadata. Object properties are | ||
| compared in ordinally sorted order recursively; array order and scalar values are | ||
| preserved. Missing or ambiguous definitions stop the action rather than bypassing | ||
| approval. This compares published metadata, not server implementation identity, | ||
| and does not eliminate the interval between discovery and invocation. | ||
|
|
||
| Existing approval UIs must handle the additional discovery request and its | ||
| notice. When an `ExternalInputRequest` is delivered through `WorkflowSession`, | ||
| informational text accompanying its inner approval content is preserved in | ||
| delivery order. Older snapshots without discovery consent restart discovery | ||
| approval. The ADR remains proposed pending the listed deciders' PR review. |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.