patchbay audit

MCP OAuth checklist

16 things to get right in the auth setup of a remote MCP server. Each item says where the rule comes from and how you can test it.

Items marked with the MCP spec refer to the authorization spec in revision 2026-07-28. Everything marked as good practice is not required by a standard. It is what we look for when we audit a server. You can run most of the list against your own server with the browser scan or the open source CLI:

npx -y @patchbay-nebius/agent audit https://mcp.example.com/mcp

Discovery

A client reads these documents before it does anything else. If they are missing or incomplete the login never starts.

  • Publish Protected Resource Metadata

    The document under /.well-known/oauth-protected-resource names your resource identifier and the authorization servers that issue tokens for it. Clients use it to find where to log in.

    Source:
    MCP spec, RFC 9728
    Test:
    Browser scan and CLI

    RESOURCE-001: what it means and how to fix it

  • List S256 in code_challenge_methods_supported

    Clients have to verify PKCE support from the authorization server metadata. If the field is absent they must stop before the login.

    Source:
    MCP spec 2026-07-28
    Test:
    Browser scan and CLI

    AUTH-003: what it means and how to fix it·Full write-up

Client registration

An MCP client is whatever the user runs. It needs a client_id without anyone filing a ticket.

  • Offer an automatic way to register

    Support Client ID Metadata Documents, which the current spec recommends, or keep a Dynamic Client Registration endpoint for older clients. With neither, every client has to be added by hand.

    Source:
    MCP spec 2026-07-28
    Test:
    Browser scan and CLI

    AUTH-005: what it means and how to fix it·Full write-up

  • Accept loopback redirect URIs with any port

    CLI and desktop clients listen on a local port that changes on every login. An authorization server that insists on an exact port breaks all of them.

    Source:
    RFC 8252 §7.3
    Test:
    CLI with flag--probe-dcr-loopback

    AUTH-006: what it means and how to fix it·Full write-up

  • Treat localhost and 127.0.0.1 the same

    Clients use both forms. Accepting one and rejecting the other locks out every client that uses the other form.

    Source:
    Good practice
    Test:
    Browser scan and CLI

    REDIRECT-001: what it means and how to fix it

Tokens

What the server does with a token once it arrives.

  • Validate the audience of every token

    A token issued for another service behind the same authorization server must not work on your MCP server. Compare the aud claim with your own resource identifier and reject everything else.

    Source:
    MCP spec, RFC 8707 §2
    Test:
    CLI with flag--probe-audience=<token>

    AUDIENCE-001: what it means and how to fix it·Full write-up

  • Accept the resource parameter

    MCP clients send it on authorization and token requests so the authorization server can bind the token to your server. Make sure yours does not reject or ignore it.

    Source:
    MCP spec, RFC 8707
    Test:
    Check by hand
  • Do not rely on a static key alone

    A long lived bearer token or API key with no OAuth discovery cannot be scoped, rotated per client or bound to an audience.

    Source:
    Good practice
    Test:
    Browser scan and CLI

    AUTH-002: what it means and how to fix it

Exposure

What anyone on the internet can reach without credentials.

  • Never expose write tools without authentication

    A public server for read only lookups can be a deliberate choice. A server that answers tools/list without credentials and offers tools that create, send or delete is open to anyone who finds the URL.

    Source:
    Good practice
    Test:
    Browser scan and CLI

    AUTH-001: what it means and how to fix it

  • Serve over HTTPS only

    Tokens and tool calls over plain HTTP can be read and changed in transit.

    Source:
    Good practice
    Test:
    Browser scan and CLI

    TRANSPORT-001: what it means and how to fix it

  • Reject requests from origins you do not expect

    This matters when browsers can reach the server. Without an origin check a web page the user visits can talk to it.

    Source:
    Good practice
    Test:
    Browser scan and CLI

    TRANSPORT-002: what it means and how to fix it

Scopes

How much a single token can do.

In the repository

These need the source code, so they only run in the CLI.

After launch

A server changes. So does what an agent can do through it.

Run the list against your server

Paste the URL and get a report with a grade in a few seconds. Free, no account. The items marked CLI need the command line tool.

Scan a server