xmcp 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1 @@
1
- import { type Request } from "express";
2
- import { IncomingHttpHeaders } from "http";
3
- export declare const setHeaders: (request: Request) => void;
4
- export declare const headers: () => IncomingHttpHeaders;
1
+ export declare const headers: () => import("http").IncomingHttpHeaders;
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var o in r)e.o(r,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:r[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{headers:()=>i,setHeaders:()=>o});const r={initialized:!1,headers:{}},o=e=>{r.initialized=!0,r.headers=e.headers},i=()=>{if(!r.initialized)throw new Error("Headers not initialized, headres() can only be used within the http transport.");return r.headers};return t})()));
1
+ !function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var t=r();for(var o in t)("object"==typeof exports?exports:e)[o]=t[o]}}(this,()=>(()=>{"use strict";var e,r,t,o={290:e=>{e.exports=require("async_hooks")},4802:(e,r,t)=>{t.r(r),t.d(r,{headers:()=>i});const o=(0,t(9382).q)({name:"http-context"}),n=(o.setContext,o.getContext),i=(o.provider,()=>n().headers)}},n={};function i(e){var r=n[e];if(void 0!==r)return r.exports;var t=n[e]={exports:{}};return o[e](t,t.exports,i),t.exports}return i.m=o,i.x=()=>{var e=i.O(void 0,[382],()=>i(4802));return i.O(e)},e=[],i.O=(r,t,o,n)=>{if(!t){var f=1/0;for(d=0;d<e.length;d++){for(var[t,o,n]=e[d],s=!0,a=0;a<t.length;a++)(!1&n||f>=n)&&Object.keys(i.O).every(e=>i.O[e](t[a]))?t.splice(a--,1):(s=!1,n<f&&(f=n));if(s){e.splice(d--,1);var u=o();void 0!==u&&(r=u)}}return r}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,o,n]},i.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return i.d(r,{a:r}),r},i.d=(e,r)=>{for(var t in r)i.o(r,t)&&!i.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((r,t)=>(i.f[t](e,r),r),[])),i.u=e=>e+".js",i.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t={811:1},i.O.require=e=>t[e],i.f.require=(e,r)=>{t[e]||(e=>{var r=e.modules,o=e.ids,n=e.runtime;for(var f in r)i.o(r,f)&&(i.m[f]=r[f]);n&&n(i);for(var s=0;s<o.length;s++)t[o[s]]=1;i.O()})(require("./"+i.u(e)))},r=i.x,i.x=()=>(i.e(382),r()),i.x()})());
@@ -0,0 +1 @@
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var r in s)("object"==typeof exports?exports:e)[r]=s[r]}}(this,()=>(()=>{var e,t,s,r={86:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=86,e.exports=t},181:e=>{"use strict";e.exports=require("buffer")},290:e=>{"use strict";e.exports=require("async_hooks")},1708:e=>{"use strict";e.exports=require("node:process")},2018:e=>{"use strict";e.exports=require("tty")},2203:e=>{"use strict";e.exports=require("stream")},3106:e=>{"use strict";e.exports=require("zlib")},3193:e=>{"use strict";e.exports=require("string_decoder")},3480:e=>{"use strict";e.exports=require("querystring")},4434:e=>{"use strict";e.exports=require("events")},6928:e=>{"use strict";e.exports=require("path")},6982:e=>{"use strict";e.exports=require("crypto")},7016:e=>{"use strict";e.exports=require("url")},7066:e=>{"use strict";e.exports=require("node:tty")},8161:e=>{"use strict";e.exports=require("node:os")},8611:e=>{"use strict";e.exports=require("http")},9023:e=>{"use strict";e.exports=require("util")},9278:e=>{"use strict";e.exports=require("net")},9780:(e,t,s)=>{"use strict";var r=s(6169),o=s(1275),i=s.n(o),n=s(8611),a=s.n(n),d=s(6982),l=s(6619),c=s.n(l),p=s(1266);function u(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}class h{constructor(){u(this,"onmessage",void 0),u(this,"onerror",void 0),u(this,"onclose",void 0)}}const g=(0,s(9382).q)({name:"http-context"}),f=(g.setContext,g.getContext,g.provider);function m(e,t,s){return t in e?Object.defineProperty(e,t,{value:s,enumerable:!0,configurable:!0,writable:!0}):e[t]=s,e}const y=s(8127).Ay.bold.green("✔");class v extends h{async start(){if(this._started)throw new Error("Transport already started");this._started=!0}async close(){this._singleResponseCollectors?.forEach(e=>{e.res.headersSent||e.res.writeHead(503).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Service unavailable: Server shutting down"},id:null}))}),this._singleResponseCollectors?.clear(),this._requestToCollectorMapping?.clear()}async send(e){const t=e.id;if(null==t)return void(this.debug&&console.log("[StatelessHTTP] Dropping notification without request ID"));const s=this._requestToCollectorMapping?.get(t);if(s){const r=this._singleResponseCollectors?.get(s);if(r&&(void 0!==e.result||void 0!==e.error)&&(r.responses.push(e),r.requestIds.delete(t),0===r.requestIds.size)){const e={"Content-Type":"application/json"},t=1===r.responses.length?r.responses[0]:r.responses;r.res.writeHead(200,e).end(JSON.stringify(t)),this._singleResponseCollectors?.delete(s);for(const e of r.responses)void 0!==e.id&&null!==e.id&&this._requestToCollectorMapping?.delete(e.id)}}}async handleRequest(e,t,s){"POST"===e.method?await this.handlePOST(e,t,s):t.writeHead(405).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Method not allowed."},id:null}))}async handlePOST(e,t,s){try{const r=e.headers.accept,o=r?.includes("application/json");if(!o)return void t.writeHead(406).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Not Acceptable: Client must accept application/json"},id:null}));let i;if(void 0!==s)i=s;else{const s=e.headers["content-type"];if(!s||!s.includes("application/json"))return void t.writeHead(415).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32e3,message:"Unsupported Media Type: Content-Type must be application/json"},id:null}));const r=p.parse(s),o=await c()(e,{limit:this.bodySizeLimit,encoding:r.parameters.charset??"utf-8"});i=JSON.parse(o.toString())}const n=Array.isArray(i)?i:[i];if(!n.some(e=>e.method&&void 0!==e.id))return void t.writeHead(202).end();const a=n.filter(e=>e.method&&void 0!==e.id).map(e=>e.id);if(0===a.length)return void t.writeHead(202).end();const l=[],u=a.length,h=(0,d.randomUUID)();this._singleResponseCollectors=this._singleResponseCollectors||new Map,this._singleResponseCollectors.set(h,{res:t,requestIds:new Set(a),responses:l,expectedCount:u});for(const e of a)this._requestToCollectorMapping=this._requestToCollectorMapping||new Map,this._requestToCollectorMapping.set(e,h);for(const e of n)this.onmessage&&this.onmessage(e)}catch(e){t.writeHead(400).end(JSON.stringify({jsonrpc:"2.0",error:{code:-32700,message:"Parse error",data:String(e)},id:null}))}}constructor(e,t){super(),m(this,"debug",void 0),m(this,"bodySizeLimit",void 0),m(this,"_started",!1),m(this,"_singleResponseCollectors",new Map),m(this,"_requestToCollectorMapping",new Map),this.debug=e,this.bodySizeLimit=t}}class S{log(e,...t){this.debug&&console.log(`[StatelessHTTP] ${e}`,...t)}setupMiddleware(e){this.app.use((e,t,s)=>{const r=this.corsOptions;void 0!==r.origin&&t.setHeader("Access-Control-Allow-Origin",Array.isArray(r.origin)?r.origin.join(","):String(r.origin)),void 0!==r.methods&&t.setHeader("Access-Control-Allow-Methods",Array.isArray(r.methods)?r.methods.join(","):String(r.methods)),void 0!==r.allowedHeaders&&t.setHeader("Access-Control-Allow-Headers",Array.isArray(r.allowedHeaders)?r.allowedHeaders.join(","):String(r.allowedHeaders)),void 0!==r.exposedHeaders&&t.setHeader("Access-Control-Expose-Headers",Array.isArray(r.exposedHeaders)?r.exposedHeaders.join(","):String(r.exposedHeaders)),"boolean"==typeof r.credentials&&t.setHeader("Access-Control-Allow-Credentials",String(r.credentials)),"number"==typeof r.maxAge&&t.setHeader("Access-Control-Max-Age",String(r.maxAge)),"OPTIONS"!==e.method?s():t.sendStatus(200)}),this.app.use(i().json({limit:e})),this.app.use((e,t,s)=>{this.log(`${e.method} ${e.path}`),s()})}setupRoutes(){this.app.get("/health",(e,t)=>{t.status(200).json({status:"ok",transport:"streamable-http",mode:"stateless"})}),this.app.get("/",(e,t)=>{t.send((e=>`\n<!DOCTYPE html>\n<html>\n <head>\n <title>xmcp_ MCP Server</title>\n <link href="https://fonts.googleapis.com/css2?family=Geist+Mono:wght@400;700&display=swap" rel="stylesheet">\n <style>\n body {\n background: #000;\n font-family: 'Geist Mono', monospace;\n color: #fff;\n margin: 0;\n padding: 0;\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n h1 {\n color: #fff;\n margin-bottom: 16px;\n font-size: 2.5rem;\n font-weight: 400;\n letter-spacing: 1px;\n }\n .endpoint-btn {\n display: inline-block;\n background: #FF4800;\n color: #fff;\n font-family: 'Geist Mono', monospace;\n font-size: 1.1rem;\n font-weight: 400;\n border: none;\n padding: 6px 12px;\n margin-top: 32px;\n text-decoration: none;\n cursor: pointer;\n }\n </style>\n </head>\n <body>\n <h1>xmcp_</h1>\n <a class="endpoint-btn" href="${e}">ENDPOINT -&gt;</a>\n </body>\n</html>\n`)(this.endpoint))}),this.app.use((e,t,s)=>{const r=crypto.randomUUID();f({id:r,headers:e.headers},()=>{s()})}),this.middleware&&this.app.use(this.middleware),this.app.use(this.endpoint,async(e,t)=>{await this.handleStatelessRequest(e,t)})}async handleStatelessRequest(e,t){try{const s=await this.createServerFn(),r=new v(this.debug,this.options.bodySizeLimit||"10mb");t.on("close",()=>{r.close(),s.close()}),await s.connect(r),await r.handleRequest(e,t,e.body)}catch(e){console.error("[HTTP-server] Error handling MCP request:",e),t.headersSent||t.status(500).json({jsonrpc:"2.0",error:{code:-32603,message:"Internal server error"},id:null})}}start(){const e=this.options.bindToLocalhost?"127.0.0.1":"0.0.0.0";this.server.listen(this.port,e,()=>{console.log(`${y} MCP Server running on http://${e}:${this.port}${this.endpoint}`),this.setupShutdownHandlers()})}setupShutdownHandlers(){process.on("SIGINT",this.shutdown.bind(this)),process.on("SIGTERM",this.shutdown.bind(this))}shutdown(){this.log("Shutting down server"),this.server.close(),process.exit(0)}constructor(e,t={},s={},r){m(this,"app",void 0),m(this,"server",void 0),m(this,"port",void 0),m(this,"endpoint",void 0),m(this,"debug",void 0),m(this,"options",void 0),m(this,"createServerFn",void 0),m(this,"corsOptions",void 0),m(this,"middleware",void 0),this.options={bindToLocalhost:!0,...t},this.app=i()(),this.server=a().createServer(this.app),this.port=t.port??parseInt(process.env.PORT||"3001",10),this.endpoint=t.endpoint??"/mcp",this.debug=t.debug??!1,this.createServerFn=e,this.corsOptions=s,this.middleware=r,this.setupMiddleware(t.bodySizeLimit||"10mb"),this.setupRoutes()}}const b=HTTP_PORT,T=HTTP_DEBUG,w=HTTP_BODY_SIZE_LIMIT,x=HTTP_ENDPOINT,O=HTTP_STATELESS,_=INJECTED_MIDDLEWARE,H=HTTP_CORS_ORIGIN,C=HTTP_CORS_METHODS,q=HTTP_CORS_ALLOWED_HEADERS,P=HTTP_CORS_EXPOSED_HEADERS,A=HTTP_CORS_CREDENTIALS,M=HTTP_CORS_MAX_AGE;!async function(){const e={port:b,debug:T,bodySizeLimit:w,endpoint:x,stateless:O},t={origin:H,methods:C,allowedHeaders:q,exposedHeaders:P,credentials:A,maxAge:M};let s;if(_){const e=await _();if(!e||!e.default||"function"!=typeof e.default)throw new Error("Middleware module does not export a default RequestHandler");s=e.default}new S(r.s,e,t,s).start()}()},9896:e=>{"use strict";e.exports=require("fs")}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var s=o[e]={id:e,loaded:!1,exports:{}};return r[e].call(s.exports,s,s.exports,i),s.loaded=!0,s.exports}return i.m=r,i.x=()=>{var e=i.O(void 0,[169,382,450],()=>i(9780));return i.O(e)},e=[],i.O=(t,s,r,o)=>{if(!s){var n=1/0;for(c=0;c<e.length;c++){for(var[s,r,o]=e[c],a=!0,d=0;d<s.length;d++)(!1&o||n>=o)&&Object.keys(i.O).every(e=>i.O[e](s[d]))?s.splice(d--,1):(a=!1,o<n&&(n=o));if(a){e.splice(c--,1);var l=r();void 0!==l&&(t=l)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[s,r,o]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce((t,s)=>(i.f[s](e,t),t),[])),i.u=e=>e+".js",i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),s={295:1},i.O.require=e=>s[e],i.f.require=(e,t)=>{s[e]||(e=>{var t=e.modules,r=e.ids,o=e.runtime;for(var n in t)i.o(t,n)&&(i.m[n]=t[n]);o&&o(i);for(var a=0;a<r.length;a++)s[r[a]]=1;i.O()})(require("./"+i.u(e)))},t=i.x,i.x=()=>(i.e(169),i.e(382),i.e(450),t()),i.x()})());
@@ -1 +1 @@
1
- !function(r,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e=t();for(var s in e)("object"==typeof exports?exports:r)[s]=e[s]}}(this,(()=>(()=>{"use strict";var r,t,e,s={6674:(r,t,e)=>{const s=require("node:process");var o=e(9636);class n{append(r){this._buffer=this._buffer?Buffer.concat([this._buffer,r]):r}readMessage(){if(!this._buffer)return null;const r=this._buffer.indexOf("\n");if(-1===r)return null;const t=this._buffer.toString("utf8",0,r).replace(/\r$/,"");return this._buffer=this._buffer.subarray(r+1),function(r){return o.OR.parse(JSON.parse(r))}(t)}clear(){this._buffer=void 0}}class i{constructor(r=s.stdin,t=s.stdout){this._stdin=r,this._stdout=t,this._readBuffer=new n,this._started=!1,this._ondata=r=>{this._readBuffer.append(r),this.processReadBuffer()},this._onerror=r=>{var t;null===(t=this.onerror)||void 0===t||t.call(this,r)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var r,t;;)try{const t=this._readBuffer.readMessage();if(null===t)break;null===(r=this.onmessage)||void 0===r||r.call(this,t)}catch(r){null===(t=this.onerror)||void 0===t||t.call(this,r)}}async close(){var r;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),null===(r=this.onclose)||void 0===r||r.call(this)}send(r){return new Promise((t=>{const e=function(r){return JSON.stringify(r)+"\n"}(r);this._stdout.write(e)?t():this._stdout.once("drain",t)}))}}var a=e(3299);function d(r,t,e){return t in r?Object.defineProperty(r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}):r[t]=e,r}class u{start(){try{this.mcpServer.connect(this.transport),console.log("[STDIO] MCP Server running with STDIO transport"),this.setupShutdownHandlers()}catch(r){console.error("[STDIO] Error starting STDIO transport:",r),process.exit(1)}}setupShutdownHandlers(){process.on("SIGINT",this.shutdown.bind(this)),process.on("SIGTERM",this.shutdown.bind(this))}shutdown(){console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)}constructor(r){d(this,"mcpServer",void 0),d(this,"transport",void 0),this.mcpServer=r,this.transport=new i}}(0,a.s)().then((r=>{new u(r).start()}))}},o={};function n(r){var t=o[r];if(void 0!==t)return t.exports;var e=o[r]={id:r,loaded:!1,exports:{}};return s[r].call(e.exports,e,e.exports,n),e.loaded=!0,e.exports}return n.m=s,n.x=()=>{var r=n.O(void 0,[804],(()=>n(6674)));return n.O(r)},r=[],n.O=(t,e,s,o)=>{if(!e){var i=1/0;for(f=0;f<r.length;f++){for(var[e,s,o]=r[f],a=!0,d=0;d<e.length;d++)(!1&o||i>=o)&&Object.keys(n.O).every((r=>n.O[r](e[d])))?e.splice(d--,1):(a=!1,o<i&&(i=o));if(a){r.splice(f--,1);var u=s();void 0!==u&&(t=u)}}return t}o=o||0;for(var f=r.length;f>0&&r[f-1][2]>o;f--)r[f]=r[f-1];r[f]=[e,s,o]},n.d=(r,t)=>{for(var e in t)n.o(t,e)&&!n.o(r,e)&&Object.defineProperty(r,e,{enumerable:!0,get:t[e]})},n.f={},n.e=r=>Promise.all(Object.keys(n.f).reduce(((t,e)=>(n.f[e](r,t),t)),[])),n.u=r=>"shared.js",n.o=(r,t)=>Object.prototype.hasOwnProperty.call(r,t),n.nmd=r=>(r.paths=[],r.children||(r.children=[]),r),n.j=966,e={966:1},n.O.require=r=>e[r],n.f.require=(r,t)=>{e[r]||(r=>{var t=r.modules,s=r.ids,o=r.runtime;for(var i in t)n.o(t,i)&&(n.m[i]=t[i]);o&&o(n);for(var a=0;a<s.length;a++)e[s[a]]=1;n.O()})(require("./"+n.u(r)))},t=n.x,n.x=()=>(n.e(804),t()),n.x()})()));
1
+ !function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var o=e();for(var r in o)("object"==typeof exports?exports:t)[r]=o[r]}}(this,()=>(()=>{"use strict";var t,e,o,r={3564:(t,e,o)=>{const r=require("node:process");var n=o(6848);class s{append(t){this._buffer=this._buffer?Buffer.concat([this._buffer,t]):t}readMessage(){if(!this._buffer)return null;const t=this._buffer.indexOf("\n");if(-1===t)return null;const e=this._buffer.toString("utf8",0,t).replace(/\r$/,"");return this._buffer=this._buffer.subarray(t+1),function(t){return n.OR.parse(JSON.parse(t))}(e)}clear(){this._buffer=void 0}}class i{constructor(t=r.stdin,e=r.stdout){this._stdin=t,this._stdout=e,this._readBuffer=new s,this._started=!1,this._ondata=t=>{this._readBuffer.append(t),this.processReadBuffer()},this._onerror=t=>{var e;null===(e=this.onerror)||void 0===e||e.call(this,t)}}async start(){if(this._started)throw new Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){for(var t,e;;)try{const e=this._readBuffer.readMessage();if(null===e)break;null===(t=this.onmessage)||void 0===t||t.call(this,e)}catch(t){null===(e=this.onerror)||void 0===e||e.call(this,t)}}async close(){var t;this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),0===this._stdin.listenerCount("data")&&this._stdin.pause(),this._readBuffer.clear(),null===(t=this.onclose)||void 0===t||t.call(this)}send(t){return new Promise(e=>{const o=function(t){return JSON.stringify(t)+"\n"}(t);this._stdout.write(o)?e():this._stdout.once("drain",e)})}}var a=o(6169);function l(t,e,o){return e in t?Object.defineProperty(t,e,{value:o,enumerable:!0,configurable:!0,writable:!0}):t[e]=o,t}class z{start(){try{this.mcpServer.connect(this.transport),console.log("[STDIO] MCP Server running with STDIO transport"),this.setupShutdownHandlers()}catch(t){console.error("[STDIO] Error starting STDIO transport:",t),process.exit(1)}}setupShutdownHandlers(){process.on("SIGINT",this.shutdown.bind(this)),process.on("SIGTERM",this.shutdown.bind(this))}shutdown(){console.log("[STDIO] Shutting down STDIO transport"),process.exit(0)}constructor(t){l(this,"mcpServer",void 0),l(this,"transport",void 0),this.mcpServer=t,this.transport=new i}}(0,a.s)().then(t=>{new z(t).start()})},6848:(t,e,o)=>{o.d(e,{$p:()=>st,Cs:()=>Lt,FT:()=>jt,Iu:()=>s,K1:()=>It,Nh:()=>Jt,O4:()=>v,OI:()=>J,OR:()=>O,Qq:()=>rt,R6:()=>U,Sq:()=>w,ZC:()=>M,_r:()=>N,aE:()=>n,gW:()=>bt,iK:()=>Ht,lg:()=>x,n_:()=>Bt,o$:()=>S,rk:()=>C,s:()=>V,tC:()=>E,tG:()=>y,vo:()=>b,wR:()=>T});var r=o(2540);const n="2025-06-18",s=[n,"2025-03-26","2024-11-05","2024-10-07"],i="2.0",a=r.z.union([r.z.string(),r.z.number().int()]),l=r.z.string(),z=r.z.object({progressToken:r.z.optional(a)}).passthrough(),p=r.z.object({_meta:r.z.optional(z)}).passthrough(),u=r.z.object({method:r.z.string(),params:r.z.optional(p)}),c=r.z.object({_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),d=r.z.object({method:r.z.string(),params:r.z.optional(c)}),h=r.z.object({_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),g=r.z.union([r.z.string(),r.z.number().int()]),m=r.z.object({jsonrpc:r.z.literal(i),id:g}).merge(u).strict(),b=t=>m.safeParse(t).success,f=r.z.object({jsonrpc:r.z.literal(i)}).merge(d).strict(),x=t=>f.safeParse(t).success,j=r.z.object({jsonrpc:r.z.literal(i),id:g,result:h}).strict(),y=t=>j.safeParse(t).success;var v;!function(t){t[t.ConnectionClosed=-32e3]="ConnectionClosed",t[t.RequestTimeout=-32001]="RequestTimeout",t[t.ParseError=-32700]="ParseError",t[t.InvalidRequest=-32600]="InvalidRequest",t[t.MethodNotFound=-32601]="MethodNotFound",t[t.InvalidParams=-32602]="InvalidParams",t[t.InternalError=-32603]="InternalError"}(v||(v={}));const _=r.z.object({jsonrpc:r.z.literal(i),id:g,error:r.z.object({code:r.z.number().int(),message:r.z.string(),data:r.z.optional(r.z.unknown())})}).strict(),S=t=>_.safeParse(t).success,O=r.z.union([m,f,j,_]),T=h.strict(),w=d.extend({method:r.z.literal("notifications/cancelled"),params:c.extend({requestId:g,reason:r.z.string().optional()})}),P=r.z.object({name:r.z.string(),title:r.z.optional(r.z.string())}).passthrough(),I=P.extend({version:r.z.string()}),q=r.z.object({experimental:r.z.optional(r.z.object({}).passthrough()),sampling:r.z.optional(r.z.object({}).passthrough()),elicitation:r.z.optional(r.z.object({}).passthrough()),roots:r.z.optional(r.z.object({listChanged:r.z.optional(r.z.boolean())}).passthrough())}).passthrough(),C=u.extend({method:r.z.literal("initialize"),params:p.extend({protocolVersion:r.z.string(),capabilities:q,clientInfo:I})}),k=r.z.object({experimental:r.z.optional(r.z.object({}).passthrough()),logging:r.z.optional(r.z.object({}).passthrough()),completions:r.z.optional(r.z.object({}).passthrough()),prompts:r.z.optional(r.z.object({listChanged:r.z.optional(r.z.boolean())}).passthrough()),resources:r.z.optional(r.z.object({subscribe:r.z.optional(r.z.boolean()),listChanged:r.z.optional(r.z.boolean())}).passthrough()),tools:r.z.optional(r.z.object({listChanged:r.z.optional(r.z.boolean())}).passthrough())}).passthrough(),R=h.extend({protocolVersion:r.z.string(),capabilities:k,serverInfo:I,instructions:r.z.optional(r.z.string())}),M=d.extend({method:r.z.literal("notifications/initialized")}),E=u.extend({method:r.z.literal("ping")}),B=r.z.object({progress:r.z.number(),total:r.z.optional(r.z.number()),message:r.z.optional(r.z.string())}).passthrough(),N=d.extend({method:r.z.literal("notifications/progress"),params:c.merge(B).extend({progressToken:a})}),D=u.extend({params:p.extend({cursor:r.z.optional(l)}).optional()}),H=h.extend({nextCursor:r.z.optional(l)}),$=r.z.object({uri:r.z.string(),mimeType:r.z.optional(r.z.string()),_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),F=$.extend({text:r.z.string()}),G=$.extend({blob:r.z.string().base64()}),L=P.extend({uri:r.z.string(),description:r.z.optional(r.z.string()),mimeType:r.z.optional(r.z.string()),_meta:r.z.optional(r.z.object({}).passthrough())}),W=P.extend({uriTemplate:r.z.string(),description:r.z.optional(r.z.string()),mimeType:r.z.optional(r.z.string()),_meta:r.z.optional(r.z.object({}).passthrough())}),J=D.extend({method:r.z.literal("resources/list")}),K=H.extend({resources:r.z.array(L)}),V=D.extend({method:r.z.literal("resources/templates/list")}),Q=H.extend({resourceTemplates:r.z.array(W)}),U=u.extend({method:r.z.literal("resources/read"),params:p.extend({uri:r.z.string()})}),Z=h.extend({contents:r.z.array(r.z.union([F,G]))}),A=d.extend({method:r.z.literal("notifications/resources/list_changed")}),X=u.extend({method:r.z.literal("resources/subscribe"),params:p.extend({uri:r.z.string()})}),Y=u.extend({method:r.z.literal("resources/unsubscribe"),params:p.extend({uri:r.z.string()})}),tt=d.extend({method:r.z.literal("notifications/resources/updated"),params:c.extend({uri:r.z.string()})}),et=r.z.object({name:r.z.string(),description:r.z.optional(r.z.string()),required:r.z.optional(r.z.boolean())}).passthrough(),ot=P.extend({description:r.z.optional(r.z.string()),arguments:r.z.optional(r.z.array(et)),_meta:r.z.optional(r.z.object({}).passthrough())}),rt=D.extend({method:r.z.literal("prompts/list")}),nt=H.extend({prompts:r.z.array(ot)}),st=u.extend({method:r.z.literal("prompts/get"),params:p.extend({name:r.z.string(),arguments:r.z.optional(r.z.record(r.z.string()))})}),it=r.z.object({type:r.z.literal("text"),text:r.z.string(),_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),at=r.z.object({type:r.z.literal("image"),data:r.z.string().base64(),mimeType:r.z.string(),_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),lt=r.z.object({type:r.z.literal("audio"),data:r.z.string().base64(),mimeType:r.z.string(),_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),zt=r.z.object({type:r.z.literal("resource"),resource:r.z.union([F,G]),_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),pt=L.extend({type:r.z.literal("resource_link")}),ut=r.z.union([it,at,lt,pt,zt]),ct=r.z.object({role:r.z.enum(["user","assistant"]),content:ut}).passthrough(),dt=h.extend({description:r.z.optional(r.z.string()),messages:r.z.array(ct)}),ht=d.extend({method:r.z.literal("notifications/prompts/list_changed")}),gt=r.z.object({title:r.z.optional(r.z.string()),readOnlyHint:r.z.optional(r.z.boolean()),destructiveHint:r.z.optional(r.z.boolean()),idempotentHint:r.z.optional(r.z.boolean()),openWorldHint:r.z.optional(r.z.boolean())}).passthrough(),mt=P.extend({description:r.z.optional(r.z.string()),inputSchema:r.z.object({type:r.z.literal("object"),properties:r.z.optional(r.z.object({}).passthrough()),required:r.z.optional(r.z.array(r.z.string()))}).passthrough(),outputSchema:r.z.optional(r.z.object({type:r.z.literal("object"),properties:r.z.optional(r.z.object({}).passthrough()),required:r.z.optional(r.z.array(r.z.string()))}).passthrough()),annotations:r.z.optional(gt),_meta:r.z.optional(r.z.object({}).passthrough())}),bt=D.extend({method:r.z.literal("tools/list")}),ft=H.extend({tools:r.z.array(mt)}),xt=h.extend({content:r.z.array(ut).default([]),structuredContent:r.z.object({}).passthrough().optional(),isError:r.z.optional(r.z.boolean())}),jt=(xt.or(h.extend({toolResult:r.z.unknown()})),u.extend({method:r.z.literal("tools/call"),params:p.extend({name:r.z.string(),arguments:r.z.optional(r.z.record(r.z.unknown()))})})),yt=d.extend({method:r.z.literal("notifications/tools/list_changed")}),vt=r.z.enum(["debug","info","notice","warning","error","critical","alert","emergency"]),_t=u.extend({method:r.z.literal("logging/setLevel"),params:p.extend({level:vt})}),St=d.extend({method:r.z.literal("notifications/message"),params:c.extend({level:vt,logger:r.z.optional(r.z.string()),data:r.z.unknown()})}),Ot=r.z.object({name:r.z.string().optional()}).passthrough(),Tt=r.z.object({hints:r.z.optional(r.z.array(Ot)),costPriority:r.z.optional(r.z.number().min(0).max(1)),speedPriority:r.z.optional(r.z.number().min(0).max(1)),intelligencePriority:r.z.optional(r.z.number().min(0).max(1))}).passthrough(),wt=r.z.object({role:r.z.enum(["user","assistant"]),content:r.z.union([it,at,lt])}).passthrough(),Pt=u.extend({method:r.z.literal("sampling/createMessage"),params:p.extend({messages:r.z.array(wt),systemPrompt:r.z.optional(r.z.string()),includeContext:r.z.optional(r.z.enum(["none","thisServer","allServers"])),temperature:r.z.optional(r.z.number()),maxTokens:r.z.number().int(),stopSequences:r.z.optional(r.z.array(r.z.string())),metadata:r.z.optional(r.z.object({}).passthrough()),modelPreferences:r.z.optional(Tt)})}),It=h.extend({model:r.z.string(),stopReason:r.z.optional(r.z.enum(["endTurn","stopSequence","maxTokens"]).or(r.z.string())),role:r.z.enum(["user","assistant"]),content:r.z.discriminatedUnion("type",[it,at,lt])}),qt=r.z.object({type:r.z.literal("boolean"),title:r.z.optional(r.z.string()),description:r.z.optional(r.z.string()),default:r.z.optional(r.z.boolean())}).passthrough(),Ct=r.z.object({type:r.z.literal("string"),title:r.z.optional(r.z.string()),description:r.z.optional(r.z.string()),minLength:r.z.optional(r.z.number()),maxLength:r.z.optional(r.z.number()),format:r.z.optional(r.z.enum(["email","uri","date","date-time"]))}).passthrough(),kt=r.z.object({type:r.z.enum(["number","integer"]),title:r.z.optional(r.z.string()),description:r.z.optional(r.z.string()),minimum:r.z.optional(r.z.number()),maximum:r.z.optional(r.z.number())}).passthrough(),Rt=r.z.object({type:r.z.literal("string"),title:r.z.optional(r.z.string()),description:r.z.optional(r.z.string()),enum:r.z.array(r.z.string()),enumNames:r.z.optional(r.z.array(r.z.string()))}).passthrough(),Mt=r.z.union([qt,Ct,kt,Rt]),Et=u.extend({method:r.z.literal("elicitation/create"),params:p.extend({message:r.z.string(),requestedSchema:r.z.object({type:r.z.literal("object"),properties:r.z.record(r.z.string(),Mt),required:r.z.optional(r.z.array(r.z.string()))}).passthrough()})}),Bt=h.extend({action:r.z.enum(["accept","reject","cancel"]),content:r.z.optional(r.z.record(r.z.string(),r.z.unknown()))}),Nt=r.z.object({type:r.z.literal("ref/resource"),uri:r.z.string()}).passthrough(),Dt=r.z.object({type:r.z.literal("ref/prompt"),name:r.z.string()}).passthrough(),Ht=u.extend({method:r.z.literal("completion/complete"),params:p.extend({ref:r.z.union([Dt,Nt]),argument:r.z.object({name:r.z.string(),value:r.z.string()}).passthrough(),context:r.z.optional(r.z.object({arguments:r.z.optional(r.z.record(r.z.string(),r.z.string()))}))})}),$t=h.extend({completion:r.z.object({values:r.z.array(r.z.string()).max(100),total:r.z.optional(r.z.number().int()),hasMore:r.z.optional(r.z.boolean())}).passthrough()}),Ft=r.z.object({uri:r.z.string().startsWith("file://"),name:r.z.optional(r.z.string()),_meta:r.z.optional(r.z.object({}).passthrough())}).passthrough(),Gt=u.extend({method:r.z.literal("roots/list")}),Lt=h.extend({roots:r.z.array(Ft)}),Wt=d.extend({method:r.z.literal("notifications/roots/list_changed")});r.z.union([E,C,Ht,_t,st,rt,J,V,U,X,Y,jt,bt]),r.z.union([w,N,M,Wt]),r.z.union([T,It,Bt,Lt]),r.z.union([E,Pt,Et,Gt]),r.z.union([w,N,St,tt,A,yt,ht]),r.z.union([T,R,$t,dt,nt,K,Q,Z,xt,ft]);class Jt extends Error{constructor(t,e,o){super(`MCP error ${t}: ${e}`),this.code=t,this.data=o,this.name="McpError"}}}},n={};function s(t){var e=n[t];if(void 0!==e)return e.exports;var o=n[t]={exports:{}};return r[t].call(o.exports,o,o.exports,s),o.exports}return s.m=r,s.x=()=>{var t=s.O(void 0,[169],()=>s(3564));return s.O(t)},t=[],s.O=(e,o,r,n)=>{if(!o){var i=1/0;for(p=0;p<t.length;p++){for(var[o,r,n]=t[p],a=!0,l=0;l<o.length;l++)(!1&n||i>=n)&&Object.keys(s.O).every(t=>s.O[t](o[l]))?o.splice(l--,1):(a=!1,n<i&&(i=n));if(a){t.splice(p--,1);var z=r();void 0!==z&&(e=z)}}return e}n=n||0;for(var p=t.length;p>0&&t[p-1][2]>n;p--)t[p]=t[p-1];t[p]=[o,r,n]},s.d=(t,e)=>{for(var o in e)s.o(e,o)&&!s.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},s.f={},s.e=t=>Promise.all(Object.keys(s.f).reduce((e,o)=>(s.f[o](t,e),e),[])),s.u=t=>t+".js",s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),s.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o={966:1},s.O.require=t=>o[t],s.f.require=(t,e)=>{o[t]||(t=>{var e=t.modules,r=t.ids,n=t.runtime;for(var i in e)s.o(e,i)&&(s.m[i]=e[i]);n&&n(s);for(var a=0;a<r.length;a++)o[r[a]]=1;s.O()})(require("./"+s.u(t)))},e=s.x,s.x=()=>(s.e(169),e()),s.x()})());
@@ -0,0 +1,9 @@
1
+ import { IncomingHttpHeaders } from "http";
2
+ export interface HttpContext {
3
+ id: string;
4
+ headers: IncomingHttpHeaders;
5
+ }
6
+ export declare const httpContext: import("../../../utils/context").Context<HttpContext>;
7
+ export declare const setHttpContext: (data: Partial<HttpContext>) => void;
8
+ export declare const getHttpContext: () => HttpContext;
9
+ export declare const httpContextProvider: (initialValue: HttpContext, callback: () => void) => void;
@@ -0,0 +1,30 @@
1
+ type DefaultContext = Object;
2
+ type GetContext<T extends DefaultContext> = () => T;
3
+ type SetContext<T extends DefaultContext> = (data: Partial<T>) => void;
4
+ export interface Context<T extends DefaultContext> {
5
+ provider: (initialValue: T, callback: () => void) => void;
6
+ getContext: GetContext<T>;
7
+ setContext: SetContext<T>;
8
+ }
9
+ interface CreateContextOptions {
10
+ name: string;
11
+ }
12
+ /**
13
+ * Create context allows you to create scoped variables for fucntions.
14
+ * Similar to React's context API.
15
+ * Usage:
16
+ * ```ts
17
+ * interface MyContext {
18
+ * value: string;
19
+ * }
20
+ *
21
+ * const context = createContext({ name: "my-context" });
22
+ *
23
+ * context.provider({
24
+ * value: "hello",
25
+ * }, () => {
26
+ * // Do something with the context
27
+ * })```
28
+ */
29
+ export declare function createContext<T extends Object>({ name, }: CreateContextOptions): Context<T>;
30
+ export {};
@@ -1,4 +1,3 @@
1
1
  import { Configuration } from "webpack";
2
- import { type CompilerMode } from "../compile";
3
- import { XmcpConfig } from "./parse-config";
4
- export declare function getWebpackConfig(mode: CompilerMode, xmcpConfig: XmcpConfig): Configuration;
2
+ import { XmcpParsedConfig } from "./parse-config";
3
+ export declare function getWebpackConfig(xmcpConfig: XmcpParsedConfig): Configuration;
@@ -1,66 +1,16 @@
1
1
  import { z } from "zod";
2
- export declare const DEFAULT_SSE_PORT = 3001;
3
- export declare const DEFAULT_SSE_BODY_SIZE_LIMIT: number;
4
- export declare const DEFAULT_STREAMABLE_HTTP_PORT = 3002;
5
- export declare const DEFAULT_STREAMABLE_HTTP_BODY_SIZE_LIMIT: number;
6
- export declare const DEFAULT_STREAMABLE_HTTP_ENDPOINT = "/mcp";
7
- export declare const DEFAULT_STREAMABLE_HTTP_STATELESS = true;
2
+ import { type Configuration } from "webpack";
3
+ export declare const DEFAULT_HTTP_PORT = 3002;
4
+ export declare const DEFAULT_HTTP_BODY_SIZE_LIMIT: number;
5
+ export declare const DEFAULT_HTTP_ENDPOINT = "/mcp";
6
+ export declare const DEFAULT_HTTP_STATELESS = true;
8
7
  declare const configSchema: z.ZodObject<{
9
- sse: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
10
- port: z.ZodDefault<z.ZodNumber>;
11
- bodySizeLimit: z.ZodDefault<z.ZodNumber>;
12
- cors: z.ZodOptional<z.ZodObject<{
13
- origin: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodBoolean]>>;
14
- methods: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
15
- allowedHeaders: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
16
- exposedHeaders: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
17
- credentials: z.ZodOptional<z.ZodBoolean>;
18
- maxAge: z.ZodOptional<z.ZodNumber>;
19
- }, "strip", z.ZodTypeAny, {
20
- maxAge?: number | undefined;
21
- origin?: string | boolean | string[] | undefined;
22
- methods?: string | string[] | undefined;
23
- allowedHeaders?: string | string[] | undefined;
24
- exposedHeaders?: string | string[] | undefined;
25
- credentials?: boolean | undefined;
26
- }, {
27
- maxAge?: number | undefined;
28
- origin?: string | boolean | string[] | undefined;
29
- methods?: string | string[] | undefined;
30
- allowedHeaders?: string | string[] | undefined;
31
- exposedHeaders?: string | string[] | undefined;
32
- credentials?: boolean | undefined;
33
- }>>;
34
- }, "strip", z.ZodTypeAny, {
35
- port: number;
36
- bodySizeLimit: number;
37
- cors?: {
38
- maxAge?: number | undefined;
39
- origin?: string | boolean | string[] | undefined;
40
- methods?: string | string[] | undefined;
41
- allowedHeaders?: string | string[] | undefined;
42
- exposedHeaders?: string | string[] | undefined;
43
- credentials?: boolean | undefined;
44
- } | undefined;
45
- }, {
46
- port?: number | undefined;
47
- bodySizeLimit?: number | undefined;
48
- cors?: {
49
- maxAge?: number | undefined;
50
- origin?: string | boolean | string[] | undefined;
51
- methods?: string | string[] | undefined;
52
- allowedHeaders?: string | string[] | undefined;
53
- exposedHeaders?: string | string[] | undefined;
54
- credentials?: boolean | undefined;
55
- } | undefined;
56
- }>]>>;
57
8
  stdio: z.ZodOptional<z.ZodBoolean>;
58
- "streamable-http": z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
9
+ http: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
59
10
  port: z.ZodDefault<z.ZodNumber>;
60
11
  bodySizeLimit: z.ZodDefault<z.ZodNumber>;
61
12
  debug: z.ZodDefault<z.ZodBoolean>;
62
13
  endpoint: z.ZodDefault<z.ZodString>;
63
- stateless: z.ZodDefault<z.ZodBoolean>;
64
14
  cors: z.ZodOptional<z.ZodObject<{
65
15
  origin: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">, z.ZodBoolean]>>;
66
16
  methods: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>;
@@ -69,111 +19,99 @@ declare const configSchema: z.ZodObject<{
69
19
  credentials: z.ZodOptional<z.ZodBoolean>;
70
20
  maxAge: z.ZodOptional<z.ZodNumber>;
71
21
  }, "strip", z.ZodTypeAny, {
72
- maxAge?: number | undefined;
73
22
  origin?: string | boolean | string[] | undefined;
74
23
  methods?: string | string[] | undefined;
75
24
  allowedHeaders?: string | string[] | undefined;
76
25
  exposedHeaders?: string | string[] | undefined;
77
26
  credentials?: boolean | undefined;
78
- }, {
79
27
  maxAge?: number | undefined;
28
+ }, {
80
29
  origin?: string | boolean | string[] | undefined;
81
30
  methods?: string | string[] | undefined;
82
31
  allowedHeaders?: string | string[] | undefined;
83
32
  exposedHeaders?: string | string[] | undefined;
84
33
  credentials?: boolean | undefined;
34
+ maxAge?: number | undefined;
85
35
  }>>;
86
36
  }, "strip", z.ZodTypeAny, {
87
37
  port: number;
88
38
  bodySizeLimit: number;
89
39
  debug: boolean;
90
40
  endpoint: string;
91
- stateless: boolean;
92
41
  cors?: {
93
- maxAge?: number | undefined;
94
42
  origin?: string | boolean | string[] | undefined;
95
43
  methods?: string | string[] | undefined;
96
44
  allowedHeaders?: string | string[] | undefined;
97
45
  exposedHeaders?: string | string[] | undefined;
98
46
  credentials?: boolean | undefined;
47
+ maxAge?: number | undefined;
99
48
  } | undefined;
100
49
  }, {
101
50
  port?: number | undefined;
102
51
  bodySizeLimit?: number | undefined;
52
+ debug?: boolean | undefined;
53
+ endpoint?: string | undefined;
103
54
  cors?: {
104
- maxAge?: number | undefined;
105
55
  origin?: string | boolean | string[] | undefined;
106
56
  methods?: string | string[] | undefined;
107
57
  allowedHeaders?: string | string[] | undefined;
108
58
  exposedHeaders?: string | string[] | undefined;
109
59
  credentials?: boolean | undefined;
60
+ maxAge?: number | undefined;
110
61
  } | undefined;
111
- debug?: boolean | undefined;
112
- endpoint?: string | undefined;
113
- stateless?: boolean | undefined;
114
62
  }>]>>;
115
63
  webpack: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodAny], z.ZodUnknown>, z.ZodAny>>;
116
64
  }, "strip", z.ZodTypeAny, {
117
- sse?: boolean | {
118
- port: number;
119
- bodySizeLimit: number;
120
- cors?: {
121
- maxAge?: number | undefined;
122
- origin?: string | boolean | string[] | undefined;
123
- methods?: string | string[] | undefined;
124
- allowedHeaders?: string | string[] | undefined;
125
- exposedHeaders?: string | string[] | undefined;
126
- credentials?: boolean | undefined;
127
- } | undefined;
128
- } | undefined;
129
65
  stdio?: boolean | undefined;
130
- "streamable-http"?: boolean | {
66
+ http?: boolean | {
131
67
  port: number;
132
68
  bodySizeLimit: number;
133
69
  debug: boolean;
134
70
  endpoint: string;
135
- stateless: boolean;
136
71
  cors?: {
137
- maxAge?: number | undefined;
138
72
  origin?: string | boolean | string[] | undefined;
139
73
  methods?: string | string[] | undefined;
140
74
  allowedHeaders?: string | string[] | undefined;
141
75
  exposedHeaders?: string | string[] | undefined;
142
76
  credentials?: boolean | undefined;
77
+ maxAge?: number | undefined;
143
78
  } | undefined;
144
79
  } | undefined;
145
80
  webpack?: ((args_0: any, ...args: unknown[]) => any) | undefined;
146
81
  }, {
147
- sse?: boolean | {
148
- port?: number | undefined;
149
- bodySizeLimit?: number | undefined;
150
- cors?: {
151
- maxAge?: number | undefined;
152
- origin?: string | boolean | string[] | undefined;
153
- methods?: string | string[] | undefined;
154
- allowedHeaders?: string | string[] | undefined;
155
- exposedHeaders?: string | string[] | undefined;
156
- credentials?: boolean | undefined;
157
- } | undefined;
158
- } | undefined;
159
82
  stdio?: boolean | undefined;
160
- "streamable-http"?: boolean | {
83
+ http?: boolean | {
161
84
  port?: number | undefined;
162
85
  bodySizeLimit?: number | undefined;
86
+ debug?: boolean | undefined;
87
+ endpoint?: string | undefined;
163
88
  cors?: {
164
- maxAge?: number | undefined;
165
89
  origin?: string | boolean | string[] | undefined;
166
90
  methods?: string | string[] | undefined;
167
91
  allowedHeaders?: string | string[] | undefined;
168
92
  exposedHeaders?: string | string[] | undefined;
169
93
  credentials?: boolean | undefined;
94
+ maxAge?: number | undefined;
170
95
  } | undefined;
171
- debug?: boolean | undefined;
172
- endpoint?: string | undefined;
173
- stateless?: boolean | undefined;
174
96
  } | undefined;
175
97
  webpack?: ((args_0: any, ...args: unknown[]) => any) | undefined;
176
98
  }>;
177
- export type XmcpConfig = z.infer<typeof configSchema>;
178
- export declare function getConfig(configFilePath: string): XmcpConfig;
99
+ type InputSchema = z.input<typeof configSchema>;
100
+ type OutputSchema = z.output<typeof configSchema>;
101
+ /** Config type for the user to provide */
102
+ export type XmcpInputConfig = Omit<InputSchema, "webpack"> & {
103
+ webpack?: (config: Configuration) => Configuration;
104
+ };
105
+ /** Config with defaults applied */
106
+ export type XmcpParsedConfig = Omit<OutputSchema, "webpack"> & {
107
+ webpack?: (config: Configuration) => Configuration;
108
+ };
109
+ /**
110
+ * Parse and validate xmcp config file
111
+ */
112
+ export declare function getConfig(): Promise<XmcpParsedConfig>;
113
+ /**
114
+ * Read config from file or return default
115
+ */
116
+ export declare function readConfig(): Promise<XmcpParsedConfig>;
179
117
  export {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "xmcp",
3
3
  "description": "The MCP framework",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "author": {
6
6
  "name": "Basement Studio",
7
7
  "email": "hello@basement.studio",
@@ -59,7 +59,9 @@
59
59
  "glob": "^11.0.2",
60
60
  "handlebars": "^4.7.7",
61
61
  "jsonwebtoken": "^9.0.2",
62
+ "memfs": "^4.17.2",
62
63
  "raw-body": "^3.0.0",
64
+ "swc-loader": "^0.2.6",
63
65
  "tsx": "^4.19.4",
64
66
  "webpack": "^5.99.7",
65
67
  "webpack-node-externals": "^3.0.0",
@@ -72,7 +74,6 @@
72
74
  "@types/node": "^22",
73
75
  "copy-webpack-plugin": "^12.0.2",
74
76
  "node-loader": "^1.0.1",
75
- "swc-loader": "^0.2.6",
76
77
  "ts-loader": "^9.4.2",
77
78
  "typescript": "^5.0.4",
78
79
  "zod": "^3.22.4"
package/dist/cli.d.ts DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,2 +0,0 @@
1
- declare function buildVercelOutput(): Promise<void>;
2
- export { buildVercelOutput };