Rocky_Mountain_Vending/.pnpm-store/v10/files/bf/e4581935c7ff4f8d4c4ab050c0819d1a4fbe5163137553c38c714c1de983a507c20b318169d12d99384ec464587e58cbd636d211dc7e027efecc311f14efe4
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
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>
2026-02-12 16:22:15 -07:00

49 lines
No EOL
1.7 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "getMcpMiddleware", {
enumerable: true,
get: function() {
return getMcpMiddleware;
}
});
const _getorcreatemcpserver = require("./get-or-create-mcp-server");
const _parsebody = require("../api-utils/node/parse-body");
const _streamableHttp = require("next/dist/compiled/@modelcontextprotocol/sdk/server/streamableHttp");
function getMcpMiddleware(options) {
return async function(req, res, next) {
const { pathname } = new URL(req.url || '', 'http://n');
if (!pathname.startsWith('/_next/mcp')) {
return next();
}
const mcpServer = (0, _getorcreatemcpserver.getOrCreateMcpServer)(options);
const transport = new _streamableHttp.StreamableHTTPServerTransport({
sessionIdGenerator: undefined
});
try {
res.on('close', ()=>{
transport.close();
});
await mcpServer.connect(transport);
const parsedBody = await (0, _parsebody.parseBody)(req, 1024 * 1024) // 1MB limit
;
await transport.handleRequest(req, res, parsedBody);
} catch (error) {
if (!res.headersSent) {
res.statusCode = 500;
res.setHeader('Content-Type', 'application/json; charset=utf-8');
res.end(JSON.stringify({
jsonrpc: '2.0',
error: {
code: -32000,
message: 'Internal server error'
},
id: null
}));
}
}
};
}
//# sourceMappingURL=get-mcp-middleware.js.map