@smithery/cli 1.0.11 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -78,7 +78,7 @@ function print() { __p += __j.call(arguments, '') }
|
|
|
78
78
|
`:`;
|
|
79
79
|
`)+B+`return __p
|
|
80
80
|
}`;var se=WE(function(){return me(g,G+"return "+B).apply(r,_)});if(se.source=B,Bv(se))throw se;return se}function PL(a){return ge(a).toLowerCase()}function RL(a){return ge(a).toUpperCase()}function IL(a,s,l){if(a=ge(a),a&&(l||s===r))return J_(a);if(!a||!(s=qr(s)))return a;var d=ut(a),x=ut(s),g=Q_(d,x),_=X_(d,x)+1;return jn(d,g,_).join("")}function jL(a,s,l){if(a=ge(a),a&&(l||s===r))return a.slice(0,r6(a)+1);if(!a||!(s=qr(s)))return a;var d=ut(a),x=X_(d,ut(s))+1;return jn(d,0,x).join("")}function ML(a,s,l){if(a=ge(a),a&&(l||s===r))return a.replace(Bx,"");if(!a||!(s=qr(s)))return a;var d=ut(a),x=Q_(d,ut(s));return jn(d,x).join("")}function BL(a,s){var l=qP,d=TP;if(ke(s)){var x="separator"in s?s.separator:x;l="length"in s?ae(s.length):l,d="omission"in s?qr(s.omission):d}a=ge(a);var g=a.length;if(Ia(a)){var _=ut(a);g=_.length}if(l>=g)return a;var w=l-ja(d);if(w<1)return d;var F=_?jn(_,0,w).join(""):a.slice(0,w);if(x===r)return F+d;if(_&&(w+=F.length-w),kv(x)){if(a.slice(w).search(x)){var j,M=F;for(x.global||(x=ev(x.source,ge(g_.exec(x))+"g")),x.lastIndex=0;j=x.exec(M);)var B=j.index;F=F.slice(0,B===r?w:B)}}else if(a.indexOf(qr(x),w)!=w){var L=F.lastIndexOf(x);L>-1&&(F=F.slice(0,L))}return F+d}function kL(a){return a=ge(a),a&&ZP.test(a)?a.replace(v_,hI):a}var LL=Ua(function(a,s,l){return a+(l?" ":"")+s.toUpperCase()}),Uv=$6("toUpperCase");function UE(a,s,l){return a=ge(a),s=l?r:s,s===r?uI(a)?vI(a):XR(a):a.match(s)||[]}var WE=ue(function(a,s){try{return Or(a,r,s)}catch(l){return Bv(l)?l:new ee(l)}}),NL=Xt(function(a,s){return Ur(s,function(l){l=Ct(l),Jt(a,l,jv(a[l],a))}),a});function UL(a){var s=a==null?0:a.length,l=Z();return a=s?Re(a,function(d){if(typeof d[1]!="function")throw new Wr(i);return[l(d[0]),d[1]]}):[],ue(function(d){for(var x=-1;++x<s;){var g=a[x];if(Or(g[0],this,d))return Or(g[1],this,d)}})}function WL(a){return hj(Vr(a,h))}function Wv(a){return function(){return a}}function $L(a,s){return a==null||a!==a?s:a}var VL=G6(),GL=G6(!0);function gr(a){return a}function $v(a){return _6(typeof a=="function"?a:Vr(a,h))}function zL(a){return D6(Vr(a,h))}function HL(a,s){return w6(a,Vr(s,h))}var KL=ue(function(a,s){return function(l){return du(l,a,s)}}),ZL=ue(function(a,s){return function(l){return du(a,l,s)}});function Vv(a,s,l){var d=Ye(s),x=El(s,d);l==null&&!(ke(s)&&(x.length||!d.length))&&(l=s,s=a,a=this,x=El(s,Ye(s)));var g=!(ke(l)&&"chain"in l)||!!l.chain,_=rn(a);return Ur(x,function(w){var F=s[w];a[w]=F,_&&(a.prototype[w]=function(){var j=this.__chain__;if(g||j){var M=a(this.__wrapped__),B=M.__actions__=vr(this.__actions__);return B.push({func:F,args:arguments,thisArg:a}),M.__chain__=j,M}return F.apply(a,On([this.value()],arguments))})}),a}function YL(){return Ze._===this&&(Ze._=EI),this}function Gv(){}function JL(a){return a=ae(a),ue(function(s){return S6(s,a)})}var QL=Ev(Re),XL=Ev(z_),eN=Ev(Hx);function $E(a){return Av(a)?Kx(Ct(a)):qj(a)}function rN(a){return function(s){return a==null?r:Ai(a,s)}}var tN=H6(),nN=H6(!0);function zv(){return[]}function Hv(){return!1}function iN(){return{}}function aN(){return""}function oN(){return!0}function sN(a,s){if(a=ae(a),a<1||a>Cn)return[];var l=Dt,d=sr(a,Dt);s=Z(s),a-=Dt;for(var x=Jx(d,s);++l<a;)s(l);return x}function uN(a){return re(a)?Re(a,Ct):Tr(a)?[a]:vr(cE(ge(a)))}function cN(a){var s=++yI;return ge(a)+s}var lN=Ol(function(a,s){return a+s},0),fN=Dv("ceil"),dN=Ol(function(a,s){return a/s},1),hN=Dv("floor");function pN(a){return a&&a.length?_l(a,gr,uv):r}function xN(a,s){return a&&a.length?_l(a,Z(s,2),uv):r}function vN(a){return Z_(a,gr)}function mN(a,s){return Z_(a,Z(s,2))}function bN(a){return a&&a.length?_l(a,gr,dv):r}function gN(a,s){return a&&a.length?_l(a,Z(s,2),dv):r}var yN=Ol(function(a,s){return a*s},1),_N=Dv("round"),EN=Ol(function(a,s){return a-s},0);function DN(a){return a&&a.length?Yx(a,gr):0}function wN(a,s){return a&&a.length?Yx(a,Z(s,2)):0}return b.after=zB,b.ary=yE,b.assign=Rk,b.assignIn=IE,b.assignInWith=Ul,b.assignWith=Ik,b.at=jk,b.before=_E,b.bind=jv,b.bindAll=NL,b.bindKey=EE,b.castArray=ik,b.chain=mE,b.chunk=hM,b.compact=pM,b.concat=xM,b.cond=UL,b.conforms=WL,b.constant=Wv,b.countBy=DB,b.create=Mk,b.curry=DE,b.curryRight=wE,b.debounce=SE,b.defaults=Bk,b.defaultsDeep=kk,b.defer=HB,b.delay=KB,b.difference=vM,b.differenceBy=mM,b.differenceWith=bM,b.drop=gM,b.dropRight=yM,b.dropRightWhile=_M,b.dropWhile=EM,b.fill=DM,b.filter=SB,b.flatMap=OB,b.flatMapDeep=AB,b.flatMapDepth=qB,b.flatten=hE,b.flattenDeep=wM,b.flattenDepth=SM,b.flip=ZB,b.flow=VL,b.flowRight=GL,b.fromPairs=CM,b.functions=Gk,b.functionsIn=zk,b.groupBy=TB,b.initial=OM,b.intersection=AM,b.intersectionBy=qM,b.intersectionWith=TM,b.invert=Kk,b.invertBy=Zk,b.invokeMap=RB,b.iteratee=$v,b.keyBy=IB,b.keys=Ye,b.keysIn=br,b.map=jl,b.mapKeys=Jk,b.mapValues=Qk,b.matches=zL,b.matchesProperty=HL,b.memoize=Bl,b.merge=Xk,b.mergeWith=jE,b.method=KL,b.methodOf=ZL,b.mixin=Vv,b.negate=kl,b.nthArg=JL,b.omit=eL,b.omitBy=rL,b.once=YB,b.orderBy=jB,b.over=QL,b.overArgs=JB,b.overEvery=XL,b.overSome=eN,b.partial=Mv,b.partialRight=CE,b.partition=MB,b.pick=tL,b.pickBy=ME,b.property=$E,b.propertyOf=rN,b.pull=jM,b.pullAll=xE,b.pullAllBy=MM,b.pullAllWith=BM,b.pullAt=kM,b.range=tN,b.rangeRight=nN,b.rearg=QB,b.reject=LB,b.remove=LM,b.rest=XB,b.reverse=Rv,b.sampleSize=UB,b.set=iL,b.setWith=aL,b.shuffle=WB,b.slice=NM,b.sortBy=GB,b.sortedUniq=HM,b.sortedUniqBy=KM,b.split=OL,b.spread=ek,b.tail=ZM,b.take=YM,b.takeRight=JM,b.takeRightWhile=QM,b.takeWhile=XM,b.tap=pB,b.throttle=rk,b.thru=Il,b.toArray=TE,b.toPairs=BE,b.toPairsIn=kE,b.toPath=uN,b.toPlainObject=RE,b.transform=oL,b.unary=tk,b.union=eB,b.unionBy=rB,b.unionWith=tB,b.uniq=nB,b.uniqBy=iB,b.uniqWith=aB,b.unset=sL,b.unzip=Iv,b.unzipWith=vE,b.update=uL,b.updateWith=cL,b.values=Va,b.valuesIn=lL,b.without=oB,b.words=UE,b.wrap=nk,b.xor=sB,b.xorBy=uB,b.xorWith=cB,b.zip=lB,b.zipObject=fB,b.zipObjectDeep=dB,b.zipWith=hB,b.entries=BE,b.entriesIn=kE,b.extend=IE,b.extendWith=Ul,Vv(b,b),b.add=lN,b.attempt=WE,b.camelCase=pL,b.capitalize=LE,b.ceil=fN,b.clamp=fL,b.clone=ak,b.cloneDeep=sk,b.cloneDeepWith=uk,b.cloneWith=ok,b.conformsTo=ck,b.deburr=NE,b.defaultTo=$L,b.divide=dN,b.endsWith=xL,b.eq=lt,b.escape=vL,b.escapeRegExp=mL,b.every=wB,b.find=CB,b.findIndex=fE,b.findKey=Lk,b.findLast=FB,b.findLastIndex=dE,b.findLastKey=Nk,b.floor=hN,b.forEach=bE,b.forEachRight=gE,b.forIn=Uk,b.forInRight=Wk,b.forOwn=$k,b.forOwnRight=Vk,b.get=Lv,b.gt=lk,b.gte=fk,b.has=Hk,b.hasIn=Nv,b.head=pE,b.identity=gr,b.includes=PB,b.indexOf=FM,b.inRange=dL,b.invoke=Yk,b.isArguments=Pi,b.isArray=re,b.isArrayBuffer=dk,b.isArrayLike=mr,b.isArrayLikeObject=We,b.isBoolean=hk,b.isBuffer=Mn,b.isDate=pk,b.isElement=xk,b.isEmpty=vk,b.isEqual=mk,b.isEqualWith=bk,b.isError=Bv,b.isFinite=gk,b.isFunction=rn,b.isInteger=FE,b.isLength=Ll,b.isMap=OE,b.isMatch=yk,b.isMatchWith=_k,b.isNaN=Ek,b.isNative=Dk,b.isNil=Sk,b.isNull=wk,b.isNumber=AE,b.isObject=ke,b.isObjectLike=Le,b.isPlainObject=bu,b.isRegExp=kv,b.isSafeInteger=Ck,b.isSet=qE,b.isString=Nl,b.isSymbol=Tr,b.isTypedArray=$a,b.isUndefined=Fk,b.isWeakMap=Ok,b.isWeakSet=Ak,b.join=PM,b.kebabCase=bL,b.last=zr,b.lastIndexOf=RM,b.lowerCase=gL,b.lowerFirst=yL,b.lt=qk,b.lte=Tk,b.max=pN,b.maxBy=xN,b.mean=vN,b.meanBy=mN,b.min=bN,b.minBy=gN,b.stubArray=zv,b.stubFalse=Hv,b.stubObject=iN,b.stubString=aN,b.stubTrue=oN,b.multiply=yN,b.nth=IM,b.noConflict=YL,b.noop=Gv,b.now=Ml,b.pad=_L,b.padEnd=EL,b.padStart=DL,b.parseInt=wL,b.random=hL,b.reduce=BB,b.reduceRight=kB,b.repeat=SL,b.replace=CL,b.result=nL,b.round=_N,b.runInContext=C,b.sample=NB,b.size=$B,b.snakeCase=FL,b.some=VB,b.sortedIndex=UM,b.sortedIndexBy=WM,b.sortedIndexOf=$M,b.sortedLastIndex=VM,b.sortedLastIndexBy=GM,b.sortedLastIndexOf=zM,b.startCase=AL,b.startsWith=qL,b.subtract=EN,b.sum=DN,b.sumBy=wN,b.template=TL,b.times=sN,b.toFinite=tn,b.toInteger=ae,b.toLength=PE,b.toLower=PL,b.toNumber=Hr,b.toSafeInteger=Pk,b.toString=ge,b.toUpper=RL,b.trim=IL,b.trimEnd=jL,b.trimStart=ML,b.truncate=BL,b.unescape=kL,b.uniqueId=cN,b.upperCase=LL,b.upperFirst=Uv,b.each=bE,b.eachRight=gE,b.first=pE,Vv(b,function(){var a={};return wt(b,function(s,l){ye.call(b.prototype,l)||(a[l]=s)}),a}(),{chain:!1}),b.VERSION=e,Ur(["bind","bindKey","curry","curryRight","partial","partialRight"],function(a){b[a].placeholder=b}),Ur(["drop","take"],function(a,s){de.prototype[a]=function(l){l=l===r?1:ze(ae(l),0);var d=this.__filtered__&&!s?new de(this):this.clone();return d.__filtered__?d.__takeCount__=sr(l,d.__takeCount__):d.__views__.push({size:sr(l,Dt),type:a+(d.__dir__<0?"Right":"")}),d},de.prototype[a+"Right"]=function(l){return this.reverse()[a](l).reverse()}}),Ur(["filter","map","takeWhile"],function(a,s){var l=s+1,d=l==h_||l==jP;de.prototype[a]=function(x){var g=this.clone();return g.__iteratees__.push({iteratee:Z(x,3),type:l}),g.__filtered__=g.__filtered__||d,g}}),Ur(["head","last"],function(a,s){var l="take"+(s?"Right":"");de.prototype[a]=function(){return this[l](1).value()[0]}}),Ur(["initial","tail"],function(a,s){var l="drop"+(s?"":"Right");de.prototype[a]=function(){return this.__filtered__?new de(this):this[l](1)}}),de.prototype.compact=function(){return this.filter(gr)},de.prototype.find=function(a){return this.filter(a).head()},de.prototype.findLast=function(a){return this.reverse().find(a)},de.prototype.invokeMap=ue(function(a,s){return typeof a=="function"?new de(this):this.map(function(l){return du(l,a,s)})}),de.prototype.reject=function(a){return this.filter(kl(Z(a)))},de.prototype.slice=function(a,s){a=ae(a);var l=this;return l.__filtered__&&(a>0||s<0)?new de(l):(a<0?l=l.takeRight(-a):a&&(l=l.drop(a)),s!==r&&(s=ae(s),l=s<0?l.dropRight(-s):l.take(s-a)),l)},de.prototype.takeRightWhile=function(a){return this.reverse().takeWhile(a).reverse()},de.prototype.toArray=function(){return this.take(Dt)},wt(de.prototype,function(a,s){var l=/^(?:filter|find|map|reject)|While$/.test(s),d=/^(?:head|last)$/.test(s),x=b[d?"take"+(s=="last"?"Right":""):s],g=d||/^find/.test(s);x&&(b.prototype[s]=function(){var _=this.__wrapped__,w=d?[1]:arguments,F=_ instanceof de,j=w[0],M=F||re(_),B=function(le){var he=x.apply(b,On([le],w));return d&&L?he[0]:he};M&&l&&typeof j=="function"&&j.length!=1&&(F=M=!1);var L=this.__chain__,G=!!this.__actions__.length,Y=g&&!L,se=F&&!G;if(!g&&M){_=se?_:new de(this);var J=a.apply(_,w);return J.__actions__.push({func:Il,args:[B],thisArg:r}),new $r(J,L)}return Y&&se?a.apply(this,w):(J=this.thru(B),Y?d?J.value()[0]:J.value():J)})}),Ur(["pop","push","shift","sort","splice","unshift"],function(a){var s=ol[a],l=/^(?:push|sort|unshift)$/.test(a)?"tap":"thru",d=/^(?:pop|shift)$/.test(a);b.prototype[a]=function(){var x=arguments;if(d&&!this.__chain__){var g=this.value();return s.apply(re(g)?g:[],x)}return this[l](function(_){return s.apply(re(_)?_:[],x)})}}),wt(de.prototype,function(a,s){var l=b[s];if(l){var d=l.name+"";ye.call(ka,d)||(ka[d]=[]),ka[d].push({name:s,func:l})}}),ka[Fl(r,O).name]=[{name:"wrapper",func:r}],de.prototype.clone=kI,de.prototype.reverse=LI,de.prototype.value=NI,b.prototype.at=xB,b.prototype.chain=vB,b.prototype.commit=mB,b.prototype.next=bB,b.prototype.plant=yB,b.prototype.reverse=_B,b.prototype.toJSON=b.prototype.valueOf=b.prototype.value=EB,b.prototype.first=b.prototype.head,au&&(b.prototype[au]=gB),b},qn=mI();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(Ze._=qn,define(function(){return qn})):wi?((wi.exports=qn)._=qn,$x._=qn):Ze._=qn}).call(Zs)});var wc=Oe(Ie());var Za=Oe(require("node:fs")),DD=Oe(require("node:os")),Zr=Oe(require("node:path")),Ir=class r{static{let e=DD.default.homedir(),t={win32:{baseDir:process.env.APPDATA||Zr.default.join(e,"AppData","Roaming"),vscodePath:Zr.default.join("Code","User","globalStorage")},darwin:{baseDir:Zr.default.join(e,"Library","Application Support"),vscodePath:Zr.default.join("Code","User","globalStorage")},linux:{baseDir:"/home/runner/.config",vscodePath:Zr.default.join("Code/User/globalStorage")}},n=process.platform,{baseDir:i,vscodePath:o}=t[n],u={claude:Zr.default.join(i,"Claude","claude_desktop_config.json"),cline:Zr.default.join(i,o,"saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),"roo-cline":Zr.default.join(i,o,"rooveterinaryinc.roo-cline","settings","cline_mcp_settings.json")};r.configPath=u.claude,r.clientPaths=u}static getConfigPath(e){let t=e?.toLowerCase()||"claude";return r.clientPaths[t]||Zr.default.join(Zr.default.dirname(r.configPath),"..",e||"claude",`${t}_config.json`)}static readConfig(e){try{let t=r.getConfigPath(e);return Za.default.existsSync(t)?{mcpServers:JSON.parse(Za.default.readFileSync(t,"utf8")).mcpServers||{}}:{mcpServers:{}}}catch{return{mcpServers:{}}}}static writeConfig(e,t){let n=r.getConfigPath(t),i=Zr.default.dirname(n);if(Za.default.existsSync(i)||Za.default.mkdirSync(i,{recursive:!0}),!e.mcpServers||typeof e.mcpServers!="object")throw new Error("Invalid config structure");Za.default.writeFileSync(n,JSON.stringify(e,null,2))}static isServerInstalled(e,t){let n=r.readConfig(t);return r.normalizeServerId(e)in n.mcpServers}static async installServer(e,t,n){let i=r.normalizeServerId(e),o=r.readConfig(n);o.mcpServers[i]=t,r.writeConfig(o,n)}static async uninstallServer(e,t){let n=r.normalizeServerId(e),i=r.readConfig(t);if(!i.mcpServers[n]){console.log(`Server ${n} not found in configuration`);return}delete i.mcpServers[n],r.writeConfig(i,t)}static getServerConfig(e,t){return r.readConfig(t).mcpServers[e]||null}static envVarsToArgs(e){return Object.entries(e).flatMap(([t,n])=>[`--${t.toLowerCase().replace(/_/g,"-")}`,n])}static normalizeServerId(e){if(e.startsWith("@")){let t=e.indexOf("/");if(t!==-1)return`${e.substring(0,t)}-${e.substring(t+1)}`}return e}static denormalizeServerId(e){if(e.startsWith("@")){let t=e.indexOf("-");if(t!==-1)return`${e.substring(0,t)}/${e.substring(t+1)}`}return e}static getInstalledServerIds(e){let t=r.readConfig(e);return Object.keys(t.mcpServers||{})}};var bT=require("node:child_process"),gT=require("node:util"),yT=Oe(mn()),bn=(0,gT.promisify)(bT.exec);async function k2e(r){if(!r)return!1;try{let e=process.platform,t={claude:"Claude"}[r]||r;if(e==="win32"){let{stdout:n}=await bn(`tasklist /FI "IMAGENAME eq ${t}.exe" /NH`);return n.includes(`${t}.exe`)}else if(e==="darwin"){let{stdout:n}=await bn(`pgrep -x "${t}"`);return!!n.trim()}else if(e==="linux"){let{stdout:n}=await bn(`pgrep -f "${t.toLowerCase()}"`);return!!n.trim()}return!1}catch{return!1}}async function L2e(r){let e={claude:"Claude",jan:"Jan"}[r]||r;try{let t=process.platform;t==="win32"?await bn(`taskkill /F /IM "${e}.exe" && start "" "${e}.exe"`):t==="darwin"?await bn(`killall "${e}" && open -a "${e}"`):t==="linux"&&await bn(`pkill -f "${e.toLowerCase()}" && ${e.toLowerCase()}`),await new Promise(n=>setTimeout(n,2e3)),t==="win32"?await bn(`start "" "${e}.exe"`):t==="darwin"?await bn(`open -a "${e}"`):t==="linux"&&await bn(e.toLowerCase()),console.log(`${e} has been restarted.`)}catch(t){console.error(`Failed to restart ${e}:`,t)}}async function Dy(r){if(!r||!await k2e(r))return!1;let{shouldRestart:t}=await yT.default.prompt([{type:"confirm",name:"shouldRestart",message:`Would you like to restart the ${r} app to apply changes?`,default:!0}]);return t&&(console.log(`Restarting ${r} app...`),await L2e(r)),t}var _T=require("node:child_process"),ET=require("node:util"),wy=Oe(mn()),Sy=Oe(Ie()),LFe=(0,ET.promisify)(_T.exec);async function Np(r,e){let t=new Map;if(r.configSchema?.properties){let o=new Set(r.configSchema.required||[]);Object.entries(r.configSchema.properties).forEach(([u,c])=>{let f=c;t.set(u,{key:u,description:f.description||`Enter value for ${u}`,required:o.has(u),default:f.default,type:f.type})})}let n={};function i(o,u){if(!u)return o;if(o==="")switch(u){case"array":return[];case"number":case"integer":return null;default:return o}if(!o)return o;switch(u){case"boolean":return String(o).toLowerCase()==="true";case"number":return Number(o);case"integer":return Number.parseInt(String(o),10);case"array":return String(o).split(",").map(c=>c.trim()).filter(c=>c!=="");default:return o}}if(e){for(let o of t.values()){let u=e[o.key];if(u!==void 0||o.default!==void 0)n[o.key]=i(u??o.default,o.type);else if(o.required)throw new Error(`Missing required config value: ${o.key}`)}return n}for(let o of t.values()){if(process.env[o.key]&&!o.required){let{reuseExisting:h}=await wy.default.prompt([{type:"confirm",name:"reuseExisting",message:`Found ${o.key} in environment. Use it?`,default:!0}]);if(h){n[o.key]=i(process.env[o.key],o.type);continue}}let u=o.required?Sy.default.red(" (required)"):Sy.default.gray(" (optional)"),c=o.key.toLowerCase().includes("key")?"password":o.type==="boolean"?"confirm":o.type==="array"?"input":o.type==="number"||o.type==="integer"?"number":"input",{value:f}=await wy.default.prompt([{type:c,name:"value",message:`${o.description}${u}${o.type==="array"?" (comma-separated)":""}`,default:o.default,mask:c==="password"?"*":void 0,validate:h=>o.required&&!h?!1:o.type==="number"||o.type==="integer"?!Number.isNaN(Number(h))||"Please enter a valid number":!0}]);(f!==void 0||o.default!==void 0)&&(n[o.key]=i(f??o.default,o.type))}return n}var bi=class{constructor(e=Ir){this.configManager=e}selectPreferredConnection(e){if(!e.connections?.length)throw new Error("No connection configuration found");let t=e.connections.find(n=>n.type==="sse");return t||e.connections[0]}formatServerConfig(e,t){let n=JSON.stringify(JSON.stringify(t));return{command:"npx",args:["-y","@smithery/cli","run",e,"--config",n]}}async installServer(e,t){let n=this.selectPreferredConnection(e),i=await Np(n),o=this.formatServerConfig(e.qualifiedName,i);await this.configManager.installServer(e.qualifiedName,o,t),await Dy(t)}async uninstallServer(e,t){try{await this.configManager.uninstallServer(e,t),console.log(`
|
|
81
|
-
Uninstalled ${e}`),await Dy(t)}catch(n){throw console.error("Failed to uninstall server:",n),n}}};var OT=Oe(FT());var pr=["claude","cline","roo-cline"],Wp=
|
|
81
|
+
Uninstalled ${e}`),await Dy(t)}catch(n){throw console.error("Failed to uninstall server:",n),n}}};var OT=Oe(FT());var pr=["claude","cline","roo-cline"],Wp="https://registry.smithery.ai",Ay="https://smithery.ai/api/track";OT.default.config();async function AT(r,e=[]){try{if(e.length===0)return[];let t=e.map(i=>ua(i,r));return(await Promise.all(t)).filter(i=>i!==null)}catch(t){throw new Error(`Failed to resolve servers: ${t instanceof Error?t.message:String(t)}`)}}async function ua(r,e="claude"){try{let t=Ir.isServerInstalled(r,e),n=await fetch(`${Wp}/servers/${r}`);if(!n.ok)return t?{qualifiedName:r,name:r,connections:[],isInstalled:!0,client:e}:null;let i=await n.json(),o=await Promise.all(i.connections.map(async c=>{if(c.type==="sse"&&c.deploymentUrl)try{let f=await fetch(`${c.deploymentUrl}/.well-known/mcp/smithery.json`);if(f.ok){let h=await f.json();return{type:"sse",deploymentUrl:c.deploymentUrl,configSchema:h.configSchema,exampleConfig:c.exampleConfig}}}catch{}return c}));return{qualifiedName:i.qualifiedName,name:i.displayName,connections:o,isInstalled:t,client:e}}catch(t){return console.error("Error resolving server:",t),null}}var ws=require("node:os"),Ds=require("node:path"),zp=require("node:fs");var or=[];for(let r=0;r<256;++r)or.push((r+256).toString(16).slice(1));function qT(r,e=0){return(or[r[e+0]]+or[r[e+1]]+or[r[e+2]]+or[r[e+3]]+"-"+or[r[e+4]]+or[r[e+5]]+"-"+or[r[e+6]]+or[r[e+7]]+"-"+or[r[e+8]]+or[r[e+9]]+"-"+or[r[e+10]]+or[r[e+11]]+or[r[e+12]]+or[r[e+13]]+or[r[e+14]]+or[r[e+15]]).toLowerCase()}var TT=require("crypto"),Vp=new Uint8Array(256),$p=Vp.length;function qy(){return $p>Vp.length-16&&((0,TT.randomFillSync)(Vp),$p=0),Vp.slice($p,$p+=16)}var PT=require("crypto"),Ty={randomUUID:PT.randomUUID};function rye(r,e,t){if(Ty.randomUUID&&!e&&!r)return Ty.randomUUID();r=r||{};let n=r.random??r.rng?.()??qy();if(n.length<16)throw new Error("Random bytes length must be >= 16");if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,e){if(t=t||0,t<0||t+16>e.length)throw new RangeError(`UUID byte range ${t}:${t+15} is out of buffer bounds`);for(let i=0;i<16;++i)e[t+i]=n[i];return e}return qT(n)}var Gp=rye;var Ss=class r{constructor(){this.data=null}static getSettingsPath(){switch((0,ws.platform)()){case"win32":return(0,Ds.join)(process.env.APPDATA||(0,Ds.join)((0,ws.homedir)(),"AppData","Roaming"),"smithery");case"darwin":return(0,Ds.join)((0,ws.homedir)(),"Library","Application Support","smithery");default:return(0,Ds.join)((0,ws.homedir)(),".config","smithery")}}static{this.SETTINGS_PATH=(0,Ds.join)(r.getSettingsPath(),"settings.json")}async initialize(){try{await zp.promises.mkdir(r.getSettingsPath(),{recursive:!0});try{let e=await zp.promises.readFile(r.SETTINGS_PATH,"utf-8");this.data=JSON.parse(e),this.data&&!this.data.userId&&(this.data.userId=Gp(),await this.save()),this.data&&this.data.analyticsConsent===void 0&&(this.data.analyticsConsent=!1,await this.save())}catch{this.data={userId:Gp(),analyticsConsent:!1,cache:{servers:{}}},await this.save()}}catch(e){throw console.error("Failed to initialize settings:",e),e}}async save(){await zp.promises.writeFile(r.SETTINGS_PATH,JSON.stringify(this.data,null,2))}getUserId(){if(!this.data)throw new Error("Settings not initialized");return this.data.userId}getAnalyticsConsent(){if(!this.data)throw new Error("Settings not initialized");return this.data.analyticsConsent??!1}async setAnalyticsConsent(e){if(!this.data)throw new Error("Settings not initialized");this.data.analyticsConsent=e,await this.save()}};var RT=Oe(mn()),tye=new bi;async function IT(r,e){let t=new Ss;if(await t.initialize(),t.getAnalyticsConsent()===!1){let{EnableAnalytics:o}=await RT.default.prompt([{type:"confirm",name:"EnableAnalytics",message:"Would you like to help improve Smithery by sending anonymous usage data?",default:!0}]);await t.setAnalyticsConsent(o)}e&&!pr.includes(e)&&(console.error(wc.default.red(`Invalid client: ${e}
|
|
82
82
|
Valid clients are: ${pr.join(", ")}`)),process.exit(1));let n=await ua(r,e);n||(console.error(wc.default.red(`Server '${r}' not found in registry`)),process.exit(1)),n.connections.some(o=>o.type==="sse"&&"deploymentUrl"in o)&&console.log(wc.default.blue("Installing remote SSE server...")),await tye.installServer(n,e),console.log(wc.default.green(`\u2713 Successfully installed package '${r}' for ${e}`))}var ca=Oe(Ie()),jT=Oe(mn());var nye=new bi;async function MT(r,e){try{e&&!pr.includes(e)&&(console.error(ca.default.red(`Invalid client: ${e}
|
|
83
83
|
Valid clients are: ${pr.join(", ")}`)),process.exit(1)),r||(console.error(ca.default.red("Error: Server ID is required")),console.log("Usage: @smithery/cli uninstall <server-id>"),process.exit(1));let{confirmUninstall:t}=await jT.default.prompt([{type:"confirm",name:"confirmUninstall",message:`Are you sure you want to uninstall ${r}?`,default:!1}]);if(!t){console.log("Uninstallation cancelled.");return}await nye.uninstallServer(r,e),console.log(ca.default.green(`
|
|
84
84
|
Successfully uninstalled ${r} for ${e}`)),e==="claude"&&console.log(ca.default.yellow(`
|