Skip to content

fix(supervisor-network): answer MCP L7 refusals in-protocol instead of HTTP 403 - #6118

Draft
elezar wants to merge 1 commit into
mainfrom
fix/6048-mcp-refusal-not-auth-challenge
Draft

elezar wants to merge 1 commit into
mainfrom
fix/6048-mcp-refusal-not-auth-challenge

Conversation

@elezar

@elezar elezar commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Summary

An L7 refusal on a protocol: mcp endpoint was an HTTP 403 policy_denied. MCP clients read a 401/403 on a first request as an authorization challenge and cache the server as needing sign-in.

For a POST carrying a JSON-RPC message, the refusal now travels in-protocol:

  • Request refused: HTTP 200 with a JSON-RPC error echoing the id. Code -32600 with data.supportedVersions when mcp.versions excludes the revision; -32601 for a method or tool call the policy refuses. The error message carries the same detail as before. A batch gets an array of errors.
  • Notification refused (no id): empty HTTP 202.
  • Unchanged: the OCSF deny events, 400/405 transport rejections, non-POST requests and non-JSON bodies (they keep the HTTP deny response), and all non-mcp protocols.

Both relay paths (JSON-RPC relay and the inspected/route-selected relay) are covered.

Testing

  • New tests for a refused request and a refused notification, for both the revision and the method refusal, asserting the response and the existing OCSF L7_REQUEST deny / JSONRPC_L7_REQUEST decision=deny messages.
  • Existing tests that asserted a 403 for MCP refusals now assert the new shape.
  • cargo test -p openshell-supervisor-network --lib: 1875 passed. cargo clippy -p openshell-supervisor-network --all-targets -- -D warnings is clean. Gateway/server tests were not run locally (z3 is not installed).

Docs: updated the MCP rejections section in docs/how-it-works/policies/schema.mdx.

Closes #6048

…f HTTP 403

MCP clients read an HTTP 401 or 403 as an authorization challenge and
cache the server as needing sign-in. A refused JSON-RPC request on an
mcp endpoint now gets a JSON-RPC error on HTTP 200 (-32600 with
supportedVersions for a revision refusal, -32601 for a method refusal),
and a refused notification gets an empty HTTP 202. The OCSF deny event
is unchanged. Non-POST and non-JSON bodies keep the HTTP deny response.

Closes #6048

Signed-off-by: Evan Lezar <elezar@nvidia.com>
@github-actions github-actions Bot added the state:accepted A maintainer decided OpenShell should pursue this issue label Dec 1, 2026
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:accepted A maintainer decided OpenShell should pursue this issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

An L7 refusal on an mcp endpoint is an HTTP 403, which MCP clients treat as "this server needs authorization"

1 participant