Repository navigation
Description
Summary
mcpproxy fails to authenticate with Smithery.ai hosted MCP servers because Smithery uses a non-standard path for OAuth authorization server metadata that mcpproxy doesn't discover.
Environment
- mcpproxy version: development
- Server:
https://server.smithery.ai/googledrive - OS: macOS
Problem
When connecting to Smithery servers, mcpproxy correctly:
- Receives 401 with
WWW-Authenticateheader pointing to protected resource metadata - Fetches protected resource metadata successfully
But fails at step 3 because Smithery uses a non-standard path for authorization server metadata.
Standard vs Smithery Paths
| Endpoint | Standard Path (RFC 8414) | Smithery Path |
|---|---|---|
| Auth Server Metadata | https://auth.smithery.ai/googledrive/.well-known/oauth-authorization-server |
https://auth.smithery.ai/.well-known/oauth-authorization-server/googledrive |
The standard puts .well-known after the path segment, but Smithery inserts .well-known between host and path.
Actual Server Responses
Protected Resource Metadata (works)
curl https://server.smithery.ai/.well-known/oauth-protected-resource/googledrive{
"authorization_servers": ["https://auth.smithery.ai/googledrive"],
"resource": "https://server.smithery.ai/googledrive"
}Auth Server Metadata - Standard Path (404)
curl https://auth.smithery.ai/googledrive/.well-known/oauth-authorization-server
# Returns: Cannot GET /googledrive/.well-known/oauth-authorization-serverAuth Server Metadata - Smithery Path (works)
curl https://auth.smithery.ai/.well-known/oauth-authorization-server/googledrive{
"issuer": "https://auth.smithery.ai/googledrive",
"authorization_endpoint": "https://auth.smithery.ai/googledrive/authorize",
"token_endpoint": "https://auth.smithery.ai/googledrive/token",
"registration_endpoint": "https://auth.smithery.ai/googledrive/register",
"response_types_supported": ["code"],
"code_challenge_methods_supported": ["S256"],
"grant_types_supported": ["authorization_code", "refresh_token"],
"token_endpoint_auth_methods_supported": ["none", "client_secret_post"]
}mcpproxy Logs
ERROR | OAuth metadata validation failed | {"server": "googledrive-smithery", "error_type": "oauth_metadata_missing"}
How Other Clients Handle This
According to MCP spec and RFC 9728, clients should try multiple discovery strategies:
- WWW-Authenticate Header: Parse
resource_metadataURL from 401 response - Path insertion: For
https://auth.example.com/path, tryhttps://auth.example.com/.well-known/oauth-authorization-server/path - Suffix path: Try
https://auth.example.com/path/.well-known/oauth-authorization-server
The official MCP TypeScript SDK has similar issues (see modelcontextprotocol/typescript-sdk#762).
Proposed Solutions
Option 1: Try Multiple Discovery Paths
When discovering auth server metadata, try both:
{auth_server}/.well-known/oauth-authorization-server # Standard
{auth_server_base}/.well-known/oauth-authorization-server/{path} # Alternative
Option 2: Support Manual Metadata URL Override
Allow specifying metadata_url in OAuth config:
{
"oauth": {
"metadata_url": "https://auth.smithery.ai/.well-known/oauth-authorization-server/googledrive"
}
}Option 3: Parse WWW-Authenticate Resource Metadata
The 401 response includes:
WWW-Authenticate: Bearer resource_metadata="https://server.smithery.ai/.well-known/oauth-protected-resource/googledrive"
Use this to discover the full OAuth chain without relying on path conventions.
Related Issues
- Autodetect OAuth without explicit oauth settings #155 - Autodetect OAuth without explicit settings
- MCP SDK #762 - Auth server metadata URL path handling
Config Attempted (not working)
{
"name": "googledrive-smithery",
"url": "https://server.smithery.ai/googledrive",
"protocol": "http",
"oauth": {
"provider": "google",
"scopes": ["https://www.googleapis.com/auth/drive.readonly"],
"issuer": "https://auth.smithery.ai/googledrive",
"auth_url": "https://auth.smithery.ai/googledrive/authorize",
"token_url": "https://auth.smithery.ai/googledrive/token",
"metadata_url": "https://auth.smithery.ai/.well-known/oauth-authorization-server/googledrive"
}
}The manual auth_url, token_url, and metadata_url fields are not being used by mcpproxy for OAuth discovery.
Activity
fix: implement RFC 8414 compliant OAuth metadata discovery (#251)
fix: discover auth server from PRM for separate domain OAuth servers
fix: implement RFC 8414 compliant OAuth metadata discovery (smart-mcp…
fix: implement RFC 8414 compliant OAuth metadata discovery (smart-mcp…