@smithery/cli 1.1.42 → 1.1.43

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}`,nDe=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),iDe=Obj
94
94
  `);return a!==-1&&(t=fR(t,i,n,a)),n+t+i};Object.defineProperties(Vu.prototype,ko);var yDe=Vu(),sRe=Vu({level:hR?hR.level:0});var ei=yDe;var Dr=ae(require("node:process"),1);function J7(){return Dr.default.platform!=="win32"?Dr.default.env.TERM!=="linux":!!Dr.default.env.CI||!!Dr.default.env.WT_SESSION||!!Dr.default.env.TERMINUS_SUBLIME||Dr.default.env.ConEmuTask==="{cmd::Cmder}"||Dr.default.env.TERM_PROGRAM==="Terminus-Sublime"||Dr.default.env.TERM_PROGRAM==="vscode"||Dr.default.env.TERM==="xterm-256color"||Dr.default.env.TERM==="alacritty"||Dr.default.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var EDe={info:ei.blue("\u2139"),success:ei.green("\u2714"),warning:ei.yellow("\u26A0"),error:ei.red("\u2716")},wDe={info:ei.blue("i"),success:ei.green("\u221A"),warning:ei.yellow("\u203C"),error:ei.red("\xD7")},FDe=J7()?EDe:wDe,Uu=FDe;function X7({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 CDe=X7();function Wu(e){if(typeof e!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(CDe,"")}function xR(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 _R(e){return e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510}function gR(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 SDe(e){if(!Number.isSafeInteger(e))throw new TypeError(`Expected a code point, got \`${typeof e}\`.`)}function bR(e,{ambiguousAsWide:t=!1}={}){return SDe(e),_R(e)||gR(e)||t&&xR(e)?2:1}var ER=ae(yR(),1),ADe=new Intl.Segmenter,ODe=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function Q7(e,t={}){if(typeof e!="string"||e.length===0)return 0;let{ambiguousIsNarrow:r=!0,countAnsiEscapeCodes:n=!1}=t;if(n||(e=Wu(e)),e.length===0)return 0;let i=0,a={ambiguousAsWide:!r};for(let{segment:u}of ADe.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)&&!ODe.test(u)){if((0,ER.default)().test(u)){i+=2;continue}i+=bR(p,a)}}return i}function ev({stream:e=process.stdout}={}){return!!(e&&e.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}var tv=ae(require("node:process"),1);function rv(){let{env:e}=tv.default,{TERM:t,TERM_PROGRAM:r}=e;return tv.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 Hr=ae(require("node:process"),1),TDe=3,nv=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(){Hr.default.platform==="win32"||!Hr.default.stdin.isTTY||(Hr.default.stdin.setRawMode(!0),Hr.default.stdin.on("data",this.#i),Hr.default.stdin.resume())}#e(){Hr.default.stdin.isTTY&&(Hr.default.stdin.off("data",this.#i),Hr.default.stdin.pause(),Hr.default.stdin.setRawMode(!1))}#i(t){t[0]===TDe&&Hr.default.emit("SIGINT")}},qDe=new nv,iv=qDe;var BDe=ae(R6(),1),av=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:$u.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:ev({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,$u.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(!rv())this.#a=Gu.default.line;else if(t===void 0)this.#a=Gu.default.dots;else if(t!=="default"&&Gu.default[t])this.#a=Gu.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:""}#_(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.#_(this.#u,"-"),i=" ".repeat(this.#l)+r+"--"+this.#v+"--"+n;this.#e=0;for(let a of Wu(i).split(`
95
95
  `))this.#e+=Math.max(1,Math.ceil(Q7(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=eR[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&&z7.hide(this.#n),this.#t.discardStdin&&$u.default.stdin.isTTY&&(this.#r=!0,iv.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&&z7.show(this.#n),this.#t.discardStdin&&$u.default.stdin.isTTY&&this.#r&&(iv.stop(),this.#r=!1),this):this}succeed(t){return this.stopAndPersist({symbol:Uu.success,text:t})}fail(t){return this.stopAndPersist({symbol:Uu.error,text:t})}warn(t){return this.stopAndPersist({symbol:Uu.warning,text:t})}info(t){return this.stopAndPersist({symbol:Uu.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.#_(l," "),h=n+i+p+c+`
97
- `;return this.stop(),this.#n.write(h),this}};function yr(e){return new av(e)}var Ev=ae(gv()),gI=ae(mI());var Vf=D.lazy(()=>D.object({type:D.string().optional(),properties:D.record(Vf).optional(),items:Vf.optional(),required:D.array(D.string()).optional(),description:D.string().optional(),default:D.unknown().optional()})),HRe=D.union([D.object({type:D.literal("stdio"),configSchema:Vf.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:Vf.optional(),exampleConfig:D.record(D.any()).optional()})]),hI=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.")}),KRe=D.object({type:D.literal("ws"),url:D.string().url(),config:D.record(D.any()).optional()});var vI=ae(We()),xI=!1;function _I(e){xI=e}function k(e){xI&&console.log(vI.default.gray(`[verbose] ${e}`))}(0,gI.config)();var bI=()=>{let e="https://registry.smithery.ai";if(!e)throw new Error("REGISTRY_ENDPOINT environment variable is not set");return e},zo=async e=>{let t=bI();k(`Resolving package ${e} from registry at ${t}`);try{k(`Making GET request to ${t}/servers/${e}`);let r=await(0,Ev.default)(`${t}/servers/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(k(`Response status: ${r.status}`),!r.ok){let a=(await r.json().catch(()=>null))?.error||await r.text();throw k(`Error response: ${a}`),r.status===404?new Error(`Server "${e}" not found`):new Error(`Package resolution failed with status ${r.status}: ${a}`)}k("Successfully received server data from registry");let n=await r.json();return k(`Server ${e} resolved with ${n.connections.length} connection options`),n}catch(r){throw k(`Package resolution error: ${r instanceof Error?r.message:String(r)}`),r instanceof Error?r:new Error(`Failed to resolve package: ${r}`)}},DI=async(e,t)=>{let r=bI();k(`Fetching connection for ${e} from registry at ${r}`),k(`Connection config provided (keys: ${Object.keys(t).join(", ")})`);try{let n={connectionType:"stdio",config:t};k(`Sending connection request for ${e}`),k(`Making POST request to ${r}/servers/${e}`);let i=await(0,Ev.default)(`${r}/servers/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(k(`Response status: ${i.status}`),!i.ok){let u=await i.text();throw k(`Error response: ${u}`),new Error(`Registry request failed with status ${i.status}: ${u}`)}k("Successfully received connection data from registry");let a=await i.json();if(k(`Connection response received (success: ${a.success})`),!a.success||!a.result)throw new Error("Invalid registry response format");return hI.parse(a.result)}catch(n){throw k(`Connection fetch error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?new Error(`Failed to fetch server connection: ${n.message}`):n}};var wv=ae(No()),Fv=ae(We());async function EI(e,t){let r={};if(!e.configSchema?.properties)return t||{};let n=new Set(e.configSchema.required||[]);for(let[i,a]of Object.entries(e.configSchema.properties)){let u=a,p=t?.[i];if(p!==void 0||u.default!==void 0)r[i]=Uye(p??u.default,u.type);else if(n.has(i))throw new Error(`Missing required config value: ${i}`)}return r}function Uye(e,t){if(!t||!e)return e;switch(t){case"boolean":return String(e).toLowerCase()==="true";case"number":return Number(e);case"integer":return Number.parseInt(String(e),10);case"array":return Array.isArray(e)?e:String(e).split(",").map(r=>r.trim()).filter(Boolean);default:return e}}async function Uf(e,t){let r={};if(!e.configSchema?.properties)return t||{};let n=new Set(e.configSchema.required||[]);if(t)return t;for(let[i,a]of Object.entries(e.configSchema.properties)){let u=a;if(process.env[i]&&!n.has(i)){let{reuseExisting:h}=await wv.default.prompt([{type:"confirm",name:"reuseExisting",message:`Found ${i} in environment. Use it?`,default:!0}]);if(h){r[i]=process.env[i];continue}}let p=n.has(i)?Fv.default.red(" (required)"):Fv.default.gray(" (optional)"),l=i.toLowerCase().includes("key")?"password":u.type==="boolean"?"confirm":u.type==="array"?"input":u.type==="number"||u.type==="integer"?"number":"input",{value:c}=await wv.default.prompt([{type:l,name:"value",message:`${u.description||`Enter value for ${i}`}${p}${u.type==="array"?" (comma-separated)":""}`,default:u.default,mask:l==="password"?"*":void 0,validate:h=>n.has(i)&&!h?!1:u.type==="number"||u.type==="integer"?!Number.isNaN(Number(h))||"Please enter a valid number":!0}]);(c!==void 0||u.default!==void 0)&&(r[i]=c??u.default)}return r}function yI(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 Ho(e){if(!e.connections?.length)throw new Error("No connection configuration found");if(!e.remote){let n=yI(e.connections);if(n)return n}let t=e.connections.find(n=>n.type==="ws");if(t)return t;let r=yI(e.connections);return r||e.connections[0]}function Wf(e){if(e.startsWith("@")){let t=e.indexOf("/");if(t!==-1)return`${e.substring(0,t)}-${e.substring(t+1)}`}return e}var Sv=ae(No()),ep=ae(We()),wI=require("node:child_process"),FI=require("node:util");var qt=require("node:path"),Cv=require("node:fs"),$f=require("fs/promises"),ai=(0,FI.promisify)(wI.exec);async function CI(){try{return await ai("uvx --version"),!0}catch{return!1}}async function SI(){let{shouldInstall:e}=await Sv.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(ep.default.yellow("UV installation was declined. You can install it manually from https://astral.sh/uv")),!1;let t=yr("Installing UV package manager...").start();try{if(process.platform==="win32")await ai('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');else try{await ai("curl -LsSf https://astral.sh/uv/install.sh | sh")}catch{await ai("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 AI(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("uvx"))}async function OI(){try{return await ai("bun --version"),!0}catch{return!1}}async function TI(){let{shouldInstall:e}=await Sv.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(ep.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 ai('powershell -c "irm bun.sh/install.ps1|iex"');else try{console.log("Attempting to install Bun via Homebrew..."),await ai("brew install oven-sh/bun/bun")}catch{console.log("Homebrew installation failed, trying direct installation..."),await ai("curl -fsSL https://bun.sh/install | bash")}return console.log(ep.default.green("Bun installed successfully!")),!0}catch(t){return console.error(ep.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 qI(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("bunx"))}function Gf(e={}){return{...h8(),...e}}async function Wye(){let e=process.platform==="win32",t=[];if(e)process.env.NVM_SYMLINK&&t.push((0,qt.join)(process.env.NVM_SYMLINK,"npx.cmd")),process.env.NVM_HOME&&t.push((0,qt.join)(process.env.NVM_HOME,process.version,"npx.cmd"));else{process.env.NVM_BIN&&t.push((0,qt.join)(process.env.NVM_BIN,"npx"));try{let i=await Cv.promises.readFile((0,qt.join)("/home/runner/.nvm","alias","default"),"utf8").then(a=>a.trim());t.push((0,qt.join)("/home/runner/.nvm","versions","node",i,"bin","npx"))}catch(i){console.debug("[Runtime] Failed to read NVM default alias:",i)}t.push((0,qt.join)("/home/runner/.nvm","versions","node",process.version,"bin","npx"))}let n=(await Promise.all(t.map(i=>Cv.promises.access(i).then(()=>i).catch(()=>null)))).find(i=>i!==null)||null;return n||console.debug("[Runtime] No NVM npx found in:",t),n}async function BI(e){if(e!=="npx")return e;let t=process.platform==="win32";try{let{stdout:l}=await ai(t?"where npx 2>nul":"which npx"),h=l.trim().split(/\r?\n/).map(T=>T.trim()).filter(Boolean).map(async T=>{try{return await(0,$f.access)(T),T}catch(C){return console.debug(`[Runtime] Path ${T} inaccessible: ${C instanceof Error?C.message:String(C)}`),null}}),E=(await Promise.all(h)).find(T=>T!==null);if(E)return E}catch(l){console.error("[Runtime] which/where command failed to find npx:",l)}let r=process.execPath.replace(t?/[\/\\]node\.exe$/:/[\/\\]node$/,""),n=t?(0,qt.join)(r,"npx.cmd"):(0,qt.join)(r,"npx");try{return await(0,$f.access)(n),n}catch{console.error("[Runtime] No npx found in current node directory")}let i=await Wye();if(i)return i;let a=[];t?(process.env.APPDATA&&a.push((0,qt.join)(process.env.APPDATA,"npm","npx.cmd")),process.env.ProgramFiles&&a.push((0,qt.join)(process.env.ProgramFiles,"nodejs","npx.cmd")),process.env.USERPROFILE&&a.push((0,qt.join)(process.env.USERPROFILE,"scoop","shims","npx.cmd"),(0,qt.join)(process.env.USERPROFILE,"scoop","apps","nodejs","current","npx.cmd")),a.push((0,qt.join)("C:","ProgramData","chocolatey","bin","npx.cmd"))):(a.push("/opt/homebrew/bin/npx","/usr/local/bin/npx","/usr/bin/npx"),process.env.HOME&&a.push((0,qt.join)(process.env.HOME,".npm-global","bin","npx")));let p=(await Promise.all(a.map(l=>(0,$f.access)(l).then(()=>l).catch(()=>null)))).find(l=>l!==null);return p||(console.error("[Runtime] Could not resolve npx path"),e)}process.removeAllListeners("warning");process.on("warning",e=>{e.name==="DeprecationWarning"&&e.message.includes("punycode")||console.warn(e)});async function Gye(){let e=new Od({name:"smithery-cli",version:"1.0.0"},{capabilities:{}});return e.setNotificationHandler(f8,t=>{console.debug("[server log]:",t.params.data)}),e}async function zye(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 Hye(e){let t=yr("Connecting to server...").start(),r=null;try{r=await Gye(),await r.connect(e);let n=await zye(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 Av.default.prompt([{name:"primitive",type:"list",message:"Pick a primitive",choices:[...n.map(l=>({name:si.default.bold(`${l.type}(${l.value.name})`),value:l,description:l.value.description})),{name:si.default.red("Exit"),value:{type:"exit"}}]}]);if(a.type==="exit"){await i();return}let u,p;if(a.type==="resource")p=yr(`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(si.default.cyan(`
97
+ `;return this.stop(),this.#n.write(h),this}};function yr(e){return new av(e)}var Ev=ae(gv()),gI=ae(mI());var Vf=D.lazy(()=>D.object({type:D.string().optional(),properties:D.record(Vf).optional(),items:Vf.optional(),required:D.array(D.string()).optional(),description:D.string().optional(),default:D.unknown().optional()})),HRe=D.union([D.object({type:D.literal("stdio"),configSchema:Vf.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:Vf.optional(),exampleConfig:D.record(D.any()).optional()})]),hI=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.")}),KRe=D.object({type:D.literal("ws"),url:D.string().url(),config:D.record(D.any()).optional()});var vI=ae(We()),xI=!1;function _I(e){xI=e}function k(e){xI&&console.log(vI.default.gray(`[verbose] ${e}`))}(0,gI.config)();var bI=()=>{let e="https://registry.smithery.ai";if(!e)throw new Error("REGISTRY_ENDPOINT environment variable is not set");return e},zo=async e=>{let t=bI();k(`Resolving package ${e} from registry at ${t}`);try{k(`Making GET request to ${t}/servers/${e}`);let r=await(0,Ev.default)(`${t}/servers/${e}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(k(`Response status: ${r.status}`),!r.ok){let a=(await r.json().catch(()=>null))?.error||await r.text();throw k(`Error response: ${a}`),r.status===404?new Error(`Server "${e}" not found`):new Error(`Package resolution failed with status ${r.status}: ${a}`)}k("Successfully received server data from registry");let n=await r.json();return k(`Server ${e} resolved with ${n.connections.length} connection options`),n}catch(r){throw k(`Package resolution error: ${r instanceof Error?r.message:String(r)}`),r instanceof Error?r:new Error(`Failed to resolve package: ${r}`)}},DI=async(e,t)=>{let r=bI();k(`Fetching connection for ${e} from registry at ${r}`),k(`Connection config provided (keys: ${Object.keys(t).join(", ")})`);try{let n={connectionType:"stdio",config:t};k(`Sending connection request for ${e}`),k(`Making POST request to ${r}/servers/${e}`);let i=await(0,Ev.default)(`${r}/servers/${e}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(k(`Response status: ${i.status}`),!i.ok){let u=await i.text();throw k(`Error response: ${u}`),new Error(`Registry request failed with status ${i.status}: ${u}`)}k("Successfully received connection data from registry");let a=await i.json();if(k(`Connection response received (success: ${a.success})`),!a.success||!a.result)throw new Error("Invalid registry response format");return hI.parse(a.result)}catch(n){throw k(`Connection fetch error: ${n instanceof Error?n.message:String(n)}`),n instanceof Error?new Error(`Failed to fetch server connection: ${n.message}`):n}};var wv=ae(No()),Fv=ae(We());async function EI(e,t){let r={};if(!e.configSchema?.properties)return t||{};let n=new Set(e.configSchema.required||[]);for(let[i,a]of Object.entries(e.configSchema.properties)){let u=a,p=t?.[i];if(p!==void 0||u.default!==void 0)r[i]=Uye(p??u.default,u.type);else if(n.has(i))throw new Error(`Missing required config value: ${i}`)}return r}function Uye(e,t){if(!t||!e)return e;switch(t){case"boolean":return String(e).toLowerCase()==="true";case"number":return Number(e);case"integer":return Number.parseInt(String(e),10);case"array":return Array.isArray(e)?e:String(e).split(",").map(r=>r.trim()).filter(Boolean);default:return e}}async function Uf(e,t){let r={};if(!e.configSchema?.properties)return t||{};let n=new Set(e.configSchema.required||[]);if(t)return t;for(let[i,a]of Object.entries(e.configSchema.properties)){let u=a;if(process.env[i]&&!n.has(i)){let{reuseExisting:h}=await wv.default.prompt([{type:"confirm",name:"reuseExisting",message:`Found ${i} in environment. Use it?`,default:!0}]);if(h){r[i]=process.env[i];continue}}let p=n.has(i)?Fv.default.red(" (required)"):Fv.default.gray(" (optional)"),l=i.toLowerCase().includes("key")?"password":u.type==="boolean"?"confirm":u.type==="array"?"input":u.type==="number"||u.type==="integer"?"number":"input",{value:c}=await wv.default.prompt([{type:l,name:"value",message:`${u.description||`Enter value for ${i}`}${p}${u.type==="array"?" (comma-separated)":""}`,default:u.default,mask:l==="password"?"*":void 0,validate:h=>n.has(i)&&!h?!1:u.type==="number"||u.type==="integer"?!Number.isNaN(Number(h))||"Please enter a valid number":!0}]);(c!==void 0||u.default!==void 0)&&(r[i]=c??u.default)}return r}function yI(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 Ho(e){if(!e.connections?.length)throw new Error("No connection configuration found");if(!e.remote){let n=yI(e.connections);if(n)return n}let t=e.connections.find(n=>n.type==="ws");if(t)return t;let r=yI(e.connections);return r||e.connections[0]}function Wf(e){if(e.startsWith("@")){let t=e.indexOf("/");if(t!==-1)return`${e.substring(0,t)}-${e.substring(t+1)}`}return e}var Sv=ae(No()),ep=ae(We()),wI=require("node:child_process"),FI=require("node:util");var qt=require("node:path"),Cv=require("node:fs"),$f=require("fs/promises"),ai=(0,FI.promisify)(wI.exec);async function CI(){try{return await ai("uvx --version"),!0}catch{return!1}}async function SI(){let{shouldInstall:e}=await Sv.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(ep.default.yellow("UV installation was declined. You can install it manually from https://astral.sh/uv")),!1;let t=yr("Installing UV package manager...").start();try{if(process.platform==="win32")await ai('powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"');else try{await ai("curl -LsSf https://astral.sh/uv/install.sh | sh")}catch{await ai("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 AI(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("uvx"))}async function OI(){try{return await ai("bun --version"),!0}catch{return!1}}async function TI(){let{shouldInstall:e}=await Sv.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(ep.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 ai('powershell -c "irm bun.sh/install.ps1|iex"');else try{console.log("Attempting to install Bun via Homebrew..."),await ai("brew install oven-sh/bun/bun")}catch{console.log("Homebrew installation failed, trying direct installation..."),await ai("curl -fsSL https://bun.sh/install | bash")}return console.log(ep.default.green("Bun installed successfully!")),!0}catch(t){return console.error(ep.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 qI(e){return!!(e.type==="stdio"&&e.stdioFunction?.includes("bunx"))}function Gf(e={}){return{...h8(),...e}}async function Wye(){let e=process.platform==="win32",t=[];if(e)process.env.NVM_SYMLINK&&t.push((0,qt.join)(process.env.NVM_SYMLINK,"npx.cmd")),process.env.NVM_HOME&&t.push((0,qt.join)(process.env.NVM_HOME,process.version,"npx.cmd"));else{process.env.NVM_BIN&&t.push((0,qt.join)(process.env.NVM_BIN,"npx"));try{let i=await Cv.promises.readFile((0,qt.join)("/home/runner/.nvm","alias","default"),"utf8").then(a=>a.trim());t.push((0,qt.join)("/home/runner/.nvm","versions","node",i,"bin","npx"))}catch(i){console.debug("[Runtime] Failed to read NVM default alias:",i)}t.push((0,qt.join)("/home/runner/.nvm","versions","node",process.version,"bin","npx"))}let n=(await Promise.all(t.map(i=>Cv.promises.access(i).then(()=>i).catch(()=>null)))).find(i=>i!==null)||null;return n||console.debug("[Runtime] No NVM npx found in:",t),n}async function BI(e){if(e!=="npx")return e;let t=process.platform==="win32";try{let{stdout:l}=await ai(t?"where npx 2>nul":"which npx"),c=l.trim().split(/\r?\n/).map(C=>C.trim()).filter(Boolean),b=(t?c.filter(C=>C.toLowerCase().endsWith(".cmd")):c).map(async C=>{try{return await(0,$f.access)(C),C}catch(S){return console.debug(`[Runtime] Path ${C} inaccessible: ${S instanceof Error?S.message:String(S)}`),null}}),T=(await Promise.all(b)).find(C=>C!==null);if(T)return T}catch(l){console.error("[Runtime] which/where command failed to find npx:",l)}let r=process.execPath.replace(t?/[\/\\]node\.exe$/:/[\/\\]node$/,""),n=t?(0,qt.join)(r,"npx.cmd"):(0,qt.join)(r,"npx");try{return await(0,$f.access)(n),n}catch{console.error("[Runtime] No npx found in current node directory")}let i=await Wye();if(i)return i;let a=[];t?(process.env.APPDATA&&a.push((0,qt.join)(process.env.APPDATA,"npm","npx.cmd")),process.env.ProgramFiles&&a.push((0,qt.join)(process.env.ProgramFiles,"nodejs","npx.cmd")),process.env.USERPROFILE&&a.push((0,qt.join)(process.env.USERPROFILE,"scoop","shims","npx.cmd"),(0,qt.join)(process.env.USERPROFILE,"scoop","apps","nodejs","current","npx.cmd")),a.push((0,qt.join)("C:","ProgramData","chocolatey","bin","npx.cmd"))):(a.push("/opt/homebrew/bin/npx","/usr/local/bin/npx","/usr/bin/npx"),process.env.HOME&&a.push((0,qt.join)(process.env.HOME,".npm-global","bin","npx")));let p=(await Promise.all(a.map(l=>(0,$f.access)(l).then(()=>l).catch(()=>null)))).find(l=>l!==null);return p||(console.error("[Runtime] Could not resolve npx path"),e)}process.removeAllListeners("warning");process.on("warning",e=>{e.name==="DeprecationWarning"&&e.message.includes("punycode")||console.warn(e)});async function Gye(){let e=new Od({name:"smithery-cli",version:"1.0.0"},{capabilities:{}});return e.setNotificationHandler(f8,t=>{console.debug("[server log]:",t.params.data)}),e}async function zye(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 Hye(e){let t=yr("Connecting to server...").start(),r=null;try{r=await Gye(),await r.connect(e);let n=await zye(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 Av.default.prompt([{name:"primitive",type:"list",message:"Pick a primitive",choices:[...n.map(l=>({name:si.default.bold(`${l.type}(${l.value.name})`),value:l,description:l.value.description})),{name:si.default.red("Exit"),value:{type:"exit"}}]}]);if(a.type==="exit"){await i();return}let u,p;if(a.type==="resource")p=yr(`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(si.default.cyan(`
98
98
  Tool: ${a.value.name}`)),console.log(si.default.dim(`Description: ${a.value.description||"No description"}`)),console.log(si.default.cyan(`
99
99
  Input Schema:`)),console.dir(a.value.inputSchema,{depth:null,colors:!0}),console.log(`
100
100
  `);continue}else if(a.type==="prompt"){let l=await Kye(a.value.arguments);p=yr(`Using prompt ${a.value.name}...`).start(),u=await r.getPrompt({name:a.value.name,arguments:l}).catch(c=>{p?.fail(c.message),p=void 0})}p&&p.succeed(),u&&(console.dir(u,{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.42",
3
+ "version": "1.1.43",
4
4
  "type": "commonjs",
5
5
  "private": false,
6
6
  "homepage": "https://smithery.ai/",