fix(api): revert oauth2 spec scheme to restore the MCP generator#3032
Merged
Conversation
Reverts the oauth2 security scheme that #2961 added to the public OpenAPI spec. That change put two auth methods (apikey + oauth2) on every endpoint, which made Speakeasy's mcp-typescript generator drop ~300 of ~335 MCP tools on every nightly run — it cannot emit a tool when an operation declares more than one security scheme. The nightly regen kept opening "Update SDK" PRs that would gut the published @trycompai/mcp-server if merged. This removes ONLY the oauth2 scheme + the per-op oauth2 entries; the packages/docs/openapi.json diff is a pure inverse of #2961 (936 deletions, no other endpoint touched). public-docs-metadata.ts is restored byte-for-byte to its pre-#2961 state. All the actual OAuth work (better-auth provider, guards, McpOrgBinding, org picker from #2955) is UNTOUCHED and stays intact. Keyless OAuth will be wired at the hosting layer (self-host or Speakeasy Enterprise), never in the base spec. Adds a guardrail test in openapi-docs.spec.ts that fails if any operation ever declares more than one security scheme again, so this regression cannot silently recur. Note: an unrelated, pre-existing test ("curates high-value API pages" / expects "SOC 2" in the /v1/policies description) fails on main too — that description changed and the SEO assertion is stale. Left as-is to keep this revert surgical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Contributor
|
🎉 This PR is included in version 3.70.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Our nightly Speakeasy MCP generation has been broken since #2961. That PR added an
oauth2security scheme to the public OpenAPI spec, putting two auth methods on every endpoint (apikey+oauth2). Speakeasy'smcp-typescriptgenerator drops a tool whenever an operation has more than one security scheme — so every nightly run produced an "Update SDK" PR that would delete ~300 of ~335 MCP tools if merged. We've been closing those PRs by hand.Fix
Surgically revert the oauth2 scheme from the spec — nothing else.
public-docs-metadata.ts— restored byte-for-byte to its pre-feat(api): declare oauth2 security scheme for MCP per-user auth #2961 state (removed theapplyMcpOAuthSecurityfunction, its const, and the call).packages/docs/openapi.json— removed only theoauth2scheme + the per-op{oauth2: []}entries. Diff is the pure inverse of feat(api): declare oauth2 security scheme for MCP per-user auth #2961 (936 deletions, no other endpoint touched). Verified:securitySchemesis back to[apikey]only, 0 operations have >1 scheme.openapi-docs.spec.ts— removed the now-irrelevant oauth2 assertions and added a guardrail test.Nothing of value is lost
All the actual OAuth work — the better-auth provider, guards,
McpOrgBinding, the org picker (from #2955) — is untouched. Only the spec's advertisement of oauth2 was removed. When we wire up keyless OAuth for real (self-host or Speakeasy Enterprise), it lives at the hosting layer, not the base spec.Guardrail (so it can't silently recur)
New test fails the suite if any operation ever declares more than one security scheme again — with a message pointing to keep extra auth at the hosting layer.
Result
Once merged, the nightly generator goes back to producing the normal 335 tools, and normal API changes (bug fixes, new endpoints) regenerate cleanly again.
Verification
typecheckclean for both changed source files.openapi-docs.spec.ts: the 2 new guardrail tests pass.Note (pre-existing, not from this PR)
One existing test (
curates high-value API pages…, expecting "SOC 2" in the/v1/policiesdescription) fails onmaintoo — that description changed and the SEO assertion is stale. Left untouched to keep this revert surgical; worth a separate cleanup.🤖 Generated with Claude Code
Summary by cubic
Reverted the
oauth2security scheme from the public OpenAPI spec to stop the Speakeasymcp-typescriptgenerator from dropping tools. All endpoints now advertise onlyapikey, restoring the full ~335 MCP tools in nightly builds.oauth2scheme and per-operation entries frompackages/docs/openapi.json; spec now lists onlyapikey.public-docs-metadata.tsto pre-feat(api): declare oauth2 security scheme for MCP per-user auth #2961 (removed OAuth helper and call).Written for commit 64978f5. Summary will update on new commits.