| 16463 | ${h7("success",W)(`Successfully imported ${g} MCP ${A7(g,"server")} to ${z} config.`)} |
| 16464 | `);else C4(` |
| 16465 | No servers were imported.`);Y(),xK()},K[8]=Y,K[9]=z,K[10]=W,K[11]=D;else D=K[11];let f=D,G;if(K[12]!==f)G=()=>{f(0)},K[12]=f,K[13]=G;else G=K[13];let Z=G,T=A.length,v;if(K[14]!==A.length)v=A7(A.length,"server"),K[14]=A.length,K[15]=v;else v=K[15];let V=`Found ${T} MCP ${v} in Claude Desktop.`,E;if(K[16]!==X.length)E=X.length>0&&TZ.default.createElement(k,{color:"warning"},"Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix."),K[16]=X.length,K[17]=E;else E=K[17];let S;if(K[18]===Symbol.for("react.memo_cache_sentinel"))S=TZ.default.createElement(k,null,"Please select the servers you want to import:"),K[18]=S;else S=K[18];let R,x;if(K[19]!==X||K[20]!==A)R=A.map((g)=>({label:`${g}${X.includes(g)?" (already exists)":""}`,value:g})),x=A.filter((g)=>!X.includes(g)),K[19]=X,K[20]=A,K[21]=R,K[22]=x;else R=K[21],x=K[22];let I;if(K[23]!==Z||K[24]!==P||K[25]!==R||K[26]!==x)I=TZ.default.createElement(Y46,{options:R,defaultValue:x,onSubmit:P,onCancel:Z,hideIndexes:!0}),K[23]=Z,K[24]=P,K[25]=R,K[26]=x,K[27]=I;else I=K[27];let B;if(K[28]!==Z||K[29]!==V||K[30]!==E||K[31]!==I)B=TZ.default.createElement(R1,{title:"Import MCP Servers from Claude Desktop",subtitle:V,color:"success",onCancel:Z,hideInputGuide:!0},E,S,I),K[28]=Z,K[29]=V,K[30]=E,K[31]=I,K[32]=B;else B=K[32];let p;if(K[33]===Symbol.for("react.memo_cache_sentinel"))p=TZ.default.createElement(u,{paddingX:1},TZ.default.createElement(k,{dimColor:!0,italic:!0},TZ.default.createElement(I1,null,TZ.default.createElement(t8,{shortcut:"Space",action:"select"}),TZ.default.createElement(t8,{shortcut:"Enter",action:"confirm"}),TZ.default.createElement(W1,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"})))),K[33]=p;else p=K[33];let C;if(K[34]!==B)C=TZ.default.createElement(TZ.default.Fragment,null,B,p),K[34]=B,K[35]=C;else C=K[35];return C}var TZ;var Hq5=y(()=>{q8();RA();s6();f0();a5();Ys6();QK();e4();rK();TZ=O6(D6(),1)});var Jq5={};T8(Jq5,{startMCPServer:()=>JaY});async function JaY(q,K,_){let Y=Bu(100);QO(q);let $=new B96({name:"claude/tengu",version:{ISSUES_EXPLAINER:"report the issue at https://github.com/anthropics/claude-code/issues",PACKAGE_URL:"@anthropic-ai/claude-code",README_URL:"https://code.claude.com/docs/en/overview",VERSION:"2.1.88",FEEDBACK_CHANNEL:"https://github.com/anthropics/claude-code/issues",BUILD_TIME:"2026-03-30T21:59:52Z"}.VERSION},{capabilities:{tools:{}}});$.setRequestHandler(ac,async()=>{let O=MX(),w=gD(O);return{tools:await Promise.all(w.map(async(j)=>{let H;if(j.outputSchema){let J=ua(j.outputSchema);if(typeof J==="object"&&J!==null&&"type"in J&&J.type==="object")H=J}return{...j,description:await j.prompt({getToolPermissionContext:async()=>O,tools:w,agents:[]}),inputSchema:ua(j.inputSchema),outputSchema:H}}))}}),$.setRequestHandler(XB,async({params:{name:O,arguments:w}})=>{let j=MX(),H=gD(j),J=L5(H,O);if(!J)throw Error(`Tool ${O} not found`);let M={abortController:P3(),options:{commands:HaY,tools:H,mainLoopModel:D5(),thinkingConfig:{type:"disabled"},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:K,verbose:_,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>$w6(),setAppState:()=>{},messages:[],readFileState:Y,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!J.isEnabled())throw Error(`Tool ${O} is not enabled`);let X=await J.validateInput?.(w??{},M);if(X&&!X.result)throw Error(`Tool ${O} input is invalid: ${X.message}`);let P=await J.call(w??{},M,uX,nG({content:[]}));return{content:[{type:"text",text:typeof P==="string"?P:g6(P.data)}]}}catch(X){return H6(X),{isError:!0,content:[{type:"text",text:(X instanceof Error?K87(X):[String(X)]).filter(Boolean).join(` |
| 16466 | `).trim()||"Error"}]}}});async function A(){let O=new g96;await $.connect(O)}return await A()}var HaY;var Mq5=y(()=>{rz8();sz8();lM();EV6();m57();Bq();BD();B2();NG();E8();i1();aq();Fj();tN();l8();Op8();dp8();HaY=[$U8]});var Dq5={};T8(Dq5,{readClaudeDesktopMcpServers:()=>WaY,getClaudeDesktopConfigPath:()=>Wq5});import{readdir as MaY,readFile as XaY,stat as Xq5}from"fs/promises";import{homedir as PaY}from"os";import{join as Pq5}from"path";async function Wq5(){let q=Z1();if(!H41.includes(q))throw Error(`Unsupported platform: ${q} - Claude Desktop integration only works on macOS and WSL.`);if(q==="macos")return Pq5(PaY(),"Library","Application Support","Claude","claude_desktop_config.json");let K=process.env.USERPROFILE?process.env.USERPROFILE.replace(/\\/g,"/"):null;if(K){let z=`/mnt/c${K.replace(/^[A-Z]:/,"")}/AppData/Roaming/Claude/claude_desktop_config.json`;try{return await Xq5(z),z}catch{}}try{try{let z=await MaY("/mnt/c/Users",{withFileTypes:!0});for(let Y of z){if(Y.name==="Public"||Y.name==="Default"||Y.name==="Default User"||Y.name==="All Users")continue;let $=Pq5("/mnt/c/Users",Y.name,"AppData","Roaming","Claude","claude_desktop_config.json");try{return await Xq5($),$}catch{}}}catch{}}catch(_){H6(_)}throw Error("Could not find Claude Desktop config file in Windows. Make sure Claude Desktop is installed on Windows.")}async function WaY(){if(!H41.includes(Z1()))throw Error("Unsupported platform - Claude Desktop integration only works on macOS and WSL.");try{let q=await Wq5(),K;try{K=await XaY(q,{encoding:"utf8"})}catch($){if(s1($)==="ENOENT")return{};throw $}let _=m5(K);if(!_||typeof _!=="object")return{};let z=_.mcpServers;if(!z||typeof z!=="object")return{};let Y={};for(let[$,A]of Object.entries(z)){if(!A||typeof A!=="object")continue;let O=_K1().safeParse(A);if(O.success)Y[$]=O.data}return Y}catch(q){return H6(q),{}}}var fq5=y(()=>{f_6();y8();vO();E8();vK()});var A36={};T8(A36,{mcpServeHandler:()=>ZaY,mcpResetChoicesHandler:()=>NaY,mcpRemoveHandler:()=>GaY,mcpListHandler:()=>TaY,mcpGetHandler:()=>vaY,mcpAddJsonHandler:()=>kaY,mcpAddFromDesktopHandler:()=>VaY});import{stat as DaY}from"fs/promises";import{cwd as faY}from"process";async function Zq5(q,K){try{let _=await oC(q,K);if(_.type==="connected")return"✓ Connected";else if(_.type==="needs-auth")return"! Needs authentication";else return"✗ Failed to connect"}catch(_){return"✗ Connection error"}}async function ZaY({debug:q,verbose:K}){let _=faY();d("tengu_mcp_start",{});try{await DaY(_)}catch(z){if(e3(z))o3(`Error: Directory ${_} does not exist`);throw z}try{let{setup:z}=await Promise.resolve().then(() => (Gl8(),Zl8));await z(_,"default",!1,!1,void 0,!1);let{startMCPServer:Y}=await Promise.resolve().then(() => (Mq5(),Jq5));await Y(_,q??!1,K??!1)}catch(z){o3(`Error: Failed to start MCP server: ${z}`)}}async function GaY(q,K){let _=EN(q),z=()=>{if(_&&(_.type==="sse"||_.type==="http"))ME8(q,_),UR4(q,_)};try{if(K.scope){let j=XN6(K.scope);d("tengu_mcp_delete",{name:q,scope:j}),await hB1(q,j),z(),process.stdout.write(`Removed MCP server ${q} from ${j} config |
| 16467 | `),gA(`File modified: ${xG(j)}`)}let Y=ww(),$=j8(),{servers:A}=SH("project"),O=!!A[q],w=[];if(Y.mcpServers?.[q])w.push("local");if(O)w.push("project");if($.mcpServers?.[q])w.push("user");if(w.length===0)o3(`No MCP server found with name: "${q}"`);else if(w.length===1){let j=w[0];d("tengu_mcp_delete",{name:q,scope:j}),await hB1(q,j),z(),process.stdout.write(`Removed MCP server "${q}" from ${j} config |
| 16468 | `),gA(`File modified: ${xG(j)}`)}else process.stderr.write(`MCP server "${q}" exists in multiple scopes: |
| 16469 | `),w.forEach((j)=>{process.stderr.write(` - ${$a6(j)} (${xG(j)}) |
| 16470 | `)}),process.stderr.write(` |
| 16471 | To remove from a specific scope, use: |
| 16472 | `),w.forEach((j)=>{process.stderr.write(` claude mcp remove "${q}" -s ${j} |
| 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(` |
| 16475 | To 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. |