Skip to content

feat(mcp): add JSON Schema for MCP/CLI configuration files#40025

Closed
lennondotw wants to merge 1 commit intomicrosoft:mainfrom
lennondotw:feat-mcp-config-json-schema
Closed

feat(mcp): add JSON Schema for MCP/CLI configuration files#40025
lennondotw wants to merge 1 commit intomicrosoft:mainfrom
lennondotw:feat-mcp-config-json-schema

Conversation

@lennondotw
Copy link
Copy Markdown

@lennondotw lennondotw commented Apr 2, 2026

Summary

  • Auto-generate a JSON Schema (draft-07) from config.d.ts using the TypeScript compiler API, recursively expanding LaunchOptions and BrowserContextOptions
  • Add utils/generate_mcp_config_schema.js generator, integrated into build.js and flint
  • Strip Markdown syntax (links, backticks) from descriptions to plain text — JSON Schema description is plain text per spec, and Markdown renders as raw syntax noise in editors that don't support it
  • Fix config.d.ts / configIni.ts drift: add missing saveTrace, outputMode; remove dead saveVideo; add timeouts.expect to longhandTypes; fix /*/** JSDoc; fix imageResponses JSDoc
  • Add 21 structural assertion tests in tests/mcp/config-schema.spec.ts including markdown stripping and drift detection
  • Document $schema usage in getting-started-mcp.md and getting-started-cli.md

How to test

Use this temporary raw URL to try the schema in your config file before merge:

{
  "$schema": "https://raw.githubusercontent.com/lennondotw/playwright/e631dfd1a/packages/playwright-core/src/tools/mcp/mcp-config.schema.json"
}

After merge, the canonical URL will be:

https://raw.githubusercontent.com/microsoft/playwright/main/packages/playwright-core/src/tools/mcp/mcp-config.schema.json

Related PRs

@lennondotw lennondotw force-pushed the feat-mcp-config-json-schema branch from 1c0ed3e to a5531e9 Compare April 2, 2026 08:21
lennondotw added a commit to lennondotw/playwright-mcp that referenced this pull request Apr 2, 2026
- Add $schema example to the Configuration file section in README
- Extend roll.js copyConfig() to also copy mcp-config.schema.json
  from playwright-core, so the schema ships with the npm package

Depends on: microsoft/playwright#40025
lennondotw added a commit to lennondotw/playwright-cli that referenced this pull request Apr 2, 2026
Add JSON Schema reference and SchemaStore mention to the
Configuration file section in README.

Depends on: microsoft/playwright#40025
@lennondotw lennondotw force-pushed the feat-mcp-config-json-schema branch from a5531e9 to 1ffb319 Compare April 2, 2026 08:31
lennondotw added a commit to lennondotw/playwright-cli that referenced this pull request Apr 2, 2026
Add JSON Schema reference and SchemaStore mention to the
Configuration file section in README.

Depends on: microsoft/playwright#40025
@lennondotw
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@lennondotw lennondotw force-pushed the feat-mcp-config-json-schema branch from 1ffb319 to e631dfd Compare April 2, 2026 09:19
Auto-generate a JSON Schema (draft-07) from config.d.ts using the
TypeScript compiler API. The schema covers all Config fields including
recursively expanded LaunchOptions and BrowserContextOptions.

- Add utils/generate_mcp_config_schema.js generator script
- Output mcp-config.schema.json alongside config.d.ts
- Register in build.js onChanges and flint for CI staleness checks
- Add config-schema.spec.ts with structural assertion tests
- Fix config.d.ts / configIni.ts drift: add saveTrace, remove dead
  saveVideo, add timeouts.expect to longhandTypes
- Document $schema usage in getting-started-mcp.md and
  getting-started-cli.md
@lennondotw lennondotw force-pushed the feat-mcp-config-json-schema branch from e631dfd to b090074 Compare April 2, 2026 09:22
@Skn0tt
Copy link
Copy Markdown
Member

Skn0tt commented Apr 2, 2026

We discussed the approach with the team, and decided agains the JSON schema approach. Thanks for taking the time to contribute though! We'll see what we can do to give the config proper IDE support.

@Skn0tt Skn0tt closed this Apr 2, 2026
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