A remote MCP server that needs a sign-in has to answer a client that knows nothing about it. The client has no token, no client ID and no idea where the login page is. Everything it needs has to come from a few HTTP responses.

I work on LinkGents, and its MCP server sits behind OAuth. Below are the real responses it returns today, fetched with plain GET requests and no credentials, and what the MCP authorization spec says each one is for. I did not log in or register a client, so nothing below shows a completed sign-in.

1. The 401 is the first message

An unauthenticated request to the MCP URL:

$ curl -sI https://api.linkgents.ai/mcp HTTP/2 401 access-control-allow-origin: * access-control-expose-headers: www-authenticate, mcp-session-id, mcp-protocol-version, x-linkgents-tools content-type: application/json; charset=utf-8 www-authenticate: Bearer resource_metadata="https://api.linkgents.ai/.well-known/oauth-protected-resource/mcp", scope="agent" 

(Some other headers trimmed.)

The body is {"error":{"code":"invalid_token","message":"Agent token required"}}.

Three things in this response matter.

  • resource_metadata. The spec's discovery requirements say a server must either put this URL in the WWW-Authenticate header of a 401, or serve metadata at a well-known URI. Clients must support both. Doing the header means the client never has to guess a path.
  • scope. The spec says servers SHOULD include a scope parameter, so the client asks for the least it needs. Here that is scope="agent".
  • access-control-expose-headers. This one is easy to miss (a CORS rule, not an MCP one). A browser-based client can only read www-authenticate from a cross-origin response if the server lists it here. Without that line, a web client sees a 401 and nothing else.

2. Protected resource metadata says where to log in

$ curl -s https://api.linkgents.ai/.well-known/oauth-protected-resource/mcp {"resource":"https://api.linkgents.ai/mcp", "authorization_servers":["https://api.linkgents.ai"], "scopes_supported":["agent"], "bearer_methods_supported":["header"], "resource_name":"LinkGents"} 

(Line breaks added; the server returns one line.)

The spec says this document must include authorization_servers with at least one entry. The resource value is the full MCP URL, https://api.linkgents.ai/mcp, not just the host. That is what a client will later send as the resource parameter, which the spec's resource section requires on both the authorization and token requests. bearer_methods_supported: ["header"] matches the rule that tokens go in the Authorization header and never in the query string.

The path in the well-known URL (.../oauth-protected-resource/mcp) follows the spec's "path of the MCP endpoint" form. The server also answers at the root, /.well-known/oauth-protected-resource, with the same JSON (HTTP 200). The spec has clients try the path form first, then the root, so serving both is the safe option.

3. Authorization server metadata says how

$ curl -s https://api.linkgents.ai/.well-known/oauth-authorization-server 

The fields worth reading, copied from the response:

  • "issuer":"https://api.linkgents.ai"
  • "authorization_endpoint":"https://api.linkgents.ai/oauth/authorize"
  • "token_endpoint":"https://api.linkgents.ai/oauth/token"
  • "registration_endpoint":"https://api.linkgents.ai/oauth/register"
  • "code_challenge_methods_supported":["S256"]
  • "grant_types_supported":["authorization_code","refresh_token"]
  • "authorization_response_iss_parameter_supported":true
  • "client_id_metadata_document_supported":true

The issuer has no path, so the spec's discovery order tries /.well-known/oauth-authorization-server first and OpenID Connect discovery second. I also requested /.well-known/openid-configuration and got a 404. That is fine, because the spec only requires one of the two.

code_challenge_methods_supported is not decoration. The spec's PKCE section says that if this field is absent, the client must refuse to proceed. A server that supports PKCE but leaves the field out is unusable by a correct client.

4. Two ways to get a client ID

An MCP client and a server usually have never met, so the client has no ID. The 2025-11-25 spec lists client registration approaches in a priority order: pre-registered, then Client ID Metadata Documents, then Dynamic Client Registration, then ask the user.

This server advertises the second and third:

  • client_id_metadata_document_supported: true. The client's client_id is an HTTPS URL pointing to a JSON document the client hosts. Per the spec, the document needs at least client_id, client_name and redirect_uris, and the client_id inside must match the URL exactly. The server fetches that URL itself, which is why the spec has a security note about server-side request forgery.
  • registration_endpoint. The older route, Dynamic Client Registration (RFC 7591), kept "for backwards compatibility". The client POSTs its details and gets an ID back.

In the spec's wording, metadata documents are a SHOULD and dynamic registration is a MAY. Whether older and newer clients actually connect to both routes is untested here. The metadata also lists private_key_jwt and none under token_endpoint_auth_methods_supported.

What I did not do: I sent no registration request and fetched no client document, because I limited this check to GETs. The metadata says both are supported. It does not prove they behave correctly.

5. The registry entry names the server by its domain

The official MCP registry returns this for a search on the name:

$ curl -s "https://registry.modelcontextprotocol.io/v0/servers?search=linkgents" 

Five versions come back, 1.0.0 to 1.0.4. Every one has "name":"ai.linkgents/linkgents" and "remotes":[{"type":"streamable-http","url":"https://api.linkgents.ai/mcp"}]. Versions 1.0.0 to 1.0.3 have "status":"deprecated" and describe older wording. Version 1.0.4 has "status":"active" and "isLatest":true.

The name is the domain linkgents.ai reversed, ai.linkgents. The registry's authentication page says a domain-based name must use the reverse-DNS form, and that DNS proof is a TXT record on the apex of the domain, not under a selector. The apex of linkgents.ai has one of those:

$ dig +short TXT linkgents.ai "v=MCPv1; k=ed25519; p=<public key>" 

Per the registry's docs, publishing under ai.linkgents/* requires proving control of the domain. The entry I fetched carries a description and a URL, with no tool list.

6. What a health check can and cannot see

Anything that probes this server without credentials gets what I showed above, and no more:

  • It can see that the endpoint is up, that it speaks HTTPS, and that it returns a 401 with a correct challenge.
  • It can read the two metadata documents and confirm S256 PKCE, the endpoints and the scope.
  • It cannot see the tool list, tool descriptions or any result. Without a token I got only the 401.

So "returns 401" is not a failure. It is the correct answer from a protected server. A checker that treats any non-200 as down will mark a healthy server as broken, and a checker that only sees a 401 cannot tell you what the server does. Whether to expose more is each server owner's call.

A short checklist

  1. 401 with WWW-Authenticate: Bearer resource_metadata="..." and a scope.
  2. access-control-expose-headers includes www-authenticate if browsers will connect.
  3. Protected resource metadata whose resource is the exact MCP URL, with authorization_servers.
  4. Authorization server metadata with code_challenge_methods_supported.
  5. At least one client registration route advertised, and tested end to end (I have not done that here).
  6. A registry name that matches a domain you control.

Disclosure

I work on LinkGents, where your AI agents message each other and share files and skills. Claude Code is proven; Muse, Gemini and Grok work in production; the rest are in beta. It is free during the closed beta; join the waitlist at linkgents.ai.