Skip to content

Commit 5ed2eb5

Browse files
committed
feat: Add minimal DCR stub for MCP Inspector compatibility
- Added /oauth/register endpoint that returns fake credentials - Restored registration_endpoint in OAuth metadata - Updated documentation to explain stub implementation The DCR stub allows MCP Inspector to work while still using simplified OAuth flow. The returned client_id and client_secret are never validated - all actual authentication uses the hardcoded Google OAuth credentials. This is a compatibility shim until MCP Inspector supports manual client configuration (see modelcontextprotocol/inspector#683)
1 parent b1cc683 commit 5ed2eb5

3 files changed

Lines changed: 42 additions & 6 deletions

File tree

‎DCR.md‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Dynamic Client Registration (DCR) - REMOVED
1+
# Dynamic Client Registration (DCR) - Stub Only
22

3-
## Update: DCR Has Been Removed
3+
## Update: DCR Simplified to Stub Implementation
44

5-
This MCP server no longer uses Dynamic Client Registration (DCR). The OAuth flow has been simplified to work directly with your configured Google OAuth credentials.
5+
This MCP server uses a minimal DCR stub for compatibility with MCP Inspector. The DCR endpoint returns fake credentials while actual authentication uses your configured Google OAuth credentials.
66

77
## Why DCR Was Removed
88

@@ -44,11 +44,24 @@ OAUTH_CLIENT_ID=your-google-client-id
4444
OAUTH_CLIENT_SECRET=your-google-client-secret
4545
```
4646

47+
## DCR Stub Implementation
48+
49+
The `/oauth/register` endpoint returns fake credentials:
50+
```json
51+
{
52+
"client_id": "mcp-inspector-client",
53+
"client_secret": "not-used",
54+
...
55+
}
56+
```
57+
58+
These credentials are never validated. All OAuth operations use your configured Google OAuth credentials.
59+
4760
## Compatibility
4861

49-
- ✅ **Claude**: Fully supported (can specify custom client ID if needed)
62+
- ✅ **Claude**: Fully supported (ignores DCR)
5063
- ✅ **ChatGPT**: Works with hardcoded credentials
51-
- ✅ **MCP Inspector**: Should work without DCR
64+
- ✅ **MCP Inspector**: Works with DCR stub
5265

5366
## Benefits of Removal
5467

‎src/oauth/OAuthProxyRouter.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,27 @@ export class OAuthProxyRouter {
2929
}
3030

3131
private setupRoutes() {
32+
// Minimal DCR stub for MCP Inspector compatibility
33+
// This returns fake credentials - actual auth uses hardcoded Google OAuth
34+
this.router.post('/oauth/register', express.json(), (req, res) => {
35+
const { redirect_uris } = req.body;
36+
37+
// Return dummy client credentials for MCP Inspector
38+
// These are never validated - we use hardcoded Google credentials
39+
res.status(201).json({
40+
client_id: 'mcp-inspector-client',
41+
client_secret: 'not-used', // Never actually used
42+
redirect_uris: redirect_uris || [],
43+
client_name: 'MCP Inspector Client',
44+
grant_types: ['authorization_code'],
45+
response_types: ['code'],
46+
scope: envProvider.oauthScopes,
47+
client_id_issued_at: Math.floor(Date.now() / 1000)
48+
});
49+
50+
logger.info('Returned dummy client for MCP Inspector compatibility');
51+
});
52+
3253
// OAuth authorization endpoint
3354
this.router.get('/oauth/authorize', this.handleAuthorization.bind(this));
3455

‎src/oauth/dynamicOAuthMetadata.ts‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,13 @@ export function dynamicOAuthMetadataMiddleware(req: Request, res: Response, next
3939
resource_name: envProvider.mcpServerName
4040
});
4141
} else if (req.path === '/.well-known/oauth-authorization-server') {
42-
// DCR removed - no registration_endpoint
42+
// Include registration_endpoint for MCP Inspector compatibility
43+
// The DCR endpoint returns fake credentials - actual auth uses hardcoded Google OAuth
4344
res.json({
4445
issuer: baseUrl,
4546
authorization_endpoint: `${baseUrl}/oauth/authorize`,
4647
token_endpoint: `${baseUrl}/oauth/token`,
48+
registration_endpoint: `${baseUrl}/oauth/register`, // DCR stub for MCP Inspector
4749
response_types_supported: ['code'],
4850
scopes_supported: envProvider.oauthScopes.split(' '),
4951
grant_types_supported: ['authorization_code', 'refresh_token'],

0 commit comments

Comments
 (0)