feat(cli): add page-actions mcp-auth flag to docs.yml - #17350
feat(cli): add page-actions mcp-auth flag to docs.yml#17350devin-ai-integration[bot] wants to merge 3 commits into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
AI Review Summary
Straightforward flag plumbing for page-actions.options.mcp-auth through the docs.yml schema, parsed config, and FDR write. Naming and default handling follow the existing mcp conventions. Two things worth verifying: whether the FDR SDK type actually declares mcpAuth yet (the conditional spread will hide a mismatch), and the interaction when mcp: false but mcp-auth: true.
- 🟡 1 warning(s)
- 🔵 1 suggestion(s)
| claudeCode: this.parsedDocsConfig.pageActions.options.claudeCode, | ||
| vscode: this.parsedDocsConfig.pageActions.options.vscode, | ||
| ...(!this.parsedDocsConfig.pageActions.options.mcp ? { mcp: false } : {}), | ||
| ...(this.parsedDocsConfig.pageActions.options.mcpAuth ? { mcpAuth: true } : {}), |
There was a problem hiding this comment.
🟡 warning
Spreading a conditional object literal bypasses TypeScript's excess-property checking, so this compiles even if CjsFdrSdk.docs.v1.commons.PageActionOptions doesn't declare mcpAuth yet (the PR notes fern-platform#13712 hasn't landed). Confirm the pinned FDR SDK version actually has the field — otherwise this silently publishes a key the server ignores, and a future rename/typo won't be caught either.
| claudeCode: this.parsedDocsConfig.pageActions.options.claudeCode, | ||
| vscode: this.parsedDocsConfig.pageActions.options.vscode, | ||
| ...(!this.parsedDocsConfig.pageActions.options.mcp ? { mcp: false } : {}), | ||
| ...(this.parsedDocsConfig.pageActions.options.mcpAuth ? { mcpAuth: true } : {}), |
There was a problem hiding this comment.
🔵 suggestion
What happens with mcp: false + mcp-auth: true? Today that publishes { mcp: false, mcpAuth: true }, which is contradictory. Either gate mcpAuth on mcp being enabled here, or document that the authed endpoint is independent of the public one.
| claude: z.boolean().optional(), | ||
| cursor: z.boolean().optional(), | ||
| mcp: z.boolean().optional(), | ||
| "mcp-auth": z.boolean().optional(), |
There was a problem hiding this comment.
🔴 Docs sites that turn on the new authenticated-MCP setting fail to build
The new mcp-auth setting is accepted by the internal parser ("mcp-auth": z.boolean().optional() at packages/cli/configuration/src/docs-yml/DocsYmlSchemas.ts:380) but was never added to the checked-in validation files the CLI uses first, so any site that sets it is rejected outright.
Impact: Users who add the new option to their docs configuration get a hard "Failed to parse docs.yml" error and cannot build or publish their site at all.
JSON-schema validation runs before parsing and forbids unknown keys
packages/cli/workspace/loader/src/loadDocsWorkspace.ts:81 validates the raw docs.yml against the generated packages/cli/workspace/loader/src/docs-yml.schema.json via validateAgainstJsonSchema and throws a CliError when validation fails (packages/cli/workspace/loader/src/loadDocsWorkspace.ts:110-114).
The docs.PageActionOptions definition in both generated schemas (docs-yml.schema.json:4487 region and the copy under packages/cli/workspace/loader/src/) still lists only copy-page, view-as-markdown, ask-ai, chatgpt, claude, claude-code, cursor, mcp, vscode, custom, skills and ends with "additionalProperties": false. Ajv is compiled with allErrors: true and no removeAdditional, so mcp-auth: true produces an additionalProperties error → Unexpected property 'mcp-auth'.
These two JSON schemas are generated from fern/apis/docs-yml/definition/docs.yml by pnpm docs-yml:jsonschema (see package.json:68), and CI enforces that they are regenerated and committed (.github/workflows/ci.yml:172-180). The previous mcp flag addition included the regenerated schemas; this PR does not.
Prompt for agents
The PR adds the new `mcp-auth` page-action option to the docs-yml Fern definition, the zod raw schema, generated api/serialization types, the parsed config, and the FDR write, but the two checked-in generated JSON schemas were not regenerated: docs-yml.schema.json at the repo root and packages/cli/workspace/loader/src/docs-yml.schema.json. The CLI validates docs.yml against the latter in packages/cli/workspace/loader/src/loadDocsWorkspace.ts before any parsing, and the docs.PageActionOptions definition there has "additionalProperties": false, so a docs.yml containing page-actions.options.mcp-auth is rejected with an 'Unexpected property' parse error, making the feature unusable. CI also enforces that these files match regeneration output (.github/workflows/ci.yml runs `pnpm jsonschema` and fails on any git diff). Fix by running `pnpm docs-yml:jsonschema` and committing the regenerated schema files.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
Confirmed and fixed — docs.PageActionOptions has "additionalProperties": false, so mcp-auth would have been rejected by loadDocsWorkspace's JSON-schema validation before parsing. Ran pnpm docs-yml:jsonschema and committed both regenerated schemas.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Docs Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on
Docs generation runs |
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via |
Description
Exposes the config flag for authenticated MCP (fern-platform#13712). An SSO/password-protected docs site opts into the authed MCP endpoint (
/_mcp/authed/server) and its OAuth metadata documents with:Defaults to
false, so nothing changes for existing sites.mcp-authfollows the existingmcpflag's plumbing (docs-yml definition →DocsYmlSchemasraw schema → generated api/serialization types →parseDocsConfiguration→convertPageActions), and the FDR write is conditional (...(mcpAuth ? { mcpAuth: true } : {})) so publishes only carry the field when it's on.Changes Made
fern/apis/docs-yml/definition/docs.yml: documentmcp-authonPageActionOptions.packages/cli/configuration: raw"mcp-auth"key, generatedmcpAuthapi type +core.serialization.property("mcp-auth", …),mcpAuth: booleanonParsedPageActionsConfig.packages/cli/configuration-loader:mcpAuth: pageActions.options?.mcpAuth ?? false.packages/cli/docs-resolver: writemcpAuththrough to FDR.feat).Testing
skills-page-action.test.tsfixture updated;docs-resolver+configuration-loadersuites pass (14 files / 107 tests).mcp-auth: trueis pending fern-platform#13712 landing, since the authed endpoint only exists there.Link to Devin session: https://app.devin.ai/sessions/612b7bdf03ae4384be9d05684646b722