oauthdoctor

A read-only MCP OAuth discovery diagnostic. One inspect command tells you whether an MCP endpoint advertises its OAuth authorization metadata the way an agent expects to discover it. No login, no token exchange.

What it is

oauthdoctor is a command-line tool that walks the OAuth discovery flow an MCP client follows to find an endpoint's authorization server. It checks the 401 challenge, the WWW-Authenticate resource_metadata pointer, the Protected Resource Metadata document, the referenced authorization server metadata, and the PKCE S256 declaration. It is a discovery diagnostic, not a login tool and not a security certifier.

The problem it solves

A common failure: my MCP server returns 401 and the agent cannot find the authorization server metadata. The MCP Authorization spec expects the metadata to be discoverable through a specific chain of documents. oauthdoctor follows that chain read-only and reports where it breaks — so you can fix your server's discovery before an agent ever connects.

When to use it

When NOT to use it

Installation

npm install -g oauthdoctor     # or run without installing:
npx oauthdoctor inspect <url> --json

Real command

npx oauthdoctor inspect https://mcp.example.com/mcp --json

What it checks

HTTP targets are refused except 127.0.0.1 / localhost / ::1 (fixture mode) to keep the tool read-only against remote servers.

Example output

Representative structure of what oauthdoctor reports. A real public OAuth-protected MCP endpoint positive case has not yet been published by the project; the tool's local positive/negative fixture tests pass.

{
  "endpoint": "https://mcp.example.com/mcp",
  "status": "PASS",
  "checks": [
    { "name": "401_challenge", "status": "PASS" },
    { "name": "www_authenticate_resource_metadata", "status": "PASS" },
    { "name": "protected_resource_metadata", "status": "PASS" },
    { "name": "authorization_server_metadata", "status": "PASS" },
    { "name": "pkce_s256", "status": "PASS" }
  ]
}

Exit codes

CodeMeaning
0PASS — all implemented discovery checks passed
1FAIL — at least one implemented check failed (findings in JSON)
2UNKNOWN — target could not be conclusively evaluated
3usage error (bad arguments or non-HTTPS remote target)

What it does NOT check

Limitations

Status

Experimental (0.1.0). Local positive/negative fixture tests pass; a real public OAuth-protected MCP endpoint positive case has not yet been validated.

npm

Package: oauthdoctor — published by npm user eidonze, version 0.1.0, MIT.

GitHub

Source: xka0085-byte/oauthdoctor — issues and the full README live there.

Related tools

Part of the Agent / Chain Evidence Tools suite · MIT · Node ≥ 18 · read-only, no keys, no payments