@sequenzy/mcp 0.0.14 → 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.
- package/dist/index.js +3 -3
- package/package.json +1 -1
- package/server.json +2 -2
package/dist/index.js
CHANGED
|
@@ -27,8 +27,8 @@ var L5=Object.create;var{getPrototypeOf:U5,defineProperty:HQ,getOwnPropertyNames
|
|
|
27
27
|
|
|
28
28
|
`)}U.write("payload.value = newResult;"),U.write("return payload;");let T=U.compile();return(E,v)=>T(F,E,v)},J,$=D1,z=!g6.jitless,K=z&&AQ.value,B=X.catchall,D;Q._zod.parse=(F,U)=>{D??(D=W.value);let O=F.value;if(!$(O))return F.issues.push({expected:"object",code:"invalid_type",input:O,inst:Q}),F;if(z&&K&&U?.async===!1&&U.jitless!==!0){if(!J)J=G(X.shape);if(F=J(F,U),!B)return F;return EY([],O,F,U,D,Q)}return Y(F,U)}});function l8(Q,X,Y,W){for(let J of Q)if(J.issues.length===0)return X.value=J.value,X;let G=Q.filter((J)=>!s0(J));if(G.length===1)return X.value=G[0].value,G[0];return X.issues.push({code:"invalid_union",input:X.value,inst:Y,errors:Q.map((J)=>J.issues.map(($)=>E0($,W,Z0())))}),X}var PQ=L("$ZodUnion",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.options.some((G)=>G._zod.optin==="optional")?"optional":void 0),m(Q._zod,"optout",()=>X.options.some((G)=>G._zod.optout==="optional")?"optional":void 0),m(Q._zod,"values",()=>{if(X.options.every((G)=>G._zod.values))return new Set(X.options.flatMap((G)=>Array.from(G._zod.values)));return}),m(Q._zod,"pattern",()=>{if(X.options.every((G)=>G._zod.pattern)){let G=X.options.map((J)=>J._zod.pattern);return new RegExp(`^(${G.map((J)=>p1(J.source)).join("|")})$`)}return});let Y=X.options.length===1,W=X.options[0]._zod.run;Q._zod.parse=(G,J)=>{if(Y)return W(G,J);let $=!1,z=[];for(let H of X.options){let K=H._zod.run({value:G.value,issues:[]},J);if(K instanceof Promise)z.push(K),$=!0;else{if(K.issues.length===0)return K;z.push(K)}}if(!$)return l8(z,G,Q,J);return Promise.all(z).then((H)=>{return l8(H,G,Q,J)})}}),TY=L("$ZodDiscriminatedUnion",(Q,X)=>{PQ.init(Q,X);let Y=Q._zod.parse;m(Q._zod,"propValues",()=>{let G={};for(let J of X.options){let $=J._zod.propValues;if(!$||Object.keys($).length===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf(J)}"`);for(let[z,H]of Object.entries($)){if(!G[z])G[z]=new Set;for(let K of H)G[z].add(K)}}return G});let W=N1(()=>{let G=X.options,J=new Map;for(let $ of G){let z=$._zod.propValues?.[X.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${X.options.indexOf($)}"`);for(let H of z){if(J.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);J.set(H,$)}}return J});Q._zod.parse=(G,J)=>{let $=G.value;if(!D1($))return G.issues.push({code:"invalid_type",expected:"object",input:$,inst:Q}),G;let z=W.value.get($?.[X.discriminator]);if(z)return z._zod.run(G,J);if(X.unionFallback)return Y(G,J);return G.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:X.discriminator,input:$,path:[X.discriminator],inst:Q}),G}}),SY=L("$ZodIntersection",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value,J=X.left._zod.run({value:G,issues:[]},W),$=X.right._zod.run({value:G,issues:[]},W);if(J instanceof Promise||$ instanceof Promise)return Promise.all([J,$]).then(([H,K])=>{return c8(Y,H,K)});return c8(Y,J,$)}});function wQ(Q,X){if(Q===X)return{valid:!0,data:Q};if(Q instanceof Date&&X instanceof Date&&+Q===+X)return{valid:!0,data:Q};if(a0(Q)&&a0(X)){let Y=Object.keys(X),W=Object.keys(Q).filter((J)=>Y.indexOf(J)!==-1),G={...Q,...X};for(let J of W){let $=wQ(Q[J],X[J]);if(!$.valid)return{valid:!1,mergeErrorPath:[J,...$.mergeErrorPath]};G[J]=$.data}return{valid:!0,data:G}}if(Array.isArray(Q)&&Array.isArray(X)){if(Q.length!==X.length)return{valid:!1,mergeErrorPath:[]};let Y=[];for(let W=0;W<Q.length;W++){let G=Q[W],J=X[W],$=wQ(G,J);if(!$.valid)return{valid:!1,mergeErrorPath:[W,...$.mergeErrorPath]};Y.push($.data)}return{valid:!0,data:Y}}return{valid:!1,mergeErrorPath:[]}}function c8(Q,X,Y){if(X.issues.length)Q.issues.push(...X.issues);if(Y.issues.length)Q.issues.push(...Y.issues);if(s0(Q))return Q;let W=wQ(X.value,Y.value);if(!W.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(W.mergeErrorPath)}`);return Q.value=W.data,Q}var RY=L("$ZodRecord",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{let G=Y.value;if(!a0(G))return Y.issues.push({expected:"record",code:"invalid_type",input:G,inst:Q}),Y;let J=[];if(X.keyType._zod.values){let $=X.keyType._zod.values;Y.value={};for(let H of $)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){let K=X.valueType._zod.run({value:G[H],issues:[]},W);if(K instanceof Promise)J.push(K.then((B)=>{if(B.issues.length)Y.issues.push(...m0(H,B.issues));Y.value[H]=B.value}));else{if(K.issues.length)Y.issues.push(...m0(H,K.issues));Y.value[H]=K.value}}let z;for(let H in G)if(!$.has(H))z=z??[],z.push(H);if(z&&z.length>0)Y.issues.push({code:"unrecognized_keys",input:G,inst:Q,keys:z})}else{Y.value={};for(let $ of Reflect.ownKeys(G)){if($==="__proto__")continue;let z=X.keyType._zod.run({value:$,issues:[]},W);if(z instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(z.issues.length){Y.issues.push({code:"invalid_key",origin:"record",issues:z.issues.map((K)=>E0(K,W,Z0())),input:$,path:[$],inst:Q}),Y.value[z.value]=z.value;continue}let H=X.valueType._zod.run({value:G[$],issues:[]},W);if(H instanceof Promise)J.push(H.then((K)=>{if(K.issues.length)Y.issues.push(...m0($,K.issues));Y.value[z.value]=K.value}));else{if(H.issues.length)Y.issues.push(...m0($,H.issues));Y.value[z.value]=H.value}}}if(J.length)return Promise.all(J).then(()=>Y);return Y}});var CY=L("$ZodEnum",(Q,X)=>{i.init(Q,X);let Y=BQ(X.entries),W=new Set(Y);Q._zod.values=W,Q._zod.pattern=new RegExp(`^(${Y.filter((G)=>FQ.has(typeof G)).map((G)=>typeof G==="string"?f0(G):G.toString()).join("|")})$`),Q._zod.parse=(G,J)=>{let $=G.value;if(W.has($))return G;return G.issues.push({code:"invalid_value",values:Y,input:$,inst:Q}),G}}),kY=L("$ZodLiteral",(Q,X)=>{if(i.init(Q,X),X.values.length===0)throw Error("Cannot create literal schema with no valid values");Q._zod.values=new Set(X.values),Q._zod.pattern=new RegExp(`^(${X.values.map((Y)=>typeof Y==="string"?f0(Y):Y?f0(Y.toString()):String(Y)).join("|")})$`),Q._zod.parse=(Y,W)=>{let G=Y.value;if(Q._zod.values.has(G))return Y;return Y.issues.push({code:"invalid_value",values:X.values,input:G,inst:Q}),Y}});var vY=L("$ZodTransform",(Q,X)=>{i.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new m1(Q.constructor.name);let G=X.transform(Y.value,Y);if(W.async)return(G instanceof Promise?G:Promise.resolve(G)).then(($)=>{return Y.value=$,Y});if(G instanceof Promise)throw new u0;return Y.value=G,Y}});function p8(Q,X){if(Q.issues.length&&X===void 0)return{issues:[],value:void 0};return Q}var xY=L("$ZodOptional",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",Q._zod.optout="optional",m(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,void 0]):void 0}),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${p1(Y.source)})?$`):void 0}),Q._zod.parse=(Y,W)=>{if(X.innerType._zod.optin==="optional"){let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>p8(J,Y.value));return p8(G,Y.value)}if(Y.value===void 0)return Y;return X.innerType._zod.run(Y,W)}}),_Y=L("$ZodNullable",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(Q._zod,"pattern",()=>{let Y=X.innerType._zod.pattern;return Y?new RegExp(`^(${p1(Y.source)}|null)$`):void 0}),m(Q._zod,"values",()=>{return X.innerType._zod.values?new Set([...X.innerType._zod.values,null]):void 0}),Q._zod.parse=(Y,W)=>{if(Y.value===null)return Y;return X.innerType._zod.run(Y,W)}}),yY=L("$ZodDefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",m(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)return Y.value=X.defaultValue,Y;let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>i8(J,X));return i8(G,X)}});function i8(Q,X){if(Q.value===void 0)Q.value=X.defaultValue;return Q}var gY=L("$ZodPrefault",(Q,X)=>{i.init(Q,X),Q._zod.optin="optional",m(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);if(Y.value===void 0)Y.value=X.defaultValue;return X.innerType._zod.run(Y,W)}}),hY=L("$ZodNonOptional",(Q,X)=>{i.init(Q,X),m(Q._zod,"values",()=>{let Y=X.innerType._zod.values;return Y?new Set([...Y].filter((W)=>W!==void 0)):void 0}),Q._zod.parse=(Y,W)=>{let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>n8(J,Q));return n8(G,Q)}});function n8(Q,X){if(!Q.issues.length&&Q.value===void 0)Q.issues.push({code:"invalid_type",expected:"nonoptional",input:Q.value,inst:X});return Q}var uY=L("$ZodCatch",(Q,X)=>{i.init(Q,X),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),m(Q._zod,"values",()=>X.innerType._zod.values),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>{if(Y.value=J.value,J.issues.length)Y.value=X.catchValue({...Y,error:{issues:J.issues.map(($)=>E0($,W,Z0()))},input:Y.value}),Y.issues=[];return Y});if(Y.value=G.value,G.issues.length)Y.value=X.catchValue({...Y,error:{issues:G.issues.map((J)=>E0(J,W,Z0()))},input:Y.value}),Y.issues=[];return Y}});var fY=L("$ZodPipe",(Q,X)=>{i.init(Q,X),m(Q._zod,"values",()=>X.in._zod.values),m(Q._zod,"optin",()=>X.in._zod.optin),m(Q._zod,"optout",()=>X.out._zod.optout),m(Q._zod,"propValues",()=>X.in._zod.propValues),Q._zod.parse=(Y,W)=>{if(W.direction==="backward"){let J=X.out._zod.run(Y,W);if(J instanceof Promise)return J.then(($)=>d6($,X.in,W));return d6(J,X.in,W)}let G=X.in._zod.run(Y,W);if(G instanceof Promise)return G.then((J)=>d6(J,X.out,W));return d6(G,X.out,W)}});function d6(Q,X,Y){if(Q.issues.length)return Q.aborted=!0,Q;return X._zod.run({value:Q.value,issues:Q.issues},Y)}var mY=L("$ZodReadonly",(Q,X)=>{i.init(Q,X),m(Q._zod,"propValues",()=>X.innerType._zod.propValues),m(Q._zod,"values",()=>X.innerType._zod.values),m(Q._zod,"optin",()=>X.innerType._zod.optin),m(Q._zod,"optout",()=>X.innerType._zod.optout),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")return X.innerType._zod.run(Y,W);let G=X.innerType._zod.run(Y,W);if(G instanceof Promise)return G.then(d8);return d8(G)}});function d8(Q){return Q.value=Object.freeze(Q.value),Q}var lY=L("$ZodCustom",(Q,X)=>{X0.init(Q,X),i.init(Q,X),Q._zod.parse=(Y,W)=>{return Y},Q._zod.check=(Y)=>{let W=Y.value,G=X.fn(W);if(G instanceof Promise)return G.then((J)=>r8(J,Y,W,Q));r8(G,Y,W,Q);return}});function r8(Q,X,Y,W){if(!Q){let G={code:"custom",input:Y,inst:W,path:[...W._zod.def.path??[]],continue:!W._zod.def.abort};if(W._zod.def.params)G.params=W._zod.def.params;X.issues.push(w1(G))}}var QH=(Q)=>{let X=typeof Q;switch(X){case"number":return Number.isNaN(Q)?"NaN":"number";case"object":{if(Array.isArray(Q))return"array";if(Q===null)return"null";if(Object.getPrototypeOf(Q)!==Object.prototype&&Q.constructor)return Q.constructor.name}}return X},XH=()=>{let Q={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"}};function X(W){return Q[W]??null}let Y={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"};return(W)=>{switch(W.code){case"invalid_type":return`Invalid input: expected ${W.expected}, received ${QH(W.input)}`;case"invalid_value":if(W.values.length===1)return`Invalid input: expected ${m6(W.values[0])}`;return`Invalid option: expected one of ${h6(W.values,"|")}`;case"too_big":{let G=W.inclusive?"<=":"<",J=X(W.origin);if(J)return`Too big: expected ${W.origin??"value"} to have ${G}${W.maximum.toString()} ${J.unit??"elements"}`;return`Too big: expected ${W.origin??"value"} to be ${G}${W.maximum.toString()}`}case"too_small":{let G=W.inclusive?">=":">",J=X(W.origin);if(J)return`Too small: expected ${W.origin} to have ${G}${W.minimum.toString()} ${J.unit}`;return`Too small: expected ${W.origin} to be ${G}${W.minimum.toString()}`}case"invalid_format":{let G=W;if(G.format==="starts_with")return`Invalid string: must start with "${G.prefix}"`;if(G.format==="ends_with")return`Invalid string: must end with "${G.suffix}"`;if(G.format==="includes")return`Invalid string: must include "${G.includes}"`;if(G.format==="regex")return`Invalid string: must match pattern ${G.pattern}`;return`Invalid ${Y[G.format]??W.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${W.divisor}`;case"unrecognized_keys":return`Unrecognized key${W.keys.length>1?"s":""}: ${h6(W.keys,", ")}`;case"invalid_key":return`Invalid key in ${W.origin}`;case"invalid_union":return"Invalid input";case"invalid_element":return`Invalid value in ${W.origin}`;default:return"Invalid input"}}};function bQ(){return{localeError:XH()}}var EV=Symbol("ZodOutput"),IV=Symbol("ZodInput");class cY{constructor(){this._map=new WeakMap,this._idmap=new Map}add(Q,...X){let Y=X[0];if(this._map.set(Q,Y),Y&&typeof Y==="object"&&"id"in Y){if(this._idmap.has(Y.id))throw Error(`ID ${Y.id} already exists in the registry`);this._idmap.set(Y.id,Q)}return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(Q){let X=this._map.get(Q);if(X&&typeof X==="object"&&"id"in X)this._idmap.delete(X.id);return this._map.delete(Q),this}get(Q){let X=Q._zod.parent;if(X){let Y={...this.get(X)??{}};delete Y.id;let W={...Y,...this._map.get(Q)};return Object.keys(W).length?W:void 0}return this._map.get(Q)}has(Q){return this._map.has(Q)}}function YH(){return new cY}var t1=YH();function pY(Q,X){return new Q({type:"string",...b(X)})}function iY(Q,X){return new Q({type:"string",format:"email",check:"string_format",abort:!1,...b(X)})}function EQ(Q,X){return new Q({type:"string",format:"guid",check:"string_format",abort:!1,...b(X)})}function nY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,...b(X)})}function dY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...b(X)})}function rY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...b(X)})}function oY(Q,X){return new Q({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...b(X)})}function tY(Q,X){return new Q({type:"string",format:"url",check:"string_format",abort:!1,...b(X)})}function aY(Q,X){return new Q({type:"string",format:"emoji",check:"string_format",abort:!1,...b(X)})}function sY(Q,X){return new Q({type:"string",format:"nanoid",check:"string_format",abort:!1,...b(X)})}function eY(Q,X){return new Q({type:"string",format:"cuid",check:"string_format",abort:!1,...b(X)})}function QW(Q,X){return new Q({type:"string",format:"cuid2",check:"string_format",abort:!1,...b(X)})}function XW(Q,X){return new Q({type:"string",format:"ulid",check:"string_format",abort:!1,...b(X)})}function YW(Q,X){return new Q({type:"string",format:"xid",check:"string_format",abort:!1,...b(X)})}function WW(Q,X){return new Q({type:"string",format:"ksuid",check:"string_format",abort:!1,...b(X)})}function GW(Q,X){return new Q({type:"string",format:"ipv4",check:"string_format",abort:!1,...b(X)})}function JW(Q,X){return new Q({type:"string",format:"ipv6",check:"string_format",abort:!1,...b(X)})}function $W(Q,X){return new Q({type:"string",format:"cidrv4",check:"string_format",abort:!1,...b(X)})}function zW(Q,X){return new Q({type:"string",format:"cidrv6",check:"string_format",abort:!1,...b(X)})}function HW(Q,X){return new Q({type:"string",format:"base64",check:"string_format",abort:!1,...b(X)})}function KW(Q,X){return new Q({type:"string",format:"base64url",check:"string_format",abort:!1,...b(X)})}function BW(Q,X){return new Q({type:"string",format:"e164",check:"string_format",abort:!1,...b(X)})}function DW(Q,X){return new Q({type:"string",format:"jwt",check:"string_format",abort:!1,...b(X)})}function AW(Q,X){return new Q({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...b(X)})}function FW(Q,X){return new Q({type:"string",format:"date",check:"string_format",...b(X)})}function LW(Q,X){return new Q({type:"string",format:"time",check:"string_format",precision:null,...b(X)})}function UW(Q,X){return new Q({type:"string",format:"duration",check:"string_format",...b(X)})}function OW(Q,X){return new Q({type:"number",checks:[],...b(X)})}function MW(Q,X){return new Q({type:"number",check:"number_format",abort:!1,format:"safeint",...b(X)})}function VW(Q,X){return new Q({type:"boolean",...b(X)})}function qW(Q,X){return new Q({type:"null",...b(X)})}function ZW(Q){return new Q({type:"unknown"})}function NW(Q,X){return new Q({type:"never",...b(X)})}function t6(Q,X){return new qQ({check:"less_than",...b(X),value:Q,inclusive:!1})}function a1(Q,X){return new qQ({check:"less_than",...b(X),value:Q,inclusive:!0})}function a6(Q,X){return new ZQ({check:"greater_than",...b(X),value:Q,inclusive:!1})}function s1(Q,X){return new ZQ({check:"greater_than",...b(X),value:Q,inclusive:!0})}function s6(Q,X){return new I8({check:"multiple_of",...b(X),value:Q})}function e6(Q,X){return new S8({check:"max_length",...b(X),maximum:Q})}function j1(Q,X){return new R8({check:"min_length",...b(X),minimum:Q})}function Q4(Q,X){return new C8({check:"length_equals",...b(X),length:Q})}function IQ(Q,X){return new k8({check:"string_format",format:"regex",...b(X),pattern:Q})}function TQ(Q){return new v8({check:"string_format",format:"lowercase",...b(Q)})}function SQ(Q){return new x8({check:"string_format",format:"uppercase",...b(Q)})}function RQ(Q,X){return new _8({check:"string_format",format:"includes",...b(X),includes:Q})}function CQ(Q,X){return new y8({check:"string_format",format:"starts_with",...b(X),prefix:Q})}function kQ(Q,X){return new g8({check:"string_format",format:"ends_with",...b(X),suffix:Q})}function A1(Q){return new h8({check:"overwrite",tx:Q})}function vQ(Q){return A1((X)=>X.normalize(Q))}function xQ(){return A1((Q)=>Q.trim())}function _Q(){return A1((Q)=>Q.toLowerCase())}function yQ(){return A1((Q)=>Q.toUpperCase())}function wW(Q,X,Y){return new Q({type:"array",element:X,...b(Y)})}function jW(Q,X,Y){let W=b(Y);return W.abort??(W.abort=!0),new Q({type:"custom",check:"custom",fn:X,...W})}function PW(Q,X,Y){return new Q({type:"custom",check:"custom",fn:X,...b(Y)})}function bW(Q){let X=WH((Y)=>{return Y.addIssue=(W)=>{if(typeof W==="string")Y.issues.push(w1(W,Y.value,X._zod.def));else{let G=W;if(G.fatal)G.continue=!1;G.code??(G.code="custom"),G.input??(G.input=Y.value),G.inst??(G.inst=X),G.continue??(G.continue=!X._zod.def.abort),Y.issues.push(w1(G))}},Q(Y.value,Y)});return X}function WH(Q,X){let Y=new X0({check:"custom",...b(X)});return Y._zod.check=Q,Y}function P1(Q){return!!Q._zod}function e0(Q,X){if(P1(Q))return d1(Q,X);return Q.safeParse(X)}function X4(Q){if(!Q)return;let X;if(P1(Q))X=Q._zod?.def?.shape;else X=Q.shape;if(!X)return;if(typeof X==="function")try{return X()}catch{return}return X}function EW(Q){if(P1(Q)){let J=Q._zod?.def;if(J){if(J.value!==void 0)return J.value;if(Array.isArray(J.values)&&J.values.length>0)return J.values[0]}}let Y=Q._def;if(Y){if(Y.value!==void 0)return Y.value;if(Array.isArray(Y.values)&&Y.values.length>0)return Y.values[0]}let W=Q.value;if(W!==void 0)return W;return}var Q6={};CX(Q6,{time:()=>uQ,duration:()=>fQ,datetime:()=>gQ,date:()=>hQ,ZodISOTime:()=>SW,ZodISODuration:()=>RW,ZodISODateTime:()=>IW,ZodISODate:()=>TW});var IW=L("ZodISODateTime",(Q,X)=>{$Y.init(Q,X),r.init(Q,X)});function gQ(Q){return AW(IW,Q)}var TW=L("ZodISODate",(Q,X)=>{zY.init(Q,X),r.init(Q,X)});function hQ(Q){return FW(TW,Q)}var SW=L("ZodISOTime",(Q,X)=>{HY.init(Q,X),r.init(Q,X)});function uQ(Q){return LW(SW,Q)}var RW=L("ZodISODuration",(Q,X)=>{KY.init(Q,X),r.init(Q,X)});function fQ(Q){return UW(RW,Q)}var CW=(Q,X)=>{l6.init(Q,X),Q.name="ZodError",Object.defineProperties(Q,{format:{value:(Y)=>lX(Q,Y)},flatten:{value:(Y)=>mX(Q,Y)},addIssue:{value:(Y)=>{Q.issues.push(Y),Q.message=JSON.stringify(Q.issues,Z1,2)}},addIssues:{value:(Y)=>{Q.issues.push(...Y),Q.message=JSON.stringify(Q.issues,Z1,2)}},isEmpty:{get(){return Q.issues.length===0}}})},Aq=L("ZodError",CW),V0=L("ZodError",CW,{Parent:Error});var kW=c6(V0),vW=p6(V0),xW=n1(V0),_W=r1(V0),yW=cX(V0),gW=pX(V0),hW=iX(V0),uW=nX(V0),fW=dX(V0),mW=rX(V0),lW=oX(V0),cW=tX(V0);var s=L("ZodType",(Q,X)=>{return i.init(Q,X),Q.def=X,Q.type=X.type,Object.defineProperty(Q,"_def",{value:X}),Q.check=(...Y)=>{return Q.clone(h.mergeDefs(X,{checks:[...X.checks??[],...Y.map((W)=>typeof W==="function"?{_zod:{check:W,def:{check:"custom"},onattach:[]}}:W)]}))},Q.clone=(Y,W)=>b0(Q,Y,W),Q.brand=()=>Q,Q.register=(Y,W)=>{return Y.add(Q,W),Q},Q.parse=(Y,W)=>kW(Q,Y,W,{callee:Q.parse}),Q.safeParse=(Y,W)=>xW(Q,Y,W),Q.parseAsync=async(Y,W)=>vW(Q,Y,W,{callee:Q.parseAsync}),Q.safeParseAsync=async(Y,W)=>_W(Q,Y,W),Q.spa=Q.safeParseAsync,Q.encode=(Y,W)=>yW(Q,Y,W),Q.decode=(Y,W)=>gW(Q,Y,W),Q.encodeAsync=async(Y,W)=>hW(Q,Y,W),Q.decodeAsync=async(Y,W)=>uW(Q,Y,W),Q.safeEncode=(Y,W)=>fW(Q,Y,W),Q.safeDecode=(Y,W)=>mW(Q,Y,W),Q.safeEncodeAsync=async(Y,W)=>lW(Q,Y,W),Q.safeDecodeAsync=async(Y,W)=>cW(Q,Y,W),Q.refine=(Y,W)=>Q.check(eH(Y,W)),Q.superRefine=(Y)=>Q.check(Q3(Y)),Q.overwrite=(Y)=>Q.check(A1(Y)),Q.optional=()=>a(Q),Q.nullable=()=>nW(Q),Q.nullish=()=>a(nW(Q)),Q.nonoptional=(Y)=>dH(Q,Y),Q.array=()=>x(Q),Q.or=(Y)=>c([Q,Y]),Q.and=(Y)=>W4(Q,Y),Q.transform=(Y)=>lQ(Q,aW(Y)),Q.default=(Y)=>pH(Q,Y),Q.prefault=(Y)=>nH(Q,Y),Q.catch=(Y)=>oH(Q,Y),Q.pipe=(Y)=>lQ(Q,Y),Q.readonly=()=>sH(Q),Q.describe=(Y)=>{let W=Q.clone();return t1.add(W,{description:Y}),W},Object.defineProperty(Q,"description",{get(){return t1.get(Q)?.description},configurable:!0}),Q.meta=(...Y)=>{if(Y.length===0)return t1.get(Q);let W=Q.clone();return t1.add(W,Y[0]),W},Q.isOptional=()=>Q.safeParse(void 0).success,Q.isNullable=()=>Q.safeParse(null).success,Q}),dW=L("_ZodString",(Q,X)=>{o6.init(Q,X),s.init(Q,X);let Y=Q._zod.bag;Q.format=Y.format??null,Q.minLength=Y.minimum??null,Q.maxLength=Y.maximum??null,Q.regex=(...W)=>Q.check(IQ(...W)),Q.includes=(...W)=>Q.check(RQ(...W)),Q.startsWith=(...W)=>Q.check(CQ(...W)),Q.endsWith=(...W)=>Q.check(kQ(...W)),Q.min=(...W)=>Q.check(j1(...W)),Q.max=(...W)=>Q.check(e6(...W)),Q.length=(...W)=>Q.check(Q4(...W)),Q.nonempty=(...W)=>Q.check(j1(1,...W)),Q.lowercase=(W)=>Q.check(TQ(W)),Q.uppercase=(W)=>Q.check(SQ(W)),Q.trim=()=>Q.check(xQ()),Q.normalize=(...W)=>Q.check(vQ(...W)),Q.toLowerCase=()=>Q.check(_Q()),Q.toUpperCase=()=>Q.check(yQ())}),AH=L("ZodString",(Q,X)=>{o6.init(Q,X),dW.init(Q,X),Q.email=(Y)=>Q.check(iY(FH,Y)),Q.url=(Y)=>Q.check(tY(LH,Y)),Q.jwt=(Y)=>Q.check(DW(SH,Y)),Q.emoji=(Y)=>Q.check(aY(UH,Y)),Q.guid=(Y)=>Q.check(EQ(pW,Y)),Q.uuid=(Y)=>Q.check(nY(Y4,Y)),Q.uuidv4=(Y)=>Q.check(dY(Y4,Y)),Q.uuidv6=(Y)=>Q.check(rY(Y4,Y)),Q.uuidv7=(Y)=>Q.check(oY(Y4,Y)),Q.nanoid=(Y)=>Q.check(sY(OH,Y)),Q.guid=(Y)=>Q.check(EQ(pW,Y)),Q.cuid=(Y)=>Q.check(eY(MH,Y)),Q.cuid2=(Y)=>Q.check(QW(VH,Y)),Q.ulid=(Y)=>Q.check(XW(qH,Y)),Q.base64=(Y)=>Q.check(HW(EH,Y)),Q.base64url=(Y)=>Q.check(KW(IH,Y)),Q.xid=(Y)=>Q.check(YW(ZH,Y)),Q.ksuid=(Y)=>Q.check(WW(NH,Y)),Q.ipv4=(Y)=>Q.check(GW(wH,Y)),Q.ipv6=(Y)=>Q.check(JW(jH,Y)),Q.cidrv4=(Y)=>Q.check($W(PH,Y)),Q.cidrv6=(Y)=>Q.check(zW(bH,Y)),Q.e164=(Y)=>Q.check(BW(TH,Y)),Q.datetime=(Y)=>Q.check(gQ(Y)),Q.date=(Y)=>Q.check(hQ(Y)),Q.time=(Y)=>Q.check(uQ(Y)),Q.duration=(Y)=>Q.check(fQ(Y))});function A(Q){return pY(AH,Q)}var r=L("ZodStringFormat",(Q,X)=>{n.init(Q,X),dW.init(Q,X)}),FH=L("ZodEmail",(Q,X)=>{a8.init(Q,X),r.init(Q,X)});var pW=L("ZodGUID",(Q,X)=>{o8.init(Q,X),r.init(Q,X)});var Y4=L("ZodUUID",(Q,X)=>{t8.init(Q,X),r.init(Q,X)});var LH=L("ZodURL",(Q,X)=>{s8.init(Q,X),r.init(Q,X)});var UH=L("ZodEmoji",(Q,X)=>{e8.init(Q,X),r.init(Q,X)});var OH=L("ZodNanoID",(Q,X)=>{QY.init(Q,X),r.init(Q,X)});var MH=L("ZodCUID",(Q,X)=>{XY.init(Q,X),r.init(Q,X)});var VH=L("ZodCUID2",(Q,X)=>{YY.init(Q,X),r.init(Q,X)});var qH=L("ZodULID",(Q,X)=>{WY.init(Q,X),r.init(Q,X)});var ZH=L("ZodXID",(Q,X)=>{GY.init(Q,X),r.init(Q,X)});var NH=L("ZodKSUID",(Q,X)=>{JY.init(Q,X),r.init(Q,X)});var wH=L("ZodIPv4",(Q,X)=>{BY.init(Q,X),r.init(Q,X)});var jH=L("ZodIPv6",(Q,X)=>{DY.init(Q,X),r.init(Q,X)});var PH=L("ZodCIDRv4",(Q,X)=>{AY.init(Q,X),r.init(Q,X)});var bH=L("ZodCIDRv6",(Q,X)=>{FY.init(Q,X),r.init(Q,X)});var EH=L("ZodBase64",(Q,X)=>{UY.init(Q,X),r.init(Q,X)});var IH=L("ZodBase64URL",(Q,X)=>{OY.init(Q,X),r.init(Q,X)});var TH=L("ZodE164",(Q,X)=>{MY.init(Q,X),r.init(Q,X)});var SH=L("ZodJWT",(Q,X)=>{VY.init(Q,X),r.init(Q,X)});var rW=L("ZodNumber",(Q,X)=>{jQ.init(Q,X),s.init(Q,X),Q.gt=(W,G)=>Q.check(a6(W,G)),Q.gte=(W,G)=>Q.check(s1(W,G)),Q.min=(W,G)=>Q.check(s1(W,G)),Q.lt=(W,G)=>Q.check(t6(W,G)),Q.lte=(W,G)=>Q.check(a1(W,G)),Q.max=(W,G)=>Q.check(a1(W,G)),Q.int=(W)=>Q.check(iW(W)),Q.safe=(W)=>Q.check(iW(W)),Q.positive=(W)=>Q.check(a6(0,W)),Q.nonnegative=(W)=>Q.check(s1(0,W)),Q.negative=(W)=>Q.check(t6(0,W)),Q.nonpositive=(W)=>Q.check(a1(0,W)),Q.multipleOf=(W,G)=>Q.check(s6(W,G)),Q.step=(W,G)=>Q.check(s6(W,G)),Q.finite=()=>Q;let Y=Q._zod.bag;Q.minValue=Math.max(Y.minimum??Number.NEGATIVE_INFINITY,Y.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,Q.maxValue=Math.min(Y.maximum??Number.POSITIVE_INFINITY,Y.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,Q.isInt=(Y.format??"").includes("int")||Number.isSafeInteger(Y.multipleOf??0.5),Q.isFinite=!0,Q.format=Y.format??null});function f(Q){return OW(rW,Q)}var RH=L("ZodNumberFormat",(Q,X)=>{qY.init(Q,X),rW.init(Q,X)});function iW(Q){return MW(RH,Q)}var CH=L("ZodBoolean",(Q,X)=>{ZY.init(Q,X),s.init(Q,X)});function Q0(Q){return VW(CH,Q)}var kH=L("ZodNull",(Q,X)=>{NY.init(Q,X),s.init(Q,X)});function cQ(Q){return qW(kH,Q)}var vH=L("ZodUnknown",(Q,X)=>{wY.init(Q,X),s.init(Q,X)});function o(){return ZW(vH)}var xH=L("ZodNever",(Q,X)=>{jY.init(Q,X),s.init(Q,X)});function _H(Q){return NW(xH,Q)}var yH=L("ZodArray",(Q,X)=>{PY.init(Q,X),s.init(Q,X),Q.element=X.element,Q.min=(Y,W)=>Q.check(j1(Y,W)),Q.nonempty=(Y)=>Q.check(j1(1,Y)),Q.max=(Y,W)=>Q.check(e6(Y,W)),Q.length=(Y,W)=>Q.check(Q4(Y,W)),Q.unwrap=()=>Q.element});function x(Q,X){return wW(yH,Q,X)}var oW=L("ZodObject",(Q,X)=>{IY.init(Q,X),s.init(Q,X),h.defineLazy(Q,"shape",()=>{return X.shape}),Q.keyof=()=>F0(Object.keys(Q._zod.def.shape)),Q.catchall=(Y)=>Q.clone({...Q._zod.def,catchall:Y}),Q.passthrough=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.loose=()=>Q.clone({...Q._zod.def,catchall:o()}),Q.strict=()=>Q.clone({...Q._zod.def,catchall:_H()}),Q.strip=()=>Q.clone({...Q._zod.def,catchall:void 0}),Q.extend=(Y)=>{return h.extend(Q,Y)},Q.safeExtend=(Y)=>{return h.safeExtend(Q,Y)},Q.merge=(Y)=>h.merge(Q,Y),Q.pick=(Y)=>h.pick(Q,Y),Q.omit=(Y)=>h.omit(Q,Y),Q.partial=(...Y)=>h.partial(sW,Q,Y[0]),Q.required=(...Y)=>h.required(eW,Q,Y[0])});function N(Q,X){let Y={type:"object",shape:Q??{},...h.normalizeParams(X)};return new oW(Y)}function B0(Q,X){return new oW({type:"object",shape:Q,catchall:o(),...h.normalizeParams(X)})}var tW=L("ZodUnion",(Q,X)=>{PQ.init(Q,X),s.init(Q,X),Q.options=X.options});function c(Q,X){return new tW({type:"union",options:Q,...h.normalizeParams(X)})}var gH=L("ZodDiscriminatedUnion",(Q,X)=>{tW.init(Q,X),TY.init(Q,X)});function pQ(Q,X,Y){return new gH({type:"union",options:X,discriminator:Q,...h.normalizeParams(Y)})}var hH=L("ZodIntersection",(Q,X)=>{SY.init(Q,X),s.init(Q,X)});function W4(Q,X){return new hH({type:"intersection",left:Q,right:X})}var uH=L("ZodRecord",(Q,X)=>{RY.init(Q,X),s.init(Q,X),Q.keyType=X.keyType,Q.valueType=X.valueType});function t(Q,X,Y){return new uH({type:"record",keyType:Q,valueType:X,...h.normalizeParams(Y)})}var mQ=L("ZodEnum",(Q,X)=>{CY.init(Q,X),s.init(Q,X),Q.enum=X.entries,Q.options=Object.values(X.entries);let Y=new Set(Object.keys(X.entries));Q.extract=(W,G)=>{let J={};for(let $ of W)if(Y.has($))J[$]=X.entries[$];else throw Error(`Key ${$} not found in enum`);return new mQ({...X,checks:[],...h.normalizeParams(G),entries:J})},Q.exclude=(W,G)=>{let J={...X.entries};for(let $ of W)if(Y.has($))delete J[$];else throw Error(`Key ${$} not found in enum`);return new mQ({...X,checks:[],...h.normalizeParams(G),entries:J})}});function F0(Q,X){let Y=Array.isArray(Q)?Object.fromEntries(Q.map((W)=>[W,W])):Q;return new mQ({type:"enum",entries:Y,...h.normalizeParams(X)})}var fH=L("ZodLiteral",(Q,X)=>{kY.init(Q,X),s.init(Q,X),Q.values=new Set(X.values),Object.defineProperty(Q,"value",{get(){if(X.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return X.values[0]}})});function j(Q,X){return new fH({type:"literal",values:Array.isArray(Q)?Q:[Q],...h.normalizeParams(X)})}var mH=L("ZodTransform",(Q,X)=>{vY.init(Q,X),s.init(Q,X),Q._zod.parse=(Y,W)=>{if(W.direction==="backward")throw new m1(Q.constructor.name);Y.addIssue=(J)=>{if(typeof J==="string")Y.issues.push(h.issue(J,Y.value,X));else{let $=J;if($.fatal)$.continue=!1;$.code??($.code="custom"),$.input??($.input=Y.value),$.inst??($.inst=Q),Y.issues.push(h.issue($))}};let G=X.transform(Y.value,Y);if(G instanceof Promise)return G.then((J)=>{return Y.value=J,Y});return Y.value=G,Y}});function aW(Q){return new mH({type:"transform",transform:Q})}var sW=L("ZodOptional",(Q,X)=>{xY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function a(Q){return new sW({type:"optional",innerType:Q})}var lH=L("ZodNullable",(Q,X)=>{_Y.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function nW(Q){return new lH({type:"nullable",innerType:Q})}var cH=L("ZodDefault",(Q,X)=>{yY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeDefault=Q.unwrap});function pH(Q,X){return new cH({type:"default",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var iH=L("ZodPrefault",(Q,X)=>{gY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function nH(Q,X){return new iH({type:"prefault",innerType:Q,get defaultValue(){return typeof X==="function"?X():h.shallowClone(X)}})}var eW=L("ZodNonOptional",(Q,X)=>{hY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function dH(Q,X){return new eW({type:"nonoptional",innerType:Q,...h.normalizeParams(X)})}var rH=L("ZodCatch",(Q,X)=>{uY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType,Q.removeCatch=Q.unwrap});function oH(Q,X){return new rH({type:"catch",innerType:Q,catchValue:typeof X==="function"?X:()=>X})}var tH=L("ZodPipe",(Q,X)=>{fY.init(Q,X),s.init(Q,X),Q.in=X.in,Q.out=X.out});function lQ(Q,X){return new tH({type:"pipe",in:Q,out:X})}var aH=L("ZodReadonly",(Q,X)=>{mY.init(Q,X),s.init(Q,X),Q.unwrap=()=>Q._zod.def.innerType});function sH(Q){return new aH({type:"readonly",innerType:Q})}var QG=L("ZodCustom",(Q,X)=>{lY.init(Q,X),s.init(Q,X)});function XG(Q,X){return jW(QG,Q??(()=>!0),X)}function eH(Q,X={}){return PW(QG,Q,X)}function Q3(Q){return bW(Q)}function iQ(Q,X){return lQ(aW(Q),X)}Z0(bQ());var nQ="2025-11-25";var YG=[nQ,"2025-06-18","2025-03-26","2024-11-05","2024-10-07"],Q1="io.modelcontextprotocol/related-task",J4="2.0",Y0=XG((Q)=>Q!==null&&(typeof Q==="object"||typeof Q==="function")),WG=c([A(),f().int()]),GG=A(),zZ=B0({ttl:c([f(),cQ()]).optional(),pollInterval:f().optional()}),X3=N({ttl:f().optional()}),Y3=N({taskId:A()}),dQ=B0({progressToken:WG.optional(),[Q1]:Y3.optional()}),q0=N({_meta:dQ.optional()}),X6=q0.extend({task:X3.optional()}),JG=(Q)=>X6.safeParse(Q).success,W0=N({method:A(),params:q0.loose().optional()}),N0=N({_meta:dQ.optional()}),w0=N({method:A(),params:N0.loose().optional()}),G0=B0({_meta:dQ.optional()}),$4=c([A(),f().int()]),$G=N({jsonrpc:j(J4),id:$4,...W0.shape}).strict(),rQ=(Q)=>$G.safeParse(Q).success,zG=N({jsonrpc:j(J4),...w0.shape}).strict(),HG=(Q)=>zG.safeParse(Q).success,oQ=N({jsonrpc:j(J4),id:$4,result:G0}).strict(),Y6=(Q)=>oQ.safeParse(Q).success;var _;(function(Q){Q[Q.ConnectionClosed=-32000]="ConnectionClosed",Q[Q.RequestTimeout=-32001]="RequestTimeout",Q[Q.ParseError=-32700]="ParseError",Q[Q.InvalidRequest=-32600]="InvalidRequest",Q[Q.MethodNotFound=-32601]="MethodNotFound",Q[Q.InvalidParams=-32602]="InvalidParams",Q[Q.InternalError=-32603]="InternalError",Q[Q.UrlElicitationRequired=-32042]="UrlElicitationRequired"})(_||(_={}));var tQ=N({jsonrpc:j(J4),id:$4.optional(),error:N({code:f().int(),message:A(),data:o().optional()})}).strict();var KG=(Q)=>tQ.safeParse(Q).success;var BG=c([$G,zG,oQ,tQ]),HZ=c([oQ,tQ]),z4=G0.strict(),W3=N0.extend({requestId:$4.optional(),reason:A().optional()}),H4=w0.extend({method:j("notifications/cancelled"),params:W3}),G3=N({src:A(),mimeType:A().optional(),sizes:x(A()).optional(),theme:F0(["light","dark"]).optional()}),W6=N({icons:x(G3).optional()}),b1=N({name:A(),title:A().optional()}),DG=b1.extend({...b1.shape,...W6.shape,version:A(),websiteUrl:A().optional(),description:A().optional()}),J3=W4(N({applyDefaults:Q0().optional()}),t(A(),o())),$3=iQ((Q)=>{if(Q&&typeof Q==="object"&&!Array.isArray(Q)){if(Object.keys(Q).length===0)return{form:{}}}return Q},W4(N({form:J3.optional(),url:Y0.optional()}),t(A(),o()).optional())),z3=B0({list:Y0.optional(),cancel:Y0.optional(),requests:B0({sampling:B0({createMessage:Y0.optional()}).optional(),elicitation:B0({create:Y0.optional()}).optional()}).optional()}),H3=B0({list:Y0.optional(),cancel:Y0.optional(),requests:B0({tools:B0({call:Y0.optional()}).optional()}).optional()}),K3=N({experimental:t(A(),Y0).optional(),sampling:N({context:Y0.optional(),tools:Y0.optional()}).optional(),elicitation:$3.optional(),roots:N({listChanged:Q0().optional()}).optional(),tasks:z3.optional()}),B3=q0.extend({protocolVersion:A(),capabilities:K3,clientInfo:DG}),aQ=W0.extend({method:j("initialize"),params:B3});var D3=N({experimental:t(A(),Y0).optional(),logging:Y0.optional(),completions:Y0.optional(),prompts:N({listChanged:Q0().optional()}).optional(),resources:N({subscribe:Q0().optional(),listChanged:Q0().optional()}).optional(),tools:N({listChanged:Q0().optional()}).optional(),tasks:H3.optional()}),A3=G0.extend({protocolVersion:A(),capabilities:D3,serverInfo:DG,instructions:A().optional()}),sQ=w0.extend({method:j("notifications/initialized"),params:N0.optional()});var K4=W0.extend({method:j("ping"),params:q0.optional()}),F3=N({progress:f(),total:a(f()),message:a(A())}),L3=N({...N0.shape,...F3.shape,progressToken:WG}),B4=w0.extend({method:j("notifications/progress"),params:L3}),U3=q0.extend({cursor:GG.optional()}),G6=W0.extend({params:U3.optional()}),J6=G0.extend({nextCursor:GG.optional()}),O3=F0(["working","input_required","completed","failed","cancelled"]),$6=N({taskId:A(),status:O3,ttl:c([f(),cQ()]),createdAt:A(),lastUpdatedAt:A(),pollInterval:a(f()),statusMessage:a(A())}),E1=G0.extend({task:$6}),M3=N0.merge($6),z6=w0.extend({method:j("notifications/tasks/status"),params:M3}),D4=W0.extend({method:j("tasks/get"),params:q0.extend({taskId:A()})}),A4=G0.merge($6),F4=W0.extend({method:j("tasks/result"),params:q0.extend({taskId:A()})}),KZ=G0.loose(),L4=G6.extend({method:j("tasks/list")}),U4=J6.extend({tasks:x($6)}),O4=W0.extend({method:j("tasks/cancel"),params:q0.extend({taskId:A()})}),AG=G0.merge($6),FG=N({uri:A(),mimeType:a(A()),_meta:t(A(),o()).optional()}),LG=FG.extend({text:A()}),eQ=A().refine((Q)=>{try{return atob(Q),!0}catch{return!1}},{message:"Invalid Base64 string"}),UG=FG.extend({blob:eQ}),H6=F0(["user","assistant"]),I1=N({audience:x(H6).optional(),priority:f().min(0).max(1).optional(),lastModified:Q6.datetime({offset:!0}).optional()}),OG=N({...b1.shape,...W6.shape,uri:A(),description:a(A()),mimeType:a(A()),annotations:I1.optional(),_meta:a(B0({}))}),V3=N({...b1.shape,...W6.shape,uriTemplate:A(),description:a(A()),mimeType:a(A()),annotations:I1.optional(),_meta:a(B0({}))}),Q9=G6.extend({method:j("resources/list")}),q3=J6.extend({resources:x(OG)}),Z3=G6.extend({method:j("resources/templates/list")}),N3=J6.extend({resourceTemplates:x(V3)}),X9=q0.extend({uri:A()}),w3=X9,Y9=W0.extend({method:j("resources/read"),params:w3}),j3=G0.extend({contents:x(c([LG,UG]))}),P3=w0.extend({method:j("notifications/resources/list_changed"),params:N0.optional()}),b3=X9,E3=W0.extend({method:j("resources/subscribe"),params:b3}),I3=X9,T3=W0.extend({method:j("resources/unsubscribe"),params:I3}),S3=N0.extend({uri:A()}),R3=w0.extend({method:j("notifications/resources/updated"),params:S3}),C3=N({name:A(),description:a(A()),required:a(Q0())}),k3=N({...b1.shape,...W6.shape,description:a(A()),arguments:a(x(C3)),_meta:a(B0({}))}),v3=G6.extend({method:j("prompts/list")}),x3=J6.extend({prompts:x(k3)}),_3=q0.extend({name:A(),arguments:t(A(),A()).optional()}),y3=W0.extend({method:j("prompts/get"),params:_3}),W9=N({type:j("text"),text:A(),annotations:I1.optional(),_meta:t(A(),o()).optional()}),G9=N({type:j("image"),data:eQ,mimeType:A(),annotations:I1.optional(),_meta:t(A(),o()).optional()}),J9=N({type:j("audio"),data:eQ,mimeType:A(),annotations:I1.optional(),_meta:t(A(),o()).optional()}),g3=N({type:j("tool_use"),name:A(),id:A(),input:t(A(),o()),_meta:t(A(),o()).optional()}),h3=N({type:j("resource"),resource:c([LG,UG]),annotations:I1.optional(),_meta:t(A(),o()).optional()}),u3=OG.extend({type:j("resource_link")}),$9=c([W9,G9,J9,u3,h3]),f3=N({role:H6,content:$9}),m3=G0.extend({description:A().optional(),messages:x(f3)}),l3=w0.extend({method:j("notifications/prompts/list_changed"),params:N0.optional()}),c3=N({title:A().optional(),readOnlyHint:Q0().optional(),destructiveHint:Q0().optional(),idempotentHint:Q0().optional(),openWorldHint:Q0().optional()}),p3=N({taskSupport:F0(["required","optional","forbidden"]).optional()}),MG=N({...b1.shape,...W6.shape,description:A().optional(),inputSchema:N({type:j("object"),properties:t(A(),Y0).optional(),required:x(A()).optional()}).catchall(o()),outputSchema:N({type:j("object"),properties:t(A(),Y0).optional(),required:x(A()).optional()}).catchall(o()).optional(),annotations:c3.optional(),execution:p3.optional(),_meta:t(A(),o()).optional()}),z9=G6.extend({method:j("tools/list")}),i3=J6.extend({tools:x(MG)}),M4=G0.extend({content:x($9).default([]),structuredContent:t(A(),o()).optional(),isError:Q0().optional()}),BZ=M4.or(G0.extend({toolResult:o()})),n3=X6.extend({name:A(),arguments:t(A(),o()).optional()}),K6=W0.extend({method:j("tools/call"),params:n3}),d3=w0.extend({method:j("notifications/tools/list_changed"),params:N0.optional()}),DZ=N({autoRefresh:Q0().default(!0),debounceMs:f().int().nonnegative().default(300)}),B6=F0(["debug","info","notice","warning","error","critical","alert","emergency"]),r3=q0.extend({level:B6}),H9=W0.extend({method:j("logging/setLevel"),params:r3}),o3=N0.extend({level:B6,logger:A().optional(),data:o()}),t3=w0.extend({method:j("notifications/message"),params:o3}),a3=N({name:A().optional()}),s3=N({hints:x(a3).optional(),costPriority:f().min(0).max(1).optional(),speedPriority:f().min(0).max(1).optional(),intelligencePriority:f().min(0).max(1).optional()}),e3=N({mode:F0(["auto","required","none"]).optional()}),QK=N({type:j("tool_result"),toolUseId:A().describe("The unique identifier for the corresponding tool call."),content:x($9).default([]),structuredContent:N({}).loose().optional(),isError:Q0().optional(),_meta:t(A(),o()).optional()}),XK=pQ("type",[W9,G9,J9]),G4=pQ("type",[W9,G9,J9,g3,QK]),YK=N({role:H6,content:c([G4,x(G4)]),_meta:t(A(),o()).optional()}),WK=X6.extend({messages:x(YK),modelPreferences:s3.optional(),systemPrompt:A().optional(),includeContext:F0(["none","thisServer","allServers"]).optional(),temperature:f().optional(),maxTokens:f().int(),stopSequences:x(A()).optional(),metadata:Y0.optional(),tools:x(MG).optional(),toolChoice:e3.optional()}),GK=W0.extend({method:j("sampling/createMessage"),params:WK}),K9=G0.extend({model:A(),stopReason:a(F0(["endTurn","stopSequence","maxTokens"]).or(A())),role:H6,content:XK}),B9=G0.extend({model:A(),stopReason:a(F0(["endTurn","stopSequence","maxTokens","toolUse"]).or(A())),role:H6,content:c([G4,x(G4)])}),JK=N({type:j("boolean"),title:A().optional(),description:A().optional(),default:Q0().optional()}),$K=N({type:j("string"),title:A().optional(),description:A().optional(),minLength:f().optional(),maxLength:f().optional(),format:F0(["email","uri","date","date-time"]).optional(),default:A().optional()}),zK=N({type:F0(["number","integer"]),title:A().optional(),description:A().optional(),minimum:f().optional(),maximum:f().optional(),default:f().optional()}),HK=N({type:j("string"),title:A().optional(),description:A().optional(),enum:x(A()),default:A().optional()}),KK=N({type:j("string"),title:A().optional(),description:A().optional(),oneOf:x(N({const:A(),title:A()})),default:A().optional()}),BK=N({type:j("string"),title:A().optional(),description:A().optional(),enum:x(A()),enumNames:x(A()).optional(),default:A().optional()}),DK=c([HK,KK]),AK=N({type:j("array"),title:A().optional(),description:A().optional(),minItems:f().optional(),maxItems:f().optional(),items:N({type:j("string"),enum:x(A())}),default:x(A()).optional()}),FK=N({type:j("array"),title:A().optional(),description:A().optional(),minItems:f().optional(),maxItems:f().optional(),items:N({anyOf:x(N({const:A(),title:A()}))}),default:x(A()).optional()}),LK=c([AK,FK]),UK=c([BK,DK,LK]),OK=c([UK,JK,$K,zK]),MK=X6.extend({mode:j("form").optional(),message:A(),requestedSchema:N({type:j("object"),properties:t(A(),OK),required:x(A()).optional()})}),VK=X6.extend({mode:j("url"),message:A(),elicitationId:A(),url:A().url()}),qK=c([MK,VK]),ZK=W0.extend({method:j("elicitation/create"),params:qK}),NK=N0.extend({elicitationId:A()}),wK=w0.extend({method:j("notifications/elicitation/complete"),params:NK}),V4=G0.extend({action:F0(["accept","decline","cancel"]),content:iQ((Q)=>Q===null?void 0:Q,t(A(),c([A(),f(),Q0(),x(A())])).optional())}),jK=N({type:j("ref/resource"),uri:A()});var PK=N({type:j("ref/prompt"),name:A()}),bK=q0.extend({ref:c([PK,jK]),argument:N({name:A(),value:A()}),context:N({arguments:t(A(),A()).optional()}).optional()}),EK=W0.extend({method:j("completion/complete"),params:bK});var IK=G0.extend({completion:B0({values:x(A()).max(100),total:a(f().int()),hasMore:a(Q0())})}),TK=N({uri:A().startsWith("file://"),name:A().optional(),_meta:t(A(),o()).optional()}),SK=W0.extend({method:j("roots/list"),params:q0.optional()}),D9=G0.extend({roots:x(TK)}),RK=w0.extend({method:j("notifications/roots/list_changed"),params:N0.optional()}),AZ=c([K4,aQ,EK,H9,y3,v3,Q9,Z3,Y9,E3,T3,K6,z9,D4,F4,L4,O4]),FZ=c([H4,B4,sQ,RK,z6]),LZ=c([z4,K9,B9,V4,D9,A4,U4,E1]),UZ=c([K4,GK,ZK,SK,D4,F4,L4,O4]),OZ=c([H4,B4,t3,R3,P3,d3,l3,z6,wK]),MZ=c([z4,A3,IK,m3,x3,q3,N3,j3,M4,i3,A4,U4,E1]);class C extends Error{constructor(Q,X,Y){super(`MCP error ${Q}: ${X}`);this.code=Q,this.data=Y,this.name="McpError"}static fromError(Q,X,Y){if(Q===_.UrlElicitationRequired&&Y){let W=Y;if(W.elicitations)return new VG(W.elicitations,X)}return new C(Q,X,Y)}}class VG extends C{constructor(Q,X=`URL elicitation${Q.length>1?"s":""} required`){super(_.UrlElicitationRequired,X,{elicitations:Q})}get elicitations(){return this.data?.elicitations??[]}}function X1(Q){return Q==="completed"||Q==="failed"||Q==="cancelled"}var CK=Symbol("Let zodToJsonSchema decide on which parser to use");var tZ=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function A9(Q){let Y=X4(Q)?.method;if(!Y)throw Error("Schema is missing a method literal");let W=EW(Y);if(typeof W!=="string")throw Error("Schema method literal must be a string");return W}function F9(Q,X){let Y=e0(Q,X);if(!Y.success)throw Y.error;return Y.data}var gK=60000;class L9{constructor(Q){if(this._options=Q,this._requestMessageId=0,this._requestHandlers=new Map,this._requestHandlerAbortControllers=new Map,this._notificationHandlers=new Map,this._responseHandlers=new Map,this._progressHandlers=new Map,this._timeoutInfo=new Map,this._pendingDebouncedNotifications=new Set,this._taskProgressTokens=new Map,this._requestResolvers=new Map,this.setNotificationHandler(H4,(X)=>{this._oncancel(X)}),this.setNotificationHandler(B4,(X)=>{this._onprogress(X)}),this.setRequestHandler(K4,(X)=>({})),this._taskStore=Q?.taskStore,this._taskMessageQueue=Q?.taskMessageQueue,this._taskStore)this.setRequestHandler(D4,async(X,Y)=>{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return{...W}}),this.setRequestHandler(F4,async(X,Y)=>{let W=async()=>{let G=X.params.taskId;if(this._taskMessageQueue){let $;while($=await this._taskMessageQueue.dequeue(G,Y.sessionId)){if($.type==="response"||$.type==="error"){let z=$.message,H=z.id,K=this._requestResolvers.get(H);if(K)if(this._requestResolvers.delete(H),$.type==="response")K(z);else{let B=z,D=new C(B.error.code,B.error.message,B.error.data);K(D)}else{let B=$.type==="response"?"Response":"Error";this._onerror(Error(`${B} handler missing for request ${H}`))}continue}await this._transport?.send($.message,{relatedRequestId:Y.requestId})}}let J=await this._taskStore.getTask(G,Y.sessionId);if(!J)throw new C(_.InvalidParams,`Task not found: ${G}`);if(!X1(J.status))return await this._waitForTaskUpdate(G,Y.signal),await W();if(X1(J.status)){let $=await this._taskStore.getTaskResult(G,Y.sessionId);return this._clearTaskQueue(G),{...$,_meta:{...$._meta,[Q1]:{taskId:G}}}}return await W()};return await W()}),this.setRequestHandler(L4,async(X,Y)=>{try{let{tasks:W,nextCursor:G}=await this._taskStore.listTasks(X.params?.cursor,Y.sessionId);return{tasks:W,nextCursor:G,_meta:{}}}catch(W){throw new C(_.InvalidParams,`Failed to list tasks: ${W instanceof Error?W.message:String(W)}`)}}),this.setRequestHandler(O4,async(X,Y)=>{try{let W=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!W)throw new C(_.InvalidParams,`Task not found: ${X.params.taskId}`);if(X1(W.status))throw new C(_.InvalidParams,`Cannot cancel task in terminal status: ${W.status}`);await this._taskStore.updateTaskStatus(X.params.taskId,"cancelled","Client cancelled task execution.",Y.sessionId),this._clearTaskQueue(X.params.taskId);let G=await this._taskStore.getTask(X.params.taskId,Y.sessionId);if(!G)throw new C(_.InvalidParams,`Task not found after cancellation: ${X.params.taskId}`);return{_meta:{},...G}}catch(W){if(W instanceof C)throw W;throw new C(_.InvalidRequest,`Failed to cancel task: ${W instanceof Error?W.message:String(W)}`)}})}async _oncancel(Q){if(!Q.params.requestId)return;this._requestHandlerAbortControllers.get(Q.params.requestId)?.abort(Q.params.reason)}_setupTimeout(Q,X,Y,W,G=!1){this._timeoutInfo.set(Q,{timeoutId:setTimeout(W,X),startTime:Date.now(),timeout:X,maxTotalTimeout:Y,resetTimeoutOnProgress:G,onTimeout:W})}_resetTimeout(Q){let X=this._timeoutInfo.get(Q);if(!X)return!1;let Y=Date.now()-X.startTime;if(X.maxTotalTimeout&&Y>=X.maxTotalTimeout)throw this._timeoutInfo.delete(Q),C.fromError(_.RequestTimeout,"Maximum total timeout exceeded",{maxTotalTimeout:X.maxTotalTimeout,totalElapsed:Y});return clearTimeout(X.timeoutId),X.timeoutId=setTimeout(X.onTimeout,X.timeout),!0}_cleanupTimeout(Q){let X=this._timeoutInfo.get(Q);if(X)clearTimeout(X.timeoutId),this._timeoutInfo.delete(Q)}async connect(Q){this._transport=Q;let X=this.transport?.onclose;this._transport.onclose=()=>{X?.(),this._onclose()};let Y=this.transport?.onerror;this._transport.onerror=(G)=>{Y?.(G),this._onerror(G)};let W=this._transport?.onmessage;this._transport.onmessage=(G,J)=>{if(W?.(G,J),Y6(G)||KG(G))this._onresponse(G);else if(rQ(G))this._onrequest(G,J);else if(HG(G))this._onnotification(G);else this._onerror(Error(`Unknown message type: ${JSON.stringify(G)}`))},await this._transport.start()}_onclose(){let Q=this._responseHandlers;this._responseHandlers=new Map,this._progressHandlers.clear(),this._taskProgressTokens.clear(),this._pendingDebouncedNotifications.clear();let X=C.fromError(_.ConnectionClosed,"Connection closed");this._transport=void 0,this.onclose?.();for(let Y of Q.values())Y(X)}_onerror(Q){this.onerror?.(Q)}_onnotification(Q){let X=this._notificationHandlers.get(Q.method)??this.fallbackNotificationHandler;if(X===void 0)return;Promise.resolve().then(()=>X(Q)).catch((Y)=>this._onerror(Error(`Uncaught error in notification handler: ${Y}`)))}_onrequest(Q,X){let Y=this._requestHandlers.get(Q.method)??this.fallbackRequestHandler,W=this._transport,G=Q.params?._meta?.[Q1]?.taskId;if(Y===void 0){let K={jsonrpc:"2.0",id:Q.id,error:{code:_.MethodNotFound,message:"Method not found"}};if(G&&this._taskMessageQueue)this._enqueueTaskMessage(G,{type:"error",message:K,timestamp:Date.now()},W?.sessionId).catch((B)=>this._onerror(Error(`Failed to enqueue error response: ${B}`)));else W?.send(K).catch((B)=>this._onerror(Error(`Failed to send an error response: ${B}`)));return}let J=new AbortController;this._requestHandlerAbortControllers.set(Q.id,J);let $=JG(Q.params)?Q.params.task:void 0,z=this._taskStore?this.requestTaskStore(Q,W?.sessionId):void 0,H={signal:J.signal,sessionId:W?.sessionId,_meta:Q.params?._meta,sendNotification:async(K)=>{let B={relatedRequestId:Q.id};if(G)B.relatedTask={taskId:G};await this.notification(K,B)},sendRequest:async(K,B,D)=>{let F={...D,relatedRequestId:Q.id};if(G&&!F.relatedTask)F.relatedTask={taskId:G};let U=F.relatedTask?.taskId??G;if(U&&z)await z.updateTaskStatus(U,"input_required");return await this.request(K,B,F)},authInfo:X?.authInfo,requestId:Q.id,requestInfo:X?.requestInfo,taskId:G,taskStore:z,taskRequestedTtl:$?.ttl,closeSSEStream:X?.closeSSEStream,closeStandaloneSSEStream:X?.closeStandaloneSSEStream};Promise.resolve().then(()=>{if($)this.assertTaskHandlerCapability(Q.method)}).then(()=>Y(Q,H)).then(async(K)=>{if(J.signal.aborted)return;let B={result:K,jsonrpc:"2.0",id:Q.id};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"response",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)},async(K)=>{if(J.signal.aborted)return;let B={jsonrpc:"2.0",id:Q.id,error:{code:Number.isSafeInteger(K.code)?K.code:_.InternalError,message:K.message??"Internal error",...K.data!==void 0&&{data:K.data}}};if(G&&this._taskMessageQueue)await this._enqueueTaskMessage(G,{type:"error",message:B,timestamp:Date.now()},W?.sessionId);else await W?.send(B)}).catch((K)=>this._onerror(Error(`Failed to send response: ${K}`))).finally(()=>{this._requestHandlerAbortControllers.delete(Q.id)})}_onprogress(Q){let{progressToken:X,...Y}=Q.params,W=Number(X),G=this._progressHandlers.get(W);if(!G){this._onerror(Error(`Received a progress notification for an unknown token: ${JSON.stringify(Q)}`));return}let J=this._responseHandlers.get(W),$=this._timeoutInfo.get(W);if($&&J&&$.resetTimeoutOnProgress)try{this._resetTimeout(W)}catch(z){this._responseHandlers.delete(W),this._progressHandlers.delete(W),this._cleanupTimeout(W),J(z);return}G(Y)}_onresponse(Q){let X=Number(Q.id),Y=this._requestResolvers.get(X);if(Y){if(this._requestResolvers.delete(X),Y6(Q))Y(Q);else{let J=new C(Q.error.code,Q.error.message,Q.error.data);Y(J)}return}let W=this._responseHandlers.get(X);if(W===void 0){this._onerror(Error(`Received a response for an unknown message ID: ${JSON.stringify(Q)}`));return}this._responseHandlers.delete(X),this._cleanupTimeout(X);let G=!1;if(Y6(Q)&&Q.result&&typeof Q.result==="object"){let J=Q.result;if(J.task&&typeof J.task==="object"){let $=J.task;if(typeof $.taskId==="string")G=!0,this._taskProgressTokens.set($.taskId,X)}}if(!G)this._progressHandlers.delete(X);if(Y6(Q))W(Q);else{let J=C.fromError(Q.error.code,Q.error.message,Q.error.data);W(J)}}get transport(){return this._transport}async close(){await this._transport?.close()}async*requestStream(Q,X,Y){let{task:W}=Y??{};if(!W){try{yield{type:"result",result:await this.request(Q,X,Y)}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}return}let G;try{let J=await this.request(Q,E1,Y);if(J.task)G=J.task.taskId,yield{type:"taskCreated",task:J.task};else throw new C(_.InternalError,"Task creation did not return a task");while(!0){let $=await this.getTask({taskId:G},Y);if(yield{type:"taskStatus",task:$},X1($.status)){if($.status==="completed")yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};else if($.status==="failed")yield{type:"error",error:new C(_.InternalError,`Task ${G} failed`)};else if($.status==="cancelled")yield{type:"error",error:new C(_.InternalError,`Task ${G} was cancelled`)};return}if($.status==="input_required"){yield{type:"result",result:await this.getTaskResult({taskId:G},X,Y)};return}let z=$.pollInterval??this._options?.defaultTaskPollInterval??1000;await new Promise((H)=>setTimeout(H,z)),Y?.signal?.throwIfAborted()}}catch(J){yield{type:"error",error:J instanceof C?J:new C(_.InternalError,String(J))}}}request(Q,X,Y){let{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J,task:$,relatedTask:z}=Y??{};return new Promise((H,K)=>{let B=(V)=>{K(V)};if(!this._transport){B(Error("Not connected"));return}if(this._options?.enforceStrictCapabilities===!0)try{if(this.assertCapabilityForMethod(Q.method),$)this.assertTaskCapability(Q.method)}catch(V){B(V);return}Y?.signal?.throwIfAborted();let D=this._requestMessageId++,F={...Q,jsonrpc:"2.0",id:D};if(Y?.onprogress)this._progressHandlers.set(D,Y.onprogress),F.params={...Q.params,_meta:{...Q.params?._meta||{},progressToken:D}};if($)F.params={...F.params,task:$};if(z)F.params={...F.params,_meta:{...F.params?._meta||{},[Q1]:z}};let U=(V)=>{this._responseHandlers.delete(D),this._progressHandlers.delete(D),this._cleanupTimeout(D),this._transport?.send({jsonrpc:"2.0",method:"notifications/cancelled",params:{requestId:D,reason:String(V)}},{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((E)=>this._onerror(Error(`Failed to send cancellation: ${E}`)));let T=V instanceof C?V:new C(_.RequestTimeout,String(V));K(T)};this._responseHandlers.set(D,(V)=>{if(Y?.signal?.aborted)return;if(V instanceof Error)return K(V);try{let T=e0(X,V.result);if(!T.success)K(T.error);else H(T.data)}catch(T){K(T)}}),Y?.signal?.addEventListener("abort",()=>{U(Y?.signal?.reason)});let O=Y?.timeout??gK,M=()=>U(C.fromError(_.RequestTimeout,"Request timed out",{timeout:O}));this._setupTimeout(D,O,Y?.maxTotalTimeout,M,Y?.resetTimeoutOnProgress??!1);let q=z?.taskId;if(q){let V=(T)=>{let E=this._responseHandlers.get(D);if(E)E(T);else this._onerror(Error(`Response handler missing for side-channeled request ${D}`))};this._requestResolvers.set(D,V),this._enqueueTaskMessage(q,{type:"request",message:F,timestamp:Date.now()}).catch((T)=>{this._cleanupTimeout(D),K(T)})}else this._transport.send(F,{relatedRequestId:W,resumptionToken:G,onresumptiontoken:J}).catch((V)=>{this._cleanupTimeout(D),K(V)})})}async getTask(Q,X){return this.request({method:"tasks/get",params:Q},A4,X)}async getTaskResult(Q,X,Y){return this.request({method:"tasks/result",params:Q},X,Y)}async listTasks(Q,X){return this.request({method:"tasks/list",params:Q},U4,X)}async cancelTask(Q,X){return this.request({method:"tasks/cancel",params:Q},AG,X)}async notification(Q,X){if(!this._transport)throw Error("Not connected");this.assertNotificationCapability(Q.method);let Y=X?.relatedTask?.taskId;if(Y){let $={...Q,jsonrpc:"2.0",params:{...Q.params,_meta:{...Q.params?._meta||{},[Q1]:X.relatedTask}}};await this._enqueueTaskMessage(Y,{type:"notification",message:$,timestamp:Date.now()});return}if((this._options?.debouncedNotificationMethods??[]).includes(Q.method)&&!Q.params&&!X?.relatedRequestId&&!X?.relatedTask){if(this._pendingDebouncedNotifications.has(Q.method))return;this._pendingDebouncedNotifications.add(Q.method),Promise.resolve().then(()=>{if(this._pendingDebouncedNotifications.delete(Q.method),!this._transport)return;let $={...Q,jsonrpc:"2.0"};if(X?.relatedTask)$={...$,params:{...$.params,_meta:{...$.params?._meta||{},[Q1]:X.relatedTask}}};this._transport?.send($,X).catch((z)=>this._onerror(z))});return}let J={...Q,jsonrpc:"2.0"};if(X?.relatedTask)J={...J,params:{...J.params,_meta:{...J.params?._meta||{},[Q1]:X.relatedTask}}};await this._transport.send(J,X)}setRequestHandler(Q,X){let Y=A9(Q);this.assertRequestHandlerCapability(Y),this._requestHandlers.set(Y,(W,G)=>{let J=F9(Q,W);return Promise.resolve(X(J,G))})}removeRequestHandler(Q){this._requestHandlers.delete(Q)}assertCanSetRequestHandler(Q){if(this._requestHandlers.has(Q))throw Error(`A request handler for ${Q} already exists, which would be overridden`)}setNotificationHandler(Q,X){let Y=A9(Q);this._notificationHandlers.set(Y,(W)=>{let G=F9(Q,W);return Promise.resolve(X(G))})}removeNotificationHandler(Q){this._notificationHandlers.delete(Q)}_cleanupTaskProgressHandler(Q){let X=this._taskProgressTokens.get(Q);if(X!==void 0)this._progressHandlers.delete(X),this._taskProgressTokens.delete(Q)}async _enqueueTaskMessage(Q,X,Y){if(!this._taskStore||!this._taskMessageQueue)throw Error("Cannot enqueue task message: taskStore and taskMessageQueue are not configured");let W=this._options?.maxTaskQueueSize;await this._taskMessageQueue.enqueue(Q,X,Y,W)}async _clearTaskQueue(Q,X){if(this._taskMessageQueue){let Y=await this._taskMessageQueue.dequeueAll(Q,X);for(let W of Y)if(W.type==="request"&&rQ(W.message)){let G=W.message.id,J=this._requestResolvers.get(G);if(J)J(new C(_.InternalError,"Task cancelled or completed")),this._requestResolvers.delete(G);else this._onerror(Error(`Resolver missing for request ${G} during task ${Q} cleanup`))}}}async _waitForTaskUpdate(Q,X){let Y=this._options?.defaultTaskPollInterval??1000;try{let W=await this._taskStore?.getTask(Q);if(W?.pollInterval)Y=W.pollInterval}catch{}return new Promise((W,G)=>{if(X.aborted){G(new C(_.InvalidRequest,"Request cancelled"));return}let J=setTimeout(W,Y);X.addEventListener("abort",()=>{clearTimeout(J),G(new C(_.InvalidRequest,"Request cancelled"))},{once:!0})})}requestTaskStore(Q,X){let Y=this._taskStore;if(!Y)throw Error("No task store configured");return{createTask:async(W)=>{if(!Q)throw Error("No request provided");return await Y.createTask(W,Q.id,{method:Q.method,params:Q.params},X)},getTask:async(W)=>{let G=await Y.getTask(W,X);if(!G)throw new C(_.InvalidParams,"Failed to retrieve task: Task not found");return G},storeTaskResult:async(W,G,J)=>{await Y.storeTaskResult(W,G,J,X);let $=await Y.getTask(W,X);if($){let z=z6.parse({method:"notifications/tasks/status",params:$});if(await this.notification(z),X1($.status))this._cleanupTaskProgressHandler(W)}},getTaskResult:(W)=>{return Y.getTaskResult(W,X)},updateTaskStatus:async(W,G,J)=>{let $=await Y.getTask(W,X);if(!$)throw new C(_.InvalidParams,`Task "${W}" not found - it may have been cleaned up`);if(X1($.status))throw new C(_.InvalidParams,`Cannot update task "${W}" from terminal status "${$.status}" to "${G}". Terminal states (completed, failed, cancelled) cannot transition to other states.`);await Y.updateTaskStatus(W,G,J,X);let z=await Y.getTask(W,X);if(z){let H=z6.parse({method:"notifications/tasks/status",params:z});if(await this.notification(H),X1(z.status))this._cleanupTaskProgressHandler(W)}},listTasks:(W)=>{return Y.listTasks(W,X)}}}}function qG(Q){return Q!==null&&typeof Q==="object"&&!Array.isArray(Q)}function ZG(Q,X){let Y={...Q};for(let W in X){let G=W,J=X[G];if(J===void 0)continue;let $=Y[G];if(qG($)&&qG(J))Y[G]={...$,...J};else Y[G]=J}return Y}var az=RX(HX(),1),sz=RX(tz(),1);function nM(){let Q=new az.default({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return sz.default(Q),Q}class VX{constructor(Q){this._ajv=Q??nM()}getValidator(Q){let X="$id"in Q&&typeof Q.$id==="string"?this._ajv.getSchema(Q.$id)??this._ajv.compile(Q):this._ajv.compile(Q);return(Y)=>{if(X(Y))return{valid:!0,data:Y,errorMessage:void 0};else return{valid:!1,data:void 0,errorMessage:this._ajv.errorsText(X.errors)}}}}class qX{constructor(Q){this._server=Q}requestStream(Q,X,Y){return this._server.requestStream(Q,X,Y)}async getTask(Q,X){return this._server.getTask({taskId:Q},X)}async getTaskResult(Q,X,Y){return this._server.getTaskResult({taskId:Q},X,Y)}async listTasks(Q,X){return this._server.listTasks(Q?{cursor:Q}:void 0,X)}async cancelTask(Q,X){return this._server.cancelTask({taskId:Q},X)}}function ez(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"tools/call":if(!Q.tools?.call)throw Error(`${Y} does not support task creation for tools/call (required for ${X})`);break;default:break}}function Q5(Q,X,Y){if(!Q)throw Error(`${Y} does not support task creation (required for ${X})`);switch(X){case"sampling/createMessage":if(!Q.sampling?.createMessage)throw Error(`${Y} does not support task creation for sampling/createMessage (required for ${X})`);break;case"elicitation/create":if(!Q.elicitation?.create)throw Error(`${Y} does not support task creation for elicitation/create (required for ${X})`);break;default:break}}class ZX extends L9{constructor(Q,X){super(X);if(this._serverInfo=Q,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(B6.options.map((Y,W)=>[Y,W])),this.isMessageIgnored=(Y,W)=>{let G=this._loggingLevels.get(W);return G?this.LOG_LEVEL_SEVERITY.get(Y)<this.LOG_LEVEL_SEVERITY.get(G):!1},this._capabilities=X?.capabilities??{},this._instructions=X?.instructions,this._jsonSchemaValidator=X?.jsonSchemaValidator??new VX,this.setRequestHandler(aQ,(Y)=>this._oninitialize(Y)),this.setNotificationHandler(sQ,()=>this.oninitialized?.()),this._capabilities.logging)this.setRequestHandler(H9,async(Y,W)=>{let G=W.sessionId||W.requestInfo?.headers["mcp-session-id"]||void 0,{level:J}=Y.params,$=B6.safeParse(J);if($.success)this._loggingLevels.set(G,$.data);return{}})}get experimental(){if(!this._experimental)this._experimental={tasks:new qX(this)};return this._experimental}registerCapabilities(Q){if(this.transport)throw Error("Cannot register capabilities after connecting to transport");this._capabilities=ZG(this._capabilities,Q)}setRequestHandler(Q,X){let W=X4(Q)?.method;if(!W)throw Error("Schema is missing a method literal");let G;if(P1(W)){let $=W;G=$._zod?.def?.value??$.value}else{let $=W;G=$._def?.value??$.value}if(typeof G!=="string")throw Error("Schema method literal must be a string");if(G==="tools/call"){let $=async(z,H)=>{let K=e0(K6,z);if(!K.success){let U=K.error instanceof Error?K.error.message:String(K.error);throw new C(_.InvalidParams,`Invalid tools/call request: ${U}`)}let{params:B}=K.data,D=await Promise.resolve(X(z,H));if(B.task){let U=e0(E1,D);if(!U.success){let O=U.error instanceof Error?U.error.message:String(U.error);throw new C(_.InvalidParams,`Invalid task creation result: ${O}`)}return U.data}let F=e0(M4,D);if(!F.success){let U=F.error instanceof Error?F.error.message:String(F.error);throw new C(_.InvalidParams,`Invalid tools/call result: ${U}`)}return F.data};return super.setRequestHandler(Q,$)}return super.setRequestHandler(Q,X)}assertCapabilityForMethod(Q){switch(Q){case"sampling/createMessage":if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${Q})`);break;case"elicitation/create":if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${Q})`);break;case"roots/list":if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${Q})`);break;case"ping":break}}assertNotificationCapability(Q){switch(Q){case"notifications/message":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"notifications/resources/updated":case"notifications/resources/list_changed":if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${Q})`);break;case"notifications/tools/list_changed":if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${Q})`);break;case"notifications/prompts/list_changed":if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${Q})`);break;case"notifications/elicitation/complete":if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${Q})`);break;case"notifications/cancelled":break;case"notifications/progress":break}}assertRequestHandlerCapability(Q){if(!this._capabilities)return;switch(Q){case"completion/complete":if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${Q})`);break;case"logging/setLevel":if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${Q})`);break;case"prompts/get":case"prompts/list":if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${Q})`);break;case"resources/list":case"resources/templates/list":case"resources/read":if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${Q})`);break;case"tools/call":case"tools/list":if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${Q})`);break;case"tasks/get":case"tasks/list":case"tasks/result":case"tasks/cancel":if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${Q})`);break;case"ping":case"initialize":break}}assertTaskCapability(Q){Q5(this._clientCapabilities?.tasks?.requests,Q,"Client")}assertTaskHandlerCapability(Q){if(!this._capabilities)return;ez(this._capabilities.tasks?.requests,Q,"Server")}async _oninitialize(Q){let X=Q.params.protocolVersion;return this._clientCapabilities=Q.params.capabilities,this._clientVersion=Q.params.clientInfo,{protocolVersion:YG.includes(X)?X:nQ,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:"ping"},z4)}async createMessage(Q,X){if(Q.tools||Q.toolChoice){if(!this._clientCapabilities?.sampling?.tools)throw Error("Client does not support sampling tools capability.")}if(Q.messages.length>0){let Y=Q.messages[Q.messages.length-1],W=Array.isArray(Y.content)?Y.content:[Y.content],G=W.some((H)=>H.type==="tool_result"),J=Q.messages.length>1?Q.messages[Q.messages.length-2]:void 0,$=J?Array.isArray(J.content)?J.content:[J.content]:[],z=$.some((H)=>H.type==="tool_use");if(G){if(W.some((H)=>H.type!=="tool_result"))throw Error("The last message must contain only tool_result content if any is present");if(!z)throw Error("tool_result blocks are not matching any tool_use from the previous message")}if(z){let H=new Set($.filter((B)=>B.type==="tool_use").map((B)=>B.id)),K=new Set(W.filter((B)=>B.type==="tool_result").map((B)=>B.toolUseId));if(H.size!==K.size||![...H].every((B)=>K.has(B)))throw Error("ids of tool_result blocks and tool_use blocks from previous message do not match")}}if(Q.tools)return this.request({method:"sampling/createMessage",params:Q},B9,X);return this.request({method:"sampling/createMessage",params:Q},K9,X)}async elicitInput(Q,X){switch(Q.mode??"form"){case"url":{if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support url elicitation.");let W=Q;return this.request({method:"elicitation/create",params:W},V4,X)}case"form":{if(!this._clientCapabilities?.elicitation?.form)throw Error("Client does not support form elicitation.");let W=Q.mode==="form"?Q:{...Q,mode:"form"},G=await this.request({method:"elicitation/create",params:W},V4,X);if(G.action==="accept"&&G.content&&W.requestedSchema)try{let $=this._jsonSchemaValidator.getValidator(W.requestedSchema)(G.content);if(!$.valid)throw new C(_.InvalidParams,`Elicitation response content does not match requested schema: ${$.errorMessage}`)}catch(J){if(J instanceof C)throw J;throw new C(_.InternalError,`Error validating elicitation response: ${J instanceof Error?J.message:String(J)}`)}return G}}}createElicitationCompletionNotifier(Q,X){if(!this._clientCapabilities?.elicitation?.url)throw Error("Client does not support URL elicitation (required for notifications/elicitation/complete)");return()=>this.notification({method:"notifications/elicitation/complete",params:{elicitationId:Q}},X)}async listRoots(Q,X){return this.request({method:"roots/list",params:Q},D9,X)}async sendLoggingMessage(Q,X){if(this._capabilities.logging){if(!this.isMessageIgnored(Q.level,X))return this.notification({method:"notifications/message",params:Q})}}async sendResourceUpdated(Q){return this.notification({method:"notifications/resources/updated",params:Q})}async sendResourceListChanged(){return this.notification({method:"notifications/resources/list_changed"})}async sendToolListChanged(){return this.notification({method:"notifications/tools/list_changed"})}async sendPromptListChanged(){return this.notification({method:"notifications/prompts/list_changed"})}}import Y5 from"node:process";class NX{append(Q){this._buffer=this._buffer?Buffer.concat([this._buffer,Q]):Q}readMessage(){if(!this._buffer)return null;let Q=this._buffer.indexOf(`
|
|
29
29
|
`);if(Q===-1)return null;let X=this._buffer.toString("utf8",0,Q).replace(/\r$/,"");return this._buffer=this._buffer.subarray(Q+1),dM(X)}clear(){this._buffer=void 0}}function dM(Q){return BG.parse(JSON.parse(Q))}function X5(Q){return JSON.stringify(Q)+`
|
|
30
|
-
`}class wX{constructor(Q=Y5.stdin,X=Y5.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new NX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}async start(){if(this._started)throw 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(){while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(Q){return new Promise((X)=>{let Y=X5(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var W5={name:"@sequenzy/mcp",version:"0.0.
|
|
31
|
-
`)}var jX=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],G5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function aM(Q){let Y=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return Y.length>0?Y:"https://sequenzy.com"}function r0(Q){let X=Q?.trim();return X?X:void 0}function K1(Q){return encodeURIComponent(Q)}function z0(Q,X){return`${Q}${X}`}function H0(Q,X=""){return`/dashboard/company/${K1(Q)}${X}`}function J5(Q,X,Y){return z0(Q,`${H0(X,"/settings")}?tab=${encodeURIComponent(Y)}`)}function sM(Q,X){let Y=jX.map((W)=>[W,X?J5(Q,X,W):""]);return Object.fromEntries(Y)}function B1(Q={},X){let Y=aM(X),W=r0(Q.companyId),G={},J=sM(Y,W);if(!W)return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J};G.dashboard=z0(Y,H0(W)),G.campaigns=z0(Y,H0(W,"/campaign")),G.sequences=z0(Y,H0(W,"/sequences")),G.settings=z0(Y,H0(W,"/settings")),G.emails=z0(Y,H0(W,"/emails")),G.subscribers=z0(Y,H0(W,"/subscribers")),G.segments=z0(Y,H0(W,"/segments")),G.metrics=z0(Y,H0(W,"/metrics")),G.transactional=z0(Y,H0(W,"/transactional"));let $=r0(Q.campaignId);if($)G.campaign=z0(Y,H0(W,`/campaign/${K1($)}`));let z=r0(Q.sequenceId);if(z)G.sequence=z0(Y,H0(W,`/sequences/${K1(z)}`));let H=r0(Q.emailId)??r0(Q.templateId);if(H)G.email=z0(Y,H0(W,`/emails/${K1(H)}`)),G.template=G.email;let K=r0(Q.transactionalId);if(K)G.transactionalEmail=z0(Y,H0(W,`/transactional/${K1(K)}`));let B=r0(Q.domainId);if(B)G.domain=z0(Y,H0(W,`/settings/domain/${K1(B)}`)),G.domainVerify=`${G.domain}/verify`;let D=r0(Q.status);if(D)G.campaignList=z0(Y,H0(W,`/campaign/list/${K1(D)}`)),G.sequenceList=z0(Y,H0(W,`/sequences/list/${K1(D)}`));let F=r0(Q.settingsTab);if(F)G.settingsTab=J5(Y,W,F);return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J}}var $5=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",mimeType:"application/json"},{uri:"sequenzy://campaigns/recent",name:"Recent Campaigns",description:"Last 10 campaigns with status and basic stats",mimeType:"application/json"},{uri:"sequenzy://subscribers/recent",name:"Recent Subscribers",description:"Most recently added subscribers",mimeType:"application/json"},{uri:"sequenzy://subscribers/engaged",name:"Engaged Subscribers",description:"Most active/engaged subscribers",mimeType:"application/json"},{uri:"sequenzy://sequences",name:"Sequences",description:"All email sequences with status",mimeType:"application/json"},{uri:"sequenzy://templates",name:"Templates",description:"All available email templates with localization status",mimeType:"application/json"},{uri:"sequenzy://segments",name:"Segments",description:"All defined segments with subscriber counts",mimeType:"application/json"},{uri:"sequenzy://tags",name:"Tags",description:"All tags with usage counts",mimeType:"application/json"},{uri:"sequenzy://health",name:"Deliverability Health",description:"Email deliverability metrics and health status",mimeType:"application/json"},{uri:"sequenzy://app-routes",name:"Dashboard URL Routes",description:"Route templates and settings tabs for building Sequenzy dashboard links",mimeType:"application/json"}];async function z5(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await w("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await w("GET","/api/v1/account"),W=_6()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await w("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await w("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await w("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await w("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await w("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await w("GET","/api/v1/templates");break;case"sequenzy://segments":X=await w("GET","/api/v1/segments");break;case"sequenzy://tags":X=await w("GET","/api/v1/tags");break;case"sequenzy://health":X=await w("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":X=B1();break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(X,null,2)}]}}catch(X){return{contents:[{uri:Q,mimeType:"text/plain",text:q1(X)}]}}}var eM={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","stripeProduct"],description:"Filter field. Use `stripeProduct` for Stripe purchase-based segments. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},operator:{type:"string",enum:["is","is_not","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds. Engagement examples: `7d`, `30d`, `90d`, `180d`, `all` for rolling time windows, or `campaign:<campaign_id>` to scope to a specific sent campaign (use `list_campaigns` to find IDs)."}},required:["field","operator","value"],additionalProperties:!1};function QV(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(typeof X!=="object"||X===null)return X;let Y=X;if(typeof Y.id==="string"&&Y.id.trim()!=="")return Y;return{...Y,id:crypto.randomUUID()}})}function WQ(Q,X,Y){if(X.html!==void 0&&X.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(X.blocks!==void 0&&!Array.isArray(X.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(Y?.requireContent&&X.html===void 0&&X.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function XV(Q){if(!Q||typeof Q!=="object")return null;let X=Q;if(X.success!==!1)return null;if(typeof X.error==="string")return Error(X.error);if(X.error&&typeof X.error==="object"&&typeof X.error.message==="string")return Error(X.error.message);if(typeof X.message==="string")return Error(X.message);return Error("The tool returned an unsuccessful response.")}function g0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function H5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function YV(Q){let X=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")X.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)X.set("tags",Q.tags.filter((Y)=>typeof Y==="string"&&Y.trim()!=="").join(","));if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")X.set("segmentId",Q.segmentId);return X.set("page",String(Q.page)),X.set("limit",String(Q.pageSize)),X}async function WV(Q,X){let Y=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,Y??100)),G=[],J=1,$=0,z=0,H=0;while(!0){let B=YV({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),D=await w("GET",`/api/v1/subscribers?${B.toString()}`,void 0,X);$=D.pagination?.total??D.subscribers.length,z=D.pagination?.totalPages??1,H+=1,G.push(...D.subscribers??[]);let F=Y!==void 0&&G.length>=Y,U=D.pagination?J>=D.pagination.totalPages:(D.subscribers??[]).length<W;if(F||U)break;J+=1}let K=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:K,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:K.length,truncated:Y!==void 0&&$>0&&K.length<$}}async function PX(Q,X){return w("GET",`/api/v1/subscribers/${encodeURIComponent(Q)}`,void 0,X)}function p(Q,X){let Y=Q[X];if(typeof Y!=="string")return;let W=Y.trim();return W.length>0?W:void 0}async function K5(Q){let X=p(Q,"companyId");if(X)return X;let Y=_6();if(Y)return Y;try{return(await w("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function GQ(Q,X){if(!g0(Q)||!X)return Q;return{...Q,url:X}}function bX(Q,X,Y){if(!Array.isArray(Q)||!X)return Q;return Q.map((W)=>{if(!g0(W))return W;let G=p(W,"id");if(!G)return W;let J=B1({companyId:X,...Y==="campaign"&&{campaignId:G},...Y==="sequence"&&{sequenceId:G},...Y==="template"&&{emailId:G}}),$=Y==="campaign"?J.urls.campaign:Y==="sequence"?J.urls.sequence:J.urls.email;return GQ(W,$)})}function GV(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(!g0(X))return X;let Y=p(X,"id");if(!Y)return X;let W=B1({companyId:Y});return{...X,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var JV=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","create_campaign","update_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","list_templates","get_template","create_template","update_template"]);async function $V(Q,X,Y){if(!g0(Y)||!JV.has(Q))return Y;let W=g0(Y.company)?Y.company:void 0,J=p(Y,"selectedCompanyId")??p(Y,"currentCompanyId")??p(Y,"companyId")??(W?p(W,"id"):void 0)??(W?p(W,"companyId"):void 0)??await K5(X);if(!J)return Y;let $=g0(Y.campaign)?Y.campaign:void 0,z=g0(Y.sequence)?Y.sequence:void 0,H=g0(Y.template)?Y.template:void 0,K={companyId:J,campaignId:p(X,"campaignId")??p(Y,"campaignId")??($?p($,"id"):void 0),sequenceId:p(X,"sequenceId")??p(Y,"sequenceId")??(z?p(z,"id"):void 0),emailId:p(X,"templateId")??p(Y,"templateId")??(H?p(H,"id"):void 0),status:p(X,"status")},B=B1(K),D=W?B1({companyId:J}):void 0;return{...Y,...Array.isArray(Y.companies)&&{companies:GV(Y.companies)},...Array.isArray(Y.campaigns)&&{campaigns:bX(Y.campaigns,J,"campaign")},...Array.isArray(Y.sequences)&&{sequences:bX(Y.sequences,J,"sequence")},...Array.isArray(Y.templates)&&{templates:bX(Y.templates,J,"template")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...$&&B.urls.campaign!==void 0&&{campaign:GQ($,B.urls.campaign)},...z&&B.urls.sequence!==void 0&&{sequence:GQ(z,B.urls.sequence)},...H&&B.urls.email!==void 0&&{template:GQ(H,B.urls.email)},appUrls:B.urls}}var B5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
30
|
+
`}class wX{constructor(Q=Y5.stdin,X=Y5.stdout){this._stdin=Q,this._stdout=X,this._readBuffer=new NX,this._started=!1,this._ondata=(Y)=>{this._readBuffer.append(Y),this.processReadBuffer()},this._onerror=(Y)=>{this.onerror?.(Y)}}async start(){if(this._started)throw 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(){while(!0)try{let Q=this._readBuffer.readMessage();if(Q===null)break;this.onmessage?.(Q)}catch(Q){this.onerror?.(Q)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(Q){return new Promise((X)=>{let Y=X5(Q);if(this._stdout.write(Y))X();else this._stdout.once("drain",X)})}}var W5={name:"@sequenzy/mcp",version:"0.0.15",mcpName:"io.github.polnikale/sequenzy-mcp",description:"Sequenzy MCP server for AI-powered email marketing automation",type:"module",bin:{"sequenzy-mcp":"dist/index.js"},main:"./dist/index.js",exports:{".":"./dist/index.js","./server.json":"./server.json"},scripts:{dev:"bun --watch src/index.ts",build:"bun build src/index.ts --outdir dist --target node --minify",start:"node dist/index.js","type-check":"tsc --noEmit",test:"bun test","test:watch":"bun test --watch",prepublishOnly:"bun run build"},dependencies:{"@modelcontextprotocol/sdk":"^1.0.0"},devDependencies:{"@types/bun":"latest","@types/node":"^22.0.0","bun-types":"latest",typescript:"^5.8.0"},files:["dist","server.json"],keywords:["sequenzy","email","mcp","ai","claude","automation"],license:"MIT",publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/sequenzy/sequenzy.git"}};class u1 extends Error{statusCode;rawDetails;code;constructor(Q,X,Y,W){super(Q);this.statusCode=X;this.rawDetails=Y;this.code=W;this.name="McpApiError"}}function oM(Q){if(Q instanceof u1)return{message:Q.message,statusCode:Q.statusCode,code:Q.code,rawDetails:Q.rawDetails};if(Q instanceof Error)return{message:Q.message};return{message:String(Q)}}function tM(Q){let X=oM(Q),Y=X.message.trim()||"Unknown error",W=Y.toLowerCase(),G=X.rawDetails?.trim()||Y;if(X.code==="MCP_AUTH_REQUIRED"||W.includes("sequenzy_api_key environment variable is required"))return{title:"Missing MCP API key",description:"The MCP server started without a Sequenzy API key, so it cannot authenticate any tool or resource request.",howToFix:"Add `SEQUENZY_API_KEY` to the MCP server environment, or run `npx @sequenzy/setup` to configure the integration automatically.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===401||X.code==="UNAUTHORIZED")return{title:"Authentication failed",description:"The MCP server reached Sequenzy, but the current API key was rejected.",howToFix:"Replace `SEQUENZY_API_KEY` with a valid personal API key, then restart the MCP client so it reconnects with fresh credentials.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(X.statusCode===403||W.includes("access denied"))return{title:"Access denied",description:"The current API key is valid, but it does not have permission to access the requested company or action.",howToFix:"Use an API key that belongs to the right account, or select a company the key can access before retrying the tool call.",docsUrl:"https://docs.sequenzy.com/authentication",details:G};if(W.includes("no company available")||W.includes("company not found"))return{title:"Company selection required",description:"The MCP server could not resolve a company for this request.",howToFix:"Call `get_account` to inspect available companies, then call `select_company`, or pass `companyId` explicitly in the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===404||W.includes("not found"))return{title:"Requested resource not found",description:"Sequenzy could not find the requested campaign, template, sequence, company, or subscriber.",howToFix:"List or fetch the resource collection first, then retry the tool with a confirmed ID or email value.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode===429||W.includes("rate limit"))return{title:"Rate limited",description:"Sequenzy temporarily slowed this MCP request because too many requests were sent too quickly.",howToFix:"Wait briefly before retrying. If the client is looping, reduce retries or add backoff before the next tool call.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.code==="NETWORK_ERROR"||W.includes("fetch failed"))return{title:"Network or configuration error",description:"The MCP server could not reach the Sequenzy API from this environment.",howToFix:"Check connectivity and verify `SEQUENZY_API_URL` if you override it in the MCP environment.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("unknown tool")||W.includes("unknown resource"))return{title:"Unsupported MCP request",description:"The client asked for a tool or resource name that this Sequenzy MCP server does not expose.",howToFix:"Refresh the client's tool list and call only the names returned by `list_tools` or `list_resources`.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(W.includes("is required")||W.includes("invalid"))return{title:"Invalid MCP input",description:"The tool call was missing a required field or included an invalid value.",howToFix:"Review the tool schema, supply the missing argument, and retry the request with corrected input.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};if(X.statusCode&&X.statusCode>=500)return{title:"Sequenzy server error",description:"The request reached Sequenzy, but the server could not complete it successfully.",howToFix:"Retry once. If it still fails, keep the details below and consult the docs before escalating.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G};return{title:"Tool execution failed",description:"The MCP server could not complete the requested operation.",howToFix:"Review the details below, adjust the tool input or credentials, and retry.",docsUrl:"https://docs.sequenzy.com/concepts/mcp",details:G}}function q1(Q){let X=tM(Q);return[`Sequenzy MCP error: ${X.title}`,`Description: ${X.description}`,`How to fix: ${X.howToFix}`,`Docs: ${X.docsUrl}`,`Details: ${X.details}`].join(`
|
|
31
|
+
`)}var jX=["product-info","domain","tracking","localization","integrations","products","events","tags","labels","goals","sync-rules","api-keys","widgets","team","danger"],G5={dashboard:"/dashboard/company/{companyId}",campaigns:"/dashboard/company/{companyId}/campaign",campaign:"/dashboard/company/{companyId}/campaign/{campaignId}",campaignList:"/dashboard/company/{companyId}/campaign/list/{status}",sequences:"/dashboard/company/{companyId}/sequences",sequence:"/dashboard/company/{companyId}/sequences/{sequenceId}",sequenceList:"/dashboard/company/{companyId}/sequences/list/{status}",settings:"/dashboard/company/{companyId}/settings",settingsTab:"/dashboard/company/{companyId}/settings?tab={tab}",emails:"/dashboard/company/{companyId}/emails",email:"/dashboard/company/{companyId}/emails/{emailId}",subscribers:"/dashboard/company/{companyId}/subscribers",segments:"/dashboard/company/{companyId}/segments",metrics:"/dashboard/company/{companyId}/metrics",transactional:"/dashboard/company/{companyId}/transactional",transactionalEmail:"/dashboard/company/{companyId}/transactional/{transactionalId}",domain:"/dashboard/company/{companyId}/settings/domain/{domainId}",domainVerify:"/dashboard/company/{companyId}/settings/domain/{domainId}/verify"};function aM(Q){let Y=(Q??process.env.SEQUENZY_APP_URL??"https://sequenzy.com").trim().replace(/\/+$/,"");return Y.length>0?Y:"https://sequenzy.com"}function r0(Q){let X=Q?.trim();return X?X:void 0}function K1(Q){return encodeURIComponent(Q)}function z0(Q,X){return`${Q}${X}`}function H0(Q,X=""){return`/dashboard/company/${K1(Q)}${X}`}function J5(Q,X,Y){return z0(Q,`${H0(X,"/settings")}?tab=${encodeURIComponent(Y)}`)}function sM(Q,X){let Y=jX.map((W)=>[W,X?J5(Q,X,W):""]);return Object.fromEntries(Y)}function B1(Q={},X){let Y=aM(X),W=r0(Q.companyId),G={},J=sM(Y,W);if(!W)return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J};G.dashboard=z0(Y,H0(W)),G.campaigns=z0(Y,H0(W,"/campaign")),G.sequences=z0(Y,H0(W,"/sequences")),G.settings=z0(Y,H0(W,"/settings")),G.emails=z0(Y,H0(W,"/emails")),G.subscribers=z0(Y,H0(W,"/subscribers")),G.segments=z0(Y,H0(W,"/segments")),G.metrics=z0(Y,H0(W,"/metrics")),G.transactional=z0(Y,H0(W,"/transactional"));let $=r0(Q.campaignId);if($)G.campaign=z0(Y,H0(W,`/campaign/${K1($)}`));let z=r0(Q.sequenceId);if(z)G.sequence=z0(Y,H0(W,`/sequences/${K1(z)}`));let H=r0(Q.emailId)??r0(Q.templateId);if(H)G.email=z0(Y,H0(W,`/emails/${K1(H)}`)),G.template=G.email;let K=r0(Q.transactionalId);if(K)G.transactionalEmail=z0(Y,H0(W,`/transactional/${K1(K)}`));let B=r0(Q.domainId);if(B)G.domain=z0(Y,H0(W,`/settings/domain/${K1(B)}`)),G.domainVerify=`${G.domain}/verify`;let D=r0(Q.status);if(D)G.campaignList=z0(Y,H0(W,`/campaign/list/${K1(D)}`)),G.sequenceList=z0(Y,H0(W,`/sequences/list/${K1(D)}`));let F=r0(Q.settingsTab);if(F)G.settingsTab=J5(Y,W,F);return{appUrl:Y,routeTemplates:G5,settingsTabValues:jX,urls:G,settingsUrls:J}}var $5=[{uri:"sequenzy://dashboard",name:"Dashboard Overview",description:"Live overview stats for the last 7 days",mimeType:"application/json"},{uri:"sequenzy://company",name:"Current Company",description:"The currently selected company, including localization settings",mimeType:"application/json"},{uri:"sequenzy://campaigns/recent",name:"Recent Campaigns",description:"Last 10 campaigns with status and basic stats",mimeType:"application/json"},{uri:"sequenzy://subscribers/recent",name:"Recent Subscribers",description:"Most recently added subscribers",mimeType:"application/json"},{uri:"sequenzy://subscribers/engaged",name:"Engaged Subscribers",description:"Most active/engaged subscribers",mimeType:"application/json"},{uri:"sequenzy://sequences",name:"Sequences",description:"All email sequences with status",mimeType:"application/json"},{uri:"sequenzy://templates",name:"Templates",description:"All available email templates with localization status",mimeType:"application/json"},{uri:"sequenzy://segments",name:"Segments",description:"All defined segments with subscriber counts",mimeType:"application/json"},{uri:"sequenzy://tags",name:"Tags",description:"All tags with usage counts",mimeType:"application/json"},{uri:"sequenzy://health",name:"Deliverability Health",description:"Email deliverability metrics and health status",mimeType:"application/json"},{uri:"sequenzy://app-routes",name:"Dashboard URL Routes",description:"Route templates and settings tabs for building Sequenzy dashboard links",mimeType:"application/json"}];async function z5(Q){try{let X;switch(Q){case"sequenzy://dashboard":X=await w("GET","/api/v1/metrics?period=7d");break;case"sequenzy://company":{let Y=await w("GET","/api/v1/account"),W=_6()??Y.currentCompanyId;if(!W)throw Error("No company available. Create or select a company first.");X=await w("GET",`/api/v1/companies/${W}`);break}case"sequenzy://campaigns/recent":X=await w("GET","/api/v1/campaigns?limit=10");break;case"sequenzy://subscribers/recent":X=await w("GET","/api/v1/subscribers?sort=createdAt&limit=20");break;case"sequenzy://subscribers/engaged":X=await w("GET","/api/v1/subscribers?sort=engagement&limit=20");break;case"sequenzy://sequences":X=await w("GET","/api/v1/sequences");break;case"sequenzy://templates":X=await w("GET","/api/v1/templates");break;case"sequenzy://segments":X=await w("GET","/api/v1/segments");break;case"sequenzy://tags":X=await w("GET","/api/v1/tags");break;case"sequenzy://health":X=await w("GET","/api/v1/health/deliverability");break;case"sequenzy://app-routes":X=B1();break;default:throw Error(`Unknown resource: ${Q}`)}return{contents:[{uri:Q,mimeType:"application/json",text:JSON.stringify(X,null,2)}]}}catch(X){return{contents:[{uri:Q,mimeType:"text/plain",text:q1(X)}]}}}var eM={type:"object",properties:{id:{type:"string",description:"Optional filter ID. Any stable string works; one will be generated if omitted."},field:{type:"string",enum:["status","tag","email","added","firstName","lastName","list","emailSent","emailOpened","emailClicked","emailBounced","emailComplained","attribute","stripeProduct"],description:"Filter field. Use `stripeProduct` for Stripe purchase-based segments. Engagement fields (`emailSent`, `emailOpened`, `emailClicked`, `emailBounced`, `emailComplained`) accept a time range as the value or a specific campaign via `campaign:<campaign_id>`."},operator:{type:"string",enum:["is","is_not","is_empty","is_not_empty","contains","not_contains","less_than","more_than","at_least","less_than_count","gte","lte","gt","lt"],description:"Filter operator. Use `is_empty` or `is_not_empty` for fields that can be blank, including custom attributes. For `stripeProduct`, use `is` or `is_not` with a raw product ID, and `at_least` or `less_than_count` with `productId:count`. For engagement fields, use `is` (event happened) or `is_not` (event did not happen)."},value:{type:"string",description:"Filter value. For custom attribute empty checks, use `attributeName:` such as `last_logged_in:`. Stripe product examples: `prod_123` for bought/didn't buy, `prod_123:3` for payment thresholds. Engagement examples: `7d`, `30d`, `90d`, `180d`, `all` for rolling time windows, or `campaign:<campaign_id>` to scope to a specific sent campaign (use `list_campaigns` to find IDs)."}},required:["field","operator","value"],additionalProperties:!1};function QV(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(typeof X!=="object"||X===null)return X;let Y=X;if(typeof Y.id==="string"&&Y.id.trim()!=="")return Y;return{...Y,id:crypto.randomUUID()}})}function WQ(Q,X,Y){if(X.html!==void 0&&X.blocks!==void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`, not both.`);if(X.blocks!==void 0&&!Array.isArray(X.blocks))throw Error(`\`blocks\` must be an array when calling \`${Q}\`.`);if(Y?.requireContent&&X.html===void 0&&X.blocks===void 0)throw Error(`Provide either \`html\` or \`blocks\` when calling \`${Q}\`.`)}function XV(Q){if(!Q||typeof Q!=="object")return null;let X=Q;if(X.success!==!1)return null;if(typeof X.error==="string")return Error(X.error);if(X.error&&typeof X.error==="object"&&typeof X.error.message==="string")return Error(X.error.message);if(typeof X.message==="string")return Error(X.message);return Error("The tool returned an unsuccessful response.")}function g0(Q){return typeof Q==="object"&&Q!==null&&!Array.isArray(Q)}function H5(Q){return Q.trim().toLowerCase().replace(/\s+/g,"-")}function YV(Q){let X=new URLSearchParams;if(typeof Q.query==="string"&&Q.query.trim()!=="")X.set("query",Q.query.trim());if(Array.isArray(Q.tags)&&Q.tags.length>0)X.set("tags",Q.tags.filter((Y)=>typeof Y==="string"&&Y.trim()!=="").join(","));if(typeof Q.segmentId==="string"&&Q.segmentId.trim()!=="")X.set("segmentId",Q.segmentId);return X.set("page",String(Q.page)),X.set("limit",String(Q.pageSize)),X}async function WV(Q,X){let Y=typeof Q.limit==="number"&&Number.isFinite(Q.limit)?Math.max(1,Math.trunc(Q.limit)):void 0,W=Math.min(100,Math.max(1,Y??100)),G=[],J=1,$=0,z=0,H=0;while(!0){let B=YV({query:Q.query,tags:Q.tags,segmentId:Q.segmentId,page:J,pageSize:W}),D=await w("GET",`/api/v1/subscribers?${B.toString()}`,void 0,X);$=D.pagination?.total??D.subscribers.length,z=D.pagination?.totalPages??1,H+=1,G.push(...D.subscribers??[]);let F=Y!==void 0&&G.length>=Y,U=D.pagination?J>=D.pagination.totalPages:(D.subscribers??[]).length<W;if(F||U)break;J+=1}let K=Y!==void 0?G.slice(0,Y):G;return{success:!0,subscribers:K,pagination:{page:1,limit:W,total:$,totalPages:z,fetchedPages:H},returned:K.length,truncated:Y!==void 0&&$>0&&K.length<$}}async function PX(Q,X){return w("GET",`/api/v1/subscribers/${encodeURIComponent(Q)}`,void 0,X)}function p(Q,X){let Y=Q[X];if(typeof Y!=="string")return;let W=Y.trim();return W.length>0?W:void 0}async function K5(Q){let X=p(Q,"companyId");if(X)return X;let Y=_6();if(Y)return Y;try{return(await w("GET","/api/v1/account")).currentCompanyId??void 0}catch{return}}function GQ(Q,X){if(!g0(Q)||!X)return Q;return{...Q,url:X}}function bX(Q,X,Y){if(!Array.isArray(Q)||!X)return Q;return Q.map((W)=>{if(!g0(W))return W;let G=p(W,"id");if(!G)return W;let J=B1({companyId:X,...Y==="campaign"&&{campaignId:G},...Y==="sequence"&&{sequenceId:G},...Y==="template"&&{emailId:G}}),$=Y==="campaign"?J.urls.campaign:Y==="sequence"?J.urls.sequence:J.urls.email;return GQ(W,$)})}function GV(Q){if(!Array.isArray(Q))return Q;return Q.map((X)=>{if(!g0(X))return X;let Y=p(X,"id");if(!Y)return X;let W=B1({companyId:Y});return{...X,url:W.urls.dashboard,settingsUrl:W.urls.settings}})}var JV=new Set(["get_account","select_company","create_company","get_company","list_campaigns","get_campaign","create_campaign","update_campaign","send_test_email","list_sequences","get_sequence","create_sequence","update_sequence","enable_sequence","disable_sequence","list_templates","get_template","create_template","update_template"]);async function $V(Q,X,Y){if(!g0(Y)||!JV.has(Q))return Y;let W=g0(Y.company)?Y.company:void 0,J=p(Y,"selectedCompanyId")??p(Y,"currentCompanyId")??p(Y,"companyId")??(W?p(W,"id"):void 0)??(W?p(W,"companyId"):void 0)??await K5(X);if(!J)return Y;let $=g0(Y.campaign)?Y.campaign:void 0,z=g0(Y.sequence)?Y.sequence:void 0,H=g0(Y.template)?Y.template:void 0,K={companyId:J,campaignId:p(X,"campaignId")??p(Y,"campaignId")??($?p($,"id"):void 0),sequenceId:p(X,"sequenceId")??p(Y,"sequenceId")??(z?p(z,"id"):void 0),emailId:p(X,"templateId")??p(Y,"templateId")??(H?p(H,"id"):void 0),status:p(X,"status")},B=B1(K),D=W?B1({companyId:J}):void 0;return{...Y,...Array.isArray(Y.companies)&&{companies:GV(Y.companies)},...Array.isArray(Y.campaigns)&&{campaigns:bX(Y.campaigns,J,"campaign")},...Array.isArray(Y.sequences)&&{sequences:bX(Y.sequences,J,"sequence")},...Array.isArray(Y.templates)&&{templates:bX(Y.templates,J,"template")},...W&&D!==void 0&&{company:{...W,url:D.urls.dashboard,settingsUrl:D.urls.settings}},...$&&B.urls.campaign!==void 0&&{campaign:GQ($,B.urls.campaign)},...z&&B.urls.sequence!==void 0&&{sequence:GQ(z,B.urls.sequence)},...H&&B.urls.email!==void 0&&{template:GQ(H,B.urls.email)},appUrls:B.urls}}var B5=[{name:"get_account",description:`Get current account information including available companies. IMPORTANT: If you have access to multiple companies, you MUST either:
|
|
32
32
|
1. Call select_company first to choose which company to work with, OR
|
|
33
33
|
2. Pass companyId explicitly in each tool call
|
|
34
34
|
|
|
@@ -45,7 +45,7 @@ Use cases:
|
|
|
45
45
|
- 'subscribe_form': Adding subscribers from signup forms
|
|
46
46
|
- 'event_tracking': Tracking CUSTOM events only (not payment events - those come from the integration)
|
|
47
47
|
|
|
48
|
-
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"}},required:["email"]}},{name:"update_subscriber",description:"Update an existing subscriber's attributes or tags",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Attributes to update"},addTags:{type:"array",items:{type:"string"},description:"Tags to add"},removeTags:{type:"array",items:{type:"string"},description:"Tags to remove"}},required:["email"]}},{name:"remove_subscriber",description:"Unsubscribe or delete a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:["email"]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:'Create a new segment from explicit filter rules. Supports Stripe product purchase filters via `field: "stripeProduct"` with values like `prod_123` or `prod_123:3`. Supports campaign-specific engagement filters via `field: "emailBounced"` (or `emailSent`/`emailOpened`/`emailClicked`/`emailComplained`) with `value: "campaign:<campaign_id>"` - combine two such filters to express rules like "bounced campaign A but not campaign B".',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the segment in. If not provided, uses the currently selected company."},name:{type:"string",description:"Segment name"},filterJoinOperator:{type:"string",enum:["and","or"],description:'How top-level filters combine. Use `"and"` to require every filter or `"or"` to match any filter.'},filters:{type:"array",items:eM,minItems:1,description:'Array of segment filters. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}]. Example campaign-specific engagement combo: [{"id":"filter-1","field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"id":"filter-2","field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]. Combine them with `filterJoinOperator: "or"` to match any filter.'}},required:["name","filters"]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, or `blocks` is required, and only those update fields are accepted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"}},required:["name","subject"]}},{name:"update_campaign",description:"Update a draft campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."}},required:["campaignId"],additionalProperties:!1}},{name:"send_test_email",description:"Send a test email to a single address",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID to test"},to:{type:"string",description:"Email address to send test to"}},required:["campaignId","to"]}},{name:"list_sequences",description:"List all email sequences (automations)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list sequences for. If not provided, uses the currently selected company."}}}},{name:"get_sequence",description:"Get sequence details plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"create_sequence",description:`Create a new email sequence. Sequenzy will automatically generate the email content using AI based on your company's brand and the goal you specify. The tool polls until emails are generated (typically 30-60 seconds).
|
|
48
|
+
Before implementing, use create_api_key to generate an API key and save it to .env as SEQUENZY_API_KEY.`,inputSchema:{type:"object",properties:{framework:{type:"string",description:"Framework/language (nextjs, express, python, etc.)"},use_case:{type:"string",description:"Use case: 'transactional' (sending emails), 'subscribe_form' (adding subscribers), 'event_tracking' (tracking CUSTOM events only - payment events should come from Stripe/Polar/etc integration)"}}}},{name:"add_subscriber",description:"Add a new subscriber to your list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to add subscriber to. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Custom attributes (name, plan, etc.)"},tags:{type:"array",items:{type:"string"},description:"Tags to apply to the subscriber"},listIds:{type:"array",items:{type:"string"},description:"List IDs to add subscriber to"}},required:["email"]}},{name:"update_subscriber",description:"Update an existing subscriber's attributes or tags",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},attributes:{type:"object",description:"Attributes to update"},addTags:{type:"array",items:{type:"string"},description:"Tags to add"},removeTags:{type:"array",items:{type:"string"},description:"Tags to remove"}},required:["email"]}},{name:"remove_subscriber",description:"Unsubscribe or delete a subscriber",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"},hardDelete:{type:"boolean",description:"If true, permanently deletes. If false, just unsubscribes."}},required:["email"]}},{name:"get_subscriber",description:"Get the full subscriber profile, including tags, list memberships, sequence enrollments, email stats, and recent activity",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},email:{type:"string",description:"Subscriber email address"}},required:["email"]}},{name:"search_subscribers",description:"Search subscribers by free-text query, tags, or segment. If you omit limit, the tool fetches all pages and returns every match.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},query:{type:"string",description:"Search query (email or name)"},tags:{type:"array",items:{type:"string"},description:"Filter by tags"},segmentId:{type:"string",description:"Filter by segment ID"},limit:{type:"number",description:"Maximum results to return. If omitted, the tool returns all matches across pages."}}}},{name:"list_tags",description:"List all tags in the account",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list tags for. If not provided, uses the currently selected company."}}}},{name:"list_lists",description:"List all subscriber lists",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list lists for. If not provided, uses the currently selected company."}}}},{name:"create_list",description:"Create a new subscriber list",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the list in. If not provided, uses the currently selected company."},name:{type:"string",description:"List name"},description:{type:"string",description:"List description"}},required:["name"]}},{name:"list_segments",description:"List all segments",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list segments for. If not provided, uses the currently selected company."}}}},{name:"create_segment",description:'Create a new segment from explicit filter rules. Supports Stripe product purchase filters via `field: "stripeProduct"` with values like `prod_123` or `prod_123:3`. Supports campaign-specific engagement filters via `field: "emailBounced"` (or `emailSent`/`emailOpened`/`emailClicked`/`emailComplained`) with `value: "campaign:<campaign_id>"` - combine two such filters to express rules like "bounced campaign A but not campaign B".',inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the segment in. If not provided, uses the currently selected company."},name:{type:"string",description:"Segment name"},filterJoinOperator:{type:"string",enum:["and","or"],description:'How top-level filters combine. Use `"and"` to require every filter or `"or"` to match any filter.'},filters:{type:"array",items:eM,minItems:1,description:'Array of segment filters. Example custom attribute empty check: [{"id":"filter-1","field":"attribute","operator":"is_empty","value":"last_logged_in:"}]. Example Stripe purchase filter: [{"id":"filter-1","field":"stripeProduct","operator":"is","value":"prod_123"}]. Example threshold filter: [{"id":"filter-1","field":"stripeProduct","operator":"at_least","value":"prod_123:3"}]. Example campaign-specific engagement combo: [{"id":"filter-1","field":"emailBounced","operator":"is","value":"campaign:cmp_abc"},{"id":"filter-2","field":"emailBounced","operator":"is_not","value":"campaign:cmp_xyz"}]. Combine them with `filterJoinOperator: "or"` to match any filter.'}},required:["name","filters"]}},{name:"get_segment_count",description:"Get the number of subscribers in a segment",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},segmentId:{type:"string",description:"Segment ID"}},required:["segmentId"]}},{name:"list_templates",description:"List all email templates, including per-locale localization sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."}}}},{name:"get_template",description:"Get a template's details, content, and all localized variants with sync status",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"create_template",description:"Create a new email template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["name","subject"]}},{name:"update_template",description:"Update an existing template. At least one of `name`, `subject`, `html`, or `blocks` is required, and only those update fields are accepted.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"},name:{type:"string",description:"Template name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}}},required:["templateId"],additionalProperties:!1}},{name:"delete_template",description:"Delete a template",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},templateId:{type:"string",description:"Template ID"}},required:["templateId"]}},{name:"list_campaigns",description:"List all campaigns",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list campaigns for. If not provided, uses the currently selected company."},status:{type:"string",description:"Filter by status (draft, scheduled, sent)"}}}},{name:"get_campaign",description:"Get campaign details and stats",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"}},required:["campaignId"]}},{name:"create_campaign",description:"Create a new campaign (as draft)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to create the campaign in. If not provided, uses the currently selected company."},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},templateId:{type:"string",description:"Use a template instead of html"},segmentId:{type:"string",description:"Target segment ID"}},required:["name","subject"]}},{name:"update_campaign",description:"Update a draft campaign",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID"},name:{type:"string",description:"Campaign name"},subject:{type:"string",description:"Email subject line"},html:{type:"string",description:"Email HTML content. Mutually exclusive with `blocks`."},blocks:{type:"array",description:"Sequenzy email blocks. Use this for editor-compatible content, including conditional blocks.",items:{type:"object"}},replyTo:{type:"string",description:"Set reply-to using an existing reply profile email address for this company."},replyProfileId:{type:"string",description:"Set reply-to using a reply profile ID for this company."}},required:["campaignId"],additionalProperties:!1}},{name:"send_test_email",description:"Send a test email to a single address",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},campaignId:{type:"string",description:"Campaign ID to test"},to:{type:"string",description:"Email address to send test to"}},required:["campaignId","to"]}},{name:"list_sequences",description:"List all email sequences (automations)",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID to list sequences for. If not provided, uses the currently selected company."}}}},{name:"get_sequence",description:"Get sequence details plus editable step content. The response includes sequence.emails with each step's nodeId, linked emailId, subject, previewText, and blocks.",inputSchema:{type:"object",properties:{companyId:{type:"string",description:"Company ID. If not provided, uses the currently selected company."},sequenceId:{type:"string",description:"Sequence ID"}},required:["sequenceId"]}},{name:"create_sequence",description:`Create a new email sequence. Sequenzy will automatically generate the email content using AI based on your company's brand and the goal you specify. The tool polls until emails are generated (typically 30-60 seconds).
|
|
49
49
|
|
|
50
50
|
IMPORTANT GUIDELINES:
|
|
51
51
|
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
"source": "github",
|
|
8
8
|
"subfolder": "packages/mcp"
|
|
9
9
|
},
|
|
10
|
-
"version": "0.0.
|
|
10
|
+
"version": "0.0.15",
|
|
11
11
|
"packages": [
|
|
12
12
|
{
|
|
13
13
|
"registryType": "npm",
|
|
14
14
|
"identifier": "@sequenzy/mcp",
|
|
15
|
-
"version": "0.0.
|
|
15
|
+
"version": "0.0.15",
|
|
16
16
|
"runtime": "node",
|
|
17
17
|
"transport": {
|
|
18
18
|
"type": "stdio"
|