13.2 MCP returns 401

Every request comes back 401 Unauthorized.

The 401 response carries a WWW-Authenticate: Bearer ..., resource_metadata="..." header. That header is informative: it names the resource-metadata URL the client should re-fetch to re-discover the AS, and (if the validation reached that point) carries an error_description naming the specific failure.

13.2.1 Possible causes

13.2.2 Verify

Without a token, you should get a 401 with a proper challenge header:

curl -sS -i -X POST https://<host>/mcp \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'

Look for the WWW-Authenticate: Bearer ... header. If the response is 500 instead of 401, the OAuth resource server isn’t configured. If it’s 200 (unauthenticated success), the AS isn’t enabled but the server didn’t refuse the request — check OAuthAuthorizationServer in application.ini.

With a valid token (obtained via any OAuth-capable MCP client):

curl -sS -X POST https://<host>/mcp \
    -H "Authorization: Bearer $OWNSONA_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'

200 with a server-info payload means the OAuth path is working end-to-end.