Summary
When a remote MCP client (Claude Desktop, Cursor, or a web-based MCP inspector) fails to connect to your hosted MCP endpoint with 401 Unauthorized or CORS policy: Response to preflight request doesn't pass access control check, the server is either missing OPTIONS preflight headers or rejecting OAuth/Bearer discovery.
If you want this fixed cleanly, SazM debugs remote MCP servers and auth/CORS issues for a fixed $99, delivered within 48 hours, 100% in writing with zero calls. See our AI integration services or request the $99 fix.
1. Handle OPTIONS Preflight & Mcp-Session-Id
- Browser-based MCP clients send an
OPTIONSpreflight beforePOST /mcp. - Return
204withAccess-Control-Allow-Origin: *,Access-Control-Allow-Methods: GET, POST, OPTIONS, andAccess-Control-Allow-Headers: Content-Type, Authorization, Mcp-Session-Id. - Expose
Mcp-Session-IdviaAccess-Control-Expose-Headersso clients can read session IDs.
2. Public vs. Authenticated MCP Endpoints
- For public read-only MCP servers (like
sazm.in/mcp), do not require OAuth oninitializeortools/list; for private servers, return401with a validWWW-Authenticateheader pointing to/.well-known/oauth-protected-resource.
Need It Fixed?
We run a live 5-tool public MCP server on Cloudflare Workers (sazm.in/mcp) and fix remote MCP auth, CORS, and transport bugs for a fixed $99 within 48 hours, verified before you pay and 100% async. Start your $99 fix or explore our AI integration services.