Codex Plugin Doctor
Codex Plugin Doctor is a local CLI validator for Codex plugin packages, skills, and MCP server bundles.
It catches packaging, metadata, security, and runtime protocol problems before a plugin reaches users, teammates, or release workflows.
Status
Codex Plugin Doctor is a public stable CLI for local and CI validation.
- Primary surface: GitHub repository and npm package
- Distribution today:
npm install -g, local source install,npm link,npm pack, GitHub Releases - Public npm package:
codex-plugin-doctor - License: MIT
1.0 Stability
The 1.0 line is the stable compatibility baseline for plugin authors and CI consumers.
- Public JSON schema surfaces and existing rule IDs/default severities are treated as stable through 1.0.
- Runtime probing remains opt-in because it executes package-local MCP servers.
- The project remains Codex-first; broader MCP Doctor positioning stays a post-1.0 expansion path.
- Post-1.0 feature work should stay additive unless a documented major-version decision is made.
See the documentation index for architecture, usage, security, and contributor guides.
Why This Exists
Codex plugin packages can fail in several places:
- the package manifest is missing or points outside the package root
- skills exist but do not expose valid
SKILL.mdmetadata .mcp.jsonis malformed or references unsafe secrets- an MCP server starts but does not complete the protocol handshake
- tools, resources, or prompts list successfully but fail deeper runtime checks
- verbose metadata creates noisy matching and unnecessary context cost
This tool gives plugin authors a repeatable preflight check before distribution.
What It Checks
Static validation:
- required
.codex-plugin/plugin.json - manifest fields:
name,version,description - skill directory wiring
SKILL.mdpresence and frontmatter fields- YAML single-line and block-scalar skill descriptions
.mcp.jsonstructure- path traversal risks
- hard-coded secret-like env values
- description quality heuristics tuned against real plugin packages
Security scorecard with security:
- shell wrapper command warnings for MCP servers
- encoded shell command failures
- remote content piped into shell failures
- MCP server
cwdpaths that escape the package root - plain HTTP remote transport warnings
Runtime MCP validation with --runtime:
initializenotifications/initializedtools/listtools/callresources/listresources/readresources/templates/listprompts/listprompts/get- paginated list responses
- runtime capability scorecard
- redacted verbose transcript with
--verbose-runtime - optional runtime approval gating with a precomputed
doctor runtime-plandigest - optional Docker isolation for local Node.js stdio servers with
--sandbox docker
MCP Protocol Discovery
Inspect an HTTP MCP endpoint's advertised protocol versions using a bounded MCP
2026-07-28 server/discover request:
codex-plugin-doctor doctor discover https://mcp.example.com/mcp --allow-network
codex-plugin-doctor doctor discover https://mcp.example.com/mcp --allow-network --json
This is an opt-in discovery-only check. A successful result validates the discovery
response, not full protocol conformance, tool behavior, or compatibility with a
particular client. Existing check --runtime remains on its 2025-11-25 baseline.
See MCP Discovery for consent, scope, and exit codes.
Offline MCP Tool Definitions
Inspect a saved MCP 2026-07-28 tools/list response without contacting a server:
codex-plugin-doctor doctor tools-file ./tools-list.json --json
This checks the supplied tool definitions and root-schema shapes within fixed file, tool, and finding limits. It does not establish server inventory completeness or execute tools. See Offline MCP Tool Definitions for the accepted input format, coverage, and exit codes.
Offline MCP Tool Diff
Compare two saved tool-list responses before updating a server or client:
codex-plugin-doctor doctor tools-diff --before ./tools-old.json --after ./tools-new.json --json
This reports added, removed, and structurally changed definitions using numeric
locations, and labels each change breaking, compatible, or unclassified
with fixed reason codes. Add --fail-on breaking to fail CI only on breaking or
unclassified changes, --markdown for pull request tables, and --show-names
locally to see tool names and the JSON Pointer of each reason. Incomplete inputs, invalid definitions, or duplicate names
prevent a comparison. Impact labels follow nested object properties, array
items, and common length and range bounds, but remain heuristics, not proof of
compatibility.
See Offline MCP Tool Diff for matching rules,
privacy, limits, and exit codes.
MCP Tool Catalog
Inspect a modern HTTP MCP server's tool definitions without invoking them:
codex-plugin-doctor doctor tools https://mcp.example.com/mcp --allow-network --json
This opt-in command performs discovery and bounded tools/list pagination. It
reports tool-definition and root-schema shape findings, explicit completion state,
and partial inspection limits. It does not claim full schema validation, tool
execution, or client compatibility. Existing doctor discover behavior is unchanged.
Add --save-response <path> to record a completely enumerated catalog as a
tools/list response for tools-file and tools-diff; nothing is written when
enumeration is incomplete. For protected servers, --bearer-token-env <NAME>
sends a bearer token from an environment variable only over HTTPS or to an
approved loopback endpoint; it is never printed or saved. The GitHub Action can compare saved responses with
tools-diff-before, tools-diff-after, and tools-diff-fail-on, capture the
live list with tools-capture-url (and tools-capture-token-env) or, for a local
stdio server with runtime: "true", tools-capture-server, and skip the
plugin package check with check: "false" in repositories that only ship an MCP
server. With tools-diff-comment: "true" it also posts the comparison as one
pull request comment that later runs update. tools-capture-sandbox: docker
starts a stdio server in the Docker sandbox, and
codex-plugin-doctor init-ci . --tools-diff-server <name> --sandbox docker
writes a pull request workflow that captures in one job and compares and
comments in another.
Local stdio servers from a package's MCP configuration can be cataloged too.
--runtime is required because this starts package code; the server is stopped
after its tool list is read:
codex-plugin-doctor doctor tools ./my-plugin --server my-server --runtime --save-response ./tools-current.json
Doctor tries server/discover (2026-07-28) first and falls back to the
initialize handshake for older stdio servers, so the saved list works with
tools-file and tools-diff either way. --sandbox docker and
--require-runtime-approval work as they do for check --runtime; add
--env <NAME> to pass a host variable such as an API key into the Docker
container by name.
See MCP Tool Catalog.
MCP Prompt Catalog and Diff
Record a server's prompt list and catch prompt changes that break clients:
codex-plugin-doctor doctor prompts https://mcp.example.com/mcp --allow-network --save-response ./mcp/prompts-baseline.json
codex-plugin-doctor doctor prompts-diff --before ./mcp/prompts-baseline.json --after ./prompts-current.json --fail-on breaking
doctor prompts reads prompts/list from an HTTP server, or from a local stdio
server with --server <name> --runtime, without retrieving any prompt.
doctor prompts-file inspects a saved list offline, and doctor prompts-diff
labels a removed prompt, a removed argument, or a newly required argument as
breaking. Like the tool diff, reports omit names unless --show-names is given.
The GitHub Action runs the same capture and comparison through prompts-*
inputs and comments on pull requests, and
init-ci --tools-diff-server <name> --prompts-baseline <path> writes that workflow.
See MCP Prompt Catalog and Diff.
MCP Resource Template Catalog and Diff
codex-plugin-doctor doctor resource-templates https://mcp.example.com/mcp --allow-network --save-response ./mcp/resource-templates-baseline.json
codex-plugin-doctor doctor resource-templates-diff --before ./mcp/resource-templates-baseline.json --after ./resource-templates-current.json --fail-on breaking
doctor resource-templates reads resources/templates/list the same way, without
reading any resource; resource-templates-file inspects a saved list, and
resource-templates-diff labels a removed template, a changed URI template, or an
added or removed template variable as breaking. Reports never include URI templates,
and names appear only with --show-names. The GitHub Action and
init-ci --tools-diff-server <name> --resource-templates-baseline <path> run the same comparison on pull requests.
See MCP Resource Template Catalog and Diff.
MCP Snapshot
codex-plugin-doctor doctor mcp-snapshot ./my-plugin --server my-server --runtime --save-dir ./mcp-current
codex-plugin-doctor doctor mcp-snapshot-diff --before ./mcp/baseline --after ./mcp-current --fail-on breaking
doctor mcp-snapshot reads the tool, prompt, and resource template lists in one
run, reading a stdio server in one session, and --save-dir writes each complete list
under the file name the matching -file and -diff commands use, plus a
manifest of what was saved. doctor mcp-snapshot-diff compares two snapshot
directories in one report and labels a list the server stopped offering, or a
dropped protocol version or capability, as breaking, and changed server
instructions as unclassified; --changelog turns the comparison into release
notes with names. In the GitHub Action, snapshot-server or snapshot-url takes the
snapshot and snapshot-diff-before-dir compares it with a committed baseline
directory in one report, and
init-ci --tools-diff-server <name> --snapshot-baseline-dir <dir> writes a
two-job workflow that posts it as one pull request comment. After an intended
change, doctor mcp-snapshot-accept makes a new snapshot the baseline, and
running that workflow by hand opens a pull request that does the same.
See MCP Snapshot.
Remote MCP Readiness
Remote MCP runtime probing is disabled until you explicitly pass --runtime --allow-network. Loopback endpoints also require --allow-local-network:
codex-plugin-doctor check ./remote-mcp --runtime --allow-network
codex-plugin-doctor check ./remote-mcp --runtime --allow-network --allow-local-network
The probe makes only bounded protocol and OAuth metadata-discovery requests, redacts report output, and applies SSRF controls. It does not authenticate or follow redirects.
Remote transport reliability adds one bounded SSE GET after initialization. HTTP 200 must be text/event-stream; HTTP 405 is compliant when the endpoint does not offer server-to-client SSE. At most one SSE resume and one session restart are attempted, and no remote response content is retained. This is a bounded readiness check, not a live interoperability, delivery-guarantee, or load-test claim.
--allow-session-lifecycle is disabled by default and is state-changing: only after a valid MCP-Session-Id it permits one bounded session DELETE. --require-remote-reliability is a strict result gate: it fails unless every attempted remote reliability scorecard passes. Local-only runs are unaffected. It grants no network consent, so --runtime --allow-network (and loopback consent when applicable) remain required. See Remote MCP Readiness and Remote MCP Transport Reliability.
MCP Registry Readiness
Validate official MCP Registry publication metadata without publishing or installing anything:
codex-plugin-doctor registry check path/to/server.json
codex-plugin-doctor registry check path/to/server.json --json --require-registry-readiness
codex-plugin-doctor registry inspect io.github.example/weather --allow-network
Local checks validate metadata, ownership consistency, package integrity, transports, and Codex installability. Exact Registry lookup is read-only, requires explicit network consent, and contacts only the fixed official Registry endpoint. It never follows advertised package, icon, repository, or remote MCP URLs. See MCP Registry Readiness.
MCP Registry Publication Preflight
Check a publication candidate locally without making a network request:
codex-plugin-doctor registry preflight path/to/server.json --json
Opt in to bounded public npm and MCP Registry metadata checks:
codex-plugin-doctor registry preflight path/to/server.json --allow-network --json
Require a publish-ready result in CI:
codex-plugin-doctor registry preflight path/to/server.json --allow-network --require-publish-ready --json
Preflight checks the exact npm package version, then the exact Registry version and latest Registry record on fixed public hosts. An existing exact Registry version is an immutable collision and must be replaced by a version bump. The command is advisory: it never authenticates, publishes, or changes npm or Registry records. See MCP Registry Publication Preflight.
Public Directory Submission Preflight
Check a plugin package for deterministic public-directory submission issues without contacting a portal:
codex-plugin-doctor doctor submission <path>
codex-plugin-doctor doctor submission <path> --json
codex-plugin-doctor doctor submission <path> --markdown
codex-plugin-doctor doctor submission <path> --require-ready
codex-plugin-doctor doctor submission archive <zip>
codex-plugin-doctor doctor submission archive <zip> --json --output submission-archive.json
codex-plugin-doctor doctor submission archive <zip> --markdown --output submission-archive.md
codex-plugin-doctor doctor submission archive <zip> --require-ready
The preflight is offline and non-executing: it does not submit a package, make network requests, start MCP servers, verify domains, or handle OAuth credentials. Its automatic status is pass or fail; a passing automatic result remains manual_review_required until portal-only review is complete. It never claims directory acceptance. See Public Directory Submission Preflight.
The archive variant accepts an existing skills-only ZIP and does not extract archive entries to disk, execute package code, or repair the archive. It reports malformed ZIP structures and deterministic package blockers; unsupported portal rules remain manual or coverage: unavailable rather than an automatic pass.
Output formats:
- human text output
- JSON reports
- Markdown reports
- Shields-compatible badge JSON and static badge Markdown
- validation history JSONL and trend summaries
- deterministic local attestation artifacts
- output contract and rule catalog freeze metadata
- bundled validation corpus reports
--outputfile writing- CI summary and artifact generation
Quick Start
Global install from npm:
npm install -g codex-plugin-doctor
codex-plugin-doctor --version
codex-plugin-doctor self-test
codex-plugin-doctor check path/to/plugin-package
Run codex-plugin-doctor check . from the root of a Codex plugin package that contains .codex-plugin/plugin.json. The Codex Plugin Doctor source repository is not itself a plugin package.
If you already have Codex installed locally and do not know plugin paths, discover the installed plugin cache:
codex-plugin-doctor list --installed
codex-plugin-doctor check --installed
codex-plugin-doctor check --installed --all-summary
codex-plugin-doctor check --installed --compat --all-summary
codex-plugin-doctor audit --installed --security --compat
codex-plugin-doctor audit --installed --security --compat --policy security
codex-plugin-doctor mcp path/to/mcp-package
codex-plugin-doctor check --installed github
codex-plugin-doctor explain plugin.manifest.missing
Run from source:
npm install
npm run build
node dist/cli.js check examples/codex-doctor-runtime --runtime
For local global usage:
npm link
codex-plugin-doctor check examples/codex-doctor-runtime --runtime
Generate validation artifacts locally:
npm run generate-validation-artifacts -- --target examples/codex-doctor-runtime --runtime-target examples/codex-doctor-runtime --out-dir validation-artifacts-local
Example Output
Passing runtime package:
Codex Plugin Doctor
===================
Status: PASS
Target: <repo>\examples\codex-doctor-runtime
Summary: 0 fail, 0 warn, 0 total
Runtime Scorecard
----------------
initialize: pass
tools/list: pass
tools/call: pass
resources/list: pass
resources/read: pass
resources/templates/list: pass
prompts/list: pass
prompts/get: pass
No findings.
Risky package:
Codex Plugin Doctor
===================
Status: FAIL
Target: <repo>\examples\codex-doctor-risky
Summary: 1 fail, 0 warn, 1 total
Failures
--------
x plugin.security.hard_coded_secret
Message: The MCP server `dangerServer` contains a hard-coded secret-like env value for `OPENAI_API_KEY`.
Impact: Hard-coded credentials inside plugin bundles increase leakage risk and make secure rotation difficult.
Suggested fix: Replace the literal value for `OPENAI_API_KEY` with an environment reference or injected secret outside the package.
Useful Commands
Run these from a Codex plugin package root:
codex-plugin-doctor --version
codex-plugin-doctor self-test
codex-plugin-doctor doctor
codex-plugin-doctor doctor contract
codex-plugin-doctor doctor contract --json --output output-contract.json
codex-plugin-doctor doctor corpus
codex-plugin-doctor doctor corpus --json --output validation-corpus.json
codex-plugin-doctor doctor corpus --manifest ../private-corpus/corpus.json --json
codex-plugin-doctor doctor corpus metrics --manifest ../private-corpus/metrics.json --markdown
codex-plugin-doctor doctor corpus metrics --manifest ../private-corpus/metrics.json --json --min-precision 0.90 --min-recall 0.85 --max-false-positive-rate 0.10
codex-plugin-doctor doctor npm <published-plugin-package>
codex-plugin-doctor doctor npm <published-plugin-package> --json --output npm-preinstall.json
codex-plugin-doctor doctor attest .
codex-plugin-doctor doctor attest . --json --output attestation.json
codex-plugin-doctor doctor attest . --json --sign-key-env CODEX_PLUGIN_DOCTOR_SIGNING_KEY --output attestation.json
codex-plugin-doctor
