Skip to content

[professional-crm] Edge Function returns 500 on every MCP POST as published; Claude Desktop reports 'Couldn't reach the MCP server' / 'Couldn't register with sign-in service' #331

@UpLeafed

Description

@UpLeafed

What happened

extensions/professional-crm cannot be deployed to a fresh Supabase project as published. Following the README produces an Edge Function that responds to GET with 200 but returns HTTP 500 on every MCP POST — i.e. on every actual tool call. The function looks healthy from a status check, but no MCP traffic works.

Claude Desktop / claude.ai users see one of:

  • Couldn't reach the MCP server. You can check the server URL and verify the server is running.
  • After a retry: Couldn't register with Professional CRM's sign-in service. You can try again, or add an OAuth Client ID in the connector settings.

The OAuth-style error is a downstream effect — Claude infers OAuth from the 500 because the standard probe failed.

Root cause(s)

Two issues in extensions/professional-crm/index.ts:

  1. StreamableHTTPTransport is constructed with { sessionIdGenerator: undefined, enableJsonResponse: true } — but the pinned @hono/mcp@0.1.1 (per the extension's own deno.json) does not accept these options. Passing them causes the request handler to throw at runtime, hence the 500s.

  2. No CORS preflight handling — browser-based MCP clients (Claude Desktop is Electron, claude.ai is browser-tab) send an OPTIONS preflight before opening the stream. Without an app.options(...) handler, Hono returns 404 on preflight and the connector probe fails before the POST ever happens. The 401/500 error responses also need CORS headers attached so the client can read the body.

Both are present in any deployment of this extension as currently shipped.

How to reproduce

  1. Fresh Supabase project, run extensions/professional-crm/schema.sql
  2. Set the four secrets per README: SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, MCP_ACCESS_KEY, DEFAULT_USER_ID
  3. supabase functions deploy professional-crm-mcp
  4. curl -X POST 'https://<project>.supabase.co/functions/v1/professional-crm-mcp?key=<key>' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' → returns HTTP 500
  5. Or add the URL as a Claude Desktop custom connector → see "Couldn't reach" error

Suggested fix

PR #330 contains both fixes as separate commits — empirically verified against a deployed Supabase project + claude.ai connector. All 10 crm_* tools work end-to-end after applying.

cc PR: #330

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions