While connecting NetClaw to GitHub's remote MCP server, I encountered four OAuth compatibility issues. Each issue became visible after resolving the previous one.
1. Incorrect metadata discovery for path-bearing issuers
GitHub's authorization server issuer is:
https://github.com/login/oauth
NetClaw currently appends the well-known metadata path directly to the issuer:
https://github.com/login/oauth/.well-known/oauth-authorization-server
This returns 404.
For path-bearing issuers, RFC 8414 requires the path-inserted form:
https://github.com/.well-known/oauth-authorization-server/login/oauth
2. No support for OAuth client secrets
GitHub OAuth Apps require a client secret during token exchange, but NetClaw currently has no configuration field for one.
3. No CLI support for configuring the client secret
Even with client-secret support in the configuration model, there is currently no safe way to provide it through netclaw mcp add.
4. GitHub token response is not requested as JSON
GitHub's token endpoint may return a form-encoded response by default, while the SDK expects JSON. This causes token parsing to fail during authorization.
Proposed Fix
Update the MCP OAuth flow to:
- Use RFC 8414 path-inserted metadata discovery for path-bearing issuers, with the existing append form as a fallback for compatibility.
- Add an optional
OAuthClientSecret using SensitiveString, stored encrypted in secrets.json.
- Add a
--client-secret option to netclaw mcp add that writes the value to the encrypted secrets store rather than netclaw.json.
- Send
Accept: application/json with OAuth token requests so token responses can be parsed correctly by the SDK.
Tests should cover both metadata URL forms, client-secret configuration/storage, and token request headers.
Related
#2123 also identifies the lack of OAuth client-secret support. This issue additionally covers the RFC 8414 metadata discovery issue and GitHub token response handling.
While connecting NetClaw to GitHub's remote MCP server, I encountered four OAuth compatibility issues. Each issue became visible after resolving the previous one.
1. Incorrect metadata discovery for path-bearing issuers
GitHub's authorization server issuer is:
NetClaw currently appends the well-known metadata path directly to the issuer:
This returns
404.For path-bearing issuers, RFC 8414 requires the path-inserted form:
2. No support for OAuth client secrets
GitHub OAuth Apps require a client secret during token exchange, but NetClaw currently has no configuration field for one.
3. No CLI support for configuring the client secret
Even with client-secret support in the configuration model, there is currently no safe way to provide it through
netclaw mcp add.4. GitHub token response is not requested as JSON
GitHub's token endpoint may return a form-encoded response by default, while the SDK expects JSON. This causes token parsing to fail during authorization.
Proposed Fix
Update the MCP OAuth flow to:
OAuthClientSecretusingSensitiveString, stored encrypted insecrets.json.--client-secretoption tonetclaw mcp addthat writes the value to the encrypted secrets store rather thannetclaw.json.Accept: application/jsonwith OAuth token requests so token responses can be parsed correctly by the SDK.Tests should cover both metadata URL forms, client-secret configuration/storage, and token request headers.
Related
#2123 also identifies the lack of OAuth client-secret support. This issue additionally covers the RFC 8414 metadata discovery issue and GitHub token response handling.