OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
fix: mcp cors and logging
Carl-Gerhard Lindesvärd593ef9b76741
diff --git a/apps/api/src/app.ts b/apps/api/src/app.tsindex 442b0a6c3..6a6c355c0 100644--- a/apps/api/src/app.ts+++ b/apps/api/src/app.ts@@ -92,7 +92,7 @@ export async function buildApp(req: FastifyRequest,callback: (error: Error | null, options: FastifyCorsOptions) => void,) => {- const corsPaths = ['/trpc', '/live', '/webhook', '/oauth', '/misc', '/ai', '/mcp'];+ const corsPaths = ['/trpc', '/live', '/webhook', '/oauth', '/misc', '/ai'];const isPrivatePath = corsPaths.some((p) => req.url.startsWith(p));if (isPrivatePath) {diff --git a/packages/mcp/src/handler.ts b/packages/mcp/src/handler.tsindex 9fcff9074..a0ab50cdd 100644--- a/packages/mcp/src/handler.ts+++ b/packages/mcp/src/handler.ts@@ -25,6 +25,7 @@ export async function handleMcpPost(query: Record<string, unknown>,): Promise<void> {const sessionId = req.headers['mcp-session-id'] as string | undefined;+ logger.info('MCP POST request', { sessionId: sessionId ?? 'new', hasAuth: !!(query['token'] || req.headers.authorization) });if (sessionId) {// Fast path: session is already on this instance@@ -56,6 +57,7 @@ export async function handleMcpPost(await attachSession(sessionManager, null, context, req, res, body);} catch (err) {if (err instanceof McpAuthError) {+ logger.warn('MCP auth failed', { reason: err.message });res.writeHead(401, { 'Content-Type': 'application/json' });res.end(JSON.stringify({ error: err.message }));} else {