Skip to content

fix(api): revert oauth2 spec scheme to restore the MCP generator#3032

Merged
tofikwest merged 1 commit into
mainfrom
fix/revert-oauth2-spec-restore-generator
Jun 4, 2026
Merged

fix(api): revert oauth2 spec scheme to restore the MCP generator#3032
tofikwest merged 1 commit into
mainfrom
fix/revert-oauth2-spec-restore-generator

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented Jun 4, 2026

Problem

Our nightly Speakeasy MCP generation has been broken since #2961. That PR added an oauth2 security scheme to the public OpenAPI spec, putting two auth methods on every endpoint (apikey + oauth2). Speakeasy's mcp-typescript generator 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.

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

  • Regenerated the spec from the reverted code and confirmed it's clean; then applied the change surgically so the diff is purely the oauth2 removal.
  • typecheck clean 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/policies description) fails on main too — 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 oauth2 security scheme from the public OpenAPI spec to stop the Speakeasy mcp-typescript generator from dropping tools. All endpoints now advertise only apikey, restoring the full ~335 MCP tools in nightly builds.

  • Bug Fixes
    • Removed oauth2 scheme and per-operation entries from packages/docs/openapi.json; spec now lists only apikey.
    • Reverted public-docs-metadata.ts to pre-feat(api): declare oauth2 security scheme for MCP per-user auth #2961 (removed OAuth helper and call).
    • Updated tests: removed OAuth assertions and added a guardrail test that fails if any operation declares more than one security scheme.
    • No runtime OAuth behavior changed; only the spec’s OAuth advertisement was removed.

Written for commit 64978f5. Summary will update on new commits.

Review in cubic

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>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
comp-framework-editor Ready Ready Preview, Comment Jun 4, 2026 9:28pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@mintlify
Copy link
Copy Markdown
Contributor

mintlify Bot commented Jun 4, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
CompAI 🟢 Ready View Preview Jun 4, 2026, 9:31 PM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@tofikwest tofikwest merged commit ccb6edc into main Jun 4, 2026
13 checks passed
@tofikwest tofikwest deleted the fix/revert-oauth2-spec-restore-generator branch June 4, 2026 21:39
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.70.3 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants