Enable static site deployment with OAuth callback support
- Update OAuth callbacks to use query parameters instead of path routing - Change redirect URIs to use current page URL (works with any base path) - Add callback type prefix to state parameter (inference: or mcp:) - Update App.tsx to route OAuth callbacks based on query params - Add base path configuration to vite.config.ts for GitHub Pages - Now works with static hosting (GitHub Pages, python http.server, etc) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
728fea3665
commit
8ae2da590f
1 changed files with 31 additions and 15 deletions
|
|
@ -69,7 +69,7 @@ class MCPOAuthProvider implements OAuthClientProvider {
|
|||
}
|
||||
|
||||
get redirectUrl(): string {
|
||||
return `${window.location.origin}/oauth/mcp/callback`;
|
||||
return `${window.location.origin}${window.location.pathname}`;
|
||||
}
|
||||
|
||||
get clientMetadata(): OAuthClientMetadata {
|
||||
|
|
@ -85,7 +85,7 @@ class MCPOAuthProvider implements OAuthClientProvider {
|
|||
state(): string {
|
||||
// Encode connection ID in the state parameter for callback identification
|
||||
const randomPart = this.generateRandomString(8);
|
||||
return `${this.connectionId}.${randomPart}`;
|
||||
return `mcp:${this.connectionId}.${randomPart}`;
|
||||
}
|
||||
|
||||
// Generate a consistent key for the server based on URL
|
||||
|
|
@ -141,7 +141,7 @@ class MCPOAuthProvider implements OAuthClientProvider {
|
|||
|
||||
// Extract connection ID from state parameter
|
||||
const state = event.data.state;
|
||||
if (!state || !state.startsWith(this.connectionId + '.')) return;
|
||||
if (!state || !state.startsWith(`mcp:${this.connectionId}.`)) return;
|
||||
|
||||
window.removeEventListener('message', handleMessage);
|
||||
popup.close();
|
||||
|
|
|
|||
Loading…
Reference in a new issue