You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vMCP: give call-binding refusals a machine-readable reason #7362
When the vMCP refuses a call-bound access token, the reason is given only in human-readable text:
401 reasons (for example token_reused, token_expired) go through Challenge().WriteInvalidToken, with error="invalid_token" and error_description="the access token is not accepted (token_reused)" (pkg/vmcp/server/call_binding.go, refuse).
403 reasons go into the JSON-RPC error message: "Forbidden: the access token does not permit this request (method_mismatch)".
A client that has to act differently on a specific reason must match that text. One client needs to: on token_reused, it must not retry the call with a fresh token. If a stolen token had already started the call, a retry would run it a second time. So it reports the outcome as unknown instead. Today that decision depends on the wording of error_description, which can change without notice.
Proposal
Expose the refusal reason (callbinding.Reason*) as a stable, documented field that clients can rely on, alongside the current text, for example:
an extra auth-param on the WWW-Authenticate challenge for the 401s (RFC 6750 section 3 allows additional auth-params, while error stays invalid_token), and
a data.reason field on the JSON-RPC error for the 403s.
The text in error_description and the message stays as it is, so existing clients keep working.
Done when
Every call-binding refusal carries its reason in a machine-readable field, documented with the list of reason values in docs/authz.md.
Tests pin the field for at least token_reused, token_expired, no_open_call and method_mismatch.
Timing: this is not needed while Mecatl embeds the vMCP, and becomes required before Mecatl can call a vMCP it does not embed (stacklok/mecatl#2812).
Now. Mecatl runs the vMCP in its own process, so a ToolHive version reaches it only through a module bump. A test against the real vMCP (feat(identitybroker): bind each gateway token to its call mecatl#3008) spends a token, replays it, and requires the outcome to be reported as unknown. A rewording of error_description would fail that test when ToolHive is bumped, rather than turn the refusal into a silent retry.
With an external gateway. Mecatl would talk to whatever vMCP version is deployed, and the test above no longer covers it. The client then needs the reason as a field rather than text, so that token_reused is never retried.
When this lands, the Mecatl side reads the field first and keeps the text match for older vMCPs.
Activity
rdimitrov commentedon Nov 27, 2026
Timing: this is not needed while Mecatl embeds the vMCP, and becomes required before Mecatl can call a vMCP it does not embed (stacklok/mecatl#2812).
error_descriptionwould fail that test when ToolHive is bumped, rather than turn the refusal into a silent retry.token_reusedis never retried.When this lands, the Mecatl side reads the field first and keeps the text match for older vMCPs.
docs(agent-identity): record the review's follow-ups on call binding
Give call-binding refusals a machine-readable reason (stacklok#7369)