@smithery/cli 1.1.52 → 1.1.53

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.
Files changed (2) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -94,7 +94,7 @@ ${t}`,tDe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),rDe=Obj
94
94
  `);return a!==-1&&(t=lR(t,i,n,a)),n+t+i};Object.defineProperties(Uu.prototype,k1);var bDe=Uu(),dRe=Uu({level:fR?fR.level:0});var Qn=bDe;var br=ae(require("node:process"),1);function X7(){return br.default.platform!=="win32"?br.default.env.TERM!=="linux":!!br.default.env.CI||!!br.default.env.WT_SESSION||!!br.default.env.TERMINUS_SUBLIME||br.default.env.ConEmuTask==="{cmd::Cmder}"||br.default.env.TERM_PROGRAM==="Terminus-Sublime"||br.default.env.TERM_PROGRAM==="vscode"||br.default.env.TERM==="xterm-256color"||br.default.env.TERM==="alacritty"||br.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var DDe={info:Qn.blue("\u2139"),success:Qn.green("\u2714"),warning:Qn.yellow("\u26A0"),error:Qn.red("\u2716")},yDe={info:Qn.blue("i"),success:Qn.green("\u221A"),warning:Qn.yellow("\u203C"),error:Qn.red("\xD7")},EDe=X7()?DDe:yDe,Wu=EDe;function Q7({onlyFirst:e=!1}={}){let r=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(r,e?void 0:"g")}var wDe=Q7();function $u(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(wDe,"")}function hR(e){return e===161||e===164||e===167||e===168||e===170||e===173||e===174||e>=176&&e<=180||e>=182&&e<=186||e>=188&&e<=191||e===198||e===208||e===215||e===216||e>=222&&e<=225||e===230||e>=232&&e<=234||e===236||e===237||e===240||e===242||e===243||e>=247&&e<=250||e===252||e===254||e===257||e===273||e===275||e===283||e===294||e===295||e===299||e>=305&&e<=307||e===312||e>=319&&e<=322||e===324||e>=328&&e<=331||e===333||e===338||e===339||e===358||e===359||e===363||e===462||e===464||e===466||e===468||e===470||e===472||e===474||e===476||e===593||e===609||e===708||e===711||e>=713&&e<=715||e===717||e===720||e>=728&&e<=731||e===733||e===735||e>=768&&e<=879||e>=913&&e<=929||e>=931&&e<=937||e>=945&&e<=961||e>=963&&e<=969||e===1025||e>=1040&&e<=1103||e===1105||e===8208||e>=8211&&e<=8214||e===8216||e===8217||e===8220||e===8221||e>=8224&&e<=8226||e>=8228&&e<=8231||e===8240||e===8242||e===8243||e===8245||e===8251||e===8254||e===8308||e===8319||e>=8321&&e<=8324||e===8364||e===8451||e===8453||e===8457||e===8467||e===8470||e===8481||e===8482||e===8486||e===8491||e===8531||e===8532||e>=8539&&e<=8542||e>=8544&&e<=8555||e>=8560&&e<=8569||e===8585||e>=8592&&e<=8601||e===8632||e===8633||e===8658||e===8660||e===8679||e===8704||e===8706||e===8707||e===8711||e===8712||e===8715||e===8719||e===8721||e===8725||e===8730||e>=8733&&e<=8736||e===8739||e===8741||e>=8743&&e<=8748||e===8750||e>=8756&&e<=8759||e===8764||e===8765||e===8776||e===8780||e===8786||e===8800||e===8801||e>=8804&&e<=8807||e===8810||e===8811||e===8814||e===8815||e===8834||e===8835||e===8838||e===8839||e===8853||e===8857||e===8869||e===8895||e===8978||e>=9312&&e<=9449||e>=9451&&e<=9547||e>=9552&&e<=9587||e>=9600&&e<=9615||e>=9618&&e<=9621||e===9632||e===9633||e>=9635&&e<=9641||e===9650||e===9651||e===9654||e===9655||e===9660||e===9661||e===9664||e===9665||e>=9670&&e<=9672||e===9675||e>=9678&&e<=9681||e>=9698&&e<=9701||e===9711||e===9733||e===9734||e===9737||e===9742||e===9743||e===9756||e===9758||e===9792||e===9794||e===9824||e===9825||e>=9827&&e<=9829||e>=9831&&e<=9834||e===9836||e===9837||e===9839||e===9886||e===9887||e===9919||e>=9926&&e<=9933||e>=9935&&e<=9939||e>=9941&&e<=9953||e===9955||e===9960||e===9961||e>=9963&&e<=9969||e===9972||e>=9974&&e<=9977||e===9979||e===9980||e===9982||e===9983||e===10045||e>=10102&&e<=10111||e>=11094&&e<=11097||e>=12872&&e<=12879||e>=57344&&e<=63743||e>=65024&&e<=65039||e===65533||e>=127232&&e<=127242||e>=127248&&e<=127277||e>=127280&&e<=127337||e>=127344&&e<=127373||e===127375||e===127376||e>=127387&&e<=127404||e>=917760&&e<=917999||e>=983040&&e<=1048573||e>=1048576&&e<=1114109}function vR(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function xR(e){return e>=4352&&e<=4447||e===8986||e===8987||e===9001||e===9002||e>=9193&&e<=9196||e===9200||e===9203||e===9725||e===9726||e===9748||e===9749||e>=9776&&e<=9783||e>=9800&&e<=9811||e===9855||e>=9866&&e<=9871||e===9875||e===9889||e===9898||e===9899||e===9917||e===9918||e===9924||e===9925||e===9934||e===9940||e===9962||e===9970||e===9971||e===9973||e===9978||e===9981||e===9989||e===9994||e===9995||e===10024||e===10060||e===10062||e>=10067&&e<=10069||e===10071||e>=10133&&e<=10135||e===10160||e===10175||e===11035||e===11036||e===11088||e===11093||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12773||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=94176&&e<=94180||e===94192||e===94193||e>=94208&&e<=100343||e>=100352&&e<=101589||e>=101631&&e<=101640||e>=110576&&e<=110579||e>=110581&&e<=110587||e===110589||e===110590||e>=110592&&e<=110882||e===110898||e>=110928&&e<=110930||e===110933||e>=110948&&e<=110951||e>=110960&&e<=111355||e>=119552&&e<=119638||e>=119648&&e<=119670||e===126980||e===127183||e===127374||e>=127377&&e<=127386||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e===127568||e===127569||e>=127584&&e<=127589||e>=127744&&e<=127776||e>=127789&&e<=127797||e>=127799&&e<=127868||e>=127870&&e<=127891||e>=127904&&e<=127946||e>=127951&&e<=127955||e>=127968&&e<=127984||e===127988||e>=127992&&e<=128062||e===128064||e>=128066&&e<=128252||e>=128255&&e<=128317||e>=128331&&e<=128334||e>=128336&&e<=128359||e===128378||e===128405||e===128406||e===128420||e>=128507&&e<=128591||e>=128640&&e<=128709||e===128716||e>=128720&&e<=128722||e>=128725&&e<=128727||e>=128732&&e<=128735||e===128747||e===128748||e>=128756&&e<=128764||e>=128992&&e<=129003||e===129008||e>=129292&&e<=129338||e>=129340&&e<=129349||e>=129351&&e<=129535||e>=129648&&e<=129660||e>=129664&&e<=129673||e>=129679&&e<=129734||e>=129742&&e<=129756||e>=129759&&e<=129769||e>=129776&&e<=129784||e>=131072&&e<=196605||e>=196608&&e<=262141}function FDe(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function gR(e,{ambiguousAsWide:t=!1}={}){return FDe(e),vR(e)||xR(e)||t&&hR(e)?2:1}var DR=ae(bR(),1),CDe=new Intl.Segmenter,SDe=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function ev(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=$u(e)),e.length===0)return 0;let i=0,a={ambiguousAsWide:!r};for(let{segment:u}of CDe.segment(e)){let p=u.codePointAt(0);if(!(p<=31||p>=127&&p<=159)&&!(p>=8203&&p<=8207||p===65279)&&!(p>=768&&p<=879||p>=6832&&p<=6911||p>=7616&&p<=7679||p>=8400&&p<=8447||p>=65056&&p<=65071)&&!(p>=55296&&p<=57343)&&!(p>=65024&&p<=65039)&&!SDe.test(u)){if((0,DR.default)().test(u)){i+=2;continue}i+=gR(p,a)}}return i}function tv({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var rv=ae(require("node:process"),1);function nv(){let{env:e}=rv.default,{TERM:t,TERM_PROGRAM:r}=e;return rv.default.platform!=="win32"?t!=="linux":!!e.WT_SESSION||!!e.TERMINUS_SUBLIME||e.ConEmuTask==="{cmd::Cmder}"||r==="Terminus-Sublime"||r==="vscode"||t==="xterm-256color"||t==="alacritty"||t==="rxvt-unicode"||t==="rxvt-unicode-256color"||e.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var zr=ae(require("node:process"),1),ADe=3,iv=class{#s=0;start(){this.#s++,this.#s===1&&this.#r()}stop(){if(this.#s<=0)throw new Error("`stop` called more times than `start`");this.#s--,this.#s===0&&this.#e()}#r(){zr.default.platform==="win32"||!zr.default.stdin.isTTY||(zr.default.stdin.setRawMode(!0),zr.default.stdin.on("data",this.#i),zr.default.stdin.resume())}#e(){zr.default.stdin.isTTY&&(zr.default.stdin.off("data",this.#i),zr.default.stdin.pause(),zr.default.stdin.setRawMode(!1))}#i(t){t[0]===ADe&&zr.default.emit("SIGINT")}},ODe=new iv,av=ODe;var TDe=ae(N6(),1),sv=class{#s=0;#r=!1;#e=0;#i=-1;#c=0;#t;#a;#n;#f;#h;#p;#d;#l;#v;#o;#u;color;constructor(t){typeof t=="string"&&(t={text:t}),this.#t={color:"cyan",stream:Gu.default.stderr,discardStdin:!0,hideCursor:!0,...t},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#h=this.#t.interval,this.#n=this.#t.stream,this.#p=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:tv({stream:this.#n}),this.#d=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,Gu.default.env.NODE_ENV==="test"&&(this._stream=this.#n,this._isEnabled=this.#p,Object.defineProperty(this,"_linesToClear",{get(){return this.#s},set(r){this.#s=r}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#i}}),Object.defineProperty(this,"_lineCount",{get(){return this.#e}}))}get indent(){return this.#l}set indent(t=0){if(!(t>=0&&Number.isInteger(t)))throw new Error("The `indent` option must be an integer from 0 and up");this.#l=t,this.#m()}get interval(){return this.#h??this.#a.interval??100}get spinner(){return this.#a}set spinner(t){if(this.#i=-1,this.#h=void 0,typeof t=="object"){if(t.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#a=t}else if(!nv())this.#a=zu.default.line;else if(t===void 0)this.#a=zu.default.dots;else if(t!=="default"&&zu.default[t])this.#a=zu.default[t];else throw new Error(`There is no built-in spinner named '${t}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#v}set text(t=""){this.#v=t,this.#m()}get prefixText(){return this.#o}set prefixText(t=""){this.#o=t,this.#m()}get suffixText(){return this.#u}set suffixText(t=""){this.#u=t,this.#m()}get isSpinning(){return this.#f!==void 0}#x(t=this.#o,r=" "){return typeof t=="string"&&t!==""?t+r:typeof t=="function"?t()+r:""}#g(t=this.#u,r=" "){return typeof t=="string"&&t!==""?r+t:typeof t=="function"?r+t():""}#m(){let t=this.#n.columns??80,r=this.#x(this.#o,"-"),n=this.#g(this.#u,"-"),i=" ".repeat(this.#l)+r+"--"+this.#v+"--"+n;this.#e=0;for(let a of $u(i).split(`
95
95
  `))this.#e+=Math.max(1,Math.ceil(ev(a,{countAnsiEscapeCodes:!0})/t))}get isEnabled(){return this.#p&&!this.#d}set isEnabled(t){if(typeof t!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#p=t}get isSilent(){return this.#d}set isSilent(t){if(typeof t!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#d=t}frame(){let t=Date.now();(this.#i===-1||t-this.#c>=this.interval)&&(this.#i=++this.#i%this.#a.frames.length,this.#c=t);let{frames:r}=this.#a,n=r[this.#i];this.color&&(n=XN[this.color](n));let i=typeof this.#o=="string"&&this.#o!==""?this.#o+" ":"",a=typeof this.text=="string"?" "+this.text:"",u=typeof this.#u=="string"&&this.#u!==""?" "+this.#u:"";return i+n+a+u}clear(){if(!this.#p||!this.#n.isTTY)return this;this.#n.cursorTo(0);for(let t=0;t<this.#s;t++)t>0&&this.#n.moveCursor(0,-1),this.#n.clearLine(1);return(this.#l||this.lastIndent!==this.#l)&&this.#n.cursorTo(this.#l),this.lastIndent=this.#l,this.#s=0,this}render(){return this.#d?this:(this.clear(),this.#n.write(this.frame()),this.#s=this.#e,this)}start(t){return t&&(this.text=t),this.#d?this:this.#p?this.isSpinning?this:(this.#t.hideCursor&&H7.hide(this.#n),this.#t.discardStdin&&Gu.default.stdin.isTTY&&(this.#r=!0,av.start()),this.render(),this.#f=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#n.write(`- ${this.text}
96
96
  `),this)}stop(){return this.#p?(clearInterval(this.#f),this.#f=void 0,this.#i=0,this.clear(),this.#t.hideCursor&&H7.show(this.#n),this.#t.discardStdin&&Gu.default.stdin.isTTY&&this.#r&&(av.stop(),this.#r=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Wu.success,text:t})}fail(t){return this.stopAndPersist({symbol:Wu.error,text:t})}warn(t){return this.stopAndPersist({symbol:Wu.warning,text:t})}info(t){return this.stopAndPersist({symbol:Wu.info,text:t})}stopAndPersist(t={}){if(this.#d)return this;let r=t.prefixText??this.#o,n=this.#x(r," "),i=t.symbol??" ",a=t.text??this.text,p=typeof a=="string"?(i?" ":"")+a:"",l=t.suffixText??this.#u,c=this.#g(l," "),h=n+i+p+c+`
97
- `;return this.stop(),this.#n.write(h),this}};function Dr(e){return new sv(e)}var Vf=ae(bv()),xI=ae(cI());var Lf=D.lazy(()=>D.object({type:D.string().optional(),properties:D.record(Lf).optional(),items:Lf.optional(),required:D.array(D.string()).optional(),description:D.string().optional(),default:D.unknown().optional()})),JRe=D.union([D.object({type:D.literal("stdio"),configSchema:Lf.optional(),exampleConfig:D.record(D.any()).optional(),published:D.boolean().optional(),stdioFunction:D.string().optional()}),D.object({type:D.literal("ws"),deploymentUrl:D.string().url(),configSchema:Lf.optional(),exampleConfig:D.record(D.any()).optional()})]),fI=D.object({command:D.string().describe("The executable to run to start the server."),args:D.array(D.string()).optional().describe("Command line arguments to pass to the executable."),env:D.record(D.string(),D.string()).optional().describe("The environment to use when spawning the process.")}),XRe=D.object({type:D.literal("ws"),url:D.string().url(),config:D.record(D.any()).optional()});var mI=ae(We()),hI=!1;function vI(e){hI=e}function M(e){hI&&console.log(mI.default.gray(`[verbose] ${e}`))}(0,xI.config)();var wv=()=>{let e="https://registry.smithery.ai";if(!e)throw new Error("REGISTRY_ENDPOINT environment variable is not set");return e},Fs=async e=>{let t=wv();M(`Resolving package ${e} from registry at ${t}`);try{M(`Making GET request to ${t}/servers/${e}`);let r=await(0,Vf.default)(`${t}/servers/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(M(`Response status: ${r.status}`),!r.ok){let a=(await r.json().catch(()=>null))?.error||await r.text();throw M(`Error response: ${a}`),r.status===404?new Error(`Server "${e}" not found`):new Error(`Package resolution failed with status ${r.status}: ${a}`)}M("Successfully received server data from registry");let n=await r.json();return M(`Server ${e} resolved with ${n.connections.length} connection options`),n}catch(r){throw M(`Package resolution error: ${r instanceof Error?r.message:String(r)}`),r instanceof Error?r:new Error(`Failed to resolve package: ${r}`)}},gI=async(e,t)=>{let r=wv();M(`Fetching connection for ${e} from registry at ${r}`),M(`Connection config provided (keys: ${Object.keys(t).join(", ")})`);try{let n={connectionType:"stdio",config:t};M(`Sending connection request for ${e}`),M(`Making POST request to ${r}/servers/${e}`);let i=await(0,Vf.default)(`${r}/servers/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(M(`Response status: ${i.status}`),!i.ok){let u=await i.text();throw M(`Error response: ${u}`),new Error(`Registry request failed with status ${i.status}: ${u}`)}M("Successfully received connection data from registry");let a=await i.json();if(M(`Connection response received (success: ${a.success})`),!a.success||!a.result)throw new Error("Invalid registry response format");return fI.parse(a.result)}catch(n){throw M(`Connection fetch error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?new Error(`Failed to fetch server connection: ${n.message}`):n}},Uf=async(e,t)=>{let r=wv();M(`Fetching configuration for ${e} using API key`);try{M(`Making GET request to ${r}/configs/${e}`);let n=await(0,Vf.default)(`${r}/configs/${e}`,{method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(M(`Response status: ${n.status}`),!n.ok){let a;try{a=(await n.clone().json())?.error||"Unknown error"}catch{a=await n.text()}throw M(`Error response: ${a}`),n.status===404?new Error(`Server "${e}" not found`):n.status===401?new Error("API key required or invalid"):n.status===400?new Error("Invalid server name"):n.status===500?new Error(`Internal server error: ${a}`):new Error(`Configuration fetch failed with status ${n.status}: ${a}`)}M("Successfully received configuration data");let i=await n.json();if(!i.success||!i.config||!i.server)throw new Error("Invalid response format");return M(`Configuration and server details for ${e} retrieved successfully`),{config:i.config,server:i.server}}catch(n){throw M(`Configuration fetch error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?n:new Error(`Failed to fetch configuration: ${n}`)}};var bI=ae(N1()),Fv=ae(We());async function Wf(e,t){let r={},n=[];if(!e.configSchema?.properties)return t||{};let i=new Set(e.configSchema.required||[]);for(let[a,u]of Object.entries(e.configSchema.properties)){let p=u,l=t?.[a];try{let c;if(l!==void 0?c=l:i.has(a)?c=void 0:c=p.default,c===void 0){if(i.has(a)){n.push(a);continue}r[a]="";continue}r[a]=Lye(c,p.type)}catch{i.has(a)?n.push(a):r[a]=null}}if(n.length>0)throw new Error(`Missing required config values: ${n.join(", ")}`);return r}function Lye(e,t){if(!t)return e;let r=n=>{throw new Error(`Invalid ${n} value: ${JSON.stringify(e)}`)};switch(t){case"boolean":{let n=String(e).toLowerCase();return n==="true"?!0:n==="false"?!1:(r("boolean"),null)}case"number":{let n=Number(e);return Number.isNaN(n)?(r("number"),null):n}case"integer":{let n=Number.parseInt(String(e),10);return Number.isNaN(n)?(r("integer"),null):n}case"string":return String(e);case"array":return Array.isArray(e)?e:String(e).split(",").map(n=>n.trim());default:return e}}async function Vye(e,t){if(!e.configSchema?.properties)return{isValid:!0,savedConfig:{}};try{let r=await Wf(e,t||{}),n=new Set(e.configSchema.required||[]);return{isValid:Array.from(n).every(a=>r[a]!==void 0),savedConfig:r}}catch{try{return{isValid:!1,savedConfig:Object.fromEntries(Object.entries(t||{}).filter(([i,a])=>a!==void 0))}}catch{return{isValid:!1}}}}async function $f(e,t){if(!e.configSchema?.properties)return{};let r={};if(t){let{isValid:a,savedConfig:u}=await Vye(e,t);if(a)return u;r=u||{}}let n=new Set(e.configSchema.required||[]),i=e.configSchema.properties;for(let[a,u]of Object.entries(i)){let p=u;if(r[a]!==void 0)continue;let l=await Uye(a,p,n);r[a]=l!==void 0?l:p.default}try{return await Wf(e,r)}catch(a){let u=a instanceof Error?a.message:"Unknown configuration error";return console.error(Fv.default.red("Configuration error:"),u),r}}async function Uye(e,t,r){let n=r.has(e)?Fv.default.red(" (required)"):" (optional)",i=e.toLowerCase().includes("key")?"password":t.type==="boolean"?"confirm":t.type==="array"?"input":t.type==="number"||t.type==="integer"?"number":"input",{value:a}=await bI.default.prompt([{type:i,name:"value",message:`${t.description||`Enter value for ${e}`}${n}${t.type==="array"?" (comma-separated)":""}`,default:t.default,mask:i==="password"?"*":void 0,validate:u=>r.has(e)&&!u?!1:t.type==="number"||t.type==="integer"?!Number.isNaN(Number(u))||"Please enter a valid number":!0}]);return a}function _I(e){let t=e.filter(n=>n.type==="stdio");if(!t.length)return null;let r=["npx","uvx","docker"];for(let n of r){let i=t.find(a=>a.stdioFunction?.startsWith(n)&&a.published);if(i)return i}for(let n of r){let i=t.find(a=>a.stdioFunction?.startsWith(n));if(i)return i}return t[0]}function z1(e){if(!e.connections?.length)throw new Error("No connection configuration found");if(!e.remote){let n=_I(e.connections);if(n)return n}let t=e.connections.find(n=>n.type==="ws");if(t)return t;let r=_I(e.connections);return r||e.connections[0]}function DI(e){if(e.startsWith("@")){let t=e.indexOf("/");if(t!==-1)return`${e.substring(0,t)}-${e.substring(t+1)}`}return e}function yI(e){if(e.startsWith("@")&&e.includes("/")){let t=e.indexOf("/");return e.substring(t+1)}return e}function EI(e,t,r,n=!0){let i=["-y","@smithery/cli@latest","run",e];if(r&&i.push("--key",r),!r||n){let a=JSON.stringify(JSON.stringify(t));i.push("--config",a)}return process.platform==="win32"?{command:"cmd",args:["/c","npx",...i]}:{command:"npx",args:i}}var Cv=ae(N1()),ii=ae(We()),wI=require("node:child_process"),FI=require("node:util");var fa=(0,FI.promisify)(wI.exec);async function Wye(){try{return await fa("uvx --version"),!0}catch{return!1}}async function $ye(){let{shouldInstall:e}=await Cv.default.prompt([{type:"confirm",name:"shouldInstall",message:"UV package manager is required for Python MCP servers. Would you like to install it?",default:!0}]);if(!e)return console.warn(ii.default.yellow("UV installation was declined. You can install it manually from https://astral.sh/uv")),!1;let t=Dr("Installing UV package manager...").start();try{if(process.platform==="win32")await fa('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');else try{await fa("curl -LsSf https://astral.sh/uv/install.sh | sh")}catch{await fa("wget -qO- https://astral.sh/uv/install.sh | sh")}return t.succeed("\u2713 UV installed successfully"),!0}catch{return t.fail("Failed to install UV. You can install it manually from https://astral.sh/uv"),!1}}function Gye(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("uvx"))}async function zye(){try{return await fa("bun --version"),!0}catch{return!1}}async function Hye(){let{shouldInstall:e}=await Cv.default.prompt([{type:"confirm",name:"shouldInstall",message:"Bun is required for this operation. Would you like to install it?",default:!0}]);if(!e)return console.warn(ii.default.yellow("Bun installation was declined. You can install it manually from https://bun.sh")),!1;try{if(console.log("Installing Bun..."),process.platform==="win32")await fa('powershell -c "irm bun.sh/install.ps1|iex"');else try{console.log("Attempting to install Bun via Homebrew..."),await fa("brew install oven-sh/bun/bun")}catch{console.log("Homebrew installation failed, trying direct installation..."),await fa("curl -fsSL https://bun.sh/install | bash")}return console.log(ii.default.green("Bun installed successfully!")),!0}catch(t){return console.error(ii.default.red("Failed to install Bun:"),t instanceof Error?t.message:String(t)),console.log("Please install Bun manually from https://bun.sh"),!1}}function Kye(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("bunx"))}function Gf(e={}){return{...vm(),...e}}async function CI(e){Gye(e)&&(M("UV installation check required"),await Wye()||await $ye()||console.warn(ii.default.yellow("UV is not installed. The server might fail to launch.")))}async function SI(e){Kye(e)&&(M("Bun installation check required"),await zye()||await Hye()||console.warn(ii.default.yellow("Bun is not installed. The server might fail to launch.")))}function AI(e){let t=e.connections.some(r=>r.type==="ws"&&"deploymentUrl"in r)&&e.remote!==!1;return t&&(M("Remote server detected, showing security notice"),console.log(ii.default.blue(`Installing remote server. Please ensure you trust the server author, especially when sharing sensitive data.
97
+ `;return this.stop(),this.#n.write(h),this}};function Dr(e){return new sv(e)}var Vf=ae(bv()),xI=ae(cI());var Lf=D.lazy(()=>D.object({type:D.string().optional(),properties:D.record(Lf).optional(),items:Lf.optional(),required:D.array(D.string()).optional(),description:D.string().optional(),default:D.unknown().optional()})),JRe=D.union([D.object({type:D.literal("stdio"),configSchema:Lf.optional(),exampleConfig:D.record(D.any()).optional(),published:D.boolean().optional(),stdioFunction:D.string().optional()}),D.object({type:D.literal("ws"),deploymentUrl:D.string().url(),configSchema:Lf.optional(),exampleConfig:D.record(D.any()).optional()})]),fI=D.object({command:D.string().describe("The executable to run to start the server."),args:D.array(D.string()).optional().describe("Command line arguments to pass to the executable."),env:D.record(D.string(),D.string()).optional().describe("The environment to use when spawning the process.")}),XRe=D.object({type:D.literal("ws"),url:D.string().url(),config:D.record(D.any()).optional()});var mI=ae(We()),hI=!1;function vI(e){hI=e}function M(e){hI&&console.log(mI.default.gray(`[verbose] ${e}`))}(0,xI.config)();var wv=()=>{let e="https://registry.smithery.ai";if(!e)throw new Error("REGISTRY_ENDPOINT environment variable is not set");return e},Fs=async e=>{let t=wv();M(`Resolving package ${e} from registry at ${t}`);try{M(`Making GET request to ${t}/servers/${e}`);let r=await(0,Vf.default)(`${t}/servers/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(M(`Response status: ${r.status}`),!r.ok){let a=(await r.json().catch(()=>null))?.error||await r.text();throw M(`Error response: ${a}`),r.status===404?new Error(`Server "${e}" not found`):new Error(`Package resolution failed with status ${r.status}: ${a}`)}M("Successfully received server data from registry");let n=await r.json();return M(`Server ${e} resolved with ${n.connections.length} connection options`),n}catch(r){throw M(`Package resolution error: ${r instanceof Error?r.message:String(r)}`),r instanceof Error?r:new Error(`Failed to resolve package: ${r}`)}},gI=async(e,t)=>{let r=wv();M(`Fetching connection for ${e} from registry at ${r}`),M(`Connection config provided (keys: ${Object.keys(t).join(", ")})`);try{let n={connectionType:"stdio",config:t};M(`Sending connection request for ${e}`),M(`Making POST request to ${r}/servers/${e}`);let i=await(0,Vf.default)(`${r}/servers/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(M(`Response status: ${i.status}`),!i.ok){let u=await i.text();throw M(`Error response: ${u}`),new Error(`Registry request failed with status ${i.status}: ${u}`)}M("Successfully received connection data from registry");let a=await i.json();if(M(`Connection response received (success: ${a.success})`),!a.success||!a.result)throw new Error("Invalid registry response format");return fI.parse(a.result)}catch(n){throw M(`Connection fetch error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?new Error(`Failed to fetch server connection: ${n.message}`):n}},Uf=async(e,t)=>{let r=wv();M(`Fetching configuration for ${e} using API key`);try{M(`Making GET request to ${r}/configs/${e}`);let n=await(0,Vf.default)(`${r}/configs/${e}`,{method:"GET",headers:{Authorization:`Bearer ${t}`,"Content-Type":"application/json"}});if(M(`Response status: ${n.status}`),!n.ok){let a;try{a=(await n.clone().json())?.error||"Unknown error"}catch{a=await n.text()}throw M(`Error response: ${a}`),n.status===404?new Error(`Server "${e}" not found`):n.status===401?new Error("API key required or invalid"):n.status===400?new Error("Invalid server name"):n.status===500?new Error(`Internal server error: ${a}`):new Error(`Configuration fetch failed with status ${n.status}: ${a}`)}M("Successfully received configuration data");let i=await n.json();if(!i.success||!i.config||!i.server)throw new Error("Invalid response format");return M(`Configuration and server details for ${e} retrieved successfully`),{config:i.config,server:i.server}}catch(n){throw M(`Configuration fetch error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?n:new Error(`Failed to fetch configuration: ${n}`)}};var bI=ae(N1()),Fv=ae(We());async function Wf(e,t){let r={},n=[];if(!e.configSchema?.properties)return t||{};let i=new Set(e.configSchema.required||[]);for(let[a,u]of Object.entries(e.configSchema.properties)){let p=u,l=t?.[a];try{let c;if(l!==void 0?c=l:i.has(a)?c=void 0:c=p.default,c===void 0){if(i.has(a)){n.push(a);continue}r[a]="";continue}r[a]=Lye(c,p.type)}catch{i.has(a)?n.push(a):r[a]=null}}if(n.length>0)throw new Error(`Missing required config values: ${n.join(", ")}`);return r}function Lye(e,t){if(!t)return e;let r=n=>{throw new Error(`Invalid ${n} value: ${JSON.stringify(e)}`)};switch(t){case"boolean":{let n=String(e).toLowerCase();return n==="true"?!0:n==="false"?!1:(r("boolean"),null)}case"number":{let n=Number(e);return Number.isNaN(n)?(r("number"),null):n}case"integer":{let n=Number.parseInt(String(e),10);return Number.isNaN(n)?(r("integer"),null):n}case"string":return String(e);case"array":return Array.isArray(e)?e:String(e).split(",").map(n=>n.trim());default:return e}}async function Vye(e,t){if(!e.configSchema?.properties)return{isValid:!0,savedConfig:{}};try{let r=await Wf(e,t||{}),n=new Set(e.configSchema.required||[]);return{isValid:Array.from(n).every(a=>r[a]!==void 0),savedConfig:r}}catch{try{return{isValid:!1,savedConfig:Object.fromEntries(Object.entries(t||{}).filter(([i,a])=>a!==void 0))}}catch{return{isValid:!1}}}}async function $f(e,t){if(!e.configSchema?.properties)return{};let r={};if(t){let{isValid:a,savedConfig:u}=await Vye(e,t);if(a)return u;r=u||{}}let n=new Set(e.configSchema.required||[]),i=e.configSchema.properties;for(let[a,u]of Object.entries(i)){let p=u;if(r[a]!==void 0)continue;let l=await Uye(a,p,n);r[a]=l!==void 0?l:p.default}try{return await Wf(e,r)}catch(a){let u=a instanceof Error?a.message:"Unknown configuration error";return console.error(Fv.default.red("Configuration error:"),u),r}}async function Uye(e,t,r){let n=r.has(e)?Fv.default.red(" (required)"):" (optional)",i=e.toLowerCase().includes("key")?"password":t.type==="boolean"?"confirm":t.type==="array"?"input":t.type==="number"||t.type==="integer"?"number":"input",{value:a}=await bI.default.prompt([{type:i,name:"value",message:`${t.description||`Enter value for ${e}`}${n}${t.type==="array"?" (comma-separated)":""}`,default:t.default,mask:i==="password"?"*":void 0,validate:u=>r.has(e)&&!u?!1:t.type==="number"||t.type==="integer"?!Number.isNaN(Number(u))||"Please enter a valid number":!0}]);return a}function _I(e){let t=e.filter(n=>n.type==="stdio");if(!t.length)return null;let r=["npx","uvx","docker"];for(let n of r){let i=t.find(a=>a.stdioFunction?.startsWith(n)&&a.published);if(i)return i}for(let n of r){let i=t.find(a=>a.stdioFunction?.startsWith(n));if(i)return i}return t[0]}function z1(e){if(!e.connections?.length)throw new Error("No connection configuration found");if(!e.remote){let n=_I(e.connections);if(n)return n}let t=e.connections.find(n=>n.type==="ws");if(t)return t;let r=_I(e.connections);return r||e.connections[0]}function DI(e){if(e.startsWith("@")){let t=e.indexOf("/");if(t!==-1)return`${e.substring(0,t)}-${e.substring(t+1)}`}return e}function yI(e){if(e.startsWith("@")&&e.includes("/")){let t=e.indexOf("/");return e.substring(t+1)}return e}function EI(e,t,r,n=!0){let i=["-y","@smithery/cli@latest","run",e];if(r&&i.push("--key",r),!(Object.keys(t).length===0)&&(!r||n)){let u=JSON.stringify(JSON.stringify(t));i.push("--config",u)}return process.platform==="win32"?{command:"cmd",args:["/c","npx",...i]}:{command:"npx",args:i}}var Cv=ae(N1()),ii=ae(We()),wI=require("node:child_process"),FI=require("node:util");var fa=(0,FI.promisify)(wI.exec);async function Wye(){try{return await fa("uvx --version"),!0}catch{return!1}}async function $ye(){let{shouldInstall:e}=await Cv.default.prompt([{type:"confirm",name:"shouldInstall",message:"UV package manager is required for Python MCP servers. Would you like to install it?",default:!0}]);if(!e)return console.warn(ii.default.yellow("UV installation was declined. You can install it manually from https://astral.sh/uv")),!1;let t=Dr("Installing UV package manager...").start();try{if(process.platform==="win32")await fa('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');else try{await fa("curl -LsSf https://astral.sh/uv/install.sh | sh")}catch{await fa("wget -qO- https://astral.sh/uv/install.sh | sh")}return t.succeed("\u2713 UV installed successfully"),!0}catch{return t.fail("Failed to install UV. You can install it manually from https://astral.sh/uv"),!1}}function Gye(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("uvx"))}async function zye(){try{return await fa("bun --version"),!0}catch{return!1}}async function Hye(){let{shouldInstall:e}=await Cv.default.prompt([{type:"confirm",name:"shouldInstall",message:"Bun is required for this operation. Would you like to install it?",default:!0}]);if(!e)return console.warn(ii.default.yellow("Bun installation was declined. You can install it manually from https://bun.sh")),!1;try{if(console.log("Installing Bun..."),process.platform==="win32")await fa('powershell -c "irm bun.sh/install.ps1|iex"');else try{console.log("Attempting to install Bun via Homebrew..."),await fa("brew install oven-sh/bun/bun")}catch{console.log("Homebrew installation failed, trying direct installation..."),await fa("curl -fsSL https://bun.sh/install | bash")}return console.log(ii.default.green("Bun installed successfully!")),!0}catch(t){return console.error(ii.default.red("Failed to install Bun:"),t instanceof Error?t.message:String(t)),console.log("Please install Bun manually from https://bun.sh"),!1}}function Kye(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("bunx"))}function Gf(e={}){return{...vm(),...e}}async function CI(e){Gye(e)&&(M("UV installation check required"),await Wye()||await $ye()||console.warn(ii.default.yellow("UV is not installed. The server might fail to launch.")))}async function SI(e){Kye(e)&&(M("Bun installation check required"),await zye()||await Hye()||console.warn(ii.default.yellow("Bun is not installed. The server might fail to launch.")))}function AI(e){let t=e.connections.some(r=>r.type==="ws"&&"deploymentUrl"in r)&&e.remote!==!1;return t&&(M("Remote server detected, showing security notice"),console.log(ii.default.blue(`Installing remote server. Please ensure you trust the server author, especially when sharing sensitive data.
98
98
  For information on Smithery's data policy, please visit: ${ii.default.underline("https://smithery.ai/docs/data-policy")}`))),t}process.removeAllListeners("warning");process.on("warning",e=>{e.name==="DeprecationWarning"&&e.message.includes("punycode")||console.warn(e)});async function Zye(){let e=new Ad({name:"smithery-cli",version:"1.0.0"},{capabilities:{}});return e.setNotificationHandler(mm,t=>{console.debug("[server log]:",t.params.data)}),e}async function Jye(e){let t=e.getServerCapabilities()||{},r=[],n=[];return t.resources&&n.push(e.listResources().then(({resources:i})=>{i.forEach(a=>r.push({type:"resource",value:a}))})),t.tools&&n.push(e.listTools().then(({tools:i})=>{i.forEach(a=>r.push({type:"tool",value:a}))})),t.prompts&&n.push(e.listPrompts().then(({prompts:i})=>{i.forEach(a=>r.push({type:"prompt",value:a}))})),await Promise.all(n),r}async function Xye(e){let t=Dr("Connecting to server...").start(),r=null;try{r=await Zye(),await r.connect(e);let n=await Jye(r);t.succeed(`Connected, server capabilities: ${Object.keys(r.getServerCapabilities()||{}).join(", ")}`);let i=async()=>{console.error("Closing connection..."),r&&(await r.close(),r=null),process.exit(0)};for(process.on("SIGINT",i),process.on("SIGTERM",i),process.on("beforeExit",i);;){let{primitive:a}=await Sv.default.prompt([{name:"primitive",type:"list",message:"Pick a primitive",choices:[...n.map(l=>({name:ai.default.bold(`${l.type}(${l.value.name})`),value:l,description:l.value.description})),{name:ai.default.red("Exit"),value:{type:"exit"}}]}]);if(a.type==="exit"){await i();return}let u,p;if(a.type==="resource")p=Dr(`Reading resource ${a.value.uri}...`).start(),u=await r.readResource({uri:a.value.uri}).catch(l=>{p?.fail(l.message),p=void 0});else if(a.type==="tool"){console.log(ai.default.cyan(`
99
99
  Tool: ${a.value.name}`)),console.log(ai.default.dim(`Description: ${a.value.description||"No description"}`)),console.log(ai.default.cyan(`
100
100
  Input Schema:`)),console.dir(a.value.inputSchema,{depth:null,colors:!0}),console.log(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smithery/cli",
3
- "version": "1.1.52",
3
+ "version": "1.1.53",
4
4
  "type": "commonjs",
5
5
  "private": false,
6
6
  "homepage": "https://smithery.ai/",