MCPcopy Create free account
hub / github.com/ChinaSiro/claude-code-sourcemap / Tq5

Function Tq5

package/cli.js:16475–16477  ·  view source on GitHub ↗
(q)

Source from the content-addressed store, hash-verified

16473`)}),o3()}catch(Y){o3(Y.message)}}async function TaY(){d("tengu_mcp_list",{});let{servers:q}=await Iq6();if(Object.keys(q).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
16474`);let K=Object.entries(q),_=await Bo6(K,async([z,Y])=>({name:z,server:Y,status:await Zq5(z,Y)}),{concurrency:KF1()});for(let{name:z,server:Y,status:$}of _)if(Y.type==="sse")console.log(`${z}: ${Y.url} (SSE) - ${$}`);else if(Y.type==="http")console.log(`${z}: ${Y.url} (HTTP) - ${$}`);else if(Y.type==="claudeai-proxy")console.log(`${z}: ${Y.url} - ${$}`);else if(!Y.type||Y.type==="stdio"){let A=Array.isArray(Y.args)?Y.args:[];console.log(`${z}: ${Y.command} ${A.join(" ")} - ${$}`)}}await xK(0)}async function vaY(q){d("tengu_mcp_get",{name:q});let K=EN(q);if(!K)o3(`No MCP server found with name: ${q}`);console.log(`${q}:`),console.log(` Scope: ${$a6(K.scope)}`);let _=await Zq5(q,K);if(console.log(` Status: ${_}`),K.type==="sse"){if(console.log(" Type: sse"),console.log(` URL: ${K.url}`),K.headers){console.log(" Headers:");for(let[z,Y]of Object.entries(K.headers))console.log(` ${z}: ${Y}`)}if(K.oauth?.clientId||K.oauth?.callbackPort){let z=[];if(K.oauth.clientId){if(z.push("client_id configured"),Ja6(q,K)?.clientSecret)z.push("client_secret configured")}if(K.oauth.callbackPort)z.push(`callback_port ${K.oauth.callbackPort}`);console.log(` OAuth: ${z.join(", ")}`)}}else if(K.type==="http"){if(console.log(" Type: http"),console.log(` URL: ${K.url}`),K.headers){console.log(" Headers:");for(let[z,Y]of Object.entries(K.headers))console.log(` ${z}: ${Y}`)}if(K.oauth?.clientId||K.oauth?.callbackPort){let z=[];if(K.oauth.clientId){if(z.push("client_id configured"),Ja6(q,K)?.clientSecret)z.push("client_secret configured")}if(K.oauth.callbackPort)z.push(`callback_port ${K.oauth.callbackPort}`);console.log(` OAuth: ${z.join(", ")}`)}}else if(K.type==="stdio"){console.log(" Type: stdio"),console.log(` Command: ${K.command}`);let z=Array.isArray(K.args)?K.args:[];if(console.log(` Args: ${z.join(" ")}`),K.env){console.log(" Environment:");for(let[Y,$]of Object.entries(K.env))console.log(` ${Y}=${$}`)}}console.log(`
16475To remove this server, run: claude mcp remove "${q}" -s ${K.scope}`),await xK(0)}async function kaY(q,K,_){try{let z=XN6(_.scope),Y=m5(K),A=_.clientSecret&&Y&&typeof Y==="object"&&"type"in Y&&(Y.type==="sse"||Y.type==="http")&&"url"in Y&&typeof Y.url==="string"&&"oauth"in Y&&Y.oauth&&typeof Y.oauth==="object"&&"clientId"in Y.oauth?await ja6():void 0;await xq6(q,Y,z);let O=Y&&typeof Y==="object"&&"type"in Y?String(Y.type||"stdio"):"stdio";if(A&&Y&&typeof Y==="object"&&"type"in Y&&(Y.type==="sse"||Y.type==="http")&&"url"in Y&&typeof Y.url==="string")Ha6(q,{type:Y.type,url:Y.url},A);d("tengu_mcp_add",{scope:z,source:"json",type:O}),gA(`Added ${O} MCP server ${q} to ${z} config`)}catch(z){o3(z.message)}}async function VaY(q){try{let K=XN6(q.scope),_=Z1();d("tengu_mcp_add",{scope:K,platform:_,source:"desktop"});let{readClaudeDesktopMcpServers:z}=await Promise.resolve().then(() => (fq5(),Dq5)),Y=await z();if(Object.keys(Y).length===0)gA("No MCP servers found in Claude Desktop configuration or configuration file does not exist.");let{unmount:$}=await vu(Nl8.default.createElement(LJ,null,Nl8.default.createElement(WM,null,Nl8.default.createElement(jq5,{servers:Y,scope:K,onDone:()=>{$()}}))),{exitOnCtrlC:!0})}catch(K){o3(K.message)}}async function NaY(){d("tengu_mcp_reset_mcpjson_choices",{}),jw((q)=>({...q,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),gA(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
16476You will be prompted for approval next time you start Claude Code.`)}var Nl8;var O36=y(()=>{np1();Hq5();s6();dU();k8();or();PD();f0();NJ();C7();V1();y8();RA();vO();vK();Nl8=O6(D6(),1)});var $x={};T8($x,{pluginValidateHandler:()=>EaY,pluginUpdateHandler:()=>maY,pluginUninstallHandler:()=>xaY,pluginListHandler:()=>LaY,pluginInstallHandler:()=>baY,pluginEnableHandler:()=>IaY,pluginDisableHandler:()=>uaY,marketplaceUpdateHandler:()=>CaY,marketplaceRemoveHandler:()=>SaY,marketplaceListHandler:()=>haY,marketplaceAddHandler:()=>RaY,handleMarketplaceError:()=>TK8,VALID_UPDATE_SCOPES:()=>rH6,VALID_INSTALLABLE_SCOPES:()=>e0});import{basename as yaY,dirname as Gq5}from"path";function TK8(q,K){H6(q),o3(`${t6.cross} Failed to ${K}: ${d6(q)}`)}function Tq5(q){if(q.errors.length>0)console.log(`${t6.cross} Found ${q.errors.length} ${A7(q.errors.length,"error")}:
16477`),q.errors.forEach((K)=>{console.log(` ${t6.pointer} ${K.path}: ${K.message}`)}),console.log("");if(q.warnings.length>0)console.log(`${t6.warning} Found ${q.warnings.length} ${A7(q.warnings.length,"warning")}:
16478`),q.warnings.forEach((K)=>{console.log(` ${t6.pointer} ${K.path}: ${K.message}`)}),console.log("")}async function EaY(q,K){if(K.cowork)ty(!0);try{let _=await GF8(q);console.log(`Validating ${_.fileType} manifest: ${_.filePath}
16479`),Tq5(_);let z=[];if(_.fileType==="plugin"){let A=Gq5(_.filePath);if(yaY(A)===".claude-plugin"){z=await byK(Gq5(A));for(let O of z)console.log(`Validating ${O.fileType}: ${O.filePath}
16480`),Tq5(O)}}let Y=_.success&&z.every((A)=>A.success),$=_.warnings.length>0||z.some((A)=>A.warnings.length>0);if(Y)gA($?`${t6.tick} Validation passed with warnings`:`${t6.tick} Validation passed`);else console.log(`${t6.cross} Validation failed`),process.exit(1)}catch(_){H6(_),console.error(`${t6.cross} Unexpected error during validation: ${d6(_)}`),process.exit(2)}}async function LaY(q){if(q.cowork)ty(!0);d("tengu_plugin_list_command",{});let K=cX(),{getPluginEditableScopes:_}=await Promise.resolve().then(() => (nh6(),_yK)),z=_(),Y=Object.keys(K.plugins),{enabled:$,disabled:A,errors:O}=await LM(),w=[...$,...A],j=w.filter((J)=>J.source.endsWith("@inline")),H=O.filter((J)=>J.source.endsWith("@inline")||J.source.startsWith("inline["));if(q.json){let J=new Map(w.map((X)=>[X.source,X])),M=[];for(let X of Y.sort()){let P=K.plugins[X];if(!P||P.length===0)continue;let W=Z4(X).name,D=O.filter((f)=>f.source===X||("plugin"in f)&&f.plugin===W).map($M);for(let f of P){let G=J.get(X),Z;if(G){let T=G.mcpServers||await Cq6(G);if(T&&Object.keys(T).length>0)Z=T}M.push({id:X,version:f.version||"unknown",scope:f.scope,enabled:z.has(X),installPath:f.installPath,installedAt:f.installedAt,lastUpdated:f.lastUpdated,projectPath:f.projectPath,mcpServers:Z,errors:D.length>0?D:void 0})}}for(let X of j){let P=X.mcpServers||await Cq6(X),W=H.filter((D)=>D.source===X.source||("plugin"in D)&&D.plugin===X.name).map($M);M.push({id:X.source,version:X.manifest.version??"unknown",scope:"session",enabled:X.enabled!==!1,installPath:X.path,mcpServers:P&&Object.keys(P).length>0?P:void 0,errors:W.length>0?W:void 0})}for(let X of H.filter((P)=>P.source.startsWith("inline[")))M.push({id:X.source,version:"unknown",scope:"session",enabled:!1,installPath:"path"in X?X.path:"",errors:[$M(X)]});if(q.available){let X=[];try{let[P,W]=await Promise.all([r_(),ih6()]),{marketplaces:D}=await Xp(P);for(let{name:f,data:G}of D)if(G)for(let Z of G.plugins){let T=eQ(Z.name,f);if(!Zb(T))X.push({pluginId:T,name:Z.name,description:Z.description,marketplaceName:f,version:Z.version,source:Z.source,installCount:W?.get(T)})}}catch{}gA(g6({installed:M,available:X},null,2))}else gA(g6(M,null,2))}if(Y.length===0&&j.length===0){if(H.length===0)gA("No plugins installed. Use `claude plugin install` to install a plugin.")}if(Y.length>0)console.log(`Installed plugins:

Callers 1

EaYFunction · 0.85

Calls 3

A7Function · 0.85
logMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected