@aventurevc/mcp-server 0.8.31 → 0.8.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{a as e}from"./auth-DGQ_qAvX.js";import{C as t,D as n,E as r,S as ee,T as i,_ as a,b as o,c as te,d as s,f as ne,h as re,i as ie,p as ae,s as c,u as l,v as u,x as d,y as f}from"./person-owner-9MfK4f_5.js";var oe=o({clerkPublishableKey:i().nullish(),oauthClient:e.nullish()}),se=`2025-11-25`,ce=`2025-03-26`,le=[se,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],ue=`io.modelcontextprotocol/related-task`,p=ne(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),de=r([i(),f().int()]),fe=i();u({ttl:f().optional(),pollInterval:f().optional()});var pe=o({ttl:f().optional()}),me=o({taskId:i()}),m=u({progressToken:de.optional(),[ue]:me.optional()}),h=o({_meta:m.optional()}),g=h.extend({task:pe.optional()}),he=e=>g.safeParse(e).success,_=o({method:i(),params:h.loose().optional()}),v=o({_meta:m.optional()}),y=o({method:i(),params:v.loose().optional()}),b=u({_meta:m.optional()}),x=r([i(),f().int()]),ge=o({jsonrpc:a(`2.0`),id:x,..._.shape}).strict(),_e=e=>ge.safeParse(e).success,ve=o({jsonrpc:a(`2.0`),...y.shape}).strict(),ye=e=>ve.safeParse(e).success,S=o({jsonrpc:a(`2.0`),id:x,result:b}).strict(),be=e=>S.safeParse(e).success,C;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(C||={});var w=o({jsonrpc:a(`2.0`),id:x.optional(),error:o({code:f().int(),message:i(),data:n().optional()})}).strict(),xe=e=>w.safeParse(e).success,Se=r([ge,ve,S,w]);r([S,w]);var T=b.strict(),Ce=v.extend({requestId:x.optional(),reason:i().optional()}),E=y.extend({method:a(`notifications/cancelled`),params:Ce}),we=o({src:i(),mimeType:i().optional(),sizes:l(i()).optional(),theme:c([`light`,`dark`]).optional()}),D=o({icons:l(we).optional()}),O=o({name:i(),title:i().optional()}),Te=O.extend({...O.shape,...D.shape,version:i(),websiteUrl:i().optional(),description:i().optional()}),Ee=re(o({applyDefaults:s().optional()}),t(i(),n())),De=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,re(o({form:Ee.optional(),url:p.optional()}),t(i(),n()).optional())),Oe=u({list:p.optional(),cancel:p.optional(),requests:u({sampling:u({createMessage:p.optional()}).optional(),elicitation:u({create:p.optional()}).optional()}).optional()}),ke=u({list:p.optional(),cancel:p.optional(),requests:u({tools:u({call:p.optional()}).optional()}).optional()}),Ae=o({experimental:t(i(),p).optional(),sampling:o({context:p.optional(),tools:p.optional()}).optional(),elicitation:De.optional(),roots:o({listChanged:s().optional()}).optional(),tasks:Oe.optional(),extensions:t(i(),p).optional()}),je=h.extend({protocolVersion:i(),capabilities:Ae,clientInfo:Te}),k=_.extend({method:a(`initialize`),params:je}),Me=e=>k.safeParse(e).success,Ne=o({experimental:t(i(),p).optional(),logging:p.optional(),completions:p.optional(),prompts:o({listChanged:s().optional()}).optional(),resources:o({subscribe:s().optional(),listChanged:s().optional()}).optional(),tools:o({listChanged:s().optional()}).optional(),tasks:ke.optional(),extensions:t(i(),p).optional()}),Pe=b.extend({protocolVersion:i(),capabilities:Ne,serverInfo:Te,instructions:i().optional()}),Fe=y.extend({method:a(`notifications/initialized`),params:v.optional()}),A=_.extend({method:a(`ping`),params:h.optional()}),Ie=o({progress:f(),total:d(f()),message:d(i())}),Le=o({...v.shape,...Ie.shape,progressToken:de}),j=y.extend({method:a(`notifications/progress`),params:Le}),Re=h.extend({cursor:fe.optional()}),M=_.extend({params:Re.optional()}),N=b.extend({nextCursor:fe.optional()}),ze=c([`working`,`input_required`,`completed`,`failed`,`cancelled`]),P=o({taskId:i(),status:ze,ttl:r([f(),te()]),createdAt:i(),lastUpdatedAt:i(),pollInterval:d(f()),statusMessage:d(i())}),F=b.extend({task:P}),Be=v.merge(P),I=y.extend({method:a(`notifications/tasks/status`),params:Be}),L=_.extend({method:a(`tasks/get`),params:h.extend({taskId:i()})}),R=b.merge(P),z=_.extend({method:a(`tasks/result`),params:h.extend({taskId:i()})});b.loose();var B=M.extend({method:a(`tasks/list`)}),V=N.extend({tasks:l(P)}),H=_.extend({method:a(`tasks/cancel`),params:h.extend({taskId:i()})}),Ve=b.merge(P),He=o({uri:i(),mimeType:d(i()),_meta:t(i(),n()).optional()}),Ue=He.extend({text:i()}),U=i().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),We=He.extend({blob:U}),W=c([`user`,`assistant`]),G=o({audience:l(W).optional(),priority:f().min(0).max(1).optional(),lastModified:ie({offset:!0}).optional()}),Ge=o({...O.shape,...D.shape,uri:i(),description:d(i()),mimeType:d(i()),size:d(f()),annotations:G.optional(),_meta:d(u({}))}),Ke=o({...O.shape,...D.shape,uriTemplate:i(),description:d(i()),mimeType:d(i()),annotations:G.optional(),_meta:d(u({}))}),qe=M.extend({method:a(`resources/list`)}),Je=N.extend({resources:l(Ge)}),Ye=M.extend({method:a(`resources/templates/list`)}),Xe=N.extend({resourceTemplates:l(Ke)}),K=h.extend({uri:i()}),Ze=K,Qe=_.extend({method:a(`resources/read`),params:Ze}),$e=b.extend({contents:l(r([Ue,We]))}),et=y.extend({method:a(`notifications/resources/list_changed`),params:v.optional()}),tt=K,nt=_.extend({method:a(`resources/subscribe`),params:tt}),rt=K,it=_.extend({method:a(`resources/unsubscribe`),params:rt}),at=v.extend({uri:i()}),ot=y.extend({method:a(`notifications/resources/updated`),params:at}),st=o({name:i(),description:d(i()),required:d(s())}),ct=o({...O.shape,...D.shape,description:d(i()),arguments:d(l(st)),_meta:d(u({}))}),lt=M.extend({method:a(`prompts/list`)}),ut=N.extend({prompts:l(ct)}),dt=h.extend({name:i(),arguments:t(i(),i()).optional()}),ft=_.extend({method:a(`prompts/get`),params:dt}),q=o({type:a(`text`),text:i(),annotations:G.optional(),_meta:t(i(),n()).optional()}),J=o({type:a(`image`),data:U,mimeType:i(),annotations:G.optional(),_meta:t(i(),n()).optional()}),Y=o({type:a(`audio`),data:U,mimeType:i(),annotations:G.optional(),_meta:t(i(),n()).optional()}),pt=o({type:a(`tool_use`),name:i(),id:i(),input:t(i(),n()),_meta:t(i(),n()).optional()}),mt=o({type:a(`resource`),resource:r([Ue,We]),annotations:G.optional(),_meta:t(i(),n()).optional()}),ht=Ge.extend({type:a(`resource_link`)}),X=r([q,J,Y,ht,mt]),gt=o({role:W,content:X}),_t=b.extend({description:i().optional(),messages:l(gt)}),vt=y.extend({method:a(`notifications/prompts/list_changed`),params:v.optional()}),yt=o({title:i().optional(),readOnlyHint:s().optional(),destructiveHint:s().optional(),idempotentHint:s().optional(),openWorldHint:s().optional()}),bt=o({taskSupport:c([`required`,`optional`,`forbidden`]).optional()}),xt=o({...O.shape,...D.shape,description:i().optional(),inputSchema:o({type:a(`object`),properties:t(i(),p).optional(),required:l(i()).optional()}).catchall(n()),outputSchema:o({type:a(`object`),properties:t(i(),p).optional(),required:l(i()).optional()}).catchall(n()).optional(),annotations:yt.optional(),execution:bt.optional(),_meta:t(i(),n()).optional()}),St=M.extend({method:a(`tools/list`)}),Ct=N.extend({tools:l(xt)}),Z=b.extend({content:l(X).default([]),structuredContent:t(i(),n()).optional(),isError:s().optional()});Z.or(b.extend({toolResult:n()}));var wt=g.extend({name:i(),arguments:t(i(),n()).optional()}),Tt=_.extend({method:a(`tools/call`),params:wt}),Et=y.extend({method:a(`notifications/tools/list_changed`),params:v.optional()});o({autoRefresh:s().default(!0),debounceMs:f().int().nonnegative().default(300)});var Q=c([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Dt=h.extend({level:Q}),Ot=_.extend({method:a(`logging/setLevel`),params:Dt}),kt=v.extend({level:Q,logger:i().optional(),data:n()}),At=y.extend({method:a(`notifications/message`),params:kt}),jt=o({name:i().optional()}),Mt=o({hints:l(jt).optional(),costPriority:f().min(0).max(1).optional(),speedPriority:f().min(0).max(1).optional(),intelligencePriority:f().min(0).max(1).optional()}),Nt=o({mode:c([`auto`,`required`,`none`]).optional()}),Pt=o({type:a(`tool_result`),toolUseId:i().describe(`The unique identifier for the corresponding tool call.`),content:l(X).default([]),structuredContent:o({}).loose().optional(),isError:s().optional(),_meta:t(i(),n()).optional()}),Ft=ae(`type`,[q,J,Y]),$=ae(`type`,[q,J,Y,pt,Pt]),It=o({role:W,content:r([$,l($)]),_meta:t(i(),n()).optional()}),Lt=g.extend({messages:l(It),modelPreferences:Mt.optional(),systemPrompt:i().optional(),includeContext:c([`none`,`thisServer`,`allServers`]).optional(),temperature:f().optional(),maxTokens:f().int(),stopSequences:l(i()).optional(),metadata:p.optional(),tools:l(xt).optional(),toolChoice:Nt.optional()}),Rt=_.extend({method:a(`sampling/createMessage`),params:Lt}),zt=b.extend({model:i(),stopReason:d(c([`endTurn`,`stopSequence`,`maxTokens`]).or(i())),role:W,content:Ft}),Bt=b.extend({model:i(),stopReason:d(c([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(i())),role:W,content:r([$,l($)])}),Vt=o({type:a(`boolean`),title:i().optional(),description:i().optional(),default:s().optional()}),Ht=o({type:a(`string`),title:i().optional(),description:i().optional(),minLength:f().optional(),maxLength:f().optional(),format:c([`email`,`uri`,`date`,`date-time`]).optional(),default:i().optional()}),Ut=o({type:c([`number`,`integer`]),title:i().optional(),description:i().optional(),minimum:f().optional(),maximum:f().optional(),default:f().optional()}),Wt=o({type:a(`string`),title:i().optional(),description:i().optional(),enum:l(i()),default:i().optional()}),Gt=o({type:a(`string`),title:i().optional(),description:i().optional(),oneOf:l(o({const:i(),title:i()})),default:i().optional()}),Kt=o({type:a(`string`),title:i().optional(),description:i().optional(),enum:l(i()),enumNames:l(i()).optional(),default:i().optional()}),qt=r([Wt,Gt]),Jt=o({type:a(`array`),title:i().optional(),description:i().optional(),minItems:f().optional(),maxItems:f().optional(),items:o({type:a(`string`),enum:l(i())}),default:l(i()).optional()}),Yt=o({type:a(`array`),title:i().optional(),description:i().optional(),minItems:f().optional(),maxItems:f().optional(),items:o({anyOf:l(o({const:i(),title:i()}))}),default:l(i()).optional()}),Xt=r([Jt,Yt]),Zt=r([Kt,qt,Xt]),Qt=r([Zt,Vt,Ht,Ut]),$t=g.extend({mode:a(`form`).optional(),message:i(),requestedSchema:o({type:a(`object`),properties:t(i(),Qt),required:l(i()).optional()})}),en=g.extend({mode:a(`url`),message:i(),elicitationId:i(),url:i().url()}),tn=r([$t,en]),nn=_.extend({method:a(`elicitation/create`),params:tn}),rn=v.extend({elicitationId:i()}),an=y.extend({method:a(`notifications/elicitation/complete`),params:rn}),on=b.extend({action:c([`accept`,`decline`,`cancel`]),content:ee(e=>e===null?void 0:e,t(i(),r([i(),f(),s(),l(i())])).optional())}),sn=o({type:a(`ref/resource`),uri:i()}),cn=o({type:a(`ref/prompt`),name:i()}),ln=h.extend({ref:r([cn,sn]),argument:o({name:i(),value:i()}),context:o({arguments:t(i(),i()).optional()}).optional()}),un=_.extend({method:a(`completion/complete`),params:ln});function dn(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function fn(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var pn=b.extend({completion:u({values:l(i()).max(100),total:d(f().int()),hasMore:d(s())})}),mn=o({uri:i().startsWith(`file://`),name:i().optional(),_meta:t(i(),n()).optional()}),hn=_.extend({method:a(`roots/list`),params:h.optional()}),gn=b.extend({roots:l(mn)}),_n=y.extend({method:a(`notifications/roots/list_changed`),params:v.optional()});r([A,k,un,Ot,ft,lt,qe,Ye,Qe,nt,it,Tt,St,L,z,B,H]),r([E,j,Fe,_n,I]),r([T,zt,Bt,on,gn,R,V,F]),r([A,Rt,nn,hn,L,z,B,H]),r([E,j,At,ot,et,Et,vt,I,an]),r([T,Pe,pn,_t,ut,Je,Xe,$e,Z,Ct,R,V,F]);var vn=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===C.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new yn(e.elicitations,n)}return new e(t,n,r)}},yn=class extends vn{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(C.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},bn=globalThis.crypto?.webcrypto??globalThis.crypto??import(`node:crypto`).then(e=>e.webcrypto);async function xn(e){return(await bn).getRandomValues(new Uint8Array(e))}async function Sn(e){let t=``;for(;t.length<e;){let n=await xn(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function Cn(e){return await Sn(e)}async function wn(e){let t=await(await bn).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function Tn(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Cn(e);return{code_verifier:t,code_challenge:await wn(t)}}export{Q as A,fn as B,lt as C,B as D,gn as E,Qe as F,be as G,xe as H,le as I,he as K,Ot as L,A as M,j as N,V as O,ue as P,I as R,se as S,qe as T,ye as U,Me as V,_e as W,L as _,Ve as a,Fe as b,zt as c,ce as d,on as f,z as g,ft as h,H as i,vn as j,St as k,Bt as l,C as m,Tt as n,E as o,T as p,oe as q,Z as r,un as s,Tn as t,F as u,R as v,Ye as w,Se as x,k as y,dn as z};
1
+ import{a as e}from"./auth-CkpcdEM3.js";import{C as t,D as n,E as r,S as ee,T as i,_ as a,b as o,c as te,d as s,f as ne,h as re,i as ie,p as ae,s as c,u as l,v as u,x as d,y as f}from"./person-owner-9MfK4f_5.js";var oe=o({clerkPublishableKey:i().nullish(),oauthClient:e.nullish()}),se=`2025-11-25`,ce=`2025-03-26`,le=[se,`2025-06-18`,`2025-03-26`,`2024-11-05`,`2024-10-07`],ue=`io.modelcontextprotocol/related-task`,p=ne(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),de=r([i(),f().int()]),fe=i();u({ttl:f().optional(),pollInterval:f().optional()});var pe=o({ttl:f().optional()}),me=o({taskId:i()}),m=u({progressToken:de.optional(),[ue]:me.optional()}),h=o({_meta:m.optional()}),g=h.extend({task:pe.optional()}),he=e=>g.safeParse(e).success,_=o({method:i(),params:h.loose().optional()}),v=o({_meta:m.optional()}),y=o({method:i(),params:v.loose().optional()}),b=u({_meta:m.optional()}),x=r([i(),f().int()]),ge=o({jsonrpc:a(`2.0`),id:x,..._.shape}).strict(),_e=e=>ge.safeParse(e).success,ve=o({jsonrpc:a(`2.0`),...y.shape}).strict(),ye=e=>ve.safeParse(e).success,S=o({jsonrpc:a(`2.0`),id:x,result:b}).strict(),be=e=>S.safeParse(e).success,C;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(C||={});var w=o({jsonrpc:a(`2.0`),id:x.optional(),error:o({code:f().int(),message:i(),data:n().optional()})}).strict(),xe=e=>w.safeParse(e).success,Se=r([ge,ve,S,w]);r([S,w]);var T=b.strict(),Ce=v.extend({requestId:x.optional(),reason:i().optional()}),E=y.extend({method:a(`notifications/cancelled`),params:Ce}),we=o({src:i(),mimeType:i().optional(),sizes:l(i()).optional(),theme:c([`light`,`dark`]).optional()}),D=o({icons:l(we).optional()}),O=o({name:i(),title:i().optional()}),Te=O.extend({...O.shape,...D.shape,version:i(),websiteUrl:i().optional(),description:i().optional()}),Ee=re(o({applyDefaults:s().optional()}),t(i(),n())),De=ee(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,re(o({form:Ee.optional(),url:p.optional()}),t(i(),n()).optional())),Oe=u({list:p.optional(),cancel:p.optional(),requests:u({sampling:u({createMessage:p.optional()}).optional(),elicitation:u({create:p.optional()}).optional()}).optional()}),ke=u({list:p.optional(),cancel:p.optional(),requests:u({tools:u({call:p.optional()}).optional()}).optional()}),Ae=o({experimental:t(i(),p).optional(),sampling:o({context:p.optional(),tools:p.optional()}).optional(),elicitation:De.optional(),roots:o({listChanged:s().optional()}).optional(),tasks:Oe.optional(),extensions:t(i(),p).optional()}),je=h.extend({protocolVersion:i(),capabilities:Ae,clientInfo:Te}),k=_.extend({method:a(`initialize`),params:je}),Me=e=>k.safeParse(e).success,Ne=o({experimental:t(i(),p).optional(),logging:p.optional(),completions:p.optional(),prompts:o({listChanged:s().optional()}).optional(),resources:o({subscribe:s().optional(),listChanged:s().optional()}).optional(),tools:o({listChanged:s().optional()}).optional(),tasks:ke.optional(),extensions:t(i(),p).optional()}),Pe=b.extend({protocolVersion:i(),capabilities:Ne,serverInfo:Te,instructions:i().optional()}),Fe=y.extend({method:a(`notifications/initialized`),params:v.optional()}),A=_.extend({method:a(`ping`),params:h.optional()}),Ie=o({progress:f(),total:d(f()),message:d(i())}),Le=o({...v.shape,...Ie.shape,progressToken:de}),j=y.extend({method:a(`notifications/progress`),params:Le}),Re=h.extend({cursor:fe.optional()}),M=_.extend({params:Re.optional()}),N=b.extend({nextCursor:fe.optional()}),ze=c([`working`,`input_required`,`completed`,`failed`,`cancelled`]),P=o({taskId:i(),status:ze,ttl:r([f(),te()]),createdAt:i(),lastUpdatedAt:i(),pollInterval:d(f()),statusMessage:d(i())}),F=b.extend({task:P}),Be=v.merge(P),I=y.extend({method:a(`notifications/tasks/status`),params:Be}),L=_.extend({method:a(`tasks/get`),params:h.extend({taskId:i()})}),R=b.merge(P),z=_.extend({method:a(`tasks/result`),params:h.extend({taskId:i()})});b.loose();var B=M.extend({method:a(`tasks/list`)}),V=N.extend({tasks:l(P)}),H=_.extend({method:a(`tasks/cancel`),params:h.extend({taskId:i()})}),Ve=b.merge(P),He=o({uri:i(),mimeType:d(i()),_meta:t(i(),n()).optional()}),Ue=He.extend({text:i()}),U=i().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),We=He.extend({blob:U}),W=c([`user`,`assistant`]),G=o({audience:l(W).optional(),priority:f().min(0).max(1).optional(),lastModified:ie({offset:!0}).optional()}),Ge=o({...O.shape,...D.shape,uri:i(),description:d(i()),mimeType:d(i()),size:d(f()),annotations:G.optional(),_meta:d(u({}))}),Ke=o({...O.shape,...D.shape,uriTemplate:i(),description:d(i()),mimeType:d(i()),annotations:G.optional(),_meta:d(u({}))}),qe=M.extend({method:a(`resources/list`)}),Je=N.extend({resources:l(Ge)}),Ye=M.extend({method:a(`resources/templates/list`)}),Xe=N.extend({resourceTemplates:l(Ke)}),K=h.extend({uri:i()}),Ze=K,Qe=_.extend({method:a(`resources/read`),params:Ze}),$e=b.extend({contents:l(r([Ue,We]))}),et=y.extend({method:a(`notifications/resources/list_changed`),params:v.optional()}),tt=K,nt=_.extend({method:a(`resources/subscribe`),params:tt}),rt=K,it=_.extend({method:a(`resources/unsubscribe`),params:rt}),at=v.extend({uri:i()}),ot=y.extend({method:a(`notifications/resources/updated`),params:at}),st=o({name:i(),description:d(i()),required:d(s())}),ct=o({...O.shape,...D.shape,description:d(i()),arguments:d(l(st)),_meta:d(u({}))}),lt=M.extend({method:a(`prompts/list`)}),ut=N.extend({prompts:l(ct)}),dt=h.extend({name:i(),arguments:t(i(),i()).optional()}),ft=_.extend({method:a(`prompts/get`),params:dt}),q=o({type:a(`text`),text:i(),annotations:G.optional(),_meta:t(i(),n()).optional()}),J=o({type:a(`image`),data:U,mimeType:i(),annotations:G.optional(),_meta:t(i(),n()).optional()}),Y=o({type:a(`audio`),data:U,mimeType:i(),annotations:G.optional(),_meta:t(i(),n()).optional()}),pt=o({type:a(`tool_use`),name:i(),id:i(),input:t(i(),n()),_meta:t(i(),n()).optional()}),mt=o({type:a(`resource`),resource:r([Ue,We]),annotations:G.optional(),_meta:t(i(),n()).optional()}),ht=Ge.extend({type:a(`resource_link`)}),X=r([q,J,Y,ht,mt]),gt=o({role:W,content:X}),_t=b.extend({description:i().optional(),messages:l(gt)}),vt=y.extend({method:a(`notifications/prompts/list_changed`),params:v.optional()}),yt=o({title:i().optional(),readOnlyHint:s().optional(),destructiveHint:s().optional(),idempotentHint:s().optional(),openWorldHint:s().optional()}),bt=o({taskSupport:c([`required`,`optional`,`forbidden`]).optional()}),xt=o({...O.shape,...D.shape,description:i().optional(),inputSchema:o({type:a(`object`),properties:t(i(),p).optional(),required:l(i()).optional()}).catchall(n()),outputSchema:o({type:a(`object`),properties:t(i(),p).optional(),required:l(i()).optional()}).catchall(n()).optional(),annotations:yt.optional(),execution:bt.optional(),_meta:t(i(),n()).optional()}),St=M.extend({method:a(`tools/list`)}),Ct=N.extend({tools:l(xt)}),Z=b.extend({content:l(X).default([]),structuredContent:t(i(),n()).optional(),isError:s().optional()});Z.or(b.extend({toolResult:n()}));var wt=g.extend({name:i(),arguments:t(i(),n()).optional()}),Tt=_.extend({method:a(`tools/call`),params:wt}),Et=y.extend({method:a(`notifications/tools/list_changed`),params:v.optional()});o({autoRefresh:s().default(!0),debounceMs:f().int().nonnegative().default(300)});var Q=c([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Dt=h.extend({level:Q}),Ot=_.extend({method:a(`logging/setLevel`),params:Dt}),kt=v.extend({level:Q,logger:i().optional(),data:n()}),At=y.extend({method:a(`notifications/message`),params:kt}),jt=o({name:i().optional()}),Mt=o({hints:l(jt).optional(),costPriority:f().min(0).max(1).optional(),speedPriority:f().min(0).max(1).optional(),intelligencePriority:f().min(0).max(1).optional()}),Nt=o({mode:c([`auto`,`required`,`none`]).optional()}),Pt=o({type:a(`tool_result`),toolUseId:i().describe(`The unique identifier for the corresponding tool call.`),content:l(X).default([]),structuredContent:o({}).loose().optional(),isError:s().optional(),_meta:t(i(),n()).optional()}),Ft=ae(`type`,[q,J,Y]),$=ae(`type`,[q,J,Y,pt,Pt]),It=o({role:W,content:r([$,l($)]),_meta:t(i(),n()).optional()}),Lt=g.extend({messages:l(It),modelPreferences:Mt.optional(),systemPrompt:i().optional(),includeContext:c([`none`,`thisServer`,`allServers`]).optional(),temperature:f().optional(),maxTokens:f().int(),stopSequences:l(i()).optional(),metadata:p.optional(),tools:l(xt).optional(),toolChoice:Nt.optional()}),Rt=_.extend({method:a(`sampling/createMessage`),params:Lt}),zt=b.extend({model:i(),stopReason:d(c([`endTurn`,`stopSequence`,`maxTokens`]).or(i())),role:W,content:Ft}),Bt=b.extend({model:i(),stopReason:d(c([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(i())),role:W,content:r([$,l($)])}),Vt=o({type:a(`boolean`),title:i().optional(),description:i().optional(),default:s().optional()}),Ht=o({type:a(`string`),title:i().optional(),description:i().optional(),minLength:f().optional(),maxLength:f().optional(),format:c([`email`,`uri`,`date`,`date-time`]).optional(),default:i().optional()}),Ut=o({type:c([`number`,`integer`]),title:i().optional(),description:i().optional(),minimum:f().optional(),maximum:f().optional(),default:f().optional()}),Wt=o({type:a(`string`),title:i().optional(),description:i().optional(),enum:l(i()),default:i().optional()}),Gt=o({type:a(`string`),title:i().optional(),description:i().optional(),oneOf:l(o({const:i(),title:i()})),default:i().optional()}),Kt=o({type:a(`string`),title:i().optional(),description:i().optional(),enum:l(i()),enumNames:l(i()).optional(),default:i().optional()}),qt=r([Wt,Gt]),Jt=o({type:a(`array`),title:i().optional(),description:i().optional(),minItems:f().optional(),maxItems:f().optional(),items:o({type:a(`string`),enum:l(i())}),default:l(i()).optional()}),Yt=o({type:a(`array`),title:i().optional(),description:i().optional(),minItems:f().optional(),maxItems:f().optional(),items:o({anyOf:l(o({const:i(),title:i()}))}),default:l(i()).optional()}),Xt=r([Jt,Yt]),Zt=r([Kt,qt,Xt]),Qt=r([Zt,Vt,Ht,Ut]),$t=g.extend({mode:a(`form`).optional(),message:i(),requestedSchema:o({type:a(`object`),properties:t(i(),Qt),required:l(i()).optional()})}),en=g.extend({mode:a(`url`),message:i(),elicitationId:i(),url:i().url()}),tn=r([$t,en]),nn=_.extend({method:a(`elicitation/create`),params:tn}),rn=v.extend({elicitationId:i()}),an=y.extend({method:a(`notifications/elicitation/complete`),params:rn}),on=b.extend({action:c([`accept`,`decline`,`cancel`]),content:ee(e=>e===null?void 0:e,t(i(),r([i(),f(),s(),l(i())])).optional())}),sn=o({type:a(`ref/resource`),uri:i()}),cn=o({type:a(`ref/prompt`),name:i()}),ln=h.extend({ref:r([cn,sn]),argument:o({name:i(),value:i()}),context:o({arguments:t(i(),i()).optional()}).optional()}),un=_.extend({method:a(`completion/complete`),params:ln});function dn(e){if(e.params.ref.type!==`ref/prompt`)throw TypeError(`Expected CompleteRequestPrompt, but got ${e.params.ref.type}`)}function fn(e){if(e.params.ref.type!==`ref/resource`)throw TypeError(`Expected CompleteRequestResourceTemplate, but got ${e.params.ref.type}`)}var pn=b.extend({completion:u({values:l(i()).max(100),total:d(f().int()),hasMore:d(s())})}),mn=o({uri:i().startsWith(`file://`),name:i().optional(),_meta:t(i(),n()).optional()}),hn=_.extend({method:a(`roots/list`),params:h.optional()}),gn=b.extend({roots:l(mn)}),_n=y.extend({method:a(`notifications/roots/list_changed`),params:v.optional()});r([A,k,un,Ot,ft,lt,qe,Ye,Qe,nt,it,Tt,St,L,z,B,H]),r([E,j,Fe,_n,I]),r([T,zt,Bt,on,gn,R,V,F]),r([A,Rt,nn,hn,L,z,B,H]),r([E,j,At,ot,et,Et,vt,I,an]),r([T,Pe,pn,_t,ut,Je,Xe,$e,Z,Ct,R,V,F]);var vn=class e extends Error{constructor(e,t,n){super(`MCP error ${e}: ${t}`),this.code=e,this.data=n,this.name=`McpError`}static fromError(t,n,r){if(t===C.UrlElicitationRequired&&r){let e=r;if(e.elicitations)return new yn(e.elicitations,n)}return new e(t,n,r)}},yn=class extends vn{constructor(e,t=`URL elicitation${e.length>1?`s`:``} required`){super(C.UrlElicitationRequired,t,{elicitations:e})}get elicitations(){return this.data?.elicitations??[]}},bn=globalThis.crypto?.webcrypto??globalThis.crypto??import(`node:crypto`).then(e=>e.webcrypto);async function xn(e){return(await bn).getRandomValues(new Uint8Array(e))}async function Sn(e){let t=``;for(;t.length<e;){let n=await xn(e-t.length);for(let e of n)e<198&&(t+=`abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~`[e%66])}return t}async function Cn(e){return await Sn(e)}async function wn(e){let t=await(await bn).subtle.digest(`SHA-256`,new TextEncoder().encode(e));return btoa(String.fromCharCode(...new Uint8Array(t))).replace(/\//g,`_`).replace(/\+/g,`-`).replace(/=/g,``)}async function Tn(e){if(e||=43,e<43||e>128)throw`Expected a length between 43 and 128. Received ${e}.`;let t=await Cn(e);return{code_verifier:t,code_challenge:await wn(t)}}export{Q as A,fn as B,lt as C,B as D,gn as E,Qe as F,be as G,xe as H,le as I,he as K,Ot as L,A as M,j as N,V as O,ue as P,I as R,se as S,qe as T,ye as U,Me as V,_e as W,L as _,Ve as a,Fe as b,zt as c,ce as d,on as f,z as g,ft as h,H as i,vn as j,St as k,Bt as l,C as m,Tt as n,E as o,T as p,oe as q,Z as r,un as s,Tn as t,F as u,R as v,Ye as w,Se as x,k as y,dn as z};