Skip to content

feat: add JSON-based settings file for authorization-server tests (supersedes #228)#360

Open
pcarleton wants to merge 5 commits into
mainfrom
paulc/pr228-superseding
Open

feat: add JSON-based settings file for authorization-server tests (supersedes #228)#360
pcarleton wants to merge 5 commits into
mainfrom
paulc/pr228-superseding

Conversation

@pcarleton

Copy link
Copy Markdown
Member

Supersedes #228 by @Michito-Okai. Original commit cherry-picked with authorship preserved (ba4cd2a), then rebased onto current main (post-#227) and tightened up per review.

What this adds

A --file <path> option for the authorization subcommand that loads settings from a JSON file. CLI flags take precedence over file values.

mcp-conformance authorization --file examples/authorization-server-settings.example.json

Changes vs #228

  • Single source of truth for validation. Dropped the separate AuthorizationServerFileOptionsSchema and the bespoke mergeAuthorizationServerOptions helper. The file is JSON.parsed, generically spread-merged with CLI options (CLI wins; undefined flags don't clobber file values), then validated once by the existing AuthorizationServerOptionsSchema. Unknown keys are stripped by Zod. New options added to the schema flow through to --file automatically.
  • Clear error when neither --url nor --file is given — explicit guard before Zod parse, instead of a cryptic url: Invalid input.
  • Sample moved to examples/authorization-server-settings.example.json with an https:// issuer (RFC 8414).
  • Tests for merge precedence, file-only url, missing-url failure, and unknown-key stripping.
  • Rebased onto main and conflict-resolved against feat: scenario option for authorization server test #227's --scenario/--verbose additions.

Files

  • src/index.ts--file option, load + spread-merge + url guard
  • examples/authorization-server-settings.example.json — sample
  • src/authorization-file-options.test.ts — merge/validation tests

Closes #228.
Addresses #225.

@pkg-pr-new

pkg-pr-new Bot commented Jun 23, 2026

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@modelcontextprotocol/conformance@360

commit: aab03c6

…ypo'd files

The settings file must be a complete, valid AuthorizationServerOptions on
its own; CLI flags are optional overrides on top. .strict() rejects unknown
keys so a typo'd field surfaces as an error instead of being silently
ignored. ZodError from file parsing is reported with the file path.
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