Skip to main content
Some MCP servers let a client connect, list tools, and call public tools without a token. They ask for sign-in only when a call needs it. This pattern is often called lazy authentication. MCPJam recognizes these sign-in challenges. Depending on the host you are emulating, it shows a Connect card, signs you in, and runs the call again, or it reports the challenge the way that host would.

What a sign-in challenge looks like

Hosts accept two different signals.

HTTP 401 with WWW-Authenticate

The server answers the protected request with 401 Unauthorized and a WWW-Authenticate: Bearer header. This is the signal the MCP authorization specification defines.
Anthropic’s lazy authentication guide asks for the same signal. It says Claude starts sign-in only when the HTTP request itself fails with 401 Unauthorized and a WWW-Authenticate header, so return the 401 before the request reaches your MCP handler. Per the same guide, a 200 result with isError: true is passed to the model as an ordinary tool failure.

A tool result with _meta["mcp/www_authenticate"] (ChatGPT style)

OpenAI’s Apps SDK authentication guide uses a different shape. The call completes with HTTP 200, and the tool result carries isError: true and the challenge in _meta["mcp/www_authenticate"].
That guide requires both of these before ChatGPT shows its sign-in UI:
  • The tool declares securitySchemes that include oauth2. A tool that declares both noauth and oauth2 can be called anonymously and asks for sign-in to unlock more.
  • The challenge has both an error and an error_description parameter.
This challenge is not part of the MCP specification. A client that does not know it treats the result as an ordinary tool error.
A 403 with WWW-Authenticate: Bearer error="insufficient_scope" asks for more scopes on an existing sign-in. MCPJam handles it with the scope step-up flow, not with the settings below.

Per-host settings

How a host reacts to each signal is a setting on the client you are emulating. Open Clients, select a client, and find Mid-session sign-in in the MCP Protocol card. Each signal has an action and a trigger. The actions:
  • Prompt to sign in: MCPJam shows a Connect card. After you sign in, it runs the call again.
  • Notify: the call fails with a sign-in message and is not run again. You can still sign in from the card and then run the call yourself.
  • Pass through: the challenge is an ordinary error.
A trigger only narrows its action, so it has no effect while that action is Pass through. The defaults follow the MCP specification: any 401 counts as a challenge, because the specification falls back to well-known discovery when the header is missing, and the _meta challenge is not acted on. The settings are read on every call, so a change applies to the next call without reconnecting the server. In the MCP Protocol JSON editor, the same settings are these keys. Leave a key out to use its default.

Preset values

The host presets set these values from each vendor’s published documentation. MCPJam has not yet measured them against the live hosts. Every other preset uses the defaults.

Why the host did not prompt

When the emulated host does not start sign-in for a challenge, MCPJam explains why and what the server could send instead. For example, with a Claude preset and a _meta challenge, the note says the host ignores _meta["mcp/www_authenticate"] and that the server should return HTTP 401 with a WWW-Authenticate: Bearer header instead. The note appears with the error, and under Details on a Connect card. It is for you; it is never sent to the model.

The Connect card

When the action is Prompt to sign in or Notify, MCPJam shows a card in place of the failed call:
my-server (https://api.example.com) needs you to sign in to use list_files. Connect · Not now · Details
  • Nothing happens until you click Connect. MCPJam does not open the sign-in page or fetch the server’s authorization metadata before your click. A script, an inspector command, or an app widget cannot click it for you.
  • The card names only the MCP server’s origin. The authorization server’s own sign-in page tells you who it is.
  • The card expires after 10 minutes. It counts down while it is open. After that, sign in and run the call again yourself.
  • Not now hides the card and does not offer it again for that server for the rest of this tab. Later calls show a short notice instead. To sign in after that, reconnect the server with OAuth.
  • Details shows the requested scope, the server’s message, and how the emulated host handles the challenge. Text from the server is always shown as plain text.

After you sign in

  • The original call runs again on its own, whether it reads or writes. It uses the tool-approval policy in Clients; OAuth does not add a separate Run again prompt.
  • If the server asks for sign-in again right after you signed in, MCPJam does not retry. The call fails with a message asking you to check that your account has access to the server, then try again.

Which servers can sign in

Whether MCPJam can start a sign-in depends on the server’s authentication setting:

Shared connections

In a hosted project, a server can use a connection someone else set up. Signing in never replaces that shared credential. You sign in with your own account, and MCPJam does not re-run the earlier call with it. Instead it says: “Signed in with your own account. Run the tool again to use it; the earlier call was not retried.”

The CLI, tests, and evals never sign in

Non-interactive surfaces never start a sign-in, whatever the client’s settings say. This covers the CLI, mcpjam test, and evals. They report the challenge so you can sign in yourself. A 401 challenge fails the command with AUTH_REQUIRED. The details carry the parsed challenge and the command that signs in:
--scopes appears only when the challenge named a scope. A 403 insufficient_scope challenge reports INSUFFICIENT_SCOPE with the same kind of hint. mcpjam test keeps running when a tool call asks for sign-in. The affected case gets an AUTHORIZATION_REQUIRED issue, its iterations record the parsed challenge, and the command prints the mcpjam oauth login command for each server that asked, with where to put the credentials it saves. The exit code is unchanged. Evals record the challenge on the iteration with a remediation, for example connecting the server with OAuth in the eval environment. A _meta challenge is a completed result, so mcpjam tools call prints the result unchanged and adds _authChallenge next to it, with the parsed challenge and the same hint. The CLI adds _authChallenge; it is not part of the server’s result. The public API reports the same challenges: AUTH_REQUIRED (HTTP 403) with details.authChallenge for a 401, and an authChallenge field next to a _meta-challenged tool result.

Test your server with the CLI

  1. Check that the anonymous surface works. The probe sends an unauthenticated initialize, so a lazy-auth server reports ready, not oauth_required:
    mcpjam server probe cannot probe a server that supports only MCP 2026-07-28, which has no initialize, so such a server may report reachable rather than ready.
  2. Call a protected tool without credentials, and check that the challenge is the one you meant to send:
    • For a 401 challenge, expect AUTH_REQUIRED with details.challenge.
    • For a _meta challenge, expect the isError result with _authChallenge next to it.
  3. Sign in, then call the tool again with the saved credentials. If the challenge names a scope, add it with --scopes; the details.hint command already does:
To see what a specific host would do, connect the server in the inspector with Auto authentication, select the Claude or ChatGPT preset client, and run the protected tool from the Tools tab.