Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
1 line
No EOL
2.7 KiB
Text
1 line
No EOL
2.7 KiB
Text
{"version":3,"sources":["../../../src/server/mcp/get-mcp-middleware.ts"],"sourcesContent":["import type { ServerResponse, IncomingMessage } from 'http'\nimport {\n getOrCreateMcpServer,\n type McpServerOptions,\n} from './get-or-create-mcp-server'\nimport { parseBody } from '../api-utils/node/parse-body'\nimport { StreamableHTTPServerTransport } from 'next/dist/compiled/@modelcontextprotocol/sdk/server/streamableHttp'\n\nexport function getMcpMiddleware(options: McpServerOptions) {\n return async function (\n req: IncomingMessage,\n res: ServerResponse,\n next: () => void\n ): Promise<void> {\n const { pathname } = new URL(req.url || '', 'http://n')\n if (!pathname.startsWith('/_next/mcp')) {\n return next()\n }\n const mcpServer = getOrCreateMcpServer(options)\n const transport = new StreamableHTTPServerTransport({\n sessionIdGenerator: undefined,\n })\n try {\n res.on('close', () => {\n transport.close()\n })\n await mcpServer.connect(transport)\n const parsedBody = await parseBody(req, 1024 * 1024) // 1MB limit\n await transport.handleRequest(req, res, parsedBody)\n } catch (error) {\n if (!res.headersSent) {\n res.statusCode = 500\n res.setHeader('Content-Type', 'application/json; charset=utf-8')\n res.end(\n JSON.stringify({\n jsonrpc: '2.0',\n error: { code: -32000, message: 'Internal server error' },\n id: null,\n })\n )\n }\n }\n }\n}\n"],"names":["getOrCreateMcpServer","parseBody","StreamableHTTPServerTransport","getMcpMiddleware","options","req","res","next","pathname","URL","url","startsWith","mcpServer","transport","sessionIdGenerator","undefined","on","close","connect","parsedBody","handleRequest","error","headersSent","statusCode","setHeader","end","JSON","stringify","jsonrpc","code","message","id"],"mappings":"AACA,SACEA,oBAAoB,QAEf,6BAA4B;AACnC,SAASC,SAAS,QAAQ,+BAA8B;AACxD,SAASC,6BAA6B,QAAQ,qEAAoE;AAElH,OAAO,SAASC,iBAAiBC,OAAyB;IACxD,OAAO,eACLC,GAAoB,EACpBC,GAAmB,EACnBC,IAAgB;QAEhB,MAAM,EAAEC,QAAQ,EAAE,GAAG,IAAIC,IAAIJ,IAAIK,GAAG,IAAI,IAAI;QAC5C,IAAI,CAACF,SAASG,UAAU,CAAC,eAAe;YACtC,OAAOJ;QACT;QACA,MAAMK,YAAYZ,qBAAqBI;QACvC,MAAMS,YAAY,IAAIX,8BAA8B;YAClDY,oBAAoBC;QACtB;QACA,IAAI;YACFT,IAAIU,EAAE,CAAC,SAAS;gBACdH,UAAUI,KAAK;YACjB;YACA,MAAML,UAAUM,OAAO,CAACL;YACxB,MAAMM,aAAa,MAAMlB,UAAUI,KAAK,OAAO,MAAM,YAAY;;YACjE,MAAMQ,UAAUO,aAAa,CAACf,KAAKC,KAAKa;QAC1C,EAAE,OAAOE,OAAO;YACd,IAAI,CAACf,IAAIgB,WAAW,EAAE;gBACpBhB,IAAIiB,UAAU,GAAG;gBACjBjB,IAAIkB,SAAS,CAAC,gBAAgB;gBAC9BlB,IAAImB,GAAG,CACLC,KAAKC,SAAS,CAAC;oBACbC,SAAS;oBACTP,OAAO;wBAAEQ,MAAM,CAAC;wBAAOC,SAAS;oBAAwB;oBACxDC,IAAI;gBACN;YAEJ;QACF;IACF;AACF","ignoreList":[0]} |