Skip to content

fix(mcp): honour the private-endpoint opt-in during OAuth - #2101

Merged
elie222 merged 2 commits into
elie222:mainfrom
tc3oliver:fix/mcp-oauth-private-endpoint
Oct 25, 2026
Merged

elie222 merged 2 commits into
elie222:mainfrom
tc3oliver:fix/mcp-oauth-private-endpoint

Conversation

@tc3oliver

Copy link
Copy Markdown
Contributor

Why

An instance that sets MCP_ALLOW_PRIVATE_ENDPOINT=true can connect to a plain-HTTP MCP server on its private network with a static token, but OAuth fails with "MCP remote URL must use HTTPS". This blocks servers that advertise OAuth metadata on a LAN, such as a Home Assistant install. The broker's own requests already honour the flag; two URL checks in the OAuth provider did not.

What changed

The provider now receives the instance's existing allowPrivateEndpoint setting from the broker. The browser authorization URL check and the RFC 8707 resource binding, including the one used when refreshing a token, apply it. No new setting.

Security note: the flag is an existing owner opt-in, and nothing changes when it is off. When it is on, OAuth authorization URLs and resource bindings may use plain HTTP, the same relaxation the flag already applies to the server URL.

How tested

Two new unit tests in mcp-oauth.test.ts check that a private HTTP authorization URL and a private HTTP resource are accepted with the flag and rejected without it. Both failed before the change. Lint, typecheck and the MCP OAuth, transport and connector tests pass.

With MCP_ALLOW_PRIVATE_ENDPOINT on, a plain-HTTP server on the private
network connected with a static token but failed OAuth with "MCP remote
URL must use HTTPS". The broker's fetches already honoured the flag, but
the browser authorization URL check and the RFC 8707 resource binding
(including the one used on refresh) validated with the default policy.

Pass the flag to the provider and to both checks. Behaviour is unchanged
when the flag is off.
@vercel

vercel Bot commented Oct 25, 2026

Copy link
Copy Markdown

@tc3oliver is attempting to deploy a commit to the Inbox Zero Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous test coverage gap addressed.

Summary

OAuth URL checks now honor the existing instance opt-in for private endpoints.

  • MCP OAuth accepts private HTTP URLs when the instance opts in.

Reviews (2) · Last reviewed commit: "test(mcp): cover the private-endpoint op..." · Reviewed by Greptile

Comment thread packages/adapters/src/mcp-oauth.test.ts Resolved
@elie222
elie222 merged commit 6250a6d into elie222:main Oct 25, 2026
18 of 19 checks passed
@tc3oliver
tc3oliver deleted the fix/mcp-oauth-private-endpoint branch November 13, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants