You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AuthSettings.issuer_url is required in resource-server-only mode but never used #3702
Following up on #3283, where it was noted that token_verifier= shouldn't make you invent an authorization server. I didn't find an issue tracking that, so here's one.
What happens
For a server that only verifies bearer tokens (token_verifier=, no auth_server_provider, resource_server_url=None):
AuthSettings(resource_server_url=None) fails validation: issuer_url field required.
MCPServer(token_verifier=...) without auth= raises "Cannot specify auth_server_provider or token_verifier without auth settings".
With a placeholder such as issuer_url="https://placeholder.invalid", everything works: only /mcp is mounted, a missing token gets 401 and a valid one gets 200. The value is never read. It's only used when auth_server_provider is set (server.py:1218) or when the PRM document is served (server.py:1277).
Minor related point: resource_server_url is typed AnyHttpUrl | None but declared with Field(...), so None has to be passed explicitly.
What I expected
To configure a resource-server-only setup without a made-up URL.
Validate that issuer_url is set when resource_server_url is set, since the PRM authorization_servers needs an entry, and when auth_server_provider is used.
Existing configs behave the same. The only change is that the placeholder is no longer needed.
The alternative would be to allow token_verifier= without auth= at all, but that's a bigger change. Does the first shape fit, or would you prefer something different? I'm happy to implement whichever you prefer.
AuthSettings(resource_server_url=None) raises ValidationError: 1 validation error for AuthSettings / issuer_url / Field required — reproduces exactly as described.
Audited all issuer_url read sites: src/mcp/server/lowlevel/server.py:803 (inside if auth_server_provider:), :839 (inside if auth and auth.resource_server_url:), src/mcp/server/mcpserver/server.py:1218 (inside if self._auth_server_provider:), :1277 (inside the resource_server_url branch). In resource-server-only mode (token_verifier set, no auth server provider, no resource_server_url) none of them execute — so the mandatory field is never read.
The incremental fix shape from the issue (optional issuer_url/resource_server_url plus a validator requiring issuer_url only when resource_server_url is set or an auth server provider is used) matches this audit.
Note: open PR #3292 takes the alternative, bigger approach (token verifier without AuthSettings at all) — flagging in case maintainers prefer it.
Disclosure: this verification was AI-assisted (per this repo's CONTRIBUTING).
Activity
lzif commentedon Oct 14, 2026
Verified on current main (
754254c0, 2026-10-13):AuthSettings(resource_server_url=None)raisesValidationError: 1 validation error for AuthSettings / issuer_url / Field required— reproduces exactly as described.issuer_urlread sites:src/mcp/server/lowlevel/server.py:803(insideif auth_server_provider:),:839(insideif auth and auth.resource_server_url:),src/mcp/server/mcpserver/server.py:1218(insideif self._auth_server_provider:),:1277(inside theresource_server_urlbranch). In resource-server-only mode (token_verifierset, no auth server provider, noresource_server_url) none of them execute — so the mandatory field is never read.The incremental fix shape from the issue (optional
issuer_url/resource_server_urlplus a validator requiringissuer_urlonly whenresource_server_urlis set or an auth server provider is used) matches this audit.Note: open PR #3292 takes the alternative, bigger approach (token verifier without
AuthSettingsat all) — flagging in case maintainers prefer it.Disclosure: this verification was AI-assisted (per this repo's CONTRIBUTING).