@smithery/cli 1.1.7 → 1.1.8
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 +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -85,8 +85,8 @@ __p += '`),fe&&(k+=`' +
|
|
|
85
85
|
function print() { __p += __j.call(arguments, '') }
|
|
86
86
|
`:`;
|
|
87
87
|
`)+k+`return __p
|
|
88
|
-
}`;var oe=bD(function(){return be(_,G+"return "+k).apply(r,E)});if(oe.source=k,Zv(oe))throw oe;return oe}function jU(o){return ge(o).toLowerCase()}function BU(o){return ge(o).toUpperCase()}function kU(o,a,l){if(o=ge(o),o&&(l||a===r))return O6(o);if(!o||!(a=Fr(a)))return o;var h=ct(o),x=ct(a),_=F6(h,x),E=A6(h,x)+1;return $n(h,_,E).join("")}function MU(o,a,l){if(o=ge(o),o&&(l||a===r))return o.slice(0,T6(o)+1);if(!o||!(a=Fr(a)))return o;var h=ct(o),x=A6(h,ct(a))+1;return $n(h,0,x).join("")}function LU(o,a,l){if(o=ge(o),o&&(l||a===r))return o.replace(Zx,"");if(!o||!(a=Fr(a)))return o;var h=ct(o),x=F6(h,ct(a));return $n(h,x).join("")}function NU(o,a){var l=Qc,h=su;if(ke(a)){var x="separator"in a?a.separator:x;l="length"in a?se(a.length):l,h="omission"in a?Fr(a.omission):h}o=ge(o);var _=o.length;if(zs(o)){var E=ct(o);_=E.length}if(l>=_)return o;var S=l-Hs(h);if(S<1)return h;var F=E?$n(E,0,S).join(""):o.slice(0,S);if(x===r)return F+h;if(E&&(S+=F.length-S),Yv(x)){if(o.slice(S).search(x)){var j,B=F;for(x.global||(x=dv(x.source,ge(Zy.exec(x))+"g")),x.lastIndex=0;j=x.exec(B);)var k=j.index;F=F.slice(0,k===r?S:k)}}else if(o.indexOf(Fr(x),S)!=S){var L=F.lastIndexOf(x);L>-1&&(F=F.slice(0,L))}return F+h}function UU(o){return o=ge(o),o&&XI.test(o)?o.replace(zy,vB):o}var WU=Qs(function(o,a,l){return o+(l?" ":"")+a.toUpperCase()}),Qv=_E("toUpperCase");function mD(o,a,l){return o=ge(o),a=l?r:a,a===r?fB(o)?_B(o):tB(o):o.match(a)||[]}var bD=ae(function(o,a){try{return Cr(o,r,a)}catch(l){return Zv(l)?l:new ee(l)}}),$U=nn(function(o,a){return Ur(a,function(l){l=Ot(l),rn(o,l,Hv(o[l],o))}),o});function VU(o){var a=o==null?0:o.length,l=Z();return o=a?Pe(o,function(h){if(typeof h[1]!="function")throw new Wr(i);return[l(h[0]),h[1]]}):[],ae(function(h){for(var x=-1;++x<a;){var _=o[x];if(Cr(_[0],this,h))return Cr(_[1],this,h)}})}function GU(o){return vk(Vr(o,d))}function em(o){return function(){return o}}function zU(o,a){return o==null||o!==o?a:o}var HU=yE(),KU=yE(!0);function _r(o){return o}function rm(o){return J6(typeof o=="function"?o:Vr(o,d))}function ZU(o){return Q6(Vr(o,d))}function YU(o,a){return eE(o,Vr(a,d))}var JU=ae(function(o,a){return function(l){return yu(l,o,a)}}),XU=ae(function(o,a){return function(l){return yu(o,l,a)}});function tm(o,a,l){var h=Ke(a),x=Ol(a,h);l==null&&!(ke(a)&&(x.length||!h.length))&&(l=a,a=o,o=this,x=Ol(a,Ke(a)));var _=!(ke(l)&&"chain"in l)||!!l.chain,E=on(o);return Ur(x,function(S){var F=a[S];o[S]=F,E&&(o.prototype[S]=function(){var j=this.__chain__;if(_||j){var B=o(this.__wrapped__),k=B.__actions__=vr(this.__actions__);return k.push({func:F,args:arguments,thisArg:o}),B.__chain__=j,B}return F.apply(o,Bn([this.value()],arguments))})}),o}function QU(){return He._===this&&(He._=SB),this}function nm(){}function eW(o){return o=se(o),ae(function(a){return rE(a,o)})}var rW=Iv(Pe),tW=Iv(E6),nW=Iv(sv);function _D(o){return Uv(o)?ov(Ot(o)):Rk(o)}function iW(o){return function(a){return o==null?r:Mi(o,a)}}var sW=DE(),oW=DE(!0);function im(){return[]}function sm(){return!1}function aW(){return{}}function uW(){return""}function cW(){return!0}function lW(o,a){if(o=se(o),o<1||o>In)return[];var l=wt,h=ar(o,wt);a=Z(a),o-=wt;for(var x=cv(h,a);++l<o;)a(l);return x}function fW(o){return re(o)?Pe(o,Ot):Ar(o)?[o]:vr(LE(ge(o)))}function dW(o){var a=++DB;return ge(o)+a}var hW=Rl(function(o,a){return o+a},0),pW=jv("ceil"),xW=Rl(function(o,a){return o/a},1),vW=jv("floor");function mW(o){return o&&o.length?Cl(o,_r,gv):r}function bW(o,a){return o&&o.length?Cl(o,Z(a,2),gv):r}function _W(o){return S6(o,_r)}function gW(o,a){return S6(o,Z(a,2))}function yW(o){return o&&o.length?Cl(o,_r,wv):r}function EW(o,a){return o&&o.length?Cl(o,Z(a,2),wv):r}var DW=Rl(function(o,a){return o*a},1),wW=jv("round"),SW=Rl(function(o,a){return o-a},0);function CW(o){return o&&o.length?uv(o,_r):0}function OW(o,a){return o&&o.length?uv(o,Z(a,2)):0}return b.after=ZL,b.ary=YE,b.assign=BN,b.assignIn=lD,b.assignInWith=zl,b.assignWith=kN,b.at=MN,b.before=JE,b.bind=Hv,b.bindAll=$U,b.bindKey=XE,b.castArray=aN,b.chain=HE,b.chunk=vM,b.compact=mM,b.concat=bM,b.cond=VU,b.conforms=GU,b.constant=em,b.countBy=CL,b.create=LN,b.curry=QE,b.curryRight=eD,b.debounce=rD,b.defaults=NN,b.defaultsDeep=UN,b.defer=YL,b.delay=JL,b.difference=_M,b.differenceBy=gM,b.differenceWith=yM,b.drop=EM,b.dropRight=DM,b.dropRightWhile=wM,b.dropWhile=SM,b.fill=CM,b.filter=FL,b.flatMap=TL,b.flatMapDeep=PL,b.flatMapDepth=RL,b.flatten=$E,b.flattenDeep=OM,b.flattenDepth=FM,b.flip=XL,b.flow=HU,b.flowRight=KU,b.fromPairs=AM,b.functions=KN,b.functionsIn=ZN,b.groupBy=IL,b.initial=TM,b.intersection=PM,b.intersectionBy=RM,b.intersectionWith=IM,b.invert=JN,b.invertBy=XN,b.invokeMap=BL,b.iteratee=rm,b.keyBy=kL,b.keys=Ke,b.keysIn=br,b.map=Nl,b.mapKeys=eU,b.mapValues=rU,b.matches=ZU,b.matchesProperty=YU,b.memoize=Wl,b.merge=tU,b.mergeWith=fD,b.method=JU,b.methodOf=XU,b.mixin=tm,b.negate=$l,b.nthArg=eW,b.omit=nU,b.omitBy=iU,b.once=QL,b.orderBy=ML,b.over=rW,b.overArgs=eN,b.overEvery=tW,b.overSome=nW,b.partial=Kv,b.partialRight=tD,b.partition=LL,b.pick=sU,b.pickBy=dD,b.property=_D,b.propertyOf=iW,b.pull=MM,b.pullAll=GE,b.pullAllBy=LM,b.pullAllWith=NM,b.pullAt=UM,b.range=sW,b.rangeRight=oW,b.rearg=rN,b.reject=WL,b.remove=WM,b.rest=tN,b.reverse=Gv,b.sampleSize=VL,b.set=aU,b.setWith=uU,b.shuffle=GL,b.slice=$M,b.sortBy=KL,b.sortedUniq=YM,b.sortedUniqBy=JM,b.split=TU,b.spread=nN,b.tail=XM,b.take=QM,b.takeRight=eL,b.takeRightWhile=rL,b.takeWhile=tL,b.tap=mL,b.throttle=iN,b.thru=Ll,b.toArray=aD,b.toPairs=hD,b.toPairsIn=pD,b.toPath=fW,b.toPlainObject=cD,b.transform=cU,b.unary=sN,b.union=nL,b.unionBy=iL,b.unionWith=sL,b.uniq=oL,b.uniqBy=aL,b.uniqWith=uL,b.unset=lU,b.unzip=zv,b.unzipWith=zE,b.update=fU,b.updateWith=dU,b.values=to,b.valuesIn=hU,b.without=cL,b.words=mD,b.wrap=oN,b.xor=lL,b.xorBy=fL,b.xorWith=dL,b.zip=hL,b.zipObject=pL,b.zipObjectDeep=xL,b.zipWith=vL,b.entries=hD,b.entriesIn=pD,b.extend=lD,b.extendWith=zl,tm(b,b),b.add=hW,b.attempt=bD,b.camelCase=mU,b.capitalize=xD,b.ceil=pW,b.clamp=pU,b.clone=uN,b.cloneDeep=lN,b.cloneDeepWith=fN,b.cloneWith=cN,b.conformsTo=dN,b.deburr=vD,b.defaultTo=zU,b.divide=xW,b.endsWith=bU,b.eq=ft,b.escape=_U,b.escapeRegExp=gU,b.every=OL,b.find=AL,b.findIndex=UE,b.findKey=WN,b.findLast=qL,b.findLastIndex=WE,b.findLastKey=$N,b.floor=vW,b.forEach=KE,b.forEachRight=ZE,b.forIn=VN,b.forInRight=GN,b.forOwn=zN,b.forOwnRight=HN,b.get=Jv,b.gt=hN,b.gte=pN,b.has=YN,b.hasIn=Xv,b.head=VE,b.identity=_r,b.includes=jL,b.indexOf=qM,b.inRange=xU,b.invoke=QN,b.isArguments=Ui,b.isArray=re,b.isArrayBuffer=xN,b.isArrayLike=mr,b.isArrayLikeObject=Ue,b.isBoolean=vN,b.isBuffer=Vn,b.isDate=mN,b.isElement=bN,b.isEmpty=_N,b.isEqual=gN,b.isEqualWith=yN,b.isError=Zv,b.isFinite=EN,b.isFunction=on,b.isInteger=nD,b.isLength=Vl,b.isMap=iD,b.isMatch=DN,b.isMatchWith=wN,b.isNaN=SN,b.isNative=CN,b.isNil=FN,b.isNull=ON,b.isNumber=sD,b.isObject=ke,b.isObjectLike=Me,b.isPlainObject=Ou,b.isRegExp=Yv,b.isSafeInteger=AN,b.isSet=oD,b.isString=Gl,b.isSymbol=Ar,b.isTypedArray=ro,b.isUndefined=qN,b.isWeakMap=TN,b.isWeakSet=PN,b.join=jM,b.kebabCase=yU,b.last=zr,b.lastIndexOf=BM,b.lowerCase=EU,b.lowerFirst=DU,b.lt=RN,b.lte=IN,b.max=mW,b.maxBy=bW,b.mean=_W,b.meanBy=gW,b.min=yW,b.minBy=EW,b.stubArray=im,b.stubFalse=sm,b.stubObject=aW,b.stubString=uW,b.stubTrue=cW,b.multiply=DW,b.nth=kM,b.noConflict=QU,b.noop=nm,b.now=Ul,b.pad=wU,b.padEnd=SU,b.padStart=CU,b.parseInt=OU,b.random=vU,b.reduce=NL,b.reduceRight=UL,b.repeat=FU,b.replace=AU,b.result=oU,b.round=wW,b.runInContext=C,b.sample=$L,b.size=zL,b.snakeCase=qU,b.some=HL,b.sortedIndex=VM,b.sortedIndexBy=GM,b.sortedIndexOf=zM,b.sortedLastIndex=HM,b.sortedLastIndexBy=KM,b.sortedLastIndexOf=ZM,b.startCase=PU,b.startsWith=RU,b.subtract=SW,b.sum=CW,b.sumBy=OW,b.template=IU,b.times=lW,b.toFinite=an,b.toInteger=se,b.toLength=uD,b.toLower=jU,b.toNumber=Hr,b.toSafeInteger=jN,b.toString=ge,b.toUpper=BU,b.trim=kU,b.trimEnd=MU,b.trimStart=LU,b.truncate=NU,b.unescape=UU,b.uniqueId=dW,b.upperCase=WU,b.upperFirst=Qv,b.each=KE,b.eachRight=ZE,b.first=VE,tm(b,function(){var o={};return St(b,function(a,l){Ee.call(b.prototype,l)||(o[l]=a)}),o}(),{chain:!1}),b.VERSION=e,Ur(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){b[o].placeholder=b}),Ur(["drop","take"],function(o,a){le.prototype[o]=function(l){l=l===r?1:Ge(se(l),0);var h=this.__filtered__&&!a?new le(this):this.clone();return h.__filtered__?h.__takeCount__=ar(l,h.__takeCount__):h.__views__.push({size:ar(l,wt),type:o+(h.__dir__<0?"Right":"")}),h},le.prototype[o+"Right"]=function(l){return this.reverse()[o](l).reverse()}}),Ur(["filter","map","takeWhile"],function(o,a){var l=a+1,h=l==$y||l==MI;le.prototype[o]=function(x){var _=this.clone();return _.__iteratees__.push({iteratee:Z(x,3),type:l}),_.__filtered__=_.__filtered__||h,_}}),Ur(["head","last"],function(o,a){var l="take"+(a?"Right":"");le.prototype[o]=function(){return this[l](1).value()[0]}}),Ur(["initial","tail"],function(o,a){var l="drop"+(a?"":"Right");le.prototype[o]=function(){return this.__filtered__?new le(this):this[l](1)}}),le.prototype.compact=function(){return this.filter(_r)},le.prototype.find=function(o){return this.filter(o).head()},le.prototype.findLast=function(o){return this.reverse().find(o)},le.prototype.invokeMap=ae(function(o,a){return typeof o=="function"?new le(this):this.map(function(l){return yu(l,o,a)})}),le.prototype.reject=function(o){return this.filter($l(Z(o)))},le.prototype.slice=function(o,a){o=se(o);var l=this;return l.__filtered__&&(o>0||a<0)?new le(l):(o<0?l=l.takeRight(-o):o&&(l=l.drop(o)),a!==r&&(a=se(a),l=a<0?l.dropRight(-a):l.take(a-o)),l)},le.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},le.prototype.toArray=function(){return this.take(wt)},St(le.prototype,function(o,a){var l=/^(?:filter|find|map|reject)|While$/.test(a),h=/^(?:head|last)$/.test(a),x=b[h?"take"+(a=="last"?"Right":""):a],_=h||/^find/.test(a);x&&(b.prototype[a]=function(){var E=this.__wrapped__,S=h?[1]:arguments,F=E instanceof le,j=S[0],B=F||re(E),k=function(ce){var fe=x.apply(b,Bn([ce],S));return h&&L?fe[0]:fe};B&&l&&typeof j=="function"&&j.length!=1&&(F=B=!1);var L=this.__chain__,G=!!this.__actions__.length,Y=_&&!L,oe=F&&!G;if(!_&&B){E=oe?E:new le(this);var J=o.apply(E,S);return J.__actions__.push({func:Ll,args:[k],thisArg:r}),new $r(J,L)}return Y&&oe?o.apply(this,S):(J=this.thru(k),Y?h?J.value()[0]:J.value():J)})}),Ur(["pop","push","shift","sort","splice","unshift"],function(o){var a=fl[o],l=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",h=/^(?:pop|shift)$/.test(o);b.prototype[o]=function(){var x=arguments;if(h&&!this.__chain__){var _=this.value();return a.apply(re(_)?_:[],x)}return this[l](function(E){return a.apply(re(E)?E:[],x)})}}),St(le.prototype,function(o,a){var l=b[a];if(l){var h=l.name+"";Ee.call(Ys,h)||(Ys[h]=[]),Ys[h].push({name:a,func:l})}}),Ys[Pl(r,O).name]=[{name:"wrapper",func:r}],le.prototype.clone=UB,le.prototype.reverse=WB,le.prototype.value=$B,b.prototype.at=bL,b.prototype.chain=_L,b.prototype.commit=gL,b.prototype.next=yL,b.prototype.plant=DL,b.prototype.reverse=wL,b.prototype.toJSON=b.prototype.valueOf=b.prototype.value=SL,b.prototype.first=b.prototype.head,pu&&(b.prototype[pu]=EL),b},Mn=gB();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(He._=Mn,define(function(){return Mn})):Ri?((Ri.exports=Mn)._=Mn,rv._=Mn):He._=Mn}).call(iu)});var Rc=ye(Re());var ao=ye(require("node:fs")),QD=ye(require("node:os")),Pr=ye(require("node:path")),Rr=class r{static{let e=QD.default.homedir(),t={win32:{baseDir:process.env.APPDATA||Pr.default.join(e,"AppData","Roaming"),vscodePath:Pr.default.join("Code","User","globalStorage")},darwin:{baseDir:Pr.default.join(e,"Library","Application Support"),vscodePath:Pr.default.join("Code","User","globalStorage")},linux:{baseDir:"/home/runner/.config",vscodePath:Pr.default.join("Code/User/globalStorage")}},n=process.platform,{baseDir:i,vscodePath:s}=t[n],u={claude:Pr.default.join(i,"Claude","claude_desktop_config.json"),cline:Pr.default.join(i,s,"saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),"roo-cline":Pr.default.join(i,s,"rooveterinaryinc.roo-cline","settings","cline_mcp_settings.json"),"windsurf-next":Pr.default.join(i,".codeium","windsurf","mcp_config.json")};r.configPath=u.claude,r.clientPaths=u}static getConfigPath(e){let t=e?.toLowerCase()||"claude";return r.clientPaths[t]||Pr.default.join(Pr.default.dirname(r.configPath),"..",e||"claude",`${t}_config.json`)}static readConfig(e){try{let t=r.getConfigPath(e);return ao.default.existsSync(t)?{mcpServers:JSON.parse(ao.default.readFileSync(t,"utf8")).mcpServers||{}}:{mcpServers:{}}}catch{return{mcpServers:{}}}}static writeConfig(e,t){let n=r.getConfigPath(t),i=Pr.default.dirname(n);if(ao.default.existsSync(i)||ao.default.mkdirSync(i,{recursive:!0}),!e.mcpServers||typeof e.mcpServers!="object")throw new Error("Invalid config structure");ao.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),s=r.readConfig(n);s.mcpServers[i]=t,r.writeConfig(s,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 KT=require("node:child_process"),ZT=require("node:util"),YT=ye(yn()),En=(0,ZT.promisify)(KT.exec);async function Uye(r){if(!r)return!1;try{let e=process.platform,t={claude:"Claude"}[r]||r;if(e==="win32"){let{stdout:n}=await En(`tasklist /FI "IMAGENAME eq ${t}.exe" /NH`);return n.includes(`${t}.exe`)}else if(e==="darwin"){let{stdout:n}=await En(`pgrep -x "${t}"`);return!!n.trim()}else if(e==="linux"){let{stdout:n}=await En(`pgrep -f "${t.toLowerCase()}"`);return!!n.trim()}return!1}catch{return!1}}async function Wye(r){let e={claude:"Claude",jan:"Jan"}[r]||r;try{let t=process.platform;t==="win32"?await En(`taskkill /F /IM "${e}.exe" && start "" "${e}.exe"`):t==="darwin"?await En(`killall "${e}" && open -a "${e}"`):t==="linux"&&await En(`pkill -f "${e.toLowerCase()}" && ${e.toLowerCase()}`),await new Promise(n=>setTimeout(n,2e3)),t==="win32"?await En(`start "" "${e}.exe"`):t==="darwin"?await En(`open -a "${e}"`):t==="linux"&&await En(e.toLowerCase()),console.log(`${e} has been restarted.`)}catch(t){console.error(`Failed to restart ${e}:`,t)}}async function j2(r){if(!r||!await Uye(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 Wye(r)),t}var JT=require("node:child_process"),XT=require("node:util"),B2=ye(yn()),k2=ye(Re()),CAe=(0,XT.promisify)(JT.exec);async function Gp(r,e){let t=new Map;if(r.configSchema?.properties){let s=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:s.has(u),default:f.default,type:f.type})})}let n={};function i(s,u){if(!u)return s;if(s==="")switch(u){case"array":return[];case"number":case"integer":return null;default:return s}if(!s)return s;switch(u){case"boolean":return String(s).toLowerCase()==="true";case"number":return Number(s);case"integer":return Number.parseInt(String(s),10);case"array":return String(s).split(",").map(c=>c.trim()).filter(c=>c!=="");default:return s}}if(e){for(let s of t.values()){let u=e[s.key];if(u!==void 0||s.default!==void 0)n[s.key]=i(u??s.default,s.type);else if(s.required)throw new Error(`Missing required config value: ${s.key}`)}return n}for(let s of t.values()){if(process.env[s.key]&&!s.required){let{reuseExisting:d}=await B2.default.prompt([{type:"confirm",name:"reuseExisting",message:`Found ${s.key} in environment. Use it?`,default:!0}]);if(d){n[s.key]=i(process.env[s.key],s.type);continue}}let u=s.required?k2.default.red(" (required)"):k2.default.gray(" (optional)"),c=s.key.toLowerCase().includes("key")?"password":s.type==="boolean"?"confirm":s.type==="array"?"input":s.type==="number"||s.type==="integer"?"number":"input",{value:f}=await B2.default.prompt([{type:c,name:"value",message:`${s.description}${u}${s.type==="array"?" (comma-separated)":""}`,default:s.default,mask:c==="password"?"*":void 0,validate:d=>s.required&&!d?!1:s.type==="number"||s.type==="integer"?!Number.isNaN(Number(d))||"Please enter a valid number":!0}]);(f!==void 0||s.default!==void 0)&&(n[s.key]=i(f??s.default,s.type))}return n}var Ci=class{constructor(e=Rr){this.configManager=e}selectPreferredConnection(e){if(!e.connections?.length)throw new Error("No connection configuration found");let t=e.connections.find(n=>n.type==="ws");return t||e.connections[0]}formatServerConfig(e,t){let n=JSON.stringify(JSON.stringify(t));return{command:"npx",args:["-y","@smithery/cli@latest","run",e,"--config",n]}}async installServer(e,t){let n=this.selectPreferredConnection(e),i=await Gp(n),s=this.formatServerConfig(e.qualifiedName,i);await this.configManager.installServer(e.qualifiedName,s,t),await j2(t)}async uninstallServer(e,t){try{await this.configManager.uninstallServer(e,t),console.log(`
|
|
89
|
-
Uninstalled ${e}`),await j2(t)}catch(n){throw console.error("Failed to uninstall server:",n),n}}};var iP=ye(nP());var pr=["claude","cline","windsurf
|
|
88
|
+
}`;var oe=bD(function(){return be(_,G+"return "+k).apply(r,E)});if(oe.source=k,Zv(oe))throw oe;return oe}function jU(o){return ge(o).toLowerCase()}function BU(o){return ge(o).toUpperCase()}function kU(o,a,l){if(o=ge(o),o&&(l||a===r))return O6(o);if(!o||!(a=Fr(a)))return o;var h=ct(o),x=ct(a),_=F6(h,x),E=A6(h,x)+1;return $n(h,_,E).join("")}function MU(o,a,l){if(o=ge(o),o&&(l||a===r))return o.slice(0,T6(o)+1);if(!o||!(a=Fr(a)))return o;var h=ct(o),x=A6(h,ct(a))+1;return $n(h,0,x).join("")}function LU(o,a,l){if(o=ge(o),o&&(l||a===r))return o.replace(Zx,"");if(!o||!(a=Fr(a)))return o;var h=ct(o),x=F6(h,ct(a));return $n(h,x).join("")}function NU(o,a){var l=Qc,h=su;if(ke(a)){var x="separator"in a?a.separator:x;l="length"in a?se(a.length):l,h="omission"in a?Fr(a.omission):h}o=ge(o);var _=o.length;if(zs(o)){var E=ct(o);_=E.length}if(l>=_)return o;var S=l-Hs(h);if(S<1)return h;var F=E?$n(E,0,S).join(""):o.slice(0,S);if(x===r)return F+h;if(E&&(S+=F.length-S),Yv(x)){if(o.slice(S).search(x)){var j,B=F;for(x.global||(x=dv(x.source,ge(Zy.exec(x))+"g")),x.lastIndex=0;j=x.exec(B);)var k=j.index;F=F.slice(0,k===r?S:k)}}else if(o.indexOf(Fr(x),S)!=S){var L=F.lastIndexOf(x);L>-1&&(F=F.slice(0,L))}return F+h}function UU(o){return o=ge(o),o&&XI.test(o)?o.replace(zy,vB):o}var WU=Qs(function(o,a,l){return o+(l?" ":"")+a.toUpperCase()}),Qv=_E("toUpperCase");function mD(o,a,l){return o=ge(o),a=l?r:a,a===r?fB(o)?_B(o):tB(o):o.match(a)||[]}var bD=ae(function(o,a){try{return Cr(o,r,a)}catch(l){return Zv(l)?l:new ee(l)}}),$U=nn(function(o,a){return Ur(a,function(l){l=Ot(l),rn(o,l,Hv(o[l],o))}),o});function VU(o){var a=o==null?0:o.length,l=Z();return o=a?Pe(o,function(h){if(typeof h[1]!="function")throw new Wr(i);return[l(h[0]),h[1]]}):[],ae(function(h){for(var x=-1;++x<a;){var _=o[x];if(Cr(_[0],this,h))return Cr(_[1],this,h)}})}function GU(o){return vk(Vr(o,d))}function em(o){return function(){return o}}function zU(o,a){return o==null||o!==o?a:o}var HU=yE(),KU=yE(!0);function _r(o){return o}function rm(o){return J6(typeof o=="function"?o:Vr(o,d))}function ZU(o){return Q6(Vr(o,d))}function YU(o,a){return eE(o,Vr(a,d))}var JU=ae(function(o,a){return function(l){return yu(l,o,a)}}),XU=ae(function(o,a){return function(l){return yu(o,l,a)}});function tm(o,a,l){var h=Ke(a),x=Ol(a,h);l==null&&!(ke(a)&&(x.length||!h.length))&&(l=a,a=o,o=this,x=Ol(a,Ke(a)));var _=!(ke(l)&&"chain"in l)||!!l.chain,E=on(o);return Ur(x,function(S){var F=a[S];o[S]=F,E&&(o.prototype[S]=function(){var j=this.__chain__;if(_||j){var B=o(this.__wrapped__),k=B.__actions__=vr(this.__actions__);return k.push({func:F,args:arguments,thisArg:o}),B.__chain__=j,B}return F.apply(o,Bn([this.value()],arguments))})}),o}function QU(){return He._===this&&(He._=SB),this}function nm(){}function eW(o){return o=se(o),ae(function(a){return rE(a,o)})}var rW=Iv(Pe),tW=Iv(E6),nW=Iv(sv);function _D(o){return Uv(o)?ov(Ot(o)):Rk(o)}function iW(o){return function(a){return o==null?r:Mi(o,a)}}var sW=DE(),oW=DE(!0);function im(){return[]}function sm(){return!1}function aW(){return{}}function uW(){return""}function cW(){return!0}function lW(o,a){if(o=se(o),o<1||o>In)return[];var l=wt,h=ar(o,wt);a=Z(a),o-=wt;for(var x=cv(h,a);++l<o;)a(l);return x}function fW(o){return re(o)?Pe(o,Ot):Ar(o)?[o]:vr(LE(ge(o)))}function dW(o){var a=++DB;return ge(o)+a}var hW=Rl(function(o,a){return o+a},0),pW=jv("ceil"),xW=Rl(function(o,a){return o/a},1),vW=jv("floor");function mW(o){return o&&o.length?Cl(o,_r,gv):r}function bW(o,a){return o&&o.length?Cl(o,Z(a,2),gv):r}function _W(o){return S6(o,_r)}function gW(o,a){return S6(o,Z(a,2))}function yW(o){return o&&o.length?Cl(o,_r,wv):r}function EW(o,a){return o&&o.length?Cl(o,Z(a,2),wv):r}var DW=Rl(function(o,a){return o*a},1),wW=jv("round"),SW=Rl(function(o,a){return o-a},0);function CW(o){return o&&o.length?uv(o,_r):0}function OW(o,a){return o&&o.length?uv(o,Z(a,2)):0}return b.after=ZL,b.ary=YE,b.assign=BN,b.assignIn=lD,b.assignInWith=zl,b.assignWith=kN,b.at=MN,b.before=JE,b.bind=Hv,b.bindAll=$U,b.bindKey=XE,b.castArray=aN,b.chain=HE,b.chunk=vM,b.compact=mM,b.concat=bM,b.cond=VU,b.conforms=GU,b.constant=em,b.countBy=CL,b.create=LN,b.curry=QE,b.curryRight=eD,b.debounce=rD,b.defaults=NN,b.defaultsDeep=UN,b.defer=YL,b.delay=JL,b.difference=_M,b.differenceBy=gM,b.differenceWith=yM,b.drop=EM,b.dropRight=DM,b.dropRightWhile=wM,b.dropWhile=SM,b.fill=CM,b.filter=FL,b.flatMap=TL,b.flatMapDeep=PL,b.flatMapDepth=RL,b.flatten=$E,b.flattenDeep=OM,b.flattenDepth=FM,b.flip=XL,b.flow=HU,b.flowRight=KU,b.fromPairs=AM,b.functions=KN,b.functionsIn=ZN,b.groupBy=IL,b.initial=TM,b.intersection=PM,b.intersectionBy=RM,b.intersectionWith=IM,b.invert=JN,b.invertBy=XN,b.invokeMap=BL,b.iteratee=rm,b.keyBy=kL,b.keys=Ke,b.keysIn=br,b.map=Nl,b.mapKeys=eU,b.mapValues=rU,b.matches=ZU,b.matchesProperty=YU,b.memoize=Wl,b.merge=tU,b.mergeWith=fD,b.method=JU,b.methodOf=XU,b.mixin=tm,b.negate=$l,b.nthArg=eW,b.omit=nU,b.omitBy=iU,b.once=QL,b.orderBy=ML,b.over=rW,b.overArgs=eN,b.overEvery=tW,b.overSome=nW,b.partial=Kv,b.partialRight=tD,b.partition=LL,b.pick=sU,b.pickBy=dD,b.property=_D,b.propertyOf=iW,b.pull=MM,b.pullAll=GE,b.pullAllBy=LM,b.pullAllWith=NM,b.pullAt=UM,b.range=sW,b.rangeRight=oW,b.rearg=rN,b.reject=WL,b.remove=WM,b.rest=tN,b.reverse=Gv,b.sampleSize=VL,b.set=aU,b.setWith=uU,b.shuffle=GL,b.slice=$M,b.sortBy=KL,b.sortedUniq=YM,b.sortedUniqBy=JM,b.split=TU,b.spread=nN,b.tail=XM,b.take=QM,b.takeRight=eL,b.takeRightWhile=rL,b.takeWhile=tL,b.tap=mL,b.throttle=iN,b.thru=Ll,b.toArray=aD,b.toPairs=hD,b.toPairsIn=pD,b.toPath=fW,b.toPlainObject=cD,b.transform=cU,b.unary=sN,b.union=nL,b.unionBy=iL,b.unionWith=sL,b.uniq=oL,b.uniqBy=aL,b.uniqWith=uL,b.unset=lU,b.unzip=zv,b.unzipWith=zE,b.update=fU,b.updateWith=dU,b.values=to,b.valuesIn=hU,b.without=cL,b.words=mD,b.wrap=oN,b.xor=lL,b.xorBy=fL,b.xorWith=dL,b.zip=hL,b.zipObject=pL,b.zipObjectDeep=xL,b.zipWith=vL,b.entries=hD,b.entriesIn=pD,b.extend=lD,b.extendWith=zl,tm(b,b),b.add=hW,b.attempt=bD,b.camelCase=mU,b.capitalize=xD,b.ceil=pW,b.clamp=pU,b.clone=uN,b.cloneDeep=lN,b.cloneDeepWith=fN,b.cloneWith=cN,b.conformsTo=dN,b.deburr=vD,b.defaultTo=zU,b.divide=xW,b.endsWith=bU,b.eq=ft,b.escape=_U,b.escapeRegExp=gU,b.every=OL,b.find=AL,b.findIndex=UE,b.findKey=WN,b.findLast=qL,b.findLastIndex=WE,b.findLastKey=$N,b.floor=vW,b.forEach=KE,b.forEachRight=ZE,b.forIn=VN,b.forInRight=GN,b.forOwn=zN,b.forOwnRight=HN,b.get=Jv,b.gt=hN,b.gte=pN,b.has=YN,b.hasIn=Xv,b.head=VE,b.identity=_r,b.includes=jL,b.indexOf=qM,b.inRange=xU,b.invoke=QN,b.isArguments=Ui,b.isArray=re,b.isArrayBuffer=xN,b.isArrayLike=mr,b.isArrayLikeObject=Ue,b.isBoolean=vN,b.isBuffer=Vn,b.isDate=mN,b.isElement=bN,b.isEmpty=_N,b.isEqual=gN,b.isEqualWith=yN,b.isError=Zv,b.isFinite=EN,b.isFunction=on,b.isInteger=nD,b.isLength=Vl,b.isMap=iD,b.isMatch=DN,b.isMatchWith=wN,b.isNaN=SN,b.isNative=CN,b.isNil=FN,b.isNull=ON,b.isNumber=sD,b.isObject=ke,b.isObjectLike=Me,b.isPlainObject=Ou,b.isRegExp=Yv,b.isSafeInteger=AN,b.isSet=oD,b.isString=Gl,b.isSymbol=Ar,b.isTypedArray=ro,b.isUndefined=qN,b.isWeakMap=TN,b.isWeakSet=PN,b.join=jM,b.kebabCase=yU,b.last=zr,b.lastIndexOf=BM,b.lowerCase=EU,b.lowerFirst=DU,b.lt=RN,b.lte=IN,b.max=mW,b.maxBy=bW,b.mean=_W,b.meanBy=gW,b.min=yW,b.minBy=EW,b.stubArray=im,b.stubFalse=sm,b.stubObject=aW,b.stubString=uW,b.stubTrue=cW,b.multiply=DW,b.nth=kM,b.noConflict=QU,b.noop=nm,b.now=Ul,b.pad=wU,b.padEnd=SU,b.padStart=CU,b.parseInt=OU,b.random=vU,b.reduce=NL,b.reduceRight=UL,b.repeat=FU,b.replace=AU,b.result=oU,b.round=wW,b.runInContext=C,b.sample=$L,b.size=zL,b.snakeCase=qU,b.some=HL,b.sortedIndex=VM,b.sortedIndexBy=GM,b.sortedIndexOf=zM,b.sortedLastIndex=HM,b.sortedLastIndexBy=KM,b.sortedLastIndexOf=ZM,b.startCase=PU,b.startsWith=RU,b.subtract=SW,b.sum=CW,b.sumBy=OW,b.template=IU,b.times=lW,b.toFinite=an,b.toInteger=se,b.toLength=uD,b.toLower=jU,b.toNumber=Hr,b.toSafeInteger=jN,b.toString=ge,b.toUpper=BU,b.trim=kU,b.trimEnd=MU,b.trimStart=LU,b.truncate=NU,b.unescape=UU,b.uniqueId=dW,b.upperCase=WU,b.upperFirst=Qv,b.each=KE,b.eachRight=ZE,b.first=VE,tm(b,function(){var o={};return St(b,function(a,l){Ee.call(b.prototype,l)||(o[l]=a)}),o}(),{chain:!1}),b.VERSION=e,Ur(["bind","bindKey","curry","curryRight","partial","partialRight"],function(o){b[o].placeholder=b}),Ur(["drop","take"],function(o,a){le.prototype[o]=function(l){l=l===r?1:Ge(se(l),0);var h=this.__filtered__&&!a?new le(this):this.clone();return h.__filtered__?h.__takeCount__=ar(l,h.__takeCount__):h.__views__.push({size:ar(l,wt),type:o+(h.__dir__<0?"Right":"")}),h},le.prototype[o+"Right"]=function(l){return this.reverse()[o](l).reverse()}}),Ur(["filter","map","takeWhile"],function(o,a){var l=a+1,h=l==$y||l==MI;le.prototype[o]=function(x){var _=this.clone();return _.__iteratees__.push({iteratee:Z(x,3),type:l}),_.__filtered__=_.__filtered__||h,_}}),Ur(["head","last"],function(o,a){var l="take"+(a?"Right":"");le.prototype[o]=function(){return this[l](1).value()[0]}}),Ur(["initial","tail"],function(o,a){var l="drop"+(a?"":"Right");le.prototype[o]=function(){return this.__filtered__?new le(this):this[l](1)}}),le.prototype.compact=function(){return this.filter(_r)},le.prototype.find=function(o){return this.filter(o).head()},le.prototype.findLast=function(o){return this.reverse().find(o)},le.prototype.invokeMap=ae(function(o,a){return typeof o=="function"?new le(this):this.map(function(l){return yu(l,o,a)})}),le.prototype.reject=function(o){return this.filter($l(Z(o)))},le.prototype.slice=function(o,a){o=se(o);var l=this;return l.__filtered__&&(o>0||a<0)?new le(l):(o<0?l=l.takeRight(-o):o&&(l=l.drop(o)),a!==r&&(a=se(a),l=a<0?l.dropRight(-a):l.take(a-o)),l)},le.prototype.takeRightWhile=function(o){return this.reverse().takeWhile(o).reverse()},le.prototype.toArray=function(){return this.take(wt)},St(le.prototype,function(o,a){var l=/^(?:filter|find|map|reject)|While$/.test(a),h=/^(?:head|last)$/.test(a),x=b[h?"take"+(a=="last"?"Right":""):a],_=h||/^find/.test(a);x&&(b.prototype[a]=function(){var E=this.__wrapped__,S=h?[1]:arguments,F=E instanceof le,j=S[0],B=F||re(E),k=function(ce){var fe=x.apply(b,Bn([ce],S));return h&&L?fe[0]:fe};B&&l&&typeof j=="function"&&j.length!=1&&(F=B=!1);var L=this.__chain__,G=!!this.__actions__.length,Y=_&&!L,oe=F&&!G;if(!_&&B){E=oe?E:new le(this);var J=o.apply(E,S);return J.__actions__.push({func:Ll,args:[k],thisArg:r}),new $r(J,L)}return Y&&oe?o.apply(this,S):(J=this.thru(k),Y?h?J.value()[0]:J.value():J)})}),Ur(["pop","push","shift","sort","splice","unshift"],function(o){var a=fl[o],l=/^(?:push|sort|unshift)$/.test(o)?"tap":"thru",h=/^(?:pop|shift)$/.test(o);b.prototype[o]=function(){var x=arguments;if(h&&!this.__chain__){var _=this.value();return a.apply(re(_)?_:[],x)}return this[l](function(E){return a.apply(re(E)?E:[],x)})}}),St(le.prototype,function(o,a){var l=b[a];if(l){var h=l.name+"";Ee.call(Ys,h)||(Ys[h]=[]),Ys[h].push({name:a,func:l})}}),Ys[Pl(r,O).name]=[{name:"wrapper",func:r}],le.prototype.clone=UB,le.prototype.reverse=WB,le.prototype.value=$B,b.prototype.at=bL,b.prototype.chain=_L,b.prototype.commit=gL,b.prototype.next=yL,b.prototype.plant=DL,b.prototype.reverse=wL,b.prototype.toJSON=b.prototype.valueOf=b.prototype.value=SL,b.prototype.first=b.prototype.head,pu&&(b.prototype[pu]=EL),b},Mn=gB();typeof define=="function"&&typeof define.amd=="object"&&define.amd?(He._=Mn,define(function(){return Mn})):Ri?((Ri.exports=Mn)._=Mn,rv._=Mn):He._=Mn}).call(iu)});var Rc=ye(Re());var ao=ye(require("node:fs")),QD=ye(require("node:os")),Pr=ye(require("node:path")),Rr=class r{static{let e=QD.default.homedir(),t={win32:{baseDir:process.env.APPDATA||Pr.default.join(e,"AppData","Roaming"),vscodePath:Pr.default.join("Code","User","globalStorage")},darwin:{baseDir:Pr.default.join(e,"Library","Application Support"),vscodePath:Pr.default.join("Code","User","globalStorage")},linux:{baseDir:"/home/runner/.config",vscodePath:Pr.default.join("Code/User/globalStorage")}},n=process.platform,{baseDir:i,vscodePath:s}=t[n],u={claude:Pr.default.join(i,"Claude","claude_desktop_config.json"),cline:Pr.default.join(i,s,"saoudrizwan.claude-dev","settings","cline_mcp_settings.json"),"roo-cline":Pr.default.join(i,s,"rooveterinaryinc.roo-cline","settings","cline_mcp_settings.json"),windsurf:Pr.default.join(i,".codeium","windsurf","mcp_config.json")};r.configPath=u.claude,r.clientPaths=u}static getConfigPath(e){let t=e?.toLowerCase()||"claude";return r.clientPaths[t]||Pr.default.join(Pr.default.dirname(r.configPath),"..",e||"claude",`${t}_config.json`)}static readConfig(e){try{let t=r.getConfigPath(e);return ao.default.existsSync(t)?{mcpServers:JSON.parse(ao.default.readFileSync(t,"utf8")).mcpServers||{}}:{mcpServers:{}}}catch{return{mcpServers:{}}}}static writeConfig(e,t){let n=r.getConfigPath(t),i=Pr.default.dirname(n);if(ao.default.existsSync(i)||ao.default.mkdirSync(i,{recursive:!0}),!e.mcpServers||typeof e.mcpServers!="object")throw new Error("Invalid config structure");ao.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),s=r.readConfig(n);s.mcpServers[i]=t,r.writeConfig(s,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 KT=require("node:child_process"),ZT=require("node:util"),YT=ye(yn()),En=(0,ZT.promisify)(KT.exec);async function Uye(r){if(!r)return!1;try{let e=process.platform,t={claude:"Claude"}[r]||r;if(e==="win32"){let{stdout:n}=await En(`tasklist /FI "IMAGENAME eq ${t}.exe" /NH`);return n.includes(`${t}.exe`)}else if(e==="darwin"){let{stdout:n}=await En(`pgrep -x "${t}"`);return!!n.trim()}else if(e==="linux"){let{stdout:n}=await En(`pgrep -f "${t.toLowerCase()}"`);return!!n.trim()}return!1}catch{return!1}}async function Wye(r){let e={claude:"Claude",jan:"Jan"}[r]||r;try{let t=process.platform;t==="win32"?await En(`taskkill /F /IM "${e}.exe" && start "" "${e}.exe"`):t==="darwin"?await En(`killall "${e}" && open -a "${e}"`):t==="linux"&&await En(`pkill -f "${e.toLowerCase()}" && ${e.toLowerCase()}`),await new Promise(n=>setTimeout(n,2e3)),t==="win32"?await En(`start "" "${e}.exe"`):t==="darwin"?await En(`open -a "${e}"`):t==="linux"&&await En(e.toLowerCase()),console.log(`${e} has been restarted.`)}catch(t){console.error(`Failed to restart ${e}:`,t)}}async function j2(r){if(!r||!await Uye(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 Wye(r)),t}var JT=require("node:child_process"),XT=require("node:util"),B2=ye(yn()),k2=ye(Re()),CAe=(0,XT.promisify)(JT.exec);async function Gp(r,e){let t=new Map;if(r.configSchema?.properties){let s=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:s.has(u),default:f.default,type:f.type})})}let n={};function i(s,u){if(!u)return s;if(s==="")switch(u){case"array":return[];case"number":case"integer":return null;default:return s}if(!s)return s;switch(u){case"boolean":return String(s).toLowerCase()==="true";case"number":return Number(s);case"integer":return Number.parseInt(String(s),10);case"array":return String(s).split(",").map(c=>c.trim()).filter(c=>c!=="");default:return s}}if(e){for(let s of t.values()){let u=e[s.key];if(u!==void 0||s.default!==void 0)n[s.key]=i(u??s.default,s.type);else if(s.required)throw new Error(`Missing required config value: ${s.key}`)}return n}for(let s of t.values()){if(process.env[s.key]&&!s.required){let{reuseExisting:d}=await B2.default.prompt([{type:"confirm",name:"reuseExisting",message:`Found ${s.key} in environment. Use it?`,default:!0}]);if(d){n[s.key]=i(process.env[s.key],s.type);continue}}let u=s.required?k2.default.red(" (required)"):k2.default.gray(" (optional)"),c=s.key.toLowerCase().includes("key")?"password":s.type==="boolean"?"confirm":s.type==="array"?"input":s.type==="number"||s.type==="integer"?"number":"input",{value:f}=await B2.default.prompt([{type:c,name:"value",message:`${s.description}${u}${s.type==="array"?" (comma-separated)":""}`,default:s.default,mask:c==="password"?"*":void 0,validate:d=>s.required&&!d?!1:s.type==="number"||s.type==="integer"?!Number.isNaN(Number(d))||"Please enter a valid number":!0}]);(f!==void 0||s.default!==void 0)&&(n[s.key]=i(f??s.default,s.type))}return n}var Ci=class{constructor(e=Rr){this.configManager=e}selectPreferredConnection(e){if(!e.connections?.length)throw new Error("No connection configuration found");let t=e.connections.find(n=>n.type==="ws");return t||e.connections[0]}formatServerConfig(e,t){let n=JSON.stringify(JSON.stringify(t));return{command:"npx",args:["-y","@smithery/cli@latest","run",e,"--config",n]}}async installServer(e,t){let n=this.selectPreferredConnection(e),i=await Gp(n),s=this.formatServerConfig(e.qualifiedName,i);await this.configManager.installServer(e.qualifiedName,s,t),await j2(t)}async uninstallServer(e,t){try{await this.configManager.uninstallServer(e,t),console.log(`
|
|
89
|
+
Uninstalled ${e}`),await j2(t)}catch(n){throw console.error("Failed to uninstall server:",n),n}}};var iP=ye(nP());var pr=["claude","cline","windsurf","roo-cline"],U2="https://registry.smithery.ai",W2="https://smithery.ai/api/track";iP.default.config();async function sP(r,e=[]){try{if(e.length===0)return[];let t=e.map(i=>ms(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 ms(r,e="claude"){try{let t=Rr.isServerInstalled(r,e),n=await fetch(`${U2}/servers/${r}`);if(!n.ok)return t?{qualifiedName:r,name:r,connections:[],isInstalled:!0,client:e}:null;let i=await n.json(),s=await Promise.all(i.connections.map(async c=>{if(c.type==="ws"&&c.deploymentUrl)try{let f=await fetch(`${c.deploymentUrl}/.well-known/mcp/smithery.json`);if(f.ok){let d=await f.json();return{type:"ws",deploymentUrl:c.deploymentUrl,configSchema:d.configSchema,exampleConfig:c.exampleConfig}}}catch{}return c}));return{qualifiedName:i.qualifiedName,name:i.displayName,connections:s,isInstalled:t,client:e}}catch(t){return console.error("Error resolving server:",t),null}}async function oP(r,e,t="stdio"){try{let n={connectionType:t,config:e},i=await fetch(`${U2}/servers/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});try{return(await i.json()).result}catch(s){let u=s instanceof Error?s.message:"Unknown parsing error";throw new Error(`Invalid JSON response from registry: ${u}`)}}catch{return null}}var Ba=require("node:os"),ja=require("node:path"),Yp=require("node:fs");var sr=[];for(let r=0;r<256;++r)sr.push((r+256).toString(16).slice(1));function aP(r,e=0){return(sr[r[e+0]]+sr[r[e+1]]+sr[r[e+2]]+sr[r[e+3]]+"-"+sr[r[e+4]]+sr[r[e+5]]+"-"+sr[r[e+6]]+sr[r[e+7]]+"-"+sr[r[e+8]]+sr[r[e+9]]+"-"+sr[r[e+10]]+sr[r[e+11]]+sr[r[e+12]]+sr[r[e+13]]+sr[r[e+14]]+sr[r[e+15]]).toLowerCase()}var uP=require("crypto"),Kp=new Uint8Array(256),Hp=Kp.length;function $2(){return Hp>Kp.length-16&&((0,uP.randomFillSync)(Kp),Hp=0),Kp.slice(Hp,Hp+=16)}var cP=require("crypto"),V2={randomUUID:cP.randomUUID};function i6e(r,e,t){if(V2.randomUUID&&!e&&!r)return V2.randomUUID();r=r||{};let n=r.random??r.rng?.()??$2();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 aP(n)}var Zp=i6e;var ka=class r{constructor(){this.data=null}static getSettingsPath(){switch((0,Ba.platform)()){case"win32":return(0,ja.join)(process.env.APPDATA||(0,ja.join)((0,Ba.homedir)(),"AppData","Roaming"),"smithery");case"darwin":return(0,ja.join)((0,Ba.homedir)(),"Library","Application Support","smithery");default:return(0,ja.join)((0,Ba.homedir)(),".config","smithery")}}static{this.SETTINGS_PATH=(0,ja.join)(r.getSettingsPath(),"settings.json")}async initialize(){try{await Yp.promises.mkdir(r.getSettingsPath(),{recursive:!0});try{let e=await Yp.promises.readFile(r.SETTINGS_PATH,"utf-8");this.data=JSON.parse(e),this.data&&!this.data.userId&&(this.data.userId=Zp(),await this.save()),this.data&&this.data.analyticsConsent===void 0&&(this.data.analyticsConsent=!1,await this.save())}catch{this.data={userId:Zp(),analyticsConsent:!1,cache:{servers:{}}},await this.save()}}catch(e){throw console.error("Failed to initialize settings:",e),e}}async save(){await Yp.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 lP=ye(yn()),s6e=new Ci;async function fP(r,e){let t=new ka;if(await t.initialize(),t.getAnalyticsConsent()===!1){let{EnableAnalytics:s}=await lP.default.prompt([{type:"confirm",name:"EnableAnalytics",message:"Would you like to help improve Smithery by sending anonymous usage data?",default:!0}]);await t.setAnalyticsConsent(s)}e&&!pr.includes(e)&&(console.error(Rc.default.red(`Invalid client: ${e}
|
|
90
90
|
Valid clients are: ${pr.join(", ")}`)),process.exit(1));let n=await ms(r,e);n||(console.error(Rc.default.red(`Server '${r}' not found in registry`)),process.exit(1)),n.connections.some(s=>s.type==="ws"&&"deploymentUrl"in s)&&console.log(Rc.default.blue("Installing remote server...")),await s6e.installServer(n,e),console.log(Rc.default.green(`\u2713 Successfully installed package '${r}' for ${e}`))}var bs=ye(Re()),dP=ye(yn());var o6e=new Ci;async function hP(r,e){try{e&&!pr.includes(e)&&(console.error(bs.default.red(`Invalid client: ${e}
|
|
91
91
|
Valid clients are: ${pr.join(", ")}`)),process.exit(1)),r||(console.error(bs.default.red("Error: Server ID is required")),console.log("Usage: @smithery/cli uninstall <server-id>"),process.exit(1));let{confirmUninstall:t}=await dP.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 o6e.uninstallServer(r,e),console.log(bs.default.green(`
|
|
92
92
|
Successfully uninstalled ${r} for ${e}`)),e==="claude"&&console.log(bs.default.yellow(`
|