Skip to content

Conversation

@darthvader58
Copy link

Problem

Chatgpt developer mode was failing to register custom OAuth connectors with the MCP endpoint https://api.supermemory.ai/mcp, returning a validation error:

Validation error for RegisterOAuthClientResponse 
Input should be a valid dictionary or instance of RegisterOAuthClientResponse 
[type=model_type, input_value='{"client_id":"gQIWiUdSvz...client_name":"ChatGPT"}', input_type=str]

This was simply a ChatGPT-specific compatibility issue where the response was being parsed as a string instead of a JSON object.

Solution

Fixes #17

This PR implements a complete OAuth client registration flow with proper CORS handling:

  • Added `/oauth/register` endpoint - Handles ChatGPT's OAuth client registration requests
  • Global CORS headers - Ensures all responses work with ChatGPT's browser environment
  • Preflight OPTIONS and CORS support- Proper preflight OPTIONS handling and cross-origin headers
  • `/mcp` endpoint - The original failing endpoint now supports OAuth registration

Proposed solutions works with any MCP client supporting OAuth 2.0 and supports proper JSON serialization with Content-Type: application/json headers

workers/app.ts Outdated
Comment on lines 289 to 292
const body = await request.json() as any

// Check if this is an OAuth registration request
if (body.client_name || body.redirect_uris) {

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to add SuperMemory MCP as Connector to ChatGPT

1 participant