@mcp-use/inspector 20.3.9 → 20.3.10
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/app/inspector.js.gz +0 -0
- package/dist/cli.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/server/index.js +1 -1
- package/package.json +2 -2
package/dist/app/inspector.js.gz
CHANGED
|
Binary file
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ ${n.join(`\r
|
|
|
5
5
|
\r
|
|
6
6
|
`)},Wo=e=>{let t=e.socket.encrypted?"https":"http",r=new URL(e.url??"/",`${t}://${e.headers.host??"localhost"}`),n=new Headers;for(let o in e.headers){let s=e.headers[o];s&&n.append(o,Array.isArray(s)?s[0]:s)}return new Request(r,{headers:n})},zo=e=>{let{server:t,fetchCallback:r,wss:n}=e,o=new Map;n.on("connection",(a,c)=>{let l=o.get(c);l&&(l.resolve(a),o.delete(c))});let s=a=>{let c=o.get(a);c&&(o.delete(a),c.reject(new Error("WebSocket handshake aborted")))},i=(a,c)=>new Promise((l,u)=>{o.set(a,{resolve:l,reject:u,connectionSymbol:c})});t.on("upgrade",async(a,c,l)=>{if(a.headers.upgrade?.toLowerCase()!=="websocket")return;let u={incoming:a,outgoing:void 0,wss:n,[fr]:i},d=400,f;try{let b=await r(Wo(a),u);b instanceof Response&&(d=b.status,f=b.headers)}catch{t.listenerCount("upgrade")===1&&Zt(c,500);return}let h=o.get(a);if(!h||h.connectionSymbol!==u[dr]){s(a),t.listenerCount("upgrade")===1&&Zt(c,d,f);return}let y=b=>{pr(b,f)},m=()=>s(a);c.once("close",m),n.on("headers",y);try{n.handleUpgrade(a,c,l,b=>{c.off("close",m),n.emit("connection",b,a)})}finally{n.off("headers",y)}}),t.on("close",()=>{n.close()})},Fi=qt(async(e,t,r)=>{if(e.req.header("upgrade")?.toLowerCase()!=="websocket")return;let n=e.env,o=n[fr];if(!o||!n.incoming)return new Response(null,{status:500});let s=$o();return n[dr]=s,(async()=>{let i;try{i=await o(n.incoming,s)}catch{return}let a=[],c=(d,f)=>{a.push([d,f])};i.on("message",c);let l={binaryType:"arraybuffer",close(d,f){i.close(d,f)},protocol:i.protocol,raw:i,get readyState(){return i.readyState},send(d,f){i.send(d,{compress:f?.compress})},url:new URL(e.req.url)};try{t?.onOpen?.(new Event("open"),l)}catch(d){(r?.onError??console.error)(d)}let u=(d,f)=>{let h=Array.isArray(d)?d:[d];for(let y of h)try{t?.onMessage?.(new MessageEvent("message",{data:f?y instanceof ArrayBuffer?y:y.buffer.slice(y.byteOffset,y.byteOffset+y.byteLength):typeof y=="string"?y:Buffer.from(y).toString("utf-8")}),l)}catch(m){(r?.onError??console.error)(m)}};i.off("message",c);for(let d of a)u(...d);i.on("message",(d,f)=>{u(d,f)}),i.on("close",(d,f)=>{try{t?.onClose?.(new Ho("close",{code:d,reason:f.toString()}),l)}catch(h){(r?.onError??console.error)(h)}}),i.on("error",d=>{try{t?.onError?.(new jo("error",{error:d}),l)}catch(f){(r?.onError??console.error)(f)}})})(),new Response}),qo=e=>{let t=e.fetch,r=Bo(t,{hostname:e.hostname,overrideGlobalObjects:e.overrideGlobalObjects,autoCleanupIncoming:e.autoCleanupIncoming}),n=(e.createServer||io)(e.serverOptions||{},r);if(e.websocket&&e.websocket.server){if(e.websocket.server.options.noServer!==!0)throw new Error("WebSocket server must be created with { noServer: true } option");zo({server:n,fetchCallback:t,wss:e.websocket.server})}return n},hr=(e,t)=>{let r=qo(e);return r.listen(e?.port??3e3,e.hostname,()=>{let n=r.address();t&&t(n)}),r};var rt=(e,t,r)=>(n,o)=>{let s=-1;return i(0);async function i(a){if(a<=s)throw new Error("next() called multiple times");s=a;let c,l=!1,u;if(e[a]?(u=e[a][0][0],n.req.routeIndex=a):u=a===e.length&&o||void 0,u)try{c=await u(n,()=>i(a+1))}catch(d){if(d instanceof Error&&t)n.error=d,c=await t(d,n),l=!0;else throw d}else n.finalized===!1&&r&&(c=await r(n));return c&&(n.finalized===!1||l)&&(n.res=c),n}};var mr=Symbol();var gr=(e,t)=>new Response(e,{headers:{"Content-Type":t.replace(/^[^;]+/,n=>n.toLowerCase())}}).formData();var yr=32,Ko=1e4,_e=e=>"headers"in e,vr=async(e,t=Object.create(null))=>{let{all:r=!1,dot:n=!1}=t,i=(_e(e)?e.headers:e.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();return i==="multipart/form-data"||i==="application/x-www-form-urlencoded"?Vo(e,{all:r,dot:n}):{}};async function Vo(e,t){if(!_e(e)&&e.bodyCache.formData)return wr(await e.bodyCache.formData,t);let r=_e(e)?e.headers:e.raw.headers,n=await e.arrayBuffer(),o=gr(n,r.get("Content-Type")||"");_e(e)||(e.bodyCache.formData=o);let s=await o;return s?wr(s,t):{}}function wr(e,t){let r=Object.create(null),n={count:0};return e.forEach((o,s)=>{t.all||s.endsWith("[]")?Go(r,s,o):r[s]=o}),t.dot&&Object.entries(r).forEach(([o,s])=>{o.includes(".")&&(Yo(r,o,s,n),delete r[o])}),r}var Go=(e,t,r)=>{e[t]!==void 0?Array.isArray(e[t])?e[t].push(r):e[t]=[e[t],r]:t.endsWith("[]")?e[t]=[r]:e[t]=r},Yo=(e,t,r,n)=>{if(/(?:^|\.)__proto__\./.test(t))return;let o=e,s=t.split(".",yr+2);s.length>yr+1&&br(),s.forEach((i,a)=>{a===s.length-1?o[i]=r:((!o[i]||typeof o[i]!="object"||Array.isArray(o[i])||o[i]instanceof File)&&(n.count++>=Ko&&br(),o[i]=Object.create(null)),o=o[i])})},br=()=>{throw new Error("Nesting limit exceeded")};var ot=e=>{let t=e.split("/");return t[0]===""&&t.shift(),t},xr=e=>{let{groups:t,path:r}=Xo(e),n=ot(r);return Jo(n,t)},Xo=e=>{let t=[];return e=e.replace(/\{[^}]+\}/g,(r,n)=>{let o=`@${n}`;return t.push([o,r]),o}),{groups:t,path:e}},Jo=(e,t)=>{for(let r=t.length-1;r>=0;r--){let[n]=t[r];for(let o=e.length-1;o>=0;o--)if(e[o].includes(n)){e[o]=e[o].replace(n,t[r][1]);break}}return e},Te={},Er=(e,t)=>{if(e==="*")return"*";let r=e.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(r){let n=`${e}#${t}`;return Te[n]||(r[2]?Te[n]=t&&t[0]!==":"&&t[0]!=="*"?[n,r[1],new RegExp(`^${r[2]}(?=/${t})`)]:[e,r[1],new RegExp(`^${r[2]}$`)]:Te[n]=[e,r[1],!0]),Te[n]}return null},Sr=(e,t)=>{try{return t(e)}catch{return e.replace(/(?:%[0-9A-Fa-f]{2})+/g,r=>{try{return t(r)}catch{return r}})}},Qo=e=>Sr(e,decodeURI),st=e=>{let t=e.url,r=t.indexOf("/",t.indexOf(":")+4),n=r;for(;n<t.length;n++){let o=t.charCodeAt(n);if(o===37){let s=t.indexOf("?",n),i=t.indexOf("#",n),a=s===-1?i===-1?void 0:i:i===-1?s:Math.min(s,i),c=t.slice(r,a);return Qo(c.includes("%25")?c.replace(/%25/g,"%2525"):c)}else if(o===63||o===35)break}return t.slice(r,n)};var Rr=e=>{let t=st(e);return t.length>1&&t.at(-1)==="/"?t.slice(0,-1):t},G=(e,t,...r)=>(r.length&&(t=G(t,...r)),`${e?.[0]==="/"?"":"/"}${e}${t==="/"?"":`${e?.at(-1)==="/"?"":"/"}${t?.[0]==="/"?t.slice(1):t}`}`),Oe=e=>{if(e.charCodeAt(e.length-1)!==63||!e.includes(":"))return null;let t=e.split("/"),r=[],n="";return t.forEach(o=>{if(o!==""&&!/\:/.test(o))n+="/"+o;else if(/\:/.test(o))if(o.charCodeAt(o.length-1)===63){r.length===0&&n===""?r.push("/"):r.push(n);let s=o.slice(0,-1);n+="/"+s,r.push(n)}else n+="/"+o}),r.filter((o,s,i)=>i.indexOf(o)===s)},Le=e=>e.indexOf("%")!==-1?Sr(e,Zo):e,nt=e=>(e.indexOf("+")!==-1&&(e=e.replace(/\+/g," ")),Le(e)),Pr=(e,t,r)=>{let n=e.indexOf("#",8);n!==-1&&(e=e.slice(0,n));let o;if(!r&&t&&t.indexOf("%")===-1&&t.indexOf("+")===-1){let a=e.indexOf("?",8);if(a===-1)return;for(e.startsWith(t,a+1)||(a=e.indexOf(`&${t}`,a+1));a!==-1;){let c=e.charCodeAt(a+t.length+1);if(c===61){let l=a+t.length+2,u=e.indexOf("&",l);return nt(e.slice(l,u===-1?void 0:u))}else if(c==38||isNaN(c))return"";a=e.indexOf(`&${t}`,a+1)}if(o=/[%+]/.test(e),!o)return}let s=Object.create(null);o??=/[%+]/.test(e);let i=e.indexOf("?",8);for(;i!==-1;){let a=e.indexOf("&",i+1),c=e.indexOf("=",i);c>a&&a!==-1&&(c=-1);let l=e.slice(i+1,c===-1?a===-1?void 0:a:c);if(o&&(l=nt(l)),i=a,l==="")continue;let u;c===-1?u="":(u=e.slice(c+1,a===-1?void 0:a),o&&(u=nt(u))),r?(s[l]&&Array.isArray(s[l])||(s[l]=[]),s[l].push(u)):s[l]??=u}return t?s[t]:s},Ar=Pr,Cr=(e,t)=>Pr(e,t,!0),Zo=decodeURIComponent;var _r=class{raw;#e;#t;routeIndex=0;path;bodyCache={};constructor(e,t="/",r=[[]]){this.raw=e,this.path=t,this.#t=r}param(e){return e?this.#r(e):this.#s()}#r(e){let t=this.#t[0][this.routeIndex]?.[1][e],r=this.#n(t);return r&&Le(r)}#s(){let e={},t=Object.keys(this.#t[0][this.routeIndex]?.[1]??{});for(let r of t){let n=this.#n(this.#t[0][this.routeIndex][1][r]);n!==void 0&&(e[r]=Le(n))}return e}#n(e){return this.#t[1]?this.#t[1][e]:e}query(e){return Ar(this.url,e)}queries(e){return Cr(this.url,e)}header(e){if(e)return this.raw.headers.get(e)??void 0;let t=Object.create(null);return this.raw.headers.forEach((r,n)=>{t[n]=r}),t}async parseBody(e){return vr(this,e)}#o=e=>{let{bodyCache:t,raw:r}=this,n=t[e];if(n)return n;for(let o in t)return t[o].then(s=>(o==="json"&&(s=JSON.stringify(s)),new Response(s)[e]()));return t[e]=r[e]()};json(){return this.#o("text").then(e=>JSON.parse(e))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}bytes(){return this.#o("arrayBuffer").then(e=>new Uint8Array(e))}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(e,t){(this.#e??={})[e]=t}valid(e){return this.#e?.[e]}get url(){return this.raw.url}get method(){return this.raw.method}get[mr](){return this.#t}get matchedRoutes(){return this.#t[0].map(([[,e]])=>e)}get routePath(){return this.#t[0].map(([[,e]])=>e)[this.routeIndex].path}};var Tr={Stringify:1,BeforeStream:2,Stream:3},es=(e,t)=>{let r=new String(e);return r.isEscaped=!0,r.callbacks=t,r};var it=async(e,t,r,n,o)=>{typeof e=="object"&&!(e instanceof String)&&(e instanceof Promise||(e=e.toString()),e instanceof Promise&&(e=await e));let s=e.callbacks;if(!s?.length)return Promise.resolve(e);o?o[0]+=e:o=[e];let i=Promise.all(s.map(a=>a({phase:t,buffer:o,context:n}))).then(a=>Promise.all(a.filter(Boolean).map(c=>it(c,t,!1,n,o))).then(()=>o[0]));return r?es(await i,s):i};var ts="text/plain; charset=UTF-8",at=(e,t)=>({"Content-Type":e,...t}),ye=(e,t)=>new Response(e,t),ct=class{#e;#t;env={};#r;finalized=!1;error;#s;#n;#o;#u;#c;#l;#a;#d;#f;constructor(e,t){this.#e=e,t&&(this.#n=t.executionCtx,this.env=t.env,this.#l=t.notFoundHandler,this.#f=t.path,this.#d=t.matchResult)}get req(){return this.#t??=new _r(this.#e,this.#f,this.#d),this.#t}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;throw Error("This context has no ExecutionContext")}get res(){return this.#o||=ye(null,{headers:this.#a??=new Headers})}set res(e){if(this.#o&&e){e=ye(e.body,e);for(let[t,r]of this.#o.headers.entries())if(t!=="content-type")if(t==="set-cookie"){let n=this.#o.headers.getSetCookie();e.headers.delete("set-cookie");for(let o of n)e.headers.append("set-cookie",o)}else e.headers.set(t,r)}this.#o=e,this.finalized=!0}render=(...e)=>(this.#c??=t=>this.html(t),this.#c(...e));setLayout=e=>this.#u=e;getLayout=()=>this.#u;setRenderer=e=>{this.#c=e};header=(e,t,r)=>{this.finalized&&(this.#o=ye(this.#o.body,this.#o));let n=this.#o?this.#o.headers:this.#a??=new Headers;t===void 0?n.delete(e):r?.append?n.append(e,t):n.set(e,t)};status=e=>{this.#s=e};set=(e,t)=>{this.#r??=new Map,this.#r.set(e,t)};get=e=>this.#r?this.#r.get(e):void 0;get var(){return this.#r?Object.fromEntries(this.#r):{}}#i(e,t,r){let n=this.#o?new Headers(this.#o.headers):this.#a;if(typeof t=="object"&&t.headers){n??=new Headers;for(let[s,i]of new Headers(t.headers))s==="set-cookie"?n.append(s,i):n.set(s,i)}if(r){if(!n){let s=0;for(let i in r)if(++s>1||typeof r[i]!="string"){n=new Headers;break}}if(n)for(let s in r){let i=r[s];if(typeof i=="string")n.set(s,i);else{n.delete(s);for(let a of i)n.append(s,a)}}}let o=typeof t=="number"?t:t?.status??this.#s;return ye(e,{status:o,headers:n??r})}newResponse=(...e)=>this.#i(...e);body=(e,t,r)=>this.#i(e,t,r);text=(e,t,r)=>!this.#a&&!this.#s&&!t&&!r&&!this.finalized?new Response(e):this.#i(e,t,at(ts,r));json=(e,t,r)=>this.#i(JSON.stringify(e),t,at("application/json",r));html=(e,t,r)=>{let n=o=>this.#i(o,t,at("text/html; charset=UTF-8",r));return typeof e=="object"?it(e,Tr.Stringify,!1,{}).then(n):n(e)};redirect=(e,t)=>{let r=String(e);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,t??302)};notFound=()=>(this.#l??=()=>ye(),this.#l(this))};var C="ALL",Or="all",Lr=["get","post","put","delete","options","patch","query"],Me="Can not add a route since the matcher is already built.",Ie=class extends Error{};var Mr="__COMPOSED_HANDLER";var rs=e=>e.text("404 Not Found",404),Ir=(e,t)=>{if("getResponse"in e){let r=e.getResponse();return t.newResponse(r.body,r)}return console.error(e),t.text("Internal Server Error",500)},kr=class Dr{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#e="/";routes=[];constructor(t={}){[...Lr,Or].forEach(s=>{this[s]=(i,...a)=>(typeof i=="string"?this.#e=i:this.#s(s,this.#e,i),a.forEach(c=>{this.#s(s,this.#e,c)}),this)}),this.on=(s,i,...a)=>{for(let c of[i].flat()){this.#e=c;for(let l of[s].flat())a.map(u=>{this.#s(l.toUpperCase(),this.#e,u)})}return this},this.use=(s,...i)=>(typeof s=="string"?this.#e=s:(this.#e="*",i.unshift(s)),i.forEach(a=>{this.#s(C,this.#e,a)}),this);let{strict:n,...o}=t;Object.assign(this,o),this.getPath=n??!0?t.getPath??st:Rr}#t(){let t=new Dr({router:this.router,getPath:this.getPath});return t.errorHandler=this.errorHandler,t.#r=this.#r,t.routes=this.routes,t}#r=rs;errorHandler=Ir;route(t,r){let n=this.basePath(t);return r.routes.map(o=>{let s;r.errorHandler===Ir?s=o.handler:(s=async(i,a)=>(await rt([],r.errorHandler)(i,()=>o.handler(i,a))).res,s[Mr]=o.handler),n.#s(o.method,o.path,s,o.basePath)}),this}basePath(t){let r=this.#t();return r._basePath=G(this._basePath,t),r}onError=t=>(this.errorHandler=t,this);notFound=t=>(this.#r=t,this);mount(t,r,n){let o,s;n&&(typeof n=="function"?s=n:(s=n.optionHandler,n.replaceRequest===!1?o=c=>c:o=n.replaceRequest));let i=s?c=>{let l=s(c);return Array.isArray(l)?l:[l]}:c=>{let l;try{l=c.executionCtx}catch{}return[c.env,l]};o||=(()=>{let c=G(this._basePath,t),l=c==="/"?0:c.length;return u=>{let d=new URL(u.url);return d.pathname=this.getPath(u).slice(l)||"/",new Request(d,u)}})();let a=async(c,l)=>{let u=await r(o(c.req.raw),...i(c));if(u)return u;await l()};return this.#s(C,G(t,"*"),a),this}#s(t,r,n,o){t=t.toUpperCase(),r=G(this._basePath,r);let s={basePath:o!==void 0?G(this._basePath,o):this._basePath,path:r,method:t,handler:n};this.router.add(t,r,[n,s]),this.routes.push(s)}#n(t,r){if(t instanceof Error)return this.errorHandler(t,r);throw t}#o(t,r,n,o){if(o==="HEAD")return(async()=>new Response(null,await this.#o(t,r,n,"GET")))();let s=this.getPath(t,{env:n}),i=this.router.match(o,s),a=new ct(t,{path:s,matchResult:i,env:n,executionCtx:r,notFoundHandler:this.#r});if(i[0].length===1){let l;try{l=i[0][0][0][0](a,async()=>{a.res=await this.#r(a)})}catch(u){return this.#n(u,a)}return l instanceof Promise?l.then(u=>u||(a.finalized?a.res:this.#r(a))).catch(u=>this.#n(u,a)):l??this.#r(a)}let c=rt(i[0],this.errorHandler,this.#r);return(async()=>{try{let l=await c(a);if(!l.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return l.res}catch(l){return this.#n(l,a)}})()}fetch=(t,...r)=>this.#o(t,r[1],r[0],t.method);request=(t,r,n,o)=>t instanceof Request?this.fetch(r?new Request(t,r):t,n,o):(t=t.toString(),this.fetch(new Request(/^https?:\/\//.test(t)?t:`http://localhost${G("/",t)}`,r),n,o));fire=()=>{addEventListener("fetch",t=>{t.respondWith(this.#o(t.request,t,void 0,t.request.method))})}};var E=()=>Object.create(null);var ke=[];function lt(e,t){let r=this.buildAllMatchers(),n=((o,s)=>{let i=r[o]||r[C],a=i[2][s];if(a)return a;let c=s.match(i[0]);if(!c)return[[],ke];let l=c.indexOf("",1);return[i[1][l],c]});return this.match=n,n(e,t)}var ae="[^/]+",X=".*",$="(?:|/.*)",Y=Symbol(),Nr=new Set(".\\+*[^]$()");function ns(e,t){return e.length===1?t.length===1?e<t?-1:1:-1:t.length===1?1:e===X||e===$?t===$?-1:1:t===X||t===$?-1:e===ae?1:t===ae?-1:e.length===t.length?e<t?-1:1:t.length-e.length}var Ur=class ut{#e;#t;#r=E();insert(t,r,n,o,s){let i=this;for(let a=0,c=t.length;a<c;a++){let l=t[a],u=l.length===1?l==="*"?a===c-1?["","",X]:["","",ae]:null:l==="/*"?["","",$]:l.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),d;if(u){let f=u[1],h=u[2]||ae;if(f&&u[2]&&(h===".*"||(h=h.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(h))||h.length===1&&Nr.has(h)))throw Y;if(d=i.#r[h],!d){if(h!==X&&h!==$){for(let y in i.#r)if((h.length>1||y.length>1)&&y!==X&&y!==$)throw Y}d=i.#r[h]=new ut}f!==""&&(d.#t??=o.varIndex++,n.push([f,d.#t]))}else if(d=i.#r[l],!d){for(let f in i.#r)if(f.length>1&&f!==X&&f!==$)throw Y;d=i.#r[l]=new ut}i=d}if(i.#e!==void 0)throw Y;i.#e=s?-1:r}buildRegExpStr(){let r=Object.keys(this.#r).sort(ns).map(n=>{let o=this.#r[n],s=o.buildRegExpStr();return s===""?"":(typeof o.#t=="number"?`(${n})@${o.#t}`:Nr.has(n)?`\\${n}`:n)+s}).filter(Boolean);return typeof this.#e=="number"&&this.#e!==-1&&r.unshift(`#${this.#e}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}};var dt=class{#e={varIndex:0};#t=new Ur;#r=0;paths=E();insert(e,t){if(t){this.#t.insert(e.split(""),0,[],this.#e,!0);return}let r=[],n=[],o=e;for(let i=0;;){let a=!1;if(o=o.replace(/\{[^}]+\}/g,c=>{let l=`@\\${i}`;return n[i]=[l,c],i++,a=!0,l}),!a)break}let s=o.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let i=n.length-1;i>=0;i--){let[a]=n[i];for(let c=s.length-1;c>=0;c--)if(s[c].indexOf(a)!==-1){s[c]=s[c].replace(a,n[i][1]);break}}this.#t.insert(s,this.#r,r,this.#e,!1),this.paths[e]=[this.#r++,r]}buildRegExp(){let e=this.#t.buildRegExpStr();if(e==="")return[/^$/,[],[]];let t=0,r=[],n=[];return e=e.replace(/#(\d+)|@(\d+)|\.\*\$/g,(o,s,i)=>s!==void 0?(r[++t]=Number(s),"$()"):(i!==void 0&&(n[Number(i)]=++t),"")),[new RegExp(`^${e}`),r,n]}};var Br=E();function Hr(e){return Br[e]??=new RegExp(`^${e.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(t,r)=>r?`\\${r}`:t==="/*"?$:t==="*"?X:`/:${ae}`)}$`)}function De(e,t){for(let r of Object.keys(e).sort((n,o)=>o.length-n.length))if(Hr(r).test(t))return[...e[r]]}var Ne=class{name="RegExpRouter";#e;#t;#r;constructor(){this.#e={[C]:E()},this.#t={[C]:E()},this.#r={[C]:new dt}}#s(e,t){try{this.#r[e].insert(t,!/\*|\/:/.test(t))}catch(r){throw r===Y?new Ie(t):r}}add(e,t,r){let n=this.#e,o=this.#t;if(!n)throw new Error(Me);if(!n[e]){this.#r[e]=new dt;for(let a of[n,o]){a[e]=E();for(let c in a[C])a[e][c]=[...a[C][c]],this.#s(e,c)}}t==="/*"&&(t="*");let s=e===C?Object.keys(n):[e];if(/\*$/.test(t)){let a=Hr(t);for(let c of s)n[c][t]||(this.#s(c,t),n[c][t]=De(n[c],t)||De(n[C],t)||[]);for(let c of[n,o])for(let l of s)for(let u in c[l])a.test(u)&&c[l][u].push([r,t]);return}let i=Oe(t)||[t];for(let a of i)for(let c of s)o[c][a]||(this.#s(c,a),o[c][a]=De(n[c],a)||De(n[C],a)||[]),o[c][a].push([r,a])}match=lt;buildAllMatchers(){let e=E();for(let t of Object.keys(this.#t))e[t]=this.#n(t);return this.#e=this.#t=this.#r=void 0,Br=E(),e}#n(e){let t=this.#e[e],r=this.#t[e],n=this.#r[e],o=E(),s=[],[i,a,c]=n.buildRegExp();for(let l of[t,r])for(let u in l){let d=l[u],f=n.paths[u];if(!f){o[u]=[d.map(([h])=>[h,E()]),ke];continue}s[f[0]]=d.map(([h,y])=>[h,n.paths[y][1].reduceRight((m,[b],w)=>(m[b]=c[f[1][w][1]],m),E())])}return[i,a.map(l=>s[l]),o]}};var ft=class{name="SmartRouter";#e=[];#t=[];constructor(e){this.#e=e.routers}add(e,t,r){if(!this.#t)throw new Error(Me);this.#t.push([e,t,r])}match(e,t){if(!this.#t)throw new Error("Fatal error");let r=this.#e,n=this.#t,o=r.length,s=0,i;for(;s<o;s++){let a=r[s];try{for(let c=0,l=n.length;c<l;c++)a.add(...n[c]);i=a.match(e,t)}catch(c){if(c instanceof Ie)continue;throw c}this.match=a.match.bind(a),this.#e=[a],this.#t=void 0;break}if(s===o)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,i}get activeRouter(){if(this.#t||this.#e.length!==1)throw new Error("No active router has been determined yet.");return this.#e[0]}};var pt=E(),os=0,jr=class $r{#e=[];#t=E();#r=[];#s;#n=pt;insert(t,r,n){let o=this,s=xr(r),i=new Set,a=0;for(let c of s){let l=s[++a],u=Er(c,l)||(l===void 0&&c&&c.indexOf("*")===c.length-1?c:null),d=Array.isArray(u),f=d?u[0]:u||c,h=o.#t[f]||=new $r;u&&!h.#s&&(h.#s=u,o.#r.push(h)),o=h,d&&i.add(u[1])}o.#e.push({[t]:{handler:n,possibleKeys:[...i],score:++os}})}#o(t,r,n,o,s){for(let i=0,a=r.#e.length;i<a;i++){let c=r.#e[i],l=c[n]||c[C];if(l){l.params=E(),t.push(l);for(let u=0,d=l.possibleKeys.length;u<d;u++){let f=l.possibleKeys[u];l.params[f]=s?.[f]&&!u?s[f]:o[f]??s?.[f]}}}}search(t,r){let n=[];this.#n=pt;let s=[this],i=ot(r),a=[],c=i.length,l=null;for(let u=0;u<c;u++){let d=i[u],f=u===c-1,h=[];for(let m=0,b=s.length;m<b;m++){let w=s[m],p=w.#t[d];p&&(p.#n=w.#n,f?(p.#t["*"]&&this.#o(n,p.#t["*"],t,w.#n),this.#o(n,p,t,w.#n)):h.push(p));for(let g of w.#r){let v=g.#s,S=w.#n===pt?{}:{...w.#n};if(typeof v=="string"){(v==="*"||d.startsWith(v.slice(0,-1)))&&(this.#o(n,g,t,w.#n),v==="*"&&(g.#n=S,h.push(g)));continue}let[,M,O]=v;if(!(!d&&O===!0)){if(O!==!0){if(!l){l=[];let A=r[0]==="/"?1:0;for(let x=0;x<c;x++)l[x]=A,A+=i[x].length+1}let R=r.slice(l[u]),P=O.exec(R);if(P){S[M]=P[0],this.#o(n,g,t,w.#n,S),P[0].length===R.length&&g.#t["*"]&&this.#o(n,g.#t["*"],t,w.#n,S);for(let A in g.#t){g.#n=S;let x=P[0].match(/\//g)?.length??0;(a[x]||=[]).push(g);break}continue}}(O===!0||O.test(d))&&(S[M]=d,f?(this.#o(n,g,t,S,w.#n),g.#t["*"]&&this.#o(n,g.#t["*"],t,S,w.#n)):(g.#n=S,h.push(g)))}}}let y=a.shift();s=y?h.concat(y):h}return n[1]&&n.sort((u,d)=>u.score-d.score),[n.map(({handler:u,params:d})=>[u,d])]}};var ht=class{name="TrieRouter";#e=new jr;add(e,t,r){for(let n of Oe(t)||[t])this.#e.insert(e,n,r)}match(e,t){return this.#e.search(e,t)}};var mt=class extends kr{constructor(e={}){super(e),this.router=e.router??new ft({routers:[new Ne,new ht]})}};var Ue=e=>{let t={origin:"*",allowMethods:["GET","HEAD","PUT","POST","DELETE","PATCH","QUERY"],allowHeaders:[],exposeHeaders:[],...e},r=t.exposeHeaders?.length?t.exposeHeaders.join(","):void 0,n=t.allowHeaders?.length?t.allowHeaders.join(","):void 0,o=(i=>typeof i=="string"?i==="*"?()=>i:a=>i===a?a:null:typeof i=="function"?i:a=>i.includes(a)?a:null)(t.origin),s=(i=>{if(typeof i=="function")return async(a,c)=>(await i(a,c)).join(",");if(Array.isArray(i)){let a=i.join(",");return()=>a}else return()=>""})(t.allowMethods);return async function(a,c){function l(d,f){a.res.headers.set(d,f)}let u=await o(a.req.header("origin")||"",a);if(u&&l("Access-Control-Allow-Origin",u),t.credentials&&l("Access-Control-Allow-Credentials","true"),r&&l("Access-Control-Expose-Headers",r),a.req.method==="OPTIONS"){t.origin!=="*"&&a.res.headers.append("Vary","Origin"),t.maxAge!=null&&l("Access-Control-Max-Age",t.maxAge.toString());let d=await s(a.req.header("origin")||"",a);d&&l("Access-Control-Allow-Methods",d);let f=n;if(!f){let h=a.req.header("Access-Control-Request-Headers");h&&(f=h.split(",").map(y=>y.trim()).join(","))}return f&&(l("Access-Control-Allow-Headers",f),a.res.headers.append("Vary","Access-Control-Request-Headers")),a.res.headers.delete("Content-Length"),a.res.headers.delete("Content-Type"),new Response(null,{headers:a.res.headers,status:204,statusText:"No Content"})}await c(),t.origin!=="*"&&a.header("Vary","Origin",{append:!0})}};import on from"process";import sn from"path";import{fileURLToPath as Ns}from"url";import Us from"child_process";import Bs,{constants as Hs}from"fs/promises";import{promisify as ms}from"util";import gs from"child_process";import vt,{constants as Gr}from"fs/promises";import zr from"process";import ls from"os";import us from"fs";import as from"fs";import Fr from"fs";var gt;function ss(){try{return Fr.statSync("/.dockerenv"),!0}catch{return!1}}function is(){try{return Fr.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function yt(){return gt===void 0&&(gt=ss()||is()),gt}var wt,cs=()=>{try{return as.statSync("/run/.containerenv"),!0}catch{return!1}};function ce(){return wt===void 0&&(wt=cs()||yt()),wt}var Wr=()=>{if(zr.platform!=="linux")return!1;if(ls.release().toLowerCase().includes("microsoft"))return!ce();try{return us.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ce():!1}catch{return!1}},F=zr.env.__IS_WSL_TEST__?Wr:Wr();import qr from"process";import{Buffer as ds}from"buffer";import{promisify as fs}from"util";import ps from"child_process";import Bc,{constants as Hc}from"fs/promises";var hs=fs(ps.execFile),bt=()=>`${qr.env.SYSTEMROOT||qr.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;var L=async(e,t={})=>{let{powerShellPath:r,...n}=t,o=L.encodeCommand(e);return hs(r??bt(),[...L.argumentsPrefix,o],{encoding:"utf8",...n})};L.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];L.encodeCommand=e=>ds.from(e,"utf16le").toString("base64");L.escapeArgument=e=>`'${String(e).replaceAll("'","''")}'`;function Kr(e){for(let t of e.split(`
|
|
7
7
|
`)){if(/^\s*#/.test(t))continue;let r=/^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(t);if(r)return r.groups.mountPoint.trim().replaceAll(/^["']|["']$/g,"")}}var ys=ms(gs.execFile),ws=(()=>{let e="/mnt/",t;return async function(){if(t)return t;let r="/etc/wsl.conf",n=!1;try{await vt.access(r,Gr.F_OK),n=!0}catch{}if(!n)return e;let o=await vt.readFile(r,{encoding:"utf8"}),s=Kr(o);return s===void 0?e:(t=s,t=t.endsWith("/")?t:`${t}/`,t)}})(),bs=async()=>`${await ws()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,Be=F?bs:bt,Vr,Yr=async()=>(Vr??=(async()=>{try{let e=await Be();return await vt.access(e,Gr.X_OK),!0}catch{return!1}})(),Vr),Xr=async()=>{let e=await Be(),t=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await L(t,{powerShellPath:e});return r.trim()},Jr=async e=>{if(/^[a-z]+:\/\//i.test(e))return e;try{let{stdout:t}=await ys("wslpath",["-aw",e],{encoding:"utf8"});return t.trim()}catch{return e}};function ee(e,t,r){let n=o=>Object.defineProperty(e,t,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),e}import{promisify as Ls}from"util";import At from"process";import{execFile as Ms}from"child_process";import{promisify as vs}from"util";import xs from"process";import{execFile as Es}from"child_process";var Ss=vs(Es);async function xt(){if(xs.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await Ss("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}import Rs from"process";import{promisify as Ps}from"util";import{execFile as As,execFileSync as ol}from"child_process";var Cs=Ps(As);async function Qr(e,{humanReadableOutput:t=!0,signal:r}={}){if(Rs.platform!=="darwin")throw new Error("macOS only");let n=t?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:s}=await Cs("osascript",["-e",e,n],o);return s.trim()}async function Et(e){return Qr(`tell application "Finder" to set app_path to application file id "${e}" as string
|
|
8
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as _s}from"util";import{execFile as Ts}from"child_process";var Os=_s(Ts),He={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Rt=new Map(Object.entries(He)),St=class extends Error{};async function Pt(e=Os){let{stdout:t}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!r)throw new St(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:n}=r.groups,o=n.lastIndexOf("."),s=n.lastIndexOf("-"),i=o===-1?void 0:n.slice(0,o),a=s===-1?void 0:n.slice(0,s);return He[n]??He[i]??He[a]??{name:n,id:n}}var Is=Ls(Ms),ks=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,t=>t.toUpperCase());async function Ct(){if(At.platform==="darwin"){let e=await xt();return{name:await Et(e),id:e}}if(At.platform==="linux"){let{stdout:e}=await Is("xdg-mime",["query","default","x-scheme-handler/http"]),t=e.trim();return{name:ks(t.replace(/.desktop$/,"").replace("-"," ")),id:t}}if(At.platform==="win32")return Pt();throw new Error("Only macOS, Linux, and Windows are supported")}import _t from"process";var Ds=!!(_t.env.SSH_CONNECTION||_t.env.SSH_CLIENT||_t.env.SSH_TTY),Zr=Ds;var je=Symbol("fallbackAttempt"),Tt=import.meta.url?sn.dirname(Ns(import.meta.url)):"",en=sn.join(Tt,"xdg-open"),{platform:le,arch:tn}=on,rn=async(e,t)=>{if(e.length===0)return;let r=[];for(let n of e)try{return await t(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},$e=async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[je]===!0;if(delete e[je],Array.isArray(e.app))return rn(e.app,l=>$e({...e,app:l,[je]:!0}));let{name:r,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(r))return rn(r,l=>$e({...e,app:{name:l,arguments:n},[je]:!0}));if(r==="browser"||r==="browserPrivate"){let l={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(F){let f=await Xr();d=Rt.get(f)??{}}else d=await Ct();if(d.id in l){let f=l[d.id.toLowerCase()];if(r==="browserPrivate"){if(f==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(u[f])}return $e({...e,app:{name:ue[f],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,s=[],i={},a=!1;if(F&&!ce()&&!Zr&&!r&&(a=await Yr()),le==="darwin")o="open",e.wait&&s.push("--wait-apps"),e.background&&s.push("--background"),e.newInstance&&s.push("--new"),r&&s.push("-a",r);else if(le==="win32"||a){o=await Be(),s.push(...L.argumentsPrefix),F||(i.windowsVerbatimArguments=!0),F&&e.target&&(e.target=await Jr(e.target));let l=["$ProgressPreference = 'SilentlyContinue';","Start"];e.wait&&l.push("-Wait"),r?(l.push(L.escapeArgument(r)),e.target&&n.push(e.target)):e.target&&l.push(L.escapeArgument(e.target)),n.length>0&&(n=n.map(u=>L.escapeArgument(u)),l.push("-ArgumentList",n.join(","))),e.target=L.encodeCommand(l.join(" ")),e.wait||(i.stdio="ignore")}else{if(r)o=r;else{let l=!Tt||Tt==="/",u=!1;try{await Bs.access(en,Hs.X_OK),u=!0}catch{}o=on.versions.electron??(le==="android"||l||!u)?"xdg-open":en}n.length>0&&s.push(...n),e.wait||(i.stdio="ignore",i.detached=!0)}le==="darwin"&&n.length>0&&s.push("--args",...n),e.target&&s.push(e.target);let c=Us.spawn(o,s,i);return e.wait?new Promise((l,u)=>{c.once("error",u),c.once("close",d=>{if(!e.allowNonzeroExitCode&&d!==0){u(new Error(`Exited with code ${d}`));return}l(c)})}):t?new Promise((l,u)=>{c.once("error",u),c.once("spawn",()=>{c.once("close",d=>{if(c.off("error",u),d!==0){u(new Error(`Exited with code ${d}`));return}c.unref(),l(c)})})}):(c.unref(),new Promise((l,u)=>{c.once("error",u),c.once("spawn",()=>{c.off("error",u),l(c)})}))},js=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return $e({...t,target:e})};function nn(e){if(typeof e=="string"||Array.isArray(e))return e;let{[tn]:t}=e;if(!t)throw new Error(`${tn} is not supported`);return t}function we({[le]:e},{wsl:t}={}){if(t&&F)return nn(t);if(!e)throw new Error(`${le} is not supported`);return nn(e)}var ue={browser:"browser",browserPrivate:"browserPrivate"};ee(ue,"chrome",()=>we({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));ee(ue,"brave",()=>we({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));ee(ue,"firefox",()=>we({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ee(ue,"edge",()=>we({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ee(ue,"safari",()=>we({darwin:"Safari"}));var an=js;function cn(e=""){return`<link rel="icon" type="image/svg+xml" href="${`${e.replace(/\/$/,"")}/favicon-black.svg?v=4`}" />`}import{existsSync as vn,readFileSync as qs}from"fs";import z from"path";import{fileURLToPath as Ks}from"url";import{gunzipSync as Vs}from"zlib";var W=oo(bn(),1);function de(e,t){return e.header("Retry-After",String(Ws(t))),e.json({error:"Too Many Requests"},429)}function Ws(e){return e&&typeof e=="object"&&"msBeforeNext"in e&&typeof e.msBeforeNext=="number"&&Number.isFinite(e.msBeforeNext)?Math.max(1,Math.ceil(e.msBeforeNext/1e3)):60}var Gs={".js":"application/javascript",".css":"text/css",".svg":"image/svg+xml",".png":"image/png",".ico":"image/x-icon",".webmanifest":"application/manifest+json"};function Ys(){let e=z.dirname(Ks(import.meta.url));for(let t of[z.resolve(e,"app"),z.resolve(e,"../app"),z.resolve(e,"../../dist/app")])if(vn(z.join(t,"inspector.js.gz")))return t;throw new Error("Inspector bundle not found (expected dist/app/inspector.js.gz)")}function xn(e,t="/inspector/assets"){let r=Ys(),n=new Map,o=new W.default({points:600,duration:60}),s=async(i,a)=>{try{await o.consume(i.req)}catch(c){return de(i,c)}return a()};e.use(`${t}/*`,s),e.get(`${t}/*`,async i=>{let a=i.req.path.slice(t.length),c=a.startsWith("/")?a.slice(1):a;if(!c||c.includes(".."))return i.notFound();let l=c==="inspector.js"||c==="inspector.css"?`${c}.gz`:c,u=z.resolve(r,l),d=r.endsWith(z.sep)?r:`${r}${z.sep}`;if(!u.startsWith(d)||!vn(u))return i.notFound();let f=z.extname(c),h=l.endsWith(".gz"),y=/(?:^|,)\s*gzip\s*(?:,|$)/i.test(i.req.header("accept-encoding")??""),m=qs(u),b=h&&!y?n.get(u)??Xs(n,u,m):m,w=b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength);return i.body(w,200,{"Content-Type":Gs[f]??"application/octet-stream",...h&&y?{"Content-Encoding":"gzip"}:{},...h?{Vary:"Accept-Encoding"}:{},"Cache-Control":"no-cache"})})}function Xs(e,t,r){let n=Vs(r);return e.set(t,n),n}var En={name:"@mcp-use/inspector",type:"module",version:"20.3.9",description:"MCP Inspector - A tool for inspecting and debugging MCP servers",author:"",license:"MIT",homepage:"https://github.com/mcp-use/mcp-use#readme",repository:{type:"git",url:"git+https://github.com/mcp-use/mcp-use.git",directory:"libraries/typescript/packages/inspector"},bugs:{url:"https://github.com/mcp-use/mcp-use/issues"},keywords:["mcp","inspector","debug","tools"],exports:{".":{types:"./dist/server/index.d.ts",import:"./dist/server/index.js"},"./client":{types:"./dist/client/index.d.ts",import:"./dist/client/index.js"},"./client/styles.css":{default:"./dist/client/styles.css"}},main:"./dist/server/index.js",types:"./dist/server/index.d.ts",bin:{"mcp-inspect":"./dist/cli.js"},files:["dist"],scripts:{dev:"rimraf node_modules/.vite && vite --strictPort","dev:client":"pnpm run dev","dev:server":"VITE_DEV=true tsx watch src/server/server.ts","dev:standalone":"tsx watch src/server/server.ts",clean:"rimraf dist",build:"pnpm run clean && pnpm run build:client-exports && pnpm run build:server && pnpm run build:app && pnpm run verify:package","build:app":"vite build --config vite.app.config.ts && node scripts/compress-app.mjs","watch:app":"vite build --watch --config vite.app.config.ts","preview:app":"vite preview --config vite.app.config.ts --host 127.0.0.1","serve:app":"pnpm build:app && pnpm preview:app","analyze:app":"ANALYZE=true vite build --config vite.app.config.ts","build:client-exports":"tsup --config tsup.client.ts && node scripts/copy-client-styles.mjs","build:server":"tsup --config tsup.server.ts","verify:package":"node scripts/verify-package.mjs",start:"node dist/cli.js --port 3000",preview:"vite preview","type-check":"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix","test:e2e":"playwright test","test:e2e:ui":"playwright test --ui","test:e2e:debug":"playwright test --debug","test:e2e:builtin":"node tests/e2e/scripts/run-test-matrix.mjs builtin","test:e2e:prod":"node tests/e2e/scripts/run-test-matrix.mjs prod","test:e2e:mix":"node tests/e2e/scripts/run-test-matrix.mjs mix","test:e2e:prod:ui":"TEST_MODE=production playwright test --ui","test:e2e:codegen":"playwright codegen http://localhost:3000/inspector","test:e2e:report":"playwright show-report","test:e2e:python":"node tests/e2e/scripts/run-python-e2e.mjs",test:"vitest run","test:unit":"vitest run","test:unit:watch":"vitest","test:e2e:tunnel":"node tests/e2e/scripts/run-tunnel-test.mjs","install:pnpm":"pnpm install","install:npm":"npm install","lint:npm":"npm run lint:fix","lint:pnpm":"pnpm lint:fix"},engines:{node:">=22.22.2"},peerDependencies:{"@base-ui/react":"^1.6.0","@mcp-use/agent":"^2.0.16 || ^2.0.17","@mcp-use/client":"^2.0.1 || ^2.1.0 || ^2.1.1 || ^2.1.2 || ^2.1.3 || ^2.1.4 || ^2.1.5 || ^2.2.0 || ^2.2.1 || ^2.2.2 || ^2.2.3 || ^2.2.4 || ^2.2.5 || ^2.3.0 || ^2.3.1 || ^2.3.2","class-variance-authority":"^0.7.1",clsx:"^2.1.1",express:"^4.21.2 || ^5.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4","mcp-use":"^2.4.3 || ^2.4.4 || ^2.5.0 || ^2.5.1",motion:"^12.34.2",react:"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0","react-resizable-panels":"^4.6.4",sonner:"^2.0.7","tailwind-merge":"^3.5.0"},peerDependenciesMeta:{"@base-ui/react":{optional:!0},"@mcp-use/agent":{optional:!0},"@mcp-use/client":{optional:!0},"class-variance-authority":{optional:!0},clsx:{optional:!0},express:{optional:!0},"lucide-react":{optional:!0},"markdown-to-jsx":{optional:!0},"mcp-use":{optional:!0},motion:{optional:!0},react:{optional:!0},"react-dom":{optional:!0},"react-resizable-panels":{optional:!0},sonner:{optional:!0},"tailwind-merge":{optional:!0}},dependencies:{},publishConfig:{access:"public"},devDependencies:{"@base-ui/react":"^1.6.0","@hono/node-server":"^2.0.5","@mcp-use/agent":"workspace:*","@mcp-use/client":"workspace:*","@playwright/test":"^1.58.2","@tailwindcss/vite":"^4.2.0","@types/express":"^5.0.6","@vitejs/plugin-react":"^6.0.0","class-variance-authority":"^0.7.1",clsx:"^2.1.1",emulate:"0.5.0",eslint:"^9.39.2",express:"^5.2.1",hono:"^4.13.5",jsdom:"^27.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4",motion:"^12.34.2","oauth2-mock-server":"^8.2.2",open:"^11.0.0",react:"^19.2.3","react-dom":"^19.2.3","react-router":"^8.3.0","react-resizable-panels":"^4.6.4","rate-limiter-flexible":"^11.2.0","rollup-plugin-visualizer":"^6.0.3",sonner:"^2.0.7","tailwind-merge":"^3.5.0",tailwindcss:"^4.2.0",tsup:"^8.5.1",tsx:"^4.21.0","tw-animate-css":"^1.4.0",typescript:"^5.9.3",vite:"^8.0.16",vitest:"^4.1.0","wait-on":"^9.0.4",yaml:"^2.8.3",zod:"^4.2.0"}};var Qs=En.version;function Fe(){return Qs}var Zs=`<!doctype html>
|
|
8
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}import{promisify as _s}from"util";import{execFile as Ts}from"child_process";var Os=_s(Ts),He={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},Rt=new Map(Object.entries(He)),St=class extends Error{};async function Pt(e=Os){let{stdout:t}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(t);if(!r)throw new St(`Cannot find Windows browser in stdout: ${JSON.stringify(t)}`);let{id:n}=r.groups,o=n.lastIndexOf("."),s=n.lastIndexOf("-"),i=o===-1?void 0:n.slice(0,o),a=s===-1?void 0:n.slice(0,s);return He[n]??He[i]??He[a]??{name:n,id:n}}var Is=Ls(Ms),ks=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,t=>t.toUpperCase());async function Ct(){if(At.platform==="darwin"){let e=await xt();return{name:await Et(e),id:e}}if(At.platform==="linux"){let{stdout:e}=await Is("xdg-mime",["query","default","x-scheme-handler/http"]),t=e.trim();return{name:ks(t.replace(/.desktop$/,"").replace("-"," ")),id:t}}if(At.platform==="win32")return Pt();throw new Error("Only macOS, Linux, and Windows are supported")}import _t from"process";var Ds=!!(_t.env.SSH_CONNECTION||_t.env.SSH_CLIENT||_t.env.SSH_TTY),Zr=Ds;var je=Symbol("fallbackAttempt"),Tt=import.meta.url?sn.dirname(Ns(import.meta.url)):"",en=sn.join(Tt,"xdg-open"),{platform:le,arch:tn}=on,rn=async(e,t)=>{if(e.length===0)return;let r=[];for(let n of e)try{return await t(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},$e=async e=>{e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e};let t=e[je]===!0;if(delete e[je],Array.isArray(e.app))return rn(e.app,l=>$e({...e,app:l,[je]:!0}));let{name:r,arguments:n=[]}=e.app??{};if(n=[...n],Array.isArray(r))return rn(r,l=>$e({...e,app:{name:l,arguments:n},[je]:!0}));if(r==="browser"||r==="browserPrivate"){let l={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},u={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(F){let f=await Xr();d=Rt.get(f)??{}}else d=await Ct();if(d.id in l){let f=l[d.id.toLowerCase()];if(r==="browserPrivate"){if(f==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(u[f])}return $e({...e,app:{name:ue[f],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,s=[],i={},a=!1;if(F&&!ce()&&!Zr&&!r&&(a=await Yr()),le==="darwin")o="open",e.wait&&s.push("--wait-apps"),e.background&&s.push("--background"),e.newInstance&&s.push("--new"),r&&s.push("-a",r);else if(le==="win32"||a){o=await Be(),s.push(...L.argumentsPrefix),F||(i.windowsVerbatimArguments=!0),F&&e.target&&(e.target=await Jr(e.target));let l=["$ProgressPreference = 'SilentlyContinue';","Start"];e.wait&&l.push("-Wait"),r?(l.push(L.escapeArgument(r)),e.target&&n.push(e.target)):e.target&&l.push(L.escapeArgument(e.target)),n.length>0&&(n=n.map(u=>L.escapeArgument(u)),l.push("-ArgumentList",n.join(","))),e.target=L.encodeCommand(l.join(" ")),e.wait||(i.stdio="ignore")}else{if(r)o=r;else{let l=!Tt||Tt==="/",u=!1;try{await Bs.access(en,Hs.X_OK),u=!0}catch{}o=on.versions.electron??(le==="android"||l||!u)?"xdg-open":en}n.length>0&&s.push(...n),e.wait||(i.stdio="ignore",i.detached=!0)}le==="darwin"&&n.length>0&&s.push("--args",...n),e.target&&s.push(e.target);let c=Us.spawn(o,s,i);return e.wait?new Promise((l,u)=>{c.once("error",u),c.once("close",d=>{if(!e.allowNonzeroExitCode&&d!==0){u(new Error(`Exited with code ${d}`));return}l(c)})}):t?new Promise((l,u)=>{c.once("error",u),c.once("spawn",()=>{c.once("close",d=>{if(c.off("error",u),d!==0){u(new Error(`Exited with code ${d}`));return}c.unref(),l(c)})})}):(c.unref(),new Promise((l,u)=>{c.once("error",u),c.once("spawn",()=>{c.off("error",u),l(c)})}))},js=(e,t)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return $e({...t,target:e})};function nn(e){if(typeof e=="string"||Array.isArray(e))return e;let{[tn]:t}=e;if(!t)throw new Error(`${tn} is not supported`);return t}function we({[le]:e},{wsl:t}={}){if(t&&F)return nn(t);if(!e)throw new Error(`${le} is not supported`);return nn(e)}var ue={browser:"browser",browserPrivate:"browserPrivate"};ee(ue,"chrome",()=>we({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));ee(ue,"brave",()=>we({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));ee(ue,"firefox",()=>we({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ee(ue,"edge",()=>we({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ee(ue,"safari",()=>we({darwin:"Safari"}));var an=js;function cn(e=""){return`<link rel="icon" type="image/svg+xml" href="${`${e.replace(/\/$/,"")}/favicon-black.svg?v=4`}" />`}import{existsSync as vn,readFileSync as qs}from"fs";import z from"path";import{fileURLToPath as Ks}from"url";import{gunzipSync as Vs}from"zlib";var W=oo(bn(),1);function de(e,t){return e.header("Retry-After",String(Ws(t))),e.json({error:"Too Many Requests"},429)}function Ws(e){return e&&typeof e=="object"&&"msBeforeNext"in e&&typeof e.msBeforeNext=="number"&&Number.isFinite(e.msBeforeNext)?Math.max(1,Math.ceil(e.msBeforeNext/1e3)):60}var Gs={".js":"application/javascript",".css":"text/css",".svg":"image/svg+xml",".png":"image/png",".ico":"image/x-icon",".webmanifest":"application/manifest+json"};function Ys(){let e=z.dirname(Ks(import.meta.url));for(let t of[z.resolve(e,"app"),z.resolve(e,"../app"),z.resolve(e,"../../dist/app")])if(vn(z.join(t,"inspector.js.gz")))return t;throw new Error("Inspector bundle not found (expected dist/app/inspector.js.gz)")}function xn(e,t="/inspector/assets"){let r=Ys(),n=new Map,o=new W.default({points:600,duration:60}),s=async(i,a)=>{try{await o.consume(i.req)}catch(c){return de(i,c)}return a()};e.use(`${t}/*`,s),e.get(`${t}/*`,async i=>{let a=i.req.path.slice(t.length),c=a.startsWith("/")?a.slice(1):a;if(!c||c.includes(".."))return i.notFound();let l=c==="inspector.js"||c==="inspector.css"?`${c}.gz`:c,u=z.resolve(r,l),d=r.endsWith(z.sep)?r:`${r}${z.sep}`;if(!u.startsWith(d)||!vn(u))return i.notFound();let f=z.extname(c),h=l.endsWith(".gz"),y=/(?:^|,)\s*gzip\s*(?:,|$)/i.test(i.req.header("accept-encoding")??""),m=qs(u),b=h&&!y?n.get(u)??Xs(n,u,m):m,w=b.buffer.slice(b.byteOffset,b.byteOffset+b.byteLength);return i.body(w,200,{"Content-Type":Gs[f]??"application/octet-stream",...h&&y?{"Content-Encoding":"gzip"}:{},...h?{Vary:"Accept-Encoding"}:{},"Cache-Control":"no-cache"})})}function Xs(e,t,r){let n=Vs(r);return e.set(t,n),n}var En={name:"@mcp-use/inspector",type:"module",version:"20.3.10",description:"MCP Inspector - A tool for inspecting and debugging MCP servers",author:"",license:"MIT",homepage:"https://github.com/mcp-use/mcp-use#readme",repository:{type:"git",url:"git+https://github.com/mcp-use/mcp-use.git",directory:"libraries/typescript/packages/inspector"},bugs:{url:"https://github.com/mcp-use/mcp-use/issues"},keywords:["mcp","inspector","debug","tools"],exports:{".":{types:"./dist/server/index.d.ts",import:"./dist/server/index.js"},"./client":{types:"./dist/client/index.d.ts",import:"./dist/client/index.js"},"./client/styles.css":{default:"./dist/client/styles.css"}},main:"./dist/server/index.js",types:"./dist/server/index.d.ts",bin:{"mcp-inspect":"./dist/cli.js"},files:["dist"],scripts:{dev:"rimraf node_modules/.vite && vite --strictPort","dev:client":"pnpm run dev","dev:server":"VITE_DEV=true tsx watch src/server/server.ts","dev:standalone":"tsx watch src/server/server.ts",clean:"rimraf dist",build:"pnpm run clean && pnpm run build:client-exports && pnpm run build:server && pnpm run build:app && pnpm run verify:package","build:app":"vite build --config vite.app.config.ts && node scripts/compress-app.mjs","watch:app":"vite build --watch --config vite.app.config.ts","preview:app":"vite preview --config vite.app.config.ts --host 127.0.0.1","serve:app":"pnpm build:app && pnpm preview:app","analyze:app":"ANALYZE=true vite build --config vite.app.config.ts","build:client-exports":"tsup --config tsup.client.ts && node scripts/copy-client-styles.mjs","build:server":"tsup --config tsup.server.ts","verify:package":"node scripts/verify-package.mjs",start:"node dist/cli.js --port 3000",preview:"vite preview","type-check":"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix","test:e2e":"playwright test","test:e2e:ui":"playwright test --ui","test:e2e:debug":"playwright test --debug","test:e2e:builtin":"node tests/e2e/scripts/run-test-matrix.mjs builtin","test:e2e:prod":"node tests/e2e/scripts/run-test-matrix.mjs prod","test:e2e:mix":"node tests/e2e/scripts/run-test-matrix.mjs mix","test:e2e:prod:ui":"TEST_MODE=production playwright test --ui","test:e2e:codegen":"playwright codegen http://localhost:3000/inspector","test:e2e:report":"playwright show-report","test:e2e:python":"node tests/e2e/scripts/run-python-e2e.mjs",test:"vitest run","test:unit":"vitest run","test:unit:watch":"vitest","test:e2e:tunnel":"node tests/e2e/scripts/run-tunnel-test.mjs","install:pnpm":"pnpm install","install:npm":"npm install","lint:npm":"npm run lint:fix","lint:pnpm":"pnpm lint:fix"},engines:{node:">=22.22.2"},peerDependencies:{"@base-ui/react":"^1.6.0","@mcp-use/agent":"^2.0.16 || ^2.0.17","@mcp-use/client":"^2.0.1 || ^2.1.0 || ^2.1.1 || ^2.1.2 || ^2.1.3 || ^2.1.4 || ^2.1.5 || ^2.2.0 || ^2.2.1 || ^2.2.2 || ^2.2.3 || ^2.2.4 || ^2.2.5 || ^2.3.0 || ^2.3.1 || ^2.3.2","class-variance-authority":"^0.7.1",clsx:"^2.1.1",express:"^4.21.2 || ^5.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4","mcp-use":"^2.4.3 || ^2.4.4 || ^2.5.0 || ^2.5.1 || ^2.5.2",motion:"^12.34.2",react:"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0","react-resizable-panels":"^4.6.4",sonner:"^2.0.7","tailwind-merge":"^3.5.0"},peerDependenciesMeta:{"@base-ui/react":{optional:!0},"@mcp-use/agent":{optional:!0},"@mcp-use/client":{optional:!0},"class-variance-authority":{optional:!0},clsx:{optional:!0},express:{optional:!0},"lucide-react":{optional:!0},"markdown-to-jsx":{optional:!0},"mcp-use":{optional:!0},motion:{optional:!0},react:{optional:!0},"react-dom":{optional:!0},"react-resizable-panels":{optional:!0},sonner:{optional:!0},"tailwind-merge":{optional:!0}},dependencies:{},publishConfig:{access:"public"},devDependencies:{"@base-ui/react":"^1.6.0","@hono/node-server":"^2.0.5","@mcp-use/agent":"workspace:*","@mcp-use/client":"workspace:*","@playwright/test":"^1.58.2","@tailwindcss/vite":"^4.2.0","@types/express":"^5.0.6","@vitejs/plugin-react":"^6.0.0","class-variance-authority":"^0.7.1",clsx:"^2.1.1",emulate:"0.5.0",eslint:"^9.39.2",express:"^5.2.1",hono:"^4.13.5",jsdom:"^27.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4",motion:"^12.34.2","oauth2-mock-server":"^8.2.2",open:"^11.0.0",react:"^19.2.3","react-dom":"^19.2.3","react-router":"^8.3.0","react-resizable-panels":"^4.6.4","rate-limiter-flexible":"^11.2.0","rollup-plugin-visualizer":"^6.0.3",sonner:"^2.0.7","tailwind-merge":"^3.5.0",tailwindcss:"^4.2.0",tsup:"^8.5.1",tsx:"^4.21.0","tw-animate-css":"^1.4.0",typescript:"^5.9.3",vite:"^8.0.16",vitest:"^4.1.0","wait-on":"^9.0.4",yaml:"^2.8.3",zod:"^4.2.0"}};var Qs=En.version;function Fe(){return Qs}var Zs=`<!doctype html>
|
|
9
9
|
<html>
|
|
10
10
|
<head>
|
|
11
11
|
<meta charset="utf-8" />
|
package/dist/client/index.js
CHANGED
|
@@ -99,7 +99,7 @@ Return ONLY JSON.`:`Resource Information:
|
|
|
99
99
|
Based on this information, suggest 3-5 common customizable properties like theme, dimensions, colors, titles, or configuration options that would be useful for this type of resource. Keep it simple and practical.`,u=[{role:"system",content:c},{role:"user",content:l}],f=await hg({config:{provider:e.provider,model:e.model,apiKey:e.apiKey,temperature:e.temperature,baseUrl:e.baseUrl},messages:u});try{let d=vg(f);if(d)return Object.entries(d).map(([b,p])=>({key:b,value:typeof p=="object"&&p!==null?JSON.stringify(p):String(p)}));let h=f.split(`
|
|
100
100
|
`),m=[];for(let b of h){let p=b.match(/^\s*["']?(\w+)["']?\s*[:=]\s*["']?(.+?)["']?\s*,?\s*$/);p&&m.push({key:p[1].trim(),value:p[2].trim().replace(/^["']|["']$/g,"")})}if(m.length>0)return m;throw new Error("Could not parse props from LLM response")}catch(d){throw console.error("[usePropsLLM] Failed to parse LLM response:",d),new Error(`Failed to parse props from LLM response: ${f.slice(0,100)}...`)}},[e]),isAvailable:e!==null}}import{Loader2 as iC,Plus as lC,Sparkles as cC,Trash2 as dC}from"lucide-react";import{useEffect as uC,useMemo as mC,useState as Ra}from"react";import{toast as zr}from"sonner";import{jsx as $n,jsxs as Or}from"react/jsx-runtime";function yg(e,t){if(!e?.$ref)return e;let n=e.$ref;if(n.startsWith("#/")){let o=n.substring(2).split("/"),r=t;for(let s of o)if(r&&typeof r=="object"&&s in r)r=r[s];else return console.warn(`Could not resolve $ref: ${n}`),e;return r}return e}function sC(e,t){if(e.anyOf&&Array.isArray(e.anyOf)){let n=e.anyOf.find(o=>o.type!=="null");if(n)return{...yg(n,t),nullable:!0}}return e}function aC(e){return Array.isArray(e.enum)?e.enum:null}function xg({name:e,schema:t,value:n,onChange:o,required:r=!1,disabled:s=!1,rootSchema:a}){let i=a||t,c=sC(t,i);c=yg(c,i);let l=aC(c),u=c.type==="string"&&l!==null,f=c;return f.type==="object"||f.type==="array"?Or("div",{className:"space-y-2",children:[Or(Be,{htmlFor:e,className:"text-sm font-medium",children:[e,r&&$n("span",{className:"text-red-500 ml-1",children:"*"})]}),$n(fo,{id:e,value:n,onChange:h=>o(h.target.value),placeholder:f?.description||f?.default?JSON.stringify(f.default,null,2):`Enter ${e}`,className:"min-h-[100px]",disabled:s}),f?.description&&$n("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:f.description})]}):u&&l?Or("div",{className:"space-y-2",children:[Or(Be,{htmlFor:e,className:"text-sm font-medium",children:[e,r&&$n("span",{className:"text-red-500 ml-1",children:"*"})]}),Or(un,{value:n||"",onValueChange:o,disabled:s,children:[$n(hn,{id:e,className:"w-full",children:$n(fn,{placeholder:f.description||"Select an option"})}),$n(gn,{children:l.map((h,m)=>$n(ht,{value:h,children:f.enumNames?.[m]||h},h))})]}),f.description&&$n("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:f.description})]}):Or("div",{className:"space-y-2",children:[Or(Be,{htmlFor:e,className:"text-sm font-medium",children:[e,r&&$n("span",{className:"text-red-500 ml-1",children:"*"})]}),$n(Ae,{id:e,value:n,onChange:h=>o(h.target.value),placeholder:f?.description||(f?.default!==void 0?String(f.default):`Enter ${e}`),type:f.type==="number"?"number":"text",disabled:s}),f?.description&&$n("p",{className:"text-xs text-gray-500 dark:text-gray-400",children:f.description})]})}import{Fragment as wg,jsx as Vt,jsxs as rn}from"react/jsx-runtime";function Cg({open:e,onOpenChange:t,onSave:n,existingPresets:o,resource:r,resourceAnnotations:s,llmConfig:a,editingPreset:i}){let c=mC(()=>{let T=L=>{if(!L)return null;if(L.type==="object"&&L.properties)return L;let M=L?.def?.shape??L?._def?.shape;if(M&&typeof M=="object"){let q={},U=[],K=Y=>({ZodString:"string",string:"string",ZodNumber:"number",number:"number",ZodBoolean:"boolean",boolean:"boolean",ZodArray:"array",array:"array",ZodObject:"object",object:"object"})[Y]||"string",H=Y=>Y?.typeName??Y?.type??"",J=Y=>{let $=Y?._def??Y?.def??{},G=Y,te=H($);for(;te==="ZodOptional"||te==="ZodDefault"||te==="ZodNullable";){G=$.innerType??G;let z=G?._def??G?.def??{};te=H(z)}let Z=K(te);if(Z==="array"){let z=G?._def?.type??G?.def?.element??G?.element;if(z){let F=z._def??z.def??{};if(K(H(F))==="object"){let ie=F.shape??z._def?.shape??z.def?.shape??{};return{type:"array",items:{type:"object",properties:Object.fromEntries(Object.entries(ie).map(([le,Ne])=>{let de=Ne?._def??Ne?.def??{};return[le,{type:K(H(de))}]}))}}}}return{type:"array"}}return{type:Z}};for(let[Y,$]of Object.entries(M)){let G=$,te=G?._def??G?.def??{},Z=H(te),z=Z==="ZodOptional"||Z==="ZodDefault"||Z==="ZodNullable",F=J(G);q[Y]={type:F.type,...F.items&&{items:F.items},description:G?.description??te.description},z||U.push(Y)}if(Object.keys(q).length>0)return{type:"object",properties:q,required:U.length>0?U:void 0}}return null},w=s;if(w?.["mcp-use/propsSchema"])return T(w["mcp-use/propsSchema"]);let P=r.annotations;return P?.["mcp-use/propsSchema"]?T(P["mcp-use/propsSchema"]):null},[s,r.annotations,r.uri,r.name]),l=!!c,[u,f]=Ra(""),[d,h]=Ra({}),[m,b]=Ra([{id:crypto.randomUUID(),key:"",value:""}]),[p,v]=Ra(!1),[x,y]=Ra(null),{generateProps:g,isAvailable:N}=bg({llmConfig:a});uC(()=>{if(e){if(i)if(f(i.name),l)h(i.props);else{let T=Object.entries(i.props).map(([w,P])=>({id:crypto.randomUUID(),key:w,value:P}));b(T.length>0?T:[{id:crypto.randomUUID(),key:"",value:""}])}else f(""),l?h({}):b([{id:crypto.randomUUID(),key:"",value:""}]);y(null)}},[e,i,l]);let k=()=>{b([...m,{id:crypto.randomUUID(),key:"",value:""}])},I=T=>{m.length>1&&b(m.filter(w=>w.id!==T))},R=(T,w,P)=>{b(m.map(L=>L.id===T?{...L,[w]:P}:L))},C=async()=>{if(!N){zr.error("LLM not configured",{description:"Please configure LLM in the Chat tab first."});return}v(!0),y(null);try{let T=await g({resource:r,resourceAnnotations:s,propsSchema:l?c:void 0});if(l){let w={};for(let P of T)c.properties?.[P.key]&&(w[P.key]=P.value);h(w)}else b(T.map(w=>({id:crypto.randomUUID(),key:w.key,value:w.value})));zr.success("Props generated successfully",{description:`Generated ${T.length} prop(s) using ${a?.provider}`})}catch(T){let w=T instanceof Error?T.message:"Failed to generate props";y(w),zr.error("LLM Generation Failed",{description:w})}finally{v(!1)}},E=()=>{if(!u.trim()){zr.error("Preset name required",{description:"Please enter a name for this preset."});return}if(o.find(L=>L.name.toLowerCase()===u.toLowerCase()&&L.id!==i?.id)){zr.error("Duplicate preset name",{description:"A preset with this name already exists."});return}let w;if(l)w={...d};else{w={};for(let L of m)L.key.trim()&&(w[L.key.trim()]=L.value)}if(Object.keys(w).length===0){zr.error("No props defined",{description:"Please add at least one prop with a key."});return}let P={id:i?.id||crypto.randomUUID(),name:u.trim(),props:w};n(P),t(!1),zr.success(i?"Preset updated":"Preset created",{description:`Preset "${P.name}" saved successfully.`})};return Vt(on,{open:e,onOpenChange:t,children:rn(Xt,{scrollable:!0,className:"sm:max-w-[600px] max-h-[80vh]","data-testid":"props-config-dialog",children:[rn(Gt,{children:[Vt($t,{children:i?"Edit Preset":"Create Props Preset"}),rn(To,{children:["Configure props for ",r.name||r.uri,". You can manually add key-value pairs or generate them with AI."]})]}),rn(pn,{className:"space-y-4 py-4",children:[rn("div",{className:"space-y-2",children:[Vt(Be,{htmlFor:"preset-name",children:"Preset Name"}),Vt(Ae,{id:"preset-name","data-testid":"props-config-preset-name",value:u,onChange:T=>f(T.target.value),placeholder:"e.g., Dark Theme, Production Config",disabled:p})]}),rn("div",{className:"space-y-2 p-3 bg-muted rounded-lg",children:[rn("div",{className:"flex items-center justify-between",children:[Vt(Be,{className:"text-sm font-medium",children:"Generate with AI"}),N&&rn("span",{className:"text-xs text-muted-foreground",children:["Using ",a?.provider," (",a?.model,")"]})]}),N?Vt(A,{onClick:C,disabled:p,size:"sm",variant:"outline",className:"w-full","data-testid":"props-config-generate-llm-button",children:p?rn("span",{"data-testid":"props-config-generating",className:"flex items-center gap-2",children:[Vt(iC,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):rn(wg,{children:[Vt(cC,{className:"h-4 w-4 mr-2"}),"Generate Props with LLM"]})}):Vt("p",{className:"text-xs text-muted-foreground",children:"LLM not configured. Please configure LLM in the Chat tab to use this feature."}),x&&Vt("p",{className:"text-xs text-destructive","data-testid":"props-config-error",children:x})]}),rn("div",{className:"space-y-3",children:[Vt(Be,{className:"text-sm font-medium",children:"Props"}),l?Vt("div",{className:"space-y-4",children:Object.entries(c.properties||{}).map(([T,w])=>Vt(xg,{name:T,schema:w,value:d[T]||"",onChange:P=>h(L=>({...L,[T]:P})),required:c.required?.includes(T),disabled:p,rootSchema:c},T))}):rn(wg,{children:[Vt("div",{className:"flex items-center justify-between",children:rn(A,{onClick:k,size:"sm",variant:"ghost",disabled:p,"data-testid":"props-config-add-prop",children:[Vt(lC,{className:"h-4 w-4 mr-1"}),"Add Prop"]})}),m.map((T,w)=>rn("div",{className:"flex items-center gap-2",children:[rn("div",{className:"flex-1 grid grid-cols-2 gap-2",children:[Vt(Ae,{placeholder:"Key",value:T.key,onChange:P=>R(T.id,"key",P.target.value),disabled:p,"data-testid":`props-config-key-${w}`}),Vt(Ae,{placeholder:"Value",value:T.value,onChange:P=>R(T.id,"value",P.target.value),disabled:p,"data-testid":`props-config-value-${w}`})]}),Vt(A,{variant:"ghost",size:"sm",onClick:()=>I(T.id),disabled:m.length===1||p,className:"h-9 w-9 p-0","data-testid":`props-config-remove-${w}`,children:Vt(dC,{className:"h-4 w-4 text-muted-foreground"})})]},T.id))]})]})]}),rn($i,{children:[Vt(A,{variant:"outline",onClick:()=>t(!1),disabled:p,"data-testid":"props-config-cancel-button",children:"Cancel"}),rn(A,{onClick:E,disabled:p,"data-testid":"props-config-save-button",children:[i?"Update":"Create"," Preset"]})]})]})})}function Sg(e){if(e===0)return"0 Bytes";let t=1024,n=["Bytes","KB","MB","GB"],o=Math.floor(Math.log(e)/Math.log(t));return Math.round(e/Math.pow(t,o)*100)/100+" "+n[o]}function Ng(e){if(e===0)return"0 B";let t=1024,n=["B","KB","MB"],o=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,o)).toFixed(1))} ${n[o]}`}var Tg=100*1024,kg=1024*20;function wl(e,t){if(e==null)return e;if(typeof e=="string")return e.length>t?e.substring(0,t)+"... (truncated)":e;if(Array.isArray(e))return e.map(n=>wl(n,t));if(typeof e=="object"){let n={};for(let o in e)Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=wl(e[o],t));return n}return e}function Pg(e){let t=JSON.stringify(e,null,2);return new TextEncoder().encode(t).length>Tg?wl(e,kg):e}function Cl(e){let t=JSON.stringify(e,null,2),n=new TextEncoder().encode(t).length,o=n>Tg,r;if(o){let a=wl(e,kg);r=JSON.stringify(a,null,2)}else r=t;let s=Sg(n);return{isLarge:o,size:n,sizeFormatted:s,preview:r,full:t}}function Sl(e,t){try{let n=JSON.stringify(e,null,2),o=globalThis.Blob,r=new o([n],{type:"application/json"}),s=URL.createObjectURL(r),a=document.createElement("a");a.href=s,a.download=t||`data-${Date.now()}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(s)}catch(n){throw console.error("Failed to download JSON:",n),n}}import{jsx as gC}from"react/jsx-runtime";var pC={key:"text-sky-600 dark:text-sky-400",string:"text-emerald-600 dark:text-emerald-400",number:"text-amber-600 dark:text-amber-400",boolean:"text-violet-600 dark:text-violet-400",null:"text-zinc-500 dark:text-zinc-400",punctuation:"text-muted-foreground"};function fC(e){let t=[],n=0,o=(r,s)=>{s&&t.push({kind:r,text:s})};for(;n<e.length;){let r=e[n];if(r==='"'){let s=n;for(n++;n<e.length;){if(e[n]==="\\"){n+=2;continue}if(e[n]==='"'){n++;break}n++}let a=e.slice(s,n),i=n;for(;i<e.length&&/[ \t]/.test(e[i]);)i++;let c=e[i]===":";o(c?"key":"string",a);continue}if(/[0-9-]/.test(r)){let s=n;for(e[n]==="-"&&n++;n<e.length&&/[0-9.eE+-]/.test(e[n]);)n++;o("number",e.slice(s,n));continue}if(e.startsWith("true",n)||e.startsWith("false",n)){let s=e.startsWith("true",n)?"true":"false";o("boolean",s),n+=s.length;continue}if(e.startsWith("null",n)){o("null","null"),n+=4;continue}if(/[{}[\],:]/.test(r)){o("punctuation",r),n++;continue}o("punctuation",r),n++}return t}function Id(e){return fC(e).map((t,n)=>gC("span",{className:pC[t.kind],children:t.text},n))}import{Download as xC}from"lucide-react";import{ChevronRight as hC}from"lucide-react";import{useState as vC}from"react";import{Fragment as Nl,jsx as Lt,jsxs as ho}from"react/jsx-runtime";var yn={string:"text-emerald-600 dark:text-emerald-400",number:"text-amber-600 dark:text-amber-400",boolean:"text-violet-600 dark:text-violet-400",null:"text-zinc-500 dark:text-zinc-400",key:"text-sky-600 dark:text-sky-400",punctuation:"text-muted-foreground"};function bC(e){return e===null?Lt("span",{className:yn.null,children:"null"}):typeof e=="string"?Lt("span",{className:yn.string,children:JSON.stringify(e)}):typeof e=="number"?Lt("span",{className:yn.number,children:String(e)}):typeof e=="boolean"?Lt("span",{className:yn.boolean,children:String(e)}):Lt("span",{className:yn.string,children:JSON.stringify(e)})}function yC(e){return Array.isArray(e)?`[${e.length}]`:`{${Object.keys(e).length}}`}function Rg({label:e,value:t,depth:n,defaultExpanded:o}){let r=t!==null&&typeof t=="object"&&!Array.isArray(t)?Object.keys(t).length>0:Array.isArray(t)?t.length>0:!1,[s,a]=vC(r&&(o||n===0));if(!r){let d=Array.isArray(t)?"[]":"{}";return t!==null&&typeof t=="object"?ho("div",{className:"font-mono text-[0.8rem] leading-relaxed",style:{paddingLeft:n*12},children:[e!=null&&ho(Nl,{children:[Lt("span",{className:yn.key,children:JSON.stringify(e)}),Lt("span",{className:yn.punctuation,children:": "})]}),Lt("span",{className:yn.punctuation,children:d})]}):ho("div",{className:"font-mono text-[0.8rem] leading-relaxed",style:{paddingLeft:n*12},children:[e!=null&&ho(Nl,{children:[Lt("span",{className:yn.key,children:JSON.stringify(e)}),Lt("span",{className:yn.punctuation,children:": "})]}),bC(t)]})}let i=Array.isArray(t)?t.map((f,d)=>[String(d),f]):Object.entries(t),c=Array.isArray(t),l=c?"[":"{",u=c?"]":"}";return ho("div",{className:"font-mono text-[0.8rem] leading-relaxed",children:[ho("div",{className:"flex items-start gap-0.5",style:{paddingLeft:n*12},children:[Lt("button",{type:"button","aria-expanded":s,onClick:()=>a(f=>!f),className:"mt-0.5 inline-flex shrink-0 items-center justify-center rounded-sm text-muted-foreground hover:text-foreground",children:Lt(hC,{className:S("h-3.5 w-3.5 transition-transform",s&&"rotate-90")})}),ho("div",{className:"min-w-0 flex-1",children:[e!=null&&ho(Nl,{children:[Lt("span",{className:yn.key,children:JSON.stringify(e)}),Lt("span",{className:yn.punctuation,children:": "})]}),Lt("span",{className:yn.punctuation,children:l}),!s&&ho(Nl,{children:[Lt("button",{type:"button",onClick:()=>a(!0),className:"mx-1 text-xs text-muted-foreground hover:text-foreground",children:yC(t)}),Lt("span",{className:yn.punctuation,children:u})]})]})]}),s&&ho("div",{children:[i.map(([f,d])=>Lt(Rg,{label:f,value:d,depth:n+1,defaultExpanded:o},`${n}-${f}`)),Lt("div",{style:{paddingLeft:n*12},children:Lt("span",{className:yn.punctuation,children:u})})]})]})}function Mg({data:e,defaultExpanded:t=!0,className:n}){return Lt("div",{className:S("text-gray-900 dark:text-gray-100 [overflow-wrap:anywhere]",n),"data-testid":"collapsible-json",children:Lt(Rg,{value:e,depth:0,defaultExpanded:t})})}import{jsx as Ro,jsxs as Ps}from"react/jsx-runtime";var Ig="font-mono text-[0.8rem] text-gray-900 dark:text-gray-100 whitespace-pre-wrap break-words [overflow-wrap:anywhere]";function Dt({data:e,filename:t,className:n,collapsible:o=!1,defaultExpanded:r=!0,...s}){let a=Cl(e),i=Pg(e),c=()=>{Sl(e,t)},l=a.isLarge?Ro("div",{className:"mb-3 p-3 bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 rounded-lg",children:Ps("div",{className:"flex items-center justify-between gap-2",children:[Ps("div",{className:"flex-1",children:[Ps("p",{className:"text-sm font-medium text-yellow-800 dark:text-yellow-300 mb-1",children:["JSON is too large (",a.sizeFormatted,")"]}),Ro("p",{className:"text-xs text-yellow-700 dark:text-yellow-400",children:"Showing full structure with truncated values. Download the full JSON file to see complete values."})]}),Ps(A,{variant:"outline",size:"sm",onClick:c,className:"shrink-0",children:[Ro(xC,{className:"h-4 w-4 mr-1"}),"Download"]})]})}):null;return o?Ps("div",{className:n,...s,children:[l,Ro(Mg,{data:i,defaultExpanded:r})]}):a.isLarge?Ps("div",{className:n,...s,children:[l,Ro("pre",{className:Ig,children:Ro("code",{children:Id(a.preview)})})]}):Ro("div",{className:n,...s,children:Ro("pre",{className:Ig,children:Ro("code",{children:Id(a.preview)})})})}import{jsx as or,jsxs as Ma}from"react/jsx-runtime";function Eg({value:e,onChange:t}){let n=(o,r)=>{let s=parseInt(r,10);isNaN(s)||t({...e,[o]:s})};return Ma("div",{className:"grid grid-cols-2 gap-2",children:[Ma("div",{className:"space-y-1",children:[or("label",{className:"text-xs text-muted-foreground",children:"Top"}),or(Ae,{type:"number",min:"0",value:e.top,onChange:o=>n("top",o.target.value),className:"h-8","data-testid":"debugger-safe-area-top"})]}),Ma("div",{className:"space-y-1",children:[or("label",{className:"text-xs text-muted-foreground",children:"Right"}),or(Ae,{type:"number",min:"0",value:e.right,onChange:o=>n("right",o.target.value),className:"h-8","data-testid":"debugger-safe-area-right"})]}),Ma("div",{className:"space-y-1",children:[or("label",{className:"text-xs text-muted-foreground",children:"Bottom"}),or(Ae,{type:"number",min:"0",value:e.bottom,onChange:o=>n("bottom",o.target.value),className:"h-8","data-testid":"debugger-safe-area-bottom"})]}),Ma("div",{className:"space-y-1",children:[or("label",{className:"text-xs text-muted-foreground",children:"Left"}),or(Ae,{type:"number",min:"0",value:e.left,onChange:o=>n("left",o.target.value),className:"h-8","data-testid":"debugger-safe-area-left"})]})]})}function Tl(e,t){let n=new Set(t?.connectDomains??[]),o=new Set(t?.resourceDomains??[]),r=new Set(t?.frameDomains??[]),s=new Set(["script-src","style-src","img-src","font-src","media-src"]),a="connect-src",i="frame-src";for(let l of e){let u=(l.blockedUri||"").trim();if(!u||u==="(inline)"||u.startsWith("blob:")||u.startsWith("data:"))continue;let f=null;try{f=new URL(u).origin}catch{continue}if(!f)continue;let d=(l.effectiveDirective||l.directive||"").toLowerCase();d===a?(n.add(f),f.startsWith("http://")?n.add(f.replace("http://","ws://")):f.startsWith("https://")&&n.add(f.replace("https://","wss://"))):s.has(d)?o.add(f):d===i&&r.add(f)}let c={connectDomains:Array.from(n).sort(),resourceDomains:Array.from(o).sort()};return r.size>0&&(c.frameDomains=Array.from(r).sort()),c}var wC="https://raw.githubusercontent.com/modelcontextprotocol/ext-apps/bcfffb6585ea4fb1e3a9da39fb8911b83399fa71/specification/2026-01-26/apps.mdx",CC="https://mcp-use.com/docs/typescript/server/csp";function kl(e,t,n,o){let r=["Fix the Content Security Policy (CSP) for this MCP Apps widget. The widget has CSP violations that block network requests and resources.","","**References:**",`- MCP Apps CSP spec: ${wC}`,`- mcp-use CSP docs: ${CC}`,""];if(r.push("**Current declared CSP:**"),e?(r.push(`connectDomains: ${JSON.stringify(e.connectDomains??[])}`),r.push(`resourceDomains: ${JSON.stringify(e.resourceDomains??[])}`),r.push(`frameDomains: ${JSON.stringify(e.frameDomains??[])}`),r.push(`baseUriDomains: ${JSON.stringify(e.baseUriDomains??[])}`)):r.push("No CSP declared."),r.push(""),t&&(r.push("**Effective policy (originalPolicy):**"),r.push("```"),r.push(t),r.push("```"),r.push("")),n.length>0){r.push(`**Blocked requests (${n.length}):**`);for(let s of n){let a=s.effectiveDirective||s.directive,i=s.blockedUri||"(inline)";r.push(`- ${a}: ${i}`)}r.push("")}return o?(r.push("**Apply this CSP config to fix the violations:**"),r.push("Add these domains to the widget's CSP metadata (resource _meta.ui.csp). Use camelCase for MCP Apps (connectDomains, resourceDomains)."),r.push(""),r.push("```json"),r.push(JSON.stringify({connectDomains:o.connectDomains,resourceDomains:o.resourceDomains,...o.frameDomains?.length?{frameDomains:o.frameDomains}:{}},null,2)),r.push("```")):r.push("No blocked requests - no fix needed."),r.join(`
|
|
101
101
|
`)}import{Popover as Ia}from"@base-ui/react/popover";import{jsx as Ea}from"react/jsx-runtime";function rr({...e}){return Ea(Ia.Root,{"data-slot":"popover",...e})}function sr(e){return Ea(Ia.Trigger,{"data-slot":"popover-trigger",...e})}function ar({className:e,align:t="center",alignOffset:n=0,side:o="bottom",sideOffset:r=4,...s}){return Ea(Ia.Portal,{children:Ea(Ia.Positioner,{align:t,alignOffset:n,side:o,sideOffset:r,className:"isolate z-50",children:Ea(Ia.Popup,{"data-slot":"popover-content",className:S("z-50 flex w-72 origin-(--transform-origin) flex-col gap-4 rounded-md bg-popover p-4 text-sm text-popover-foreground shadow-md ring-1 ring-foreground/10 outline-hidden duration-100 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...s})})})}import{Fragment as Hg,jsx as W,jsxs as ye}from"react/jsx-runtime";var Br="__no_props__",Aa="__tool_props__",Og="__create_preset__",zg=[{value:"desktop",label:"Desktop",icon:Ug},{value:"mobile",label:"Mobile",icon:Fg}];function Bg({options:e,value:t,onValueChange:n,placeholder:o,contentTestId:r,searchTestId:s,optionTestId:a,trigger:i}){let[c,l]=Mo(!1),[u,f]=Mo(""),d=OC(null);Pl(()=>{if(!c){f("");return}let b=requestAnimationFrame(()=>d.current?.focus());return()=>cancelAnimationFrame(b)},[c]);let h=La(()=>{let b=u.trim().toLowerCase();return b?e.filter(p=>p.label.toLowerCase().includes(b)||p.value.toLowerCase().includes(b)):[...e]},[e,u]),m=h.findIndex(b=>b.value===t);return ye(Ir,{open:c,onOpenChange:l,children:[i,ye(Er,{"data-testid":r,checkedIndex:m>=0?m:void 0,className:"w-80 overflow-hidden",children:[W("div",{className:"border-b border-border p-2",onKeyDown:b=>b.stopPropagation(),children:W(Ae,{ref:d,value:u,onChange:b=>f(b.target.value),placeholder:o,"data-testid":s,className:"h-8"})}),W("div",{className:"max-h-64 overflow-y-auto",children:h.length===0?W("p",{className:"px-3 py-4 text-xs text-muted-foreground",children:"No results found."}):h.map((b,p)=>W(Pr,{index:p,label:b.label,checked:t===b.value,"data-testid":a(b.value),onSelect:()=>{n(b.value),l(!1)}},b.value))})]})]})}function Rl({displayMode:e,onDisplayModeChange:t,toolCallId:n,propsContext:o,resourceUri:r,toolInput:s,resourceAnnotations:a,llmConfig:i,resource:c,onPropsChange:l,requiredProps:u}){let{resolvedTheme:f,setTheme:d}=go(),{playground:h,updatePlaygroundSettings:m,widgets:b,clearCspViolations:p}=er(),v=b.get(n),x=v?.cspViolations??[],y=v?.declaredCsp,g=v?.effectivePolicy,N=x.length>0?Tl(x,y):null,k=x.length>0?kl(y,g,x,N):"",I=e==="fullscreen",R=e==="pip",{presets:C,activePresetId:E,savePreset:T,deletePreset:w,setActivePreset:P,getActiveProps:L}=tg(r),[M,q]=Mo(!1),K=!!u?.length&&!E,[H,J]=Mo(()=>K);Pl(()=>{K&&J(!0)},[K]);let[Y,$]=Mo(null),[G,te]=Mo(!1),[Z,z]=Mo("mode"),[F,ie]=Mo(!0),le=La(()=>Nf(y),[y]),Ne=La(()=>Tf(g),[g]),de=La(()=>kf(le,Ne),[le,Ne]),re=La(()=>cl({mode:h.cspMode,declared:y,effectivePolicy:g,violations:x}),[h.cspMode,y,g,x]),me=_C(()=>o==="tool"&&s?Aa:Br,[o,s]),[be,pe]=Mo(me());Pl(()=>{E&&o!=="tool"?pe(E):be!==Br&&be!==Aa&&pe(me())},[E,be,me,o]),Pl(()=>{if(l){if(be===Br||be===Aa)l(null);else if(E&&be===E){let _=L();_&&l(_)}}},[be,E,s,L,l,C]);let We=_=>{if(_===Og){$(null),q(!0);return}if(_===Br||_===Aa)P(null),pe(_),l?.(null);else{P(_),pe(_);let V=C.find(Le=>Le.id===_);l?.(V?.props??null)}},Ke=_=>{T(_),P(_.id),pe(_.id),l?.(_.props)},Ve=(_,V)=>{V.stopPropagation();let Le=C.find(Oe=>Oe.id===_);Le&&(w(_),Ed.success("Preset deleted",{description:`Preset "${Le.name}" has been deleted.`}))},pt=(_,V)=>{V.stopPropagation(),$(_),q(!0)},lt=()=>h.deviceType==="mobile"?W(Fg,{className:"size-3"}):W(Ug,{className:"size-3"}),D=zg.findIndex(_=>_.value===h.deviceType);return ye("div",{className:"flex items-center gap-2",children:[!I&&!R&&ye(Hg,{children:[ye(Ie,{children:[W(Re,{render:W(A,{"data-testid":"debugger-fullscreen-button",variant:"outline",size:"sm",className:"bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",onClick:()=>t("fullscreen"),children:W(kC,{className:"size-4"})}),nativeButton:!0}),W(Me,{children:"Enter fullscreen mode"})]}),ye(Ie,{children:[W(Re,{render:W(A,{"data-testid":"debugger-pip-button",variant:"outline",size:"sm",className:"bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",onClick:()=>t("pip"),children:W(MC,{className:"size-4"})}),nativeButton:!0}),W(Me,{children:"Picture-in-picture"})]})]}),ye(Ir,{children:[ye(Ie,{children:[W(Re,{render:W(Go,{render:W(A,{"data-testid":"debugger-device-button",variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",children:lt()}),nativeButton:!0}),nativeButton:!0}),ye(Me,{children:["Device: ",h.deviceType]})]}),W(Er,{"data-testid":"debugger-device-dialog",checkedIndex:D>=0?D:void 0,className:"w-56",children:zg.map((_,V)=>W(Pr,{index:V,icon:_.icon,label:_.label,checked:h.deviceType===_.value,"data-testid":`debugger-device-option-${_.value}`,onSelect:()=>m({deviceType:_.value})},_.value))})]}),ye(Ie,{children:[W(Re,{render:W(A,{"data-testid":"debugger-theme-button",variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",onClick:()=>{d(f==="dark"?"light":"dark")},children:f==="dark"?W(PC,{className:"size-3.5"}):W(LC,{className:"size-3.5"})}),nativeButton:!0}),ye(Me,{children:["Theme: ",f==="dark"?"Dark":"Light"]})]}),W(Bg,{options:Yf,value:h.locale,onValueChange:_=>m({locale:_}),placeholder:"Search locales...",contentTestId:"debugger-locale-dialog",searchTestId:"debugger-locale-search",optionTestId:_=>`debugger-locale-option-${_}`,trigger:ye(Ie,{children:[W(Re,{render:W(Go,{render:W(A,{"data-testid":"debugger-locale-button",variant:"outline",size:"sm",className:"h-8 min-w-[50px] px-2 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",children:W("span",{className:"text-xs font-mono",children:h.locale})}),nativeButton:!0}),nativeButton:!0}),W(Me,{children:"Locale"})]})}),W(Bg,{options:Xf,value:h.timeZone,onValueChange:_=>m({timeZone:_}),placeholder:"Search timezones...",contentTestId:"debugger-timezone-dialog",searchTestId:"debugger-timezone-search",optionTestId:_=>`debugger-timezone-option-${_.replace(/\//g,"-")}`,trigger:ye(Ie,{children:[W(Re,{render:W(Go,{render:W(A,{"data-testid":"debugger-timezone-button",variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",children:W(TC,{className:"size-3.5"})}),nativeButton:!0}),nativeButton:!0}),ye(Me,{children:["Timezone: ",h.timeZone]})]})}),ye(on,{open:G,onOpenChange:te,children:[ye(Ie,{children:[W(Re,{render:W(kr,{render:ye(A,{"data-testid":"debugger-csp-button",variant:"outline",size:"sm",className:"relative h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",children:[h.cspMode==="permissive"?W(_g,{className:"size-3.5"}):W(Dg,{className:"size-3.5"}),x.length>0&&W("span",{className:`absolute -top-1.5 -right-1.5 flex h-4 min-w-4 items-center justify-center rounded-full px-0.5 text-[9px] font-bold text-white leading-none ${h.cspMode==="permissive"?"bg-yellow-500":"bg-red-500"}`,children:x.length>99?"99+":x.length})]}),nativeButton:!0}),nativeButton:!0}),ye(Me,{children:["CSP:"," ",h.cspMode==="permissive"?"Permissive":"Declared",x.length>0&&` \xB7 ${x.length} ${h.cspMode==="permissive"?"would be blocked":"blocked"}`]})]}),ye(Xt,{scrollable:!0,className:"sm:max-w-[520px] max-h-[85vh]","data-testid":"debugger-csp-dialog",children:[W(Gt,{children:W($t,{children:"CSP Mode"})}),ye(pn,{className:"space-y-3",children:[W("div",{role:"tablist","aria-label":"CSP diagnostics",className:"grid grid-cols-3 rounded-md border border-zinc-200 dark:border-zinc-700 p-1",children:[["mode","Mode"],["diff","Policy Diff"],["findings","Findings"]].map(([_,V])=>W("button",{type:"button",role:"tab","aria-selected":Z===_,onClick:()=>z(_),className:`rounded px-2 py-1.5 text-xs font-medium ${Z===_?"bg-zinc-100 dark:bg-zinc-800":"text-muted-foreground"}`,children:V},_))}),Z==="mode"&&ye("div",{role:"tabpanel",className:"space-y-2",children:[ye(A,{"data-testid":"debugger-csp-option-permissive",variant:h.cspMode==="permissive"?"default":"outline",className:"w-full justify-start",onClick:()=>m({cspMode:"permissive"}),children:[W(_g,{className:"size-4 mr-2"}),"Permissive"]}),ye(A,{"data-testid":"debugger-csp-option-widget-declared",variant:h.cspMode==="widget-declared"?"default":"outline",className:"w-full justify-start",onClick:()=>m({cspMode:"widget-declared"}),children:[W(Dg,{className:"size-4 mr-2"}),"Widget-Declared"]}),W("p",{className:"text-xs text-muted-foreground",children:"Permissive records would-be blocks; Widget-Declared enforces the resource metadata policy."})]}),Z==="diff"&&ye("div",{role:"tabpanel",className:"space-y-2",children:[de.length?W("div",{className:"max-h-64 overflow-y-auto rounded border border-zinc-200 dark:border-zinc-700",children:de.map(_=>ye("div",{className:"border-b border-zinc-100 dark:border-zinc-800 p-2 text-xs last:border-0",children:[ye("div",{className:"flex items-center justify-between",children:[W("code",{children:_.directive}),W("span",{className:"text-[10px] uppercase text-muted-foreground",children:_.status})]}),ye("div",{className:"mt-1 font-mono text-[10px] text-muted-foreground break-all",children:["requested: ",_.requested.join(" ")||"\u2014",W("br",{}),"effective: ",_.effective.join(" ")||"\u2014"]})]},_.directive))}):W("p",{className:"text-xs text-muted-foreground",children:"No requested or effective policy data yet."}),g&&ye(A,{variant:"outline",size:"sm",onClick:async()=>{try{await st(g),Ed.success("Policy copied to clipboard")}catch{Ed.error("Failed to copy")}},children:[W(Lg,{className:"size-3.5 mr-2"}),"Copy effective policy"]})]}),Z==="findings"&&ye("div",{role:"tabpanel",className:"space-y-2",children:[W("div",{className:"space-y-1.5",children:re.map((_,V)=>ye("div",{className:"rounded border border-zinc-200 dark:border-zinc-700 p-2",children:[W("div",{className:"text-xs font-medium",children:_.title}),W("div",{className:"text-[11px] text-muted-foreground break-all",children:_.detail})]},`${_.title}-${V}`))}),x.length>0&&ye(Hg,{children:[ye("div",{className:"flex items-center justify-between",children:[ye("span",{className:"text-xs font-medium",children:[x.length," observed request",x.length===1?"":"s"]}),W("button",{className:"text-xs text-muted-foreground underline",onClick:()=>p(n),children:"Clear"})]}),ye("div",{className:"border border-amber-200 dark:border-amber-800 rounded-md overflow-hidden",children:[ye("div",{className:"flex items-center justify-between bg-amber-50 dark:bg-amber-950/30 px-3 py-2",children:[ye("button",{type:"button",className:"flex items-center gap-2 text-xs font-medium text-amber-800 dark:text-amber-200",onClick:()=>ie(_=>!_),children:[F?W(SC,{className:"size-3.5"}):W(NC,{className:"size-3.5"}),"Prompt for Agents"]}),W(A,{variant:"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>{st(k)},"aria-label":"Copy prompt for agents",children:W(Lg,{className:"size-3.5"})})]}),F&&W("pre",{className:"max-h-48 overflow-auto whitespace-pre-wrap p-2 text-[11px]","data-testid":"debugger-csp-prompt-for-agents",children:k})]})]})]})]})]})]}),ye(Ie,{children:[W(Re,{render:W(A,{"data-testid":"debugger-touch-button",variant:"outline",size:"sm",className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900 ${h.capabilities.touch?"border-blue-500 dark:border-blue-400":""}`,onClick:()=>{let _={...h.capabilities,touch:!h.capabilities.touch};m({capabilities:_})},children:W(IC,{className:`size-3.5 ${h.capabilities.touch?"text-blue-600 dark:text-blue-400":""}`})}),nativeButton:!0}),ye(Me,{children:["Touch: ",h.capabilities.touch?"Enabled":"Disabled"]})]}),ye(Ie,{children:[W(Re,{render:W(A,{"data-testid":"debugger-hover-button",variant:"outline",size:"sm",className:`h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900 ${h.capabilities.hover?"border-blue-500 dark:border-blue-400":""}`,onClick:()=>{let _={...h.capabilities,hover:!h.capabilities.hover};m({capabilities:_})},children:W(RC,{className:`size-3.5 ${h.capabilities.hover?"text-blue-600 dark:text-blue-400":""}`})}),nativeButton:!0}),ye(Me,{children:["Hover: ",h.capabilities.hover?"Enabled":"Disabled"]})]}),ye(rr,{children:[W(sr,{render:W(A,{"data-testid":"debugger-safe-area-button",variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900",children:W(AC,{className:"size-3.5"})}),nativeButton:!0}),W(ar,{className:"w-64 p-3","data-testid":"debugger-safe-area-dialog",children:ye("div",{className:"space-y-2",children:[W("label",{className:"text-xs font-medium",children:"Safe Area Insets"}),W(Eg,{value:h.safeAreaInsets,onChange:_=>{m({safeAreaInsets:_})}})]})})]}),o==="tool"?ye(on,{children:[ye(Ie,{children:[W(Re,{render:W(kr,{render:W(A,{variant:"outline",size:"sm",className:"h-8 w-8 p-0 bg-white/90 dark:bg-zinc-900/90 backdrop-blur-sm shadow-sm hover:bg-white dark:hover:bg-zinc-900","data-testid":"debugger-props-button",children:W(Ag,{className:"size-3.5"})}),nativeButton:!0}),nativeButton:!0}),W(Me,{children:"View Tool Props"})]}),ye(Xt,{scrollable:!0,className:"sm:max-w-[600px] max-h-[85vh]","data-testid":"debugger-props-dialog",children:[W(Gt,{children:W($t,{children:"Tool Props"})}),W(pn,{children:W(Fi,{children:W(Dt,{data:s??{},filename:"tool-props.json"})})})]})]}):ye(rr,{open:H,onOpenChange:J,children:[ye(Ie,{children:[W(Re,{render:W(sr,{render:W(A,{variant:"outline",size:"sm",className:`h-8 w-8 p-0 backdrop-blur-sm shadow-sm ${K?"bg-amber-50 dark:bg-amber-950/40 border-amber-300 dark:border-amber-700 hover:bg-amber-100 dark:hover:bg-amber-900/50 animate-pulse":"bg-white/90 dark:bg-zinc-900/90 hover:bg-white dark:hover:bg-zinc-900"}`,"data-testid":"debugger-props-button",children:W(Ag,{className:`size-3.5 ${K?"text-amber-500":""}`})}),nativeButton:!0}),nativeButton:!0}),ye(Me,{children:["Props:"," ",be===Br?"No Props":be===Aa?"Tool Props":C.find(_=>_.id===be)?.name||"Custom"]})]}),ye(ar,{className:"w-64 p-2","data-testid":"debugger-props-popover",children:[K&&ye("div",{className:"mb-2 rounded-md border border-amber-200 dark:border-amber-800/50 bg-amber-50 dark:bg-amber-950/30 px-3 py-2",children:[W("p",{className:"text-xs font-medium text-amber-700 dark:text-amber-300 mb-0.5",children:"Props required to render this widget:"}),W("p",{className:"text-xs font-mono text-amber-600 dark:text-amber-400",children:u.join(", ")}),W("p",{className:"text-xs text-amber-500 dark:text-amber-400 mt-1",children:"Create a preset below to set them."})]}),ye("div",{className:"space-y-1",children:[W(A,{variant:be===Br?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>We(Br),"data-testid":"debugger-props-no-props",children:"No Props"}),C.map(_=>ye("div",{className:"relative group flex items-center",children:[W(A,{variant:be===_.id?"secondary":"ghost",size:"sm",className:"w-full justify-start pr-14",onClick:()=>We(_.id),"data-testid":`debugger-props-preset-${_.id}`,children:_.name}),ye("div",{className:"absolute right-2 flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[W(A,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:V=>pt(_,V),"data-testid":`debugger-props-edit-${_.id}`,children:W(EC,{className:"h-3 w-3"})}),W(A,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0",onClick:V=>Ve(_.id,V),"data-testid":`debugger-props-delete-${_.id}`,children:W(DC,{className:"h-3 w-3 text-destructive"})})]})]},_.id)),W(A,{variant:"ghost",size:"sm",className:"w-full justify-start text-primary",onClick:()=>We(Og),"data-testid":"debugger-props-create-preset",children:"+ Create Preset..."})]})]})]}),W(gg,{iframeId:n,enabled:!0}),c&&W(Cg,{open:M,onOpenChange:q,onSave:Ke,existingPresets:C,resource:c,resourceAnnotations:a,llmConfig:i||null,editingPreset:Y})]})}import{jsx as Ml,jsxs as $g}from"react/jsx-runtime";function Rs({message:e,className:t="",vertical:n,noBorder:o}){return Ml("div",{className:S(`mt-2 rounded-md p-6 ${t}`,!o&&"border"),children:$g("p",{className:S("text-sm text-muted-foreground flex items-center gap-4",n&&"flex-col"),children:[$g("svg",{viewBox:"-6 -6 512 512",xmlns:"http://www.w3.org/2000/svg",className:"size-14 shrink-0 stroke-black dark:stroke-white",fill:"none",strokeWidth:"4.8",strokeLinecap:"round",strokeLinejoin:"round",children:[Ml("path",{d:"M105.933 0C164.437 0.000116002 211.865 47.607 211.865 106.333C211.865 131.829 210.493 158.403 221.068 181.602L228.975 198.947C243.584 230.997 269.265 256.7 301.303 271.336L316.155 278.121C340.142 289.079 367.694 287.335 394.066 287.335C452.571 287.335 499.999 334.942 499.999 393.668C499.999 452.394 452.571 500.001 394.066 500.001C335.562 500.001 288.134 452.394 288.134 393.668C288.134 368.974 289.24 343.275 278.992 320.807L270.586 302.38C255.948 270.29 230.214 244.565 198.118 229.939L180.164 221.758C157.282 211.331 131.078 212.666 105.933 212.666C47.4278 212.666 4.86252e-05 165.059 0 106.333C0 47.607 47.4278 0 105.933 0Z"}),Ml("circle",{cx:"100.426",cy:"399.575",r:"100.426"}),Ml("path",{d:"M500 100.426C500 155.889 455.037 200.851 399.574 200.851C344.11 200.851 299.148 155.889 299.148 100.426C299.148 44.962 344.11 0 399.574 0C455.037 0 500 44.962 500 100.426Z"})]}),e]})})}import{jsx as Q,jsxs as _e}from"react/jsx-runtime";function KC({timestamp:e}){let[t,n]=Hr(()=>Ad(e));return Da(()=>{let o=()=>n(Ad(e));o();let r=setInterval(o,1e3);return()=>clearInterval(r)},[e]),Q("span",{children:t})}function Ad(e){let n=Date.now()-e,o=Math.floor(n/1e3),r=Math.floor(o/60),s=Math.floor(r/60),a=Math.floor(s/24);return o<10?"now":o<60?`${o}s ago`:r<60?`${r}m ago`:s<24?`${s}h ago`:`${a}d ago`}function qg(e){if(!e?.isError)return null;let t=e.content;if(Array.isArray(t)){let n=t.filter(o=>o.type==="text").map(o=>o.text).filter(Boolean);if(n.length>0)return n.join(`
|
|
102
|
-
`)}return"An error occurred"}function JC(e){try{return JSON.parse(e),!0}catch{return!1}}function GC({content:e}){let[t,n]=Hr(new Set),o=Wg(r=>{n(s=>{let a=new Set(s);return a.has(r)?a.delete(r):a.add(r),a})},[]);return!Array.isArray(e)||e.length===0?Q("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):Q("div",{className:"space-y-4",children:e.map((r,s)=>{if(r.type==="text"){let a=r.text||"",i=t.has(s),c=JC(a),l=c?(()=>{try{return JSON.parse(a)}catch{return null}})():null;return _e("div",{className:"space-y-2",children:[_e("div",{className:"flex items-center justify-between gap-2",children:[_e("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Text Content",i?" (formatted)":""]}),c&&Q("button",{type:"button",onClick:()=>o(s),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline","data-testid":`tool-result-format-toggle-${s}`,children:i?"Show as text":"Try to format"})]}),i&&l!==null?Q(Dt,{data:l,filename:`content-${s}.json`}):Q("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words","data-testid":"tool-execution-results-text-content",children:a})]},s)}if(r.type==="image")return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[Q("img",{src:`data:${r.mimeType||"image/png"};base64,${r.data}`,alt:"Result",className:"max-w-full rounded","data-testid":"tool-execution-results-image-content"}),r.annotations&&Q("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:Q(Dt,{data:r.annotations,filename:`image-annotations-${s}.json`,"data-testid":"tool-execution-results-image-annotations"})})]})]},s);if(r.type==="audio")return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[Q("audio",{controls:!0,src:`data:${r.mimeType||"audio/wav"};base64,${r.data}`,className:"w-full","data-testid":"tool-execution-results-audio-content"}),r.annotations&&Q("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:Q(Dt,{data:r.annotations,filename:`audio-annotations-${s}.json`,"data-testid":"tool-execution-results-audio-annotations"})})]})]},s);if(r.type==="resource_link")return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[_e("div",{className:"font-mono text-sm break-all",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",r.uri]}),r.name&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",r.name]}),r.description&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",r.description]}),r.mimeType&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",r.mimeType]}),r.annotations&&_e("div",{className:"mt-2",children:[Q("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),Q(Dt,{data:r.annotations,filename:`resource-link-annotations-${s}.json`,"data-testid":"tool-execution-results-resource-link-annotations"})]})]})]},s);if(r.type==="resource"){let a=r.resource||{};return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[_e("div",{className:"font-mono text-sm break-all","data-testid":"tool-execution-results-resource-uri",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",a.uri]}),a.mimeType&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400","data-testid":"tool-execution-results-mime-type",children:"MIME Type:"})," ",a.mimeType]}),a.text&&_e("div",{"data-testid":"tool-execution-results-resource-text-content",children:[Q("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),Q("div",{className:"bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto",children:a.text})]}),a.blob&&_e("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",a.blob.length||0," bytes]"]}),a.annotations&&_e("div",{className:"mt-2",children:[Q("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),Q(Dt,{data:a.annotations,filename:`resource-annotations-${s}.json`,"data-testid":"tool-execution-results-resource-annotations"})]})]})]},s)}return _e("div",{className:"space-y-2",children:[_e("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",r.type||"N/A"]}),Q(Dt,{data:r,filename:`content-${s}.json`,"data-testid":"tool-execution-results-unknown-content"})]},s)})})}function Il({results:e,copiedResult:t,serverId:n,readResource:o,onCopy:r,onMaximize:s,isMaximized:a=!1,onRerunTool:i,onAuthenticateAndRerun:c,pendingAuthorizationTimestamp:l,isAuthenticating:u=!1,authorizationError:f,onWidgetHeightChange:d}){let[h,m]=Hr(0),[b,p]=Hr(!0),[v,x]=Hr("json"),[y,g]=Hr("inline"),[N,k]=Hr(null),I=e[0],R=I?e.filter(te=>te.toolName===I.toolName):[],C=R[h]||R[0],E=e.findIndex(te=>te===C),T=C?C.error||qg(C.result):null,w=T??(C!=null?JSON.stringify(C.result,null,2):"");Da(()=>{R.length>0&&h>=R.length&&m(0)},[R.length,h]);let P=vo(()=>C?.args,[C?.timestamp,h]),L=vo(()=>C?.result,[C?.timestamp,C?.duration,h]),M=Wg(te=>o(te),[o]),q=vo(()=>C&&WC(C.toolMeta)?"mcp-apps":null,[C]),U=vo(()=>C?.toolMeta?qC(C.toolMeta):null,[C?.toolMeta]),K=vo(()=>q==="mcp-apps"&&!!U,[q,U]);Da(()=>{x(K?"mcp-apps":"json")},[I?.toolName,K]);let H=vo(()=>C?.result?.content||[],[C]),J=vo(()=>U||null,[U]),Y=vo(()=>!!(H&&H.length>0||C?.result?.structuredContent),[H,C]),$=vo(()=>!K&&Y,[K,Y]),G=vo(()=>{let te=[];return K&&U&&te.push({mode:"mcp-apps",label:"Component (MCP Apps)"}),te.push({mode:"json",label:"Raw JSON"}),te},[K,U]);return Da(()=>{G.length!==0&&(G.some(te=>te.mode===v)||x(K?"mcp-apps":"json"))},[G,K,v]),Da(()=>{d&&(e.length===0||v!=="mcp-apps"||y!=="inline"||!K)&&d(null)},[d,e.length,v,y,K]),e.length===0?Q("div",{className:"flex flex-col h-full bg-white dark:bg-black",children:Q("div",{className:"flex-1 overflow-y-auto h-full",children:Q("div",{className:"flex items-center justify-center h-full",children:Q("div",{className:"text-center",children:Q(Rs,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})}):_e("div",{className:"relative flex flex-col h-full bg-white dark:bg-black",children:[Q("div",{className:"flex-1 overflow-y-auto h-full",children:_e("div",{className:"space-y-0 flex flex-col flex-1 h-full",children:[_e("div",{className:`sticky top-0 z-40 flex items-center gap-2 px-4 pt-2 backdrop-blur-xs bg-white/50 dark:bg-black/50 ${K||$?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[Q("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),C.duration!==void 0&&_e("div",{className:"hidden sm:flex items-center gap-1",children:[Q(VC,{className:"h-3 w-3 text-gray-400"}),_e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[C.duration,"ms"]})]}),K&&Q("div",{className:"flex items-center gap-4 sm:ml-4",children:Q("div",{className:"flex items-center gap-2",children:G.map((te,Z)=>_e(jC.Fragment,{children:[Z>0&&Q("span",{className:"text-xs text-zinc-400",children:"|"}),Q("button",{"data-testid":`tool-result-view-${te.mode}`,onClick:()=>x(te.mode),className:`text-xs font-medium ${v===te.mode?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:te.label})]},te.mode))})}),$&&_e("div",{className:"flex items-center gap-2 sm:ml-4",children:[Q("button",{onClick:()=>p(!0),className:`text-xs font-medium ${b?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),Q("span",{className:"text-xs text-zinc-400",children:"|"}),Q("button",{onClick:()=>p(!1),className:`text-xs font-medium ${b?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),_e("div",{className:"ml-auto flex items-center gap-1",children:[a&&i&&_e(A,{"data-testid":"tool-result-rerun",variant:"ghost",size:"sm",onClick:i,title:"Re-run with same arguments",children:[Q($C,{className:"h-4 w-4"}),Q("span",{className:"hidden sm:inline ml-1",children:"Re-run"})]}),K&&s&&Q(A,{"data-testid":"tool-result-maximize",variant:"ghost",size:"sm",onClick:s,title:a?"Restore":"Maximize",children:a?Q(FC,{className:"h-4 w-4"}):Q(UC,{className:"h-4 w-4"})}),R.length>1&&_e(un,{value:h.toString(),onValueChange:te=>m(parseInt(te)),children:[Q(hn,{className:"w-[140px] h-8 text-xs",leading:_e("div",{className:"flex items-center gap-1",children:[Q(Vg,{className:"h-3 w-3"}),Q(KC,{timestamp:C.timestamp})]})}),Q(gn,{children:R.map((te,Z)=>Q(ht,{value:Z.toString(),children:_e("div",{className:"flex items-center gap-2",children:[Q(Vg,{className:"h-3 w-3"}),Q("span",{children:Ad(te.timestamp)}),_e("span",{className:"text-xs text-muted-foreground",children:["(",new Date(te.timestamp).toLocaleTimeString(),")"]})]})},Z))})]}),Q(A,{"data-testid":`tool-result-copy-${E}`,variant:"ghost",size:"sm",onClick:()=>r(E,w),children:t===E?Q(zC,{className:"h-4 w-4"}):Q(BC,{className:"h-4 w-4"})})]})]}),(()=>{if(C.authorizationRequired){let z=!!c&&C.timestamp===l;return _e("div",{role:"alert","data-testid":"tool-result-auth-required",className:"mx-4 mt-4 flex flex-col gap-3 rounded-md border border-amber-300/60 bg-amber-50 p-3 text-amber-950 sm:flex-row sm:items-start dark:border-amber-500/40 dark:bg-amber-950/40 dark:text-amber-100",children:[Q(jg,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),_e("div",{className:"min-w-0 flex-1",children:[Q("p",{className:"font-medium",children:"Authentication required"}),Q("p",{className:"mt-0.5 text-sm opacity-90",children:"Authenticate to use this tool. The Inspector will rerun it automatically after authorization."}),z&&f&&Q("p",{className:"mt-1 text-xs text-red-700 dark:text-red-300",children:f})]}),_e(A,{"data-testid":"tool-result-authenticate-rerun",size:"sm",onClick:()=>{c?.(C.timestamp)},disabled:!z||u,className:"bg-amber-600 text-white hover:bg-amber-700 focus-visible:ring-amber-600 dark:bg-amber-500 dark:text-amber-950 dark:hover:bg-amber-400",children:[z&&u?Q(HC,{className:"size-3.5 animate-spin","aria-hidden":!0}):Q(jg,{className:"size-3.5","aria-hidden":!0}),z&&u?"Authenticating\u2026":"Authenticate and rerun"]})]})}let te=C.error||qg(C.result);return te?_e("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4 mt-4",children:[Q("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),Q("p",{className:"text-red-700 dark:text-red-400 text-sm",children:te})]}):(()=>{switch(v){case"mcp-apps":return!K||!U?Q("div",{className:"px-4 pt-4",children:Q("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:Q("p",{className:"text-sm text-red-600 dark:text-red-400",children:"MCP Apps resource not available"})})}):_e(ka,{className:"relative flex flex-1 w-full min-h-[240px] items-stretch",children:[Q("div",{className:"absolute top-2 right-2 z-30 flex items-center gap-2",children:Q(Rl,{toolCallId:`tool-${C.timestamp}`,displayMode:y,onDisplayModeChange:g,propsContext:"tool",resourceUri:U,toolInput:C.args,resourceAnnotations:C.toolMeta,llmConfig:null,resource:null,onPropsChange:k})}),Q("div",{className:"flex min-h-0 flex-1 flex-col pt-11",children:Q(Cs,{serverId:n,viewId:`tool-${C.timestamp}`,toolName:C.toolName,toolInput:P,toolOutput:L,toolMetadata:C.toolMeta,resourceUri:U,readResource:M,customProps:N||void 0,displayMode:y,onDisplayModeChange:g,onWidgetHeightChange:d?z=>d(z):void 0,noWrapper:!0},`mcp-apps-${C.timestamp}`)})]});case"json":{if($&&b){let z=C.result?.structuredContent;return _e("div",{className:"px-4 pt-4 space-y-4","data-testid":"tool-execution-results-content",children:[z&&_e("div",{className:"space-y-2","data-testid":"tool-execution-results-structured-content",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),Q(Dt,{data:z,filename:`structured-content-${C.toolName}-${Date.now()}.json`})]}),H&&H.length>0&&Q(GC,{content:H}),!z&&(!H||H.length===0)&&Q("div",{className:"text-sm text-gray-500 dark:text-gray-400","data-testid":"tool-execution-results-no-content",children:"No content to display"})]})}return Q("div",{className:"px-4 pt-4",children:Q(Dt,{data:C.result,filename:`tool-result-${C.toolName}-${Date.now()}.json`})})}default:return null}})()})()]})}),J&&v==="mcp-apps"&&Q("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 z-40 pointer-events-none",children:Q("span",{className:"text-[11px] bg-gray-200 dark:bg-zinc-800 text-gray-500 dark:text-gray-400 px-3 py-0.5 rounded-t-xl font-mono max-w-[320px] truncate block",children:J})})]})}import{isViewTool as YC}from"@mcp-use/client/react";import{useMemo as El,useState as XC}from"react";import{Fragment as ZC,jsx as Io,jsxs as Kg}from"react/jsx-runtime";function QC({widgetId:e}){let{getWidget:t}=er(),o=t(e)?.modelContext;if(!o?.content?.length&&!o?.structuredContent)return null;let r=o.content?.map(s=>s.text).join(" ")??JSON.stringify(o.structuredContent).slice(0,80);return Kg("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-[11px] text-muted-foreground bg-muted/30 border border-border/40 rounded-md mt-1",children:[Io("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-blue-400 shrink-0"}),Io("span",{className:"font-medium",children:"State synced to model"}),Io("span",{className:"truncate opacity-60 max-w-[300px]",children:r})]})}function Al({toolName:e,toolArgs:t,result:n,serverId:o,readResource:r,toolMeta:s,onSendFollowUp:a,modelContextScope:i,llmConfig:c,partialToolArgs:l,cancelled:u}){let f=El(()=>`chat-tool-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,[e]),[d,h]=XC("inline"),m=El(()=>{if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},[n]),b=YC(s),p=b?s?.ui?.resourceUri??null:null,v=El(()=>t,[e,m]),x=El(()=>m,[e,m]);return b&&p&&o&&r?Kg(ZC,{children:[Io(Cs,{serverId:o,viewId:f,toolName:e,resourceUri:p,toolInput:v,toolOutput:x,toolMetadata:s,readResource:r,displayMode:d,onDisplayModeChange:h,onSendFollowUp:a,modelContextScope:i,llmConfig:c,partialToolInput:l,cancelled:u,noWrapper:!0,className:"my-4"}),Io(QC,{widgetId:f})]}):b&&!p?Io("div",{className:"flex items-center justify-center w-full h-[200px] rounded border",children:Io(An,{className:"size-5"})}):b&&(!o||!r)?Io("div",{className:"my-4 p-4 bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg",children:Io("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Cannot render widget: Missing required props (serverId or readResource)"})}):null}import{ViewRenderer as UV,isViewTool as FV,getViewResourceUri as $V}from"@mcp-use/client/react";import{createContext as eS,use as tS,useCallback as Vn,useState as nS}from"react";import{jsx as rS}from"react/jsx-runtime";var Jg=eS(void 0);function oS({children:e}){let t=typeof window<"u"?window.__MANUFACT_CHAT_URL__:void 0,n=typeof import.meta<"u"?import.meta.env?.VITE_MANUFACT_CHAT_URL:void 0,o=t?.trim()||n?.trim()||"https://cloud.manufact.com/api/v1/inspector/chat/stream",[r,s]=nS({selectedServerId:null,activeTab:"tools",selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null,tunnelUrl:null,isTunnelStarting:!1,isEmbedded:!1,embeddedConfig:{chatApiUrl:o,chatStreamProtocol:"data-stream",chatEnableFreeTierUpgrade:!0}}),a=Vn(y=>{s(g=>({...g,selectedServerId:y}))},[]),i=Vn(y=>{s(g=>({...g,activeTab:y}))},[]),c=Vn(y=>{s(g=>({...g,selectedToolName:y}))},[]),l=Vn(y=>{s(g=>({...g,selectedPromptName:y}))},[]),u=Vn(y=>{s(g=>({...g,selectedResourceUri:y}))},[]),f=Vn(y=>{s(g=>({...g,selectedSamplingRequestId:y}))},[]),d=Vn(y=>{s(g=>({...g,selectedElicitationRequestId:y}))},[]),h=Vn(y=>{s(g=>({...g,tunnelUrl:y}))},[]),m=Vn(y=>{s(g=>({...g,isTunnelStarting:y}))},[]),b=Vn((y,g={})=>{s(N=>({...N,isEmbedded:y,embeddedConfig:{...g,chatApiUrl:g.chatApiUrl?.trim()||o,chatStreamProtocol:g.chatStreamProtocol??"data-stream",chatEnableFreeTierUpgrade:g.chatEnableFreeTierUpgrade??!0}}))},[o]),p=Vn((y,g,N)=>{console.warn("[InspectorContext] navigateToItem called:",{serverId:y,tab:g,itemIdentifier:N}),s(k=>({...k,selectedServerId:y,activeTab:g,selectedToolName:g==="tools"&&N||null,selectedPromptName:g==="prompts"&&N||null,selectedResourceUri:g==="resources"&&N||null,selectedSamplingRequestId:g==="sampling"&&N||null,selectedElicitationRequestId:g==="elicitation"&&N||null}))},[]),v=Vn(()=>{s(y=>({...y,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null}))},[]),x={...r,setSelectedServerId:a,setActiveTab:i,setSelectedToolName:c,setSelectedPromptName:l,setSelectedResourceUri:u,setSelectedSamplingRequestId:f,setSelectedElicitationRequestId:d,setTunnelUrl:h,setIsTunnelStarting:m,setEmbeddedMode:b,navigateToItem:p,clearSelection:v};return rS(Jg,{value:x,children:e})}function Eo(){let e=tS(Jg);if(!e)throw new Error("useInspector must be used within InspectorProvider");return e}import{GripVerticalIcon as sS}from"lucide-react";import*as Ur from"react-resizable-panels";import{jsx as _a}from"react/jsx-runtime";var{usePanelRef:Fr}=Ur;function ir({className:e,...t}){return _a(Ur.Group,{"data-slot":"resizable-panel-group",className:S("flex h-full w-full aria-[orientation=vertical]:flex-col",e),...t})}function Ln({...e}){return _a(Ur.Panel,{"data-slot":"resizable-panel",...e})}function lr({withHandle:e,className:t,...n}){return _a(Ur.Separator,{"data-slot":"resizable-handle",className:S("relative z-50 box-content shrink-0","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1","before:pointer-events-none before:absolute before:bg-zinc-200 before:transition-[height,width,background-color] before:duration-200 before:ease-out dark:before:bg-zinc-700","hover:before:bg-foreground/35 dark:hover:before:bg-foreground/45","aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:py-1.5 aria-[orientation=horizontal]:-my-1.5","aria-[orientation=horizontal]:before:inset-x-0 aria-[orientation=horizontal]:before:top-1.5 aria-[orientation=horizontal]:before:h-px","hover:aria-[orientation=horizontal]:before:h-0.5","aria-[orientation=vertical]:h-full aria-[orientation=vertical]:w-px aria-[orientation=vertical]:px-1.5 aria-[orientation=vertical]:-mx-1.5","aria-[orientation=vertical]:before:inset-y-0 aria-[orientation=vertical]:before:left-1.5 aria-[orientation=vertical]:before:w-px","hover:aria-[orientation=vertical]:before:w-0.5","[&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&_a("div",{className:"pointer-events-none absolute top-1/2 left-1/2 z-10 flex h-4 w-3 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-xs border border-zinc-200 bg-background shadow-sm dark:border-zinc-700",children:_a(sS,{className:"size-2.5 text-muted-foreground"})})})}import{AnimatePresence as JS,motion as Yd}from"motion/react";import{ChevronLeft as GS,Database as ch,Wrench as dh}from"lucide-react";import{useCallback as _n,useEffect as uh,useMemo as mh,useRef as zl,useState as qn}from"react";import{useState as aS}from"react";import{jsx as Gg}from"react/jsx-runtime";function bo({className:e,scrollRef:t,children:n}){let[o,r]=aS(!1);return Gg("div",{ref:t,className:S("h-full overflow-y-auto overscroll-none",e),onScroll:s=>r(s.currentTarget.scrollTop>0),children:Gg("div",{className:"flex min-h-full flex-col",children:n(o)})})}import{jsx as Oa,jsxs as Yg}from"react/jsx-runtime";function no({id:e,isSelected:t,isFocused:n,title:o,description:r,metadata:s,onClick:a,className:i,"data-testid":c}){return Oa("button",{id:e,"data-testid":c,type:"button",onClick:a,className:S("w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",t&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",n&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",i),children:Yg("div",{className:"flex items-start gap-2 sm:gap-3",children:[Yg("div",{className:"flex-1 min-w-0",children:[Oa("div",{className:"flex items-center gap-2 mb-1",children:Oa("h3",{className:S("font-medium truncate font-mono text-sm"),children:o})}),r&&Oa("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:r})]}),s&&Oa("div",{className:"flex-shrink-0 flex items-center self-center",children:s})]})})}import{forwardRef as iS}from"react";import{cva as lS}from"class-variance-authority";import{jsx as Ll}from"react/jsx-runtime";var cS={gray:"#a3a3a3",red:"#ef4444",orange:"#f97316",amber:"#f59e0b",yellow:"#eab308",lime:"#84cc16",green:"#22c55e",emerald:"#10b981",teal:"#14b8a6",cyan:"#06b6d4",blue:"#3b82f6",indigo:"#6366f1",violet:"#8b5cf6",purple:"#a855f7",fuchsia:"#d946ef",pink:"#ec4899",rose:"#f43f5e"},dS=lS("inline-flex items-center font-medium whitespace-nowrap",{variants:{variant:{solid:"",outline:"border border-border text-foreground"},size:{sm:"h-5 px-2 text-[11px] gap-1",md:"h-6 px-2.5 text-[12px] gap-1.5",lg:"h-7 px-3 text-[13px] gap-1.5"}},defaultVariants:{variant:"solid",size:"md"}}),Xg={default:{variant:"solid",color:"blue"},secondary:{variant:"solid",color:"green"},destructive:{variant:"solid",color:"red"},outline:{variant:"outline",color:"gray"}};function uS(e){return typeof e=="string"||typeof e=="number"}function mS({children:e}){return uS(e)?Ll("span",{className:"[text-box:trim-both_cap_alphabetic]",children:e}):Ll("span",{className:"inline-flex items-center gap-1",children:e})}var mn=iS(({className:e,variant:t="solid",size:n="md",color:o,children:r,style:s,...a},i)=>{let c=t&&t in Xg?Xg[t]:null,l=c?.variant??t,u=o??c?.color??"gray",f=kt(),d=cS[u],m=l==="solid"?u==="gray"?{backgroundColor:"var(--accent)",color:"var(--foreground)"}:{color:"var(--foreground)",backgroundColor:`color-mix(in srgb, ${d} 15%, var(--background))`}:{};return Ll("span",{ref:i,className:S(dS({variant:l,size:n}),f.item,e),style:{...m,...s},...a,children:Ll(mS,{children:r})})});mn.displayName="Badge";import{RefreshCw as fS,Search as gS}from"lucide-react";import{jsx as pS}from"react/jsx-runtime";function Ms({className:e,...t}){return pS("kbd",{"data-slot":"kbd",className:S("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e),...t})}import{Fragment as Qg,jsx as Nn,jsxs as Ao}from"react/jsx-runtime";var hS="h-3.5 w-3.5 shrink-0 text-muted-foreground";function $r({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:o,secondaryTabTitle:r,primaryCount:s,secondaryCount:a,secondaryIcon:i,primaryIcon:c,searchPlaceholder:l="Search...",onSearchExpand:u,onSearchChange:f,onSearchBlur:d,onTabSwitch:h,searchInputRef:m,primaryTabName:b,onRefresh:p,isRefreshing:v=!1,isScrolled:x=!1}){let y=e===b,g=y?c:i,N=y?o:r;return Ao("div",{className:`flex flex-row items-center justify-between gap-2 ${Vi(x)} ${jo}`,children:[Nn("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?Nn(Ae,{ref:m,placeholder:l,value:n,onChange:k=>f(k.target.value),onBlur:d,className:"h-8 border-gray-300 dark:border-zinc-600"}):Ao(Qg,{children:[Ao("h2",{className:`${qo} flex items-center gap-1.5`,children:[Nn(g,{className:hS,"aria-hidden":!0}),N]}),y&&Ao(Qg,{children:[Nn(mn,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),Ao(Ie,{children:[Nn(Re,{render:Nn(A,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:Nn(gS,{className:"h-4 w-4"})}),nativeButton:!0}),Ao(Me,{side:"bottom",className:"flex gap-2",children:["Search",Nn(Ms,{children:"F"})]})]}),p&&Ao(Ie,{children:[Nn(Re,{render:Nn(A,{variant:"ghost",size:"sm",onClick:p,disabled:v,className:"h-8 w-8 p-0",children:Nn(fS,{className:`h-4 w-4 ${v?"animate-spin":""}`})}),nativeButton:!0}),Ao(Me,{side:"bottom",className:"flex gap-2",children:["Refresh list",Nn(Ms,{children:"R"})]})]})]})]})}),Ao(A,{variant:"ghost",size:"sm",onClick:h,className:"gap-2 flex-shrink-0",children:[Nn("span",{className:"hidden sm:inline",children:y?r:o}),y&&a>0&&Nn(mn,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:a})]})]})}import{RefreshCw as vS,Search as bS}from"lucide-react";import{Fragment as yS,jsx as sn,jsxs as cr}from"react/jsx-runtime";function Dl({title:e,count:t,icon:n,isSearchExpanded:o,searchQuery:r,searchPlaceholder:s,onSearchExpand:a,onSearchChange:i,onSearchBlur:c,searchInputRef:l,titleTestId:u,bulkAction:f,onRefresh:d,isRefreshing:h=!1,isScrolled:m=!1}){let b=f?.icon;return cr("div",{className:`flex flex-row items-center justify-between gap-2 ${Vi(m)} ${jo}`,children:[sn("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:o?sn(Ae,{ref:l,placeholder:s,value:r,onChange:v=>i(v.target.value),onBlur:c,className:"h-8 border-gray-300 dark:border-zinc-600"}):cr(yS,{children:[cr("h2",{className:`${qo} flex items-center gap-1.5`,"data-testid":u,children:[n?sn(n,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}):null,e]}),sn(mn,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:t}),cr(Ie,{children:[sn(Re,{render:sn(A,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:sn(bS,{className:"h-4 w-4"})}),nativeButton:!0}),cr(Me,{side:"bottom",className:"flex gap-2",children:["Search",sn(Ms,{children:"F"})]})]}),d&&cr(Ie,{children:[sn(Re,{render:sn(A,{variant:"ghost",size:"sm",onClick:d,disabled:h,className:"h-8 w-8 p-0",children:sn(vS,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),nativeButton:!0}),cr(Me,{side:"bottom",className:"flex gap-2",children:["Refresh list",sn(Ms,{children:"R"})]})]})]})}),f&&b&&sn("div",{className:"flex items-center gap-2",children:cr(Ie,{children:[sn(Re,{render:sn(A,{variant:"ghost",size:"sm",onClick:f.onClick,disabled:f.disabled,className:"h-8 w-8 p-0",children:sn(b,{className:"h-4 w-4"})}),nativeButton:!0}),sn(Me,{side:"bottom",children:f.label})]})})]})}import{Database as xS,Trash2 as wS}from"lucide-react";import{jsx as Dn,jsxs as Ld}from"react/jsx-runtime";function Dd({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:o,focusedIndex:r}){if(e.length===0)return Ld("div",{className:"flex flex-1 flex-col items-center justify-center p-4 text-center",children:[Dn(xS,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),Dn("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),Dn("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});let s=(a,i)=>{a.stopPropagation(),i()};return Dn("div",{children:e.map((a,i)=>Ld("div",{className:"relative group",children:[Dn(no,{id:`saved-${a.id}`,isSelected:t?.id===a.id,isFocused:r===i,title:a.name,description:a.toolName,metadata:Dn("div",{className:"flex flex-col gap-1",children:Dn("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(a.savedAt).toLocaleString()})}),onClick:()=>n(a)}),Dn("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:Ld(Ie,{children:[Dn(Re,{render:Dn(A,{variant:"secondary",size:"sm",onClick:c=>s(c,()=>o(a.id)),className:"h-8 w-8 p-0",children:Dn(wS,{className:"h-4 w-4"})}),nativeButton:!0}),Dn(Me,{children:Dn("p",{children:"Delete saved request"})})]})})]},a.id))})}import{Save as CS}from"lucide-react";import{jsx as Is,jsxs as za}from"react/jsx-runtime";function _d({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:o,onSave:r,onCancel:s}){return e?Is("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:s,children:za("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:a=>a.stopPropagation(),children:[Is("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),za("div",{className:"space-y-4",children:[za("div",{children:[Is(Be,{htmlFor:"request-name",children:"Request Name (optional)"}),Is(Ae,{id:"request-name",value:t,onChange:a=>o(a.target.value),placeholder:n,className:"mt-2",onKeyDown:a=>{a.key==="Enter"&&r()},autoFocus:!0})]}),za("div",{className:"flex justify-end gap-2",children:[Is(A,{variant:"outline",onClick:s,children:"Cancel"}),za(A,{onClick:r,children:[Is(CS,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}import{Check as SS,ChevronDown as NS,ChevronUp as TS,Code as kS,Copy as PS,Play as RS,Save as MS,X as IS}from"lucide-react";import{useEffect as Zg,useRef as ES,useState as Ba}from"react";import{Fragment as Es,jsx as Pe,jsxs as Ht}from"react/jsx-runtime";function Od({selectedTool:e,toolArgs:t,payloadToSend:n,isExecuting:o,isConnected:r,onArgChange:s,onExecute:a,onSave:i,onCancel:c,onBulkPaste:l,autoFilledFields:u,setFields:f,sendEmptyFields:d,onToggleEmpty:h}){let m="hidden @[700px]/tool-exec:inline",b="hidden @[700px]/tool-exec:inline shrink-0 text-[10px] leading-none border border-current/30 p-1 rounded-full",p="@max-[699px]/tool-exec:size-8 @max-[699px]/tool-exec:min-w-8 @max-[699px]/tool-exec:shrink-0 @max-[699px]/tool-exec:gap-0 @max-[699px]/tool-exec:rounded-full @max-[699px]/tool-exec:!px-0 @max-[699px]/tool-exec:!py-0",v="@max-[699px]/tool-exec:!pr-0",[x,y]=Ba(!1),[g,N]=Ba(!1),[k,I]=Ba(!1),[R,C]=Ba(!1),[E,T]=Ba(!1),w=ES(null);Zg(()=>{if(w.current&&e?.description){let M=w.current,q=parseFloat(getComputedStyle(M).lineHeight),U=M.scrollHeight,K=Math.round(U/q);T(K>3),C(!1)}},[e?.description]);let P=async()=>{e&&await st(JSON.stringify(e,null,2))},L=async()=>{if(e)try{await st(JSON.stringify(n??t,null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch{}};return Zg(()=>{let M=q=>{if(q.key==="Escape"&&o&&c){q.preventDefault(),c();return}if(q.key!=="Enter")return;let U=q.metaKey||q.ctrlKey,K=!q.metaKey&&!q.ctrlKey&&!q.altKey&&!q.shiftKey,H=q.target,J=H instanceof HTMLInputElement&&H.dataset.toolArgumentInput==="true";(U||K&&J)&&e&&!o&&r&&(q.preventDefault(),a())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,o,r,a,c]),e?Ht("div",{className:"flex flex-col h-full @container/tool-exec",children:[Pe("div",{className:"shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-2 sm:pb-2 sm:pr-4",children:Pe("div",{children:Ht("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[Pe("h3",{className:"text-base sm:text-lg font-semibold","data-testid":"tool-execution-title",children:e.name}),Ht("div",{className:"flex gap-2 shrink-0",children:[Ht(Ie,{children:[Pe(Re,{render:Ht(A,{"data-testid":"tool-execution-metadata-button",variant:g?"default":"outline",onClick:()=>N(!g),disabled:o,size:"sm",className:S(Nr,p),title:"View tool metadata",children:[Pe(kS,{}),Pe("span",{className:m,children:"Metadata"})]}),nativeButton:!0}),Pe(Me,{children:Pe("p",{children:"View tool definition metadata"})})]}),Ht(Ie,{children:[Pe(Re,{render:Ht(A,{"data-testid":"tool-execution-copy-payload-button",variant:"outline",onClick:L,disabled:o,size:"sm",className:S(Nr,p),title:"Copy payload as JSON",children:[k?Pe(SS,{className:"text-green-600"}):Pe(PS,{}),Pe("span",{className:m,children:k?"Copied!":"Payload"})]}),nativeButton:!0}),Pe(Me,{children:Pe("p",{children:"Copy payload as JSON"})})]}),Ht(Ie,{children:[Pe(Re,{render:Ht(A,{"data-testid":"tool-execution-save-button",variant:"outline",onClick:i,disabled:o,size:"sm",className:S(Nr,p),title:"Save request",children:[Pe(MS,{}),Pe("span",{className:m,children:"Save"})]}),nativeButton:!0}),Pe(Me,{children:Pe("p",{children:"Save request"})})]}),o&&c?Ht(Ie,{open:x?void 0:!1,children:[Pe(Re,{render:Pe("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:"relative",children:Pe(A,{"data-testid":"tool-execution-cancel-button",onClick:c,variant:x?"destructive":"default",size:"sm",className:S(da,p,v,"transition-all"),children:x?Ht(Es,{children:[Pe(IS,{}),Pe("span",{className:m,children:"Cancel"}),Pe("span",{className:b,children:"Esc"})]}):Ht(Es,{children:[Pe(An,{}),Pe("span",{className:m,children:"Executing..."})]})})}),nativeButton:!1}),Pe(Me,{children:Pe("p",{children:"Hover to cancel (or press Esc)"})})]}):Pe(A,{"data-testid":"tool-execution-execute-button",onClick:a,disabled:o||!r,size:"sm",className:S(da,p,v),children:o?Ht(Es,{children:[Pe(An,{}),Pe("span",{className:m,children:"Executing..."})]}):Ht(Es,{children:[Pe(RS,{}),Pe("span",{className:m,children:"Execute"}),Pe("span",{className:b,children:"\u2318\u21B5"})]})})]})]})})}),Ht("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 pb-4 pr-3",children:[e.description&&Ht("div",{className:"relative mb-6",children:[Ht("div",{className:"relative",children:[Pe("p",{ref:w,"data-testid":"tool-execution-description",className:`text-sm text-gray-600 dark:text-gray-400 leading-relaxed transition-all duration-300 ${!R&&E?"line-clamp-3":""}`,children:e.description}),E&&!R&&Pe("div",{className:"absolute bottom-0 left-0 right-0 h-[1.4em] bg-linear-to-t from-white/95 dark:from-black/95 via-white/55 dark:via-black/55 to-transparent pointer-events-none"})]}),E&&Pe("div",{className:"flex justify-end",children:Pe("button",{onClick:()=>C(!R),className:"relative z-10 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 mt-1 transition-colors",children:R?Ht(Es,{children:["Show less",Pe(TS,{className:"h-3 w-3"})]}):Ht(Es,{children:["Show more",Pe(NS,{className:"h-3 w-3"})]})})})]}),Pe(fd,{selectedTool:e,toolArgs:t,onArgChange:s,onBulkPaste:l,autoFilledFields:u,setFields:f,sendEmptyFields:d,onToggleEmpty:h})]}),Pe(on,{open:g,onOpenChange:N,children:Ht(Xt,{scrollable:!0,className:"max-w-3xl max-h-[80vh]",children:[Pe(Gt,{sticky:!0,children:Pe($t,{children:"Tool Definition"})}),Pe(pn,{children:Pe(Fi,{onCopy:P,children:Pe(Dt,{data:e,filename:`tool-definition-${e.name}-${Date.now()}.json`})})})]})})]}):Ht("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[Pe("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),Pe("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}import{PanelsTopLeft as AS,Wrench as LS}from"lucide-react";import{isViewTool as DS}from"@mcp-use/client/react";import{jsx as Lo,jsxs as _l}from"react/jsx-runtime";function zd({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:o}){if(e.length===0)return _l("div",{className:"flex flex-1 flex-col items-center justify-center p-4 text-center",children:[Lo(LS,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),Lo("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]});let r=e.some(s=>s.inputSchema?.properties&&Object.keys(s.inputSchema.properties).length>0);return Lo("div",{children:e.map((s,a)=>{let i=s._meta,c=DS(i)?"mcp-apps":null,l=s.inputSchema?.properties,u=l?Object.keys(l).length:0,f=r&&u>0&&_l(mn,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[u," params"]}),h=c==="mcp-apps"||f?_l("div",{className:"flex items-center gap-1.5",children:[c==="mcp-apps"&&_l(Ie,{children:[Lo(Re,{render:Lo("span",{className:"inline-flex",children:Lo(AS,{className:"h-3.5 w-3.5"})}),nativeButton:!1}),Lo(Me,{children:Lo("p",{children:"UI widget"})})]}),f]}):void 0;return Lo(no,{id:`tool-${s.name}`,"data-testid":`tool-item-${s.name}`,isSelected:t?.name===s.name,isFocused:o===a,title:s.name,description:s.description,metadata:h,onClick:()=>n(s)},s.name)})})}import{AlertDialog as Vr}from"@base-ui/react/alert-dialog";import{jsx as jn,jsxs as zS}from"react/jsx-runtime";function Bd({...e}){return jn(Vr.Root,{"data-slot":"alert-dialog",...e})}function _S({...e}){return jn(Vr.Portal,{"data-slot":"alert-dialog-portal",...e})}function OS({className:e,...t}){return jn(Vr.Backdrop,{"data-slot":"alert-dialog-overlay",className:S("fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Hd({className:e,size:t="default",...n}){return zS(_S,{children:[jn(OS,{}),jn(Vr.Popup,{"data-slot":"alert-dialog-content","data-size":t,className:S("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function Ud({className:e,...t}){return jn("div",{"data-slot":"alert-dialog-header",className:S("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Fd({className:e,...t}){return jn("div",{"data-slot":"alert-dialog-footer",className:S("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function $d({className:e,...t}){return jn(Vr.Title,{"data-slot":"alert-dialog-title",className:S("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function Vd({className:e,...t}){return jn(Vr.Description,{"data-slot":"alert-dialog-description",className:S("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function jd({className:e,...t}){return jn(A,{"data-slot":"alert-dialog-action",className:S(e),...t})}function qd({className:e,variant:t="outline",size:n="default",...o}){return jn(Vr.Close,{"data-slot":"alert-dialog-cancel",className:S(e),render:jn(A,{variant:t,size:n}),...o})}import{useCallback as BS,useEffect as eh,useState as HS}from"react";var Wd="mcp-inspector-saved-requests";function th(){let[e,t]=HS([]);eh(()=>{try{let o=localStorage.getItem(Wd);o&&t(JSON.parse(o))}catch(o){console.error("[useSavedRequests] Failed to load saved requests:",o)}},[]),eh(()=>{let o=r=>{if(r.key===Wd&&r.newValue)try{t(JSON.parse(r.newValue))}catch(s){console.error("[useSavedRequests] Failed to parse saved requests:",s)}};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[]);let n=BS(o=>{try{localStorage.setItem(Wd,JSON.stringify(o)),t(o)}catch(r){console.error("[useSavedRequests] Failed to save requests:",r)}},[]);return{savedRequests:e,saveSavedRequests:n}}import{isOAuthInteractionRequired as VS}from"@mcp-use/client/react";import{useCallback as jr,useEffect as jS,useMemo as qS,useRef as Ol,useState as qr}from"react";var US="__mcpUseInspectorPendingToolExecution";function Kd(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function Jd(e){return`${US}:${encodeURIComponent(e)}`}function Ha(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function FS(e){return Ha(e)?typeof e.serverId=="string"&&typeof e.toolName=="string"&&e.toolName.length>0&&Ha(e.args)&&Ha(e.displayArgs)&&typeof e.timestamp=="number"&&Number.isFinite(e.timestamp)&&(e.toolMeta===void 0||Ha(e.toolMeta))&&(e.widgetResourceUri===void 0||typeof e.widgetResourceUri=="string"):!1}function $S(e){return Ha(e)&&typeof e.savedAt=="number"&&Number.isFinite(e.savedAt)&&FS(e.execution)}function nh(e,t=Kd()){if(!t)return null;let n=Jd(e);try{let o=t.getItem(n);if(!o)return null;let r=JSON.parse(o);return!$S(r)||r.execution.serverId!==e||Date.now()-r.savedAt>9e5?(t.removeItem(n),null):r.execution}catch{try{t.removeItem(n)}catch{}return null}}function oh(e,t=Kd()){if(t)try{t.setItem(Jd(e.serverId),JSON.stringify({savedAt:Date.now(),execution:e}))}catch{}}function Gd(e,t=Kd()){if(t)try{t.removeItem(Jd(e))}catch{}}function rh(e,t){if(!e)return t;if(!t)return e;let n=e.ui&&typeof e.ui=="object"&&!Array.isArray(e.ui)?e.ui:void 0,o=t.ui&&typeof t.ui=="object"&&!Array.isArray(t.ui)?t.ui:void 0;return{...e,...t,...n||o?{ui:{...n,...o}}:{}}}function sh(e,t=0){return{toolName:e.toolName,args:e.displayArgs,result:null,authorizationRequired:!0,timestamp:e.timestamp,duration:t,toolMeta:e.toolMeta}}function ah({selectedTool:e,payloadToSend:t,toolArgs:n,callTool:o,readResource:r,serverId:s,isConnected:a,authenticate:i,isAuthenticating:c=!1}){let[l,u]=qr(()=>nh(s)),[f,d]=qr(()=>l?[sh(l)]:[]),[h,m]=qr(!1),[b,p]=qr(!1),[v,x]=qr(null),[y,g]=qr(null),N=Ol(!1),k=Ol(null),I=Ol(new WeakSet),R=Ol(l!==null),[C,E]=qr(0),T=jr(async H=>{if(N.current)return;let J=new AbortController;N.current=!0,k.current=J,m(!0);let Y=Date.now();try{if(H.widgetResourceUri){try{await r(H.widgetResourceUri)}catch{}d([{toolName:H.toolName,args:H.args,result:null,timestamp:H.timestamp,duration:0,toolMeta:H.toolMeta}])}let $=await o(H.toolName,H.args,{timeout:6e5,resetTimeoutOnProgress:!0,signal:J.signal}),G=Date.now()-Y,te=rh(H.toolMeta,$?._meta);Jt(new ra({toolName:H.toolName,serverId:s,success:!0,duration:G})).catch(()=>{}),window.dispatchEvent(new Event("mcp-tool-executed")),H.widgetResourceUri?d(Z=>Z.map((z,F)=>F===0?{...z,result:$,duration:G,toolMeta:te}:z)):d(Z=>[{toolName:H.toolName,args:H.displayArgs,result:$,timestamp:H.timestamp,duration:G,toolMeta:te},...Z])}catch($){if(I.current.has(J))return;let G=Date.now()-Y;if(Jt(new ra({toolName:H.toolName,serverId:s,success:!1,duration:G,error:$ instanceof Error?$.message:String($)})).catch(()=>{}),window.dispatchEvent(new Event("mcp-tool-executed")),VS($)){let Z={...H,serverId:s};R.current=!1,u(Z),x(null);let z=sh(H,G);H.widgetResourceUri?d([z]):d(F=>[z,...F.filter(ie=>!(ie.authorizationRequired&&ie.timestamp===H.timestamp))]);return}let te={toolName:H.toolName,args:H.displayArgs,result:null,error:$ instanceof Error?$.message:String($),timestamp:H.timestamp,duration:G,toolMeta:H.toolMeta};H.widgetResourceUri?d([te]):d(Z=>[te,...Z])}finally{k.current===J&&(k.current=null,N.current=!1,m(!1))}},[o,r,s]),w=jr(async()=>{if(!e||N.current)return;let H=e?._meta||e?.metadata,J=H?.ui?.resourceUri;await T({toolName:e.name,args:t,displayArgs:n,timestamp:Date.now(),toolMeta:H,...typeof J=="string"?{widgetResourceUri:J}:{}})},[e,t,n,T]);jS(()=>{!l||!a||!R.current||N.current||(R.current=!1,Gd(s),u(null),x(null),p(!1),d(H=>H.filter(J=>!(J.authorizationRequired&&J.timestamp===l.timestamp))),T(l))},[T,a,l,C,s]);let P=jr(async H=>{if(!(!l||l.timestamp!==H||!i||b)){oh(l),x(null),p(!0);try{await i(),R.current=!0,E(J=>J+1)}catch(J){Gd(s),x(J instanceof Error?J.message:"Authentication failed")}finally{p(!1)}}},[i,b,l,s]),L=jr(async(H,J)=>{try{await st(J),g(H),setTimeout(()=>g(null),2e3)}catch(Y){console.error("[ToolsTab] Failed to copy result:",Y)}},[]),M=jr(H=>{d(J=>J.filter((Y,$)=>$!==H))},[]),q=qS(()=>{let H=e?.name??f[0]?.toolName;return H?f.filter(J=>J.toolName===H):[]},[f,e]),U=jr(H=>{let J=q[H];if(!J)return;let Y=window.open("","_blank","width=800,height=600");Y&&(Y.document.write(`
|
|
102
|
+
`)}return"An error occurred"}function JC(e){try{return JSON.parse(e),!0}catch{return!1}}function GC({content:e}){let[t,n]=Hr(new Set),o=Wg(r=>{n(s=>{let a=new Set(s);return a.has(r)?a.delete(r):a.add(r),a})},[]);return!Array.isArray(e)||e.length===0?Q("div",{className:"text-sm text-gray-500 dark:text-gray-400",children:"No content"}):Q("div",{className:"space-y-4",children:e.map((r,s)=>{if(r.type==="text"){let a=r.text||"",i=t.has(s),c=JC(a),l=c?(()=>{try{return JSON.parse(a)}catch{return null}})():null;return _e("div",{className:"space-y-2",children:[_e("div",{className:"flex items-center justify-between gap-2",children:[_e("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Text Content",i?" (formatted)":""]}),c&&Q("button",{type:"button",onClick:()=>o(s),className:"text-xs text-blue-600 dark:text-blue-400 hover:underline","data-testid":`tool-result-format-toggle-${s}`,children:i?"Show as text":"Try to format"})]}),i&&l!==null?Q(Dt,{data:l,filename:`content-${s}.json`}):Q("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 font-mono text-sm whitespace-pre-wrap break-words","data-testid":"tool-execution-results-text-content",children:a})]},s)}if(r.type==="image")return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Image Content"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[Q("img",{src:`data:${r.mimeType||"image/png"};base64,${r.data}`,alt:"Result",className:"max-w-full rounded","data-testid":"tool-execution-results-image-content"}),r.annotations&&Q("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:Q(Dt,{data:r.annotations,filename:`image-annotations-${s}.json`,"data-testid":"tool-execution-results-image-annotations"})})]})]},s);if(r.type==="audio")return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Audio Content"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3",children:[Q("audio",{controls:!0,src:`data:${r.mimeType||"audio/wav"};base64,${r.data}`,className:"w-full","data-testid":"tool-execution-results-audio-content"}),r.annotations&&Q("div",{className:"mt-2 text-xs text-gray-500 dark:text-gray-400",children:Q(Dt,{data:r.annotations,filename:`audio-annotations-${s}.json`,"data-testid":"tool-execution-results-audio-annotations"})})]})]},s);if(r.type==="resource_link")return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Resource Link"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[_e("div",{className:"font-mono text-sm break-all",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",r.uri]}),r.name&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"Name:"})," ",r.name]}),r.description&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"Description:"})," ",r.description]}),r.mimeType&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"MIME Type:"})," ",r.mimeType]}),r.annotations&&_e("div",{className:"mt-2",children:[Q("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),Q(Dt,{data:r.annotations,filename:`resource-link-annotations-${s}.json`,"data-testid":"tool-execution-results-resource-link-annotations"})]})]})]},s);if(r.type==="resource"){let a=r.resource||{};return _e("div",{className:"space-y-2",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Embedded Resource"}),_e("div",{className:"bg-gray-50 dark:bg-zinc-900 rounded-lg p-3 space-y-2",children:[_e("div",{className:"font-mono text-sm break-all","data-testid":"tool-execution-results-resource-uri",children:[Q("span",{className:"text-gray-600 dark:text-gray-400",children:"URI:"})," ",a.uri]}),a.mimeType&&_e("div",{className:"text-sm",children:[Q("span",{className:"text-gray-600 dark:text-gray-400","data-testid":"tool-execution-results-mime-type",children:"MIME Type:"})," ",a.mimeType]}),a.text&&_e("div",{"data-testid":"tool-execution-results-resource-text-content",children:[Q("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Content:"}),Q("div",{className:"bg-white dark:bg-black rounded p-2 font-mono text-sm whitespace-pre-wrap break-words max-h-60 overflow-y-auto",children:a.text})]}),a.blob&&_e("div",{className:"text-sm text-gray-600 dark:text-gray-400",children:["[Binary content: ",a.blob.length||0," bytes]"]}),a.annotations&&_e("div",{className:"mt-2",children:[Q("div",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Annotations:"}),Q(Dt,{data:a.annotations,filename:`resource-annotations-${s}.json`,"data-testid":"tool-execution-results-resource-annotations"})]})]})]},s)}return _e("div",{className:"space-y-2",children:[_e("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:["Unknown Content Type: ",r.type||"N/A"]}),Q(Dt,{data:r,filename:`content-${s}.json`,"data-testid":"tool-execution-results-unknown-content"})]},s)})})}function Il({results:e,copiedResult:t,serverId:n,readResource:o,onCopy:r,onMaximize:s,isMaximized:a=!1,onRerunTool:i,onAuthenticateAndRerun:c,pendingAuthorizationTimestamp:l,isAuthenticating:u=!1,authorizationError:f,onWidgetHeightChange:d}){let[h,m]=Hr(0),[b,p]=Hr(!0),[v,x]=Hr("json"),[y,g]=Hr("inline"),[N,k]=Hr(null),I=e[0],R=I?e.filter(te=>te.toolName===I.toolName):[],C=R[h]||R[0],E=e.findIndex(te=>te===C),T=C?C.error||qg(C.result):null,w=T??(C!=null?JSON.stringify(C.result,null,2):"");Da(()=>{R.length>0&&h>=R.length&&m(0)},[R.length,h]);let P=vo(()=>C?.args,[C?.timestamp,h]),L=vo(()=>C?.result,[C?.timestamp,C?.duration,h]),M=Wg(te=>o(te),[o]),q=vo(()=>C&&WC(C.toolMeta)?"mcp-apps":null,[C]),U=vo(()=>C?.toolMeta?qC(C.toolMeta):null,[C?.toolMeta]),K=vo(()=>q==="mcp-apps"&&!!U,[q,U]);Da(()=>{x(K?"mcp-apps":"json")},[I?.toolName,K]);let H=vo(()=>C?.result?.content||[],[C]),J=vo(()=>U||null,[U]),Y=vo(()=>!!(H&&H.length>0||C?.result?.structuredContent),[H,C]),$=vo(()=>!K&&Y,[K,Y]),G=vo(()=>{let te=[];return K&&U&&te.push({mode:"mcp-apps",label:"Component (MCP Apps)"}),te.push({mode:"json",label:"Raw JSON"}),te},[K,U]);return Da(()=>{G.length!==0&&(G.some(te=>te.mode===v)||x(K?"mcp-apps":"json"))},[G,K,v]),Da(()=>{d&&(e.length===0||v!=="mcp-apps"||y!=="inline"||!K)&&d(null)},[d,e.length,v,y,K]),e.length===0?Q("div",{className:"flex flex-col h-full bg-white dark:bg-black",children:Q("div",{className:"flex-1 overflow-y-auto h-full",children:Q("div",{className:"flex items-center justify-center h-full",children:Q("div",{className:"text-center",children:Q(Rs,{vertical:!0,noBorder:!0,message:"No Results yet"})})})})}):_e("div",{className:"relative flex flex-col h-full bg-white dark:bg-black",children:[Q("div",{className:"flex-1 overflow-y-auto h-full",children:_e("div",{className:"space-y-0 flex flex-col flex-1 min-h-full",children:[_e("div",{className:`sticky top-0 z-40 flex items-center gap-2 px-4 pt-2 backdrop-blur-xs bg-white/50 dark:bg-black/50 ${K||$?"border-b border-gray-200 dark:border-zinc-600 pb-2":""}`,children:[Q("h3",{className:"text-sm font-medium hidden sm:block",children:"Response"}),C.duration!==void 0&&_e("div",{className:"hidden sm:flex items-center gap-1",children:[Q(VC,{className:"h-3 w-3 text-gray-400"}),_e("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:[C.duration,"ms"]})]}),K&&Q("div",{className:"flex items-center gap-4 sm:ml-4",children:Q("div",{className:"flex items-center gap-2",children:G.map((te,Z)=>_e(jC.Fragment,{children:[Z>0&&Q("span",{className:"text-xs text-zinc-400",children:"|"}),Q("button",{"data-testid":`tool-result-view-${te.mode}`,onClick:()=>x(te.mode),className:`text-xs font-medium ${v===te.mode?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:te.label})]},te.mode))})}),$&&_e("div",{className:"flex items-center gap-2 sm:ml-4",children:[Q("button",{onClick:()=>p(!0),className:`text-xs font-medium ${b?"text-black dark:text-white":"text-zinc-500 dark:text-zinc-400"}`,children:"Formatted"}),Q("span",{className:"text-xs text-zinc-400",children:"|"}),Q("button",{onClick:()=>p(!1),className:`text-xs font-medium ${b?"text-zinc-500 dark:text-zinc-400":"text-black dark:text-white"}`,children:"Raw"})]}),_e("div",{className:"ml-auto flex items-center gap-1",children:[a&&i&&_e(A,{"data-testid":"tool-result-rerun",variant:"ghost",size:"sm",onClick:i,title:"Re-run with same arguments",children:[Q($C,{className:"h-4 w-4"}),Q("span",{className:"hidden sm:inline ml-1",children:"Re-run"})]}),K&&s&&Q(A,{"data-testid":"tool-result-maximize",variant:"ghost",size:"sm",onClick:s,title:a?"Restore":"Maximize",children:a?Q(FC,{className:"h-4 w-4"}):Q(UC,{className:"h-4 w-4"})}),R.length>1&&_e(un,{value:h.toString(),onValueChange:te=>m(parseInt(te)),children:[Q(hn,{className:"w-[140px] h-8 text-xs",leading:_e("div",{className:"flex items-center gap-1",children:[Q(Vg,{className:"h-3 w-3"}),Q(KC,{timestamp:C.timestamp})]})}),Q(gn,{children:R.map((te,Z)=>Q(ht,{value:Z.toString(),children:_e("div",{className:"flex items-center gap-2",children:[Q(Vg,{className:"h-3 w-3"}),Q("span",{children:Ad(te.timestamp)}),_e("span",{className:"text-xs text-muted-foreground",children:["(",new Date(te.timestamp).toLocaleTimeString(),")"]})]})},Z))})]}),Q(A,{"data-testid":`tool-result-copy-${E}`,variant:"ghost",size:"sm",onClick:()=>r(E,w),children:t===E?Q(zC,{className:"h-4 w-4"}):Q(BC,{className:"h-4 w-4"})})]})]}),(()=>{if(C.authorizationRequired){let z=!!c&&C.timestamp===l;return _e("div",{role:"alert","data-testid":"tool-result-auth-required",className:"mx-4 mt-4 flex flex-col gap-3 rounded-md border border-amber-300/60 bg-amber-50 p-3 text-amber-950 sm:flex-row sm:items-start dark:border-amber-500/40 dark:bg-amber-950/40 dark:text-amber-100",children:[Q(jg,{className:"mt-0.5 size-4 shrink-0","aria-hidden":!0}),_e("div",{className:"min-w-0 flex-1",children:[Q("p",{className:"font-medium",children:"Authentication required"}),Q("p",{className:"mt-0.5 text-sm opacity-90",children:"Authenticate to use this tool. The Inspector will rerun it automatically after authorization."}),z&&f&&Q("p",{className:"mt-1 text-xs text-red-700 dark:text-red-300",children:f})]}),_e(A,{"data-testid":"tool-result-authenticate-rerun",size:"sm",onClick:()=>{c?.(C.timestamp)},disabled:!z||u,className:"bg-amber-600 text-white hover:bg-amber-700 focus-visible:ring-amber-600 dark:bg-amber-500 dark:text-amber-950 dark:hover:bg-amber-400",children:[z&&u?Q(HC,{className:"size-3.5 animate-spin","aria-hidden":!0}):Q(jg,{className:"size-3.5","aria-hidden":!0}),z&&u?"Authenticating\u2026":"Authenticate and rerun"]})]})}let te=C.error||qg(C.result);return te?_e("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3 mx-4 mt-4",children:[Q("p",{className:"text-red-800 dark:text-red-300 font-medium",children:"Error:"}),Q("p",{className:"text-red-700 dark:text-red-400 text-sm",children:te})]}):(()=>{switch(v){case"mcp-apps":return!K||!U?Q("div",{className:"px-4 pt-4",children:Q("div",{className:"bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded p-3",children:Q("p",{className:"text-sm text-red-600 dark:text-red-400",children:"MCP Apps resource not available"})})}):_e(ka,{className:"relative flex flex-1 w-full min-h-[240px] items-stretch",children:[Q("div",{className:"absolute top-2 right-2 z-30 flex items-center gap-2",children:Q(Rl,{toolCallId:`tool-${C.timestamp}`,displayMode:y,onDisplayModeChange:g,propsContext:"tool",resourceUri:U,toolInput:C.args,resourceAnnotations:C.toolMeta,llmConfig:null,resource:null,onPropsChange:k})}),Q("div",{className:"flex min-h-0 flex-1 flex-col pt-11",children:Q(Cs,{serverId:n,viewId:`tool-${C.timestamp}`,toolName:C.toolName,toolInput:P,toolOutput:L,toolMetadata:C.toolMeta,resourceUri:U,readResource:M,customProps:N||void 0,displayMode:y,onDisplayModeChange:g,onWidgetHeightChange:d?z=>d(z):void 0,noWrapper:!0},`mcp-apps-${C.timestamp}`)})]});case"json":{if($&&b){let z=C.result?.structuredContent;return _e("div",{className:"px-4 pt-4 space-y-4","data-testid":"tool-execution-results-content",children:[z&&_e("div",{className:"space-y-2","data-testid":"tool-execution-results-structured-content",children:[Q("div",{className:"text-xs font-medium text-gray-500 dark:text-gray-400",children:"Structured Content"}),Q(Dt,{data:z,filename:`structured-content-${C.toolName}-${Date.now()}.json`})]}),H&&H.length>0&&Q(GC,{content:H}),!z&&(!H||H.length===0)&&Q("div",{className:"text-sm text-gray-500 dark:text-gray-400","data-testid":"tool-execution-results-no-content",children:"No content to display"})]})}return Q("div",{className:"px-4 pt-4",children:Q(Dt,{data:C.result,filename:`tool-result-${C.toolName}-${Date.now()}.json`})})}default:return null}})()})()]})}),J&&v==="mcp-apps"&&Q("div",{className:"absolute bottom-0 left-1/2 -translate-x-1/2 z-40 pointer-events-none",children:Q("span",{className:"text-[11px] bg-gray-200 dark:bg-zinc-800 text-gray-500 dark:text-gray-400 px-3 py-0.5 rounded-t-xl font-mono max-w-[320px] truncate block",children:J})})]})}import{isViewTool as YC}from"@mcp-use/client/react";import{useMemo as El,useState as XC}from"react";import{Fragment as ZC,jsx as Io,jsxs as Kg}from"react/jsx-runtime";function QC({widgetId:e}){let{getWidget:t}=er(),o=t(e)?.modelContext;if(!o?.content?.length&&!o?.structuredContent)return null;let r=o.content?.map(s=>s.text).join(" ")??JSON.stringify(o.structuredContent).slice(0,80);return Kg("div",{className:"flex items-center gap-1.5 px-3 py-1.5 text-[11px] text-muted-foreground bg-muted/30 border border-border/40 rounded-md mt-1",children:[Io("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-blue-400 shrink-0"}),Io("span",{className:"font-medium",children:"State synced to model"}),Io("span",{className:"truncate opacity-60 max-w-[300px]",children:r})]})}function Al({toolName:e,toolArgs:t,result:n,serverId:o,readResource:r,toolMeta:s,onSendFollowUp:a,modelContextScope:i,llmConfig:c,partialToolArgs:l,cancelled:u}){let f=El(()=>`chat-tool-${e}-${Date.now()}-${Math.random().toString(36).substring(2,11)}`,[e]),[d,h]=XC("inline"),m=El(()=>{if(!n)return null;if(typeof n=="string")try{return JSON.parse(n)}catch{return n}return n},[n]),b=YC(s),p=b?s?.ui?.resourceUri??null:null,v=El(()=>t,[e,m]),x=El(()=>m,[e,m]);return b&&p&&o&&r?Kg(ZC,{children:[Io(Cs,{serverId:o,viewId:f,toolName:e,resourceUri:p,toolInput:v,toolOutput:x,toolMetadata:s,readResource:r,displayMode:d,onDisplayModeChange:h,onSendFollowUp:a,modelContextScope:i,llmConfig:c,partialToolInput:l,cancelled:u,noWrapper:!0,className:"my-4"}),Io(QC,{widgetId:f})]}):b&&!p?Io("div",{className:"flex items-center justify-center w-full h-[200px] rounded border",children:Io(An,{className:"size-5"})}):b&&(!o||!r)?Io("div",{className:"my-4 p-4 bg-red-50/30 dark:bg-red-950/20 border border-red-200/50 dark:border-red-800/50 rounded-lg",children:Io("p",{className:"text-sm text-red-600 dark:text-red-400",children:"Cannot render widget: Missing required props (serverId or readResource)"})}):null}import{ViewRenderer as UV,isViewTool as FV,getViewResourceUri as $V}from"@mcp-use/client/react";import{createContext as eS,use as tS,useCallback as Vn,useState as nS}from"react";import{jsx as rS}from"react/jsx-runtime";var Jg=eS(void 0);function oS({children:e}){let t=typeof window<"u"?window.__MANUFACT_CHAT_URL__:void 0,n=typeof import.meta<"u"?import.meta.env?.VITE_MANUFACT_CHAT_URL:void 0,o=t?.trim()||n?.trim()||"https://cloud.manufact.com/api/v1/inspector/chat/stream",[r,s]=nS({selectedServerId:null,activeTab:"tools",selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null,tunnelUrl:null,isTunnelStarting:!1,isEmbedded:!1,embeddedConfig:{chatApiUrl:o,chatStreamProtocol:"data-stream",chatEnableFreeTierUpgrade:!0}}),a=Vn(y=>{s(g=>({...g,selectedServerId:y}))},[]),i=Vn(y=>{s(g=>({...g,activeTab:y}))},[]),c=Vn(y=>{s(g=>({...g,selectedToolName:y}))},[]),l=Vn(y=>{s(g=>({...g,selectedPromptName:y}))},[]),u=Vn(y=>{s(g=>({...g,selectedResourceUri:y}))},[]),f=Vn(y=>{s(g=>({...g,selectedSamplingRequestId:y}))},[]),d=Vn(y=>{s(g=>({...g,selectedElicitationRequestId:y}))},[]),h=Vn(y=>{s(g=>({...g,tunnelUrl:y}))},[]),m=Vn(y=>{s(g=>({...g,isTunnelStarting:y}))},[]),b=Vn((y,g={})=>{s(N=>({...N,isEmbedded:y,embeddedConfig:{...g,chatApiUrl:g.chatApiUrl?.trim()||o,chatStreamProtocol:g.chatStreamProtocol??"data-stream",chatEnableFreeTierUpgrade:g.chatEnableFreeTierUpgrade??!0}}))},[o]),p=Vn((y,g,N)=>{console.warn("[InspectorContext] navigateToItem called:",{serverId:y,tab:g,itemIdentifier:N}),s(k=>({...k,selectedServerId:y,activeTab:g,selectedToolName:g==="tools"&&N||null,selectedPromptName:g==="prompts"&&N||null,selectedResourceUri:g==="resources"&&N||null,selectedSamplingRequestId:g==="sampling"&&N||null,selectedElicitationRequestId:g==="elicitation"&&N||null}))},[]),v=Vn(()=>{s(y=>({...y,selectedToolName:null,selectedPromptName:null,selectedResourceUri:null,selectedSamplingRequestId:null,selectedElicitationRequestId:null}))},[]),x={...r,setSelectedServerId:a,setActiveTab:i,setSelectedToolName:c,setSelectedPromptName:l,setSelectedResourceUri:u,setSelectedSamplingRequestId:f,setSelectedElicitationRequestId:d,setTunnelUrl:h,setIsTunnelStarting:m,setEmbeddedMode:b,navigateToItem:p,clearSelection:v};return rS(Jg,{value:x,children:e})}function Eo(){let e=tS(Jg);if(!e)throw new Error("useInspector must be used within InspectorProvider");return e}import{GripVerticalIcon as sS}from"lucide-react";import*as Ur from"react-resizable-panels";import{jsx as _a}from"react/jsx-runtime";var{usePanelRef:Fr}=Ur;function ir({className:e,...t}){return _a(Ur.Group,{"data-slot":"resizable-panel-group",className:S("flex h-full w-full aria-[orientation=vertical]:flex-col",e),...t})}function Ln({...e}){return _a(Ur.Panel,{"data-slot":"resizable-panel",...e})}function lr({withHandle:e,className:t,...n}){return _a(Ur.Separator,{"data-slot":"resizable-handle",className:S("relative z-50 box-content shrink-0","focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-offset-1","before:pointer-events-none before:absolute before:bg-zinc-200 before:transition-[height,width,background-color] before:duration-200 before:ease-out dark:before:bg-zinc-700","hover:before:bg-foreground/35 dark:hover:before:bg-foreground/45","aria-[orientation=horizontal]:h-px aria-[orientation=horizontal]:w-full aria-[orientation=horizontal]:py-1.5 aria-[orientation=horizontal]:-my-1.5","aria-[orientation=horizontal]:before:inset-x-0 aria-[orientation=horizontal]:before:top-1.5 aria-[orientation=horizontal]:before:h-px","hover:aria-[orientation=horizontal]:before:h-0.5","aria-[orientation=vertical]:h-full aria-[orientation=vertical]:w-px aria-[orientation=vertical]:px-1.5 aria-[orientation=vertical]:-mx-1.5","aria-[orientation=vertical]:before:inset-y-0 aria-[orientation=vertical]:before:left-1.5 aria-[orientation=vertical]:before:w-px","hover:aria-[orientation=vertical]:before:w-0.5","[&[aria-orientation=horizontal]>div]:rotate-90",t),...n,children:e&&_a("div",{className:"pointer-events-none absolute top-1/2 left-1/2 z-10 flex h-4 w-3 -translate-x-1/2 -translate-y-1/2 items-center justify-center rounded-xs border border-zinc-200 bg-background shadow-sm dark:border-zinc-700",children:_a(sS,{className:"size-2.5 text-muted-foreground"})})})}import{AnimatePresence as JS,motion as Yd}from"motion/react";import{ChevronLeft as GS,Database as ch,Wrench as dh}from"lucide-react";import{useCallback as _n,useEffect as uh,useMemo as mh,useRef as zl,useState as qn}from"react";import{useState as aS}from"react";import{jsx as Gg}from"react/jsx-runtime";function bo({className:e,scrollRef:t,children:n}){let[o,r]=aS(!1);return Gg("div",{ref:t,className:S("h-full overflow-y-auto overscroll-none",e),onScroll:s=>r(s.currentTarget.scrollTop>0),children:Gg("div",{className:"flex min-h-full flex-col",children:n(o)})})}import{jsx as Oa,jsxs as Yg}from"react/jsx-runtime";function no({id:e,isSelected:t,isFocused:n,title:o,description:r,metadata:s,onClick:a,className:i,"data-testid":c}){return Oa("button",{id:e,"data-testid":c,type:"button",onClick:a,className:S("w-full text-left cursor-pointer p-2 sm:p-4 border-b dark:border-zinc-700 hover:bg-gray-50 dark:hover:bg-zinc-800/50 transition-colors group",t&&"bg-zinc-50 dark:bg-zinc-800 border-l-4 border-l-zinc-500",n&&"ring-2 ring-zinc-500 dark:ring-zinc-400 ring-inset",i),children:Yg("div",{className:"flex items-start gap-2 sm:gap-3",children:[Yg("div",{className:"flex-1 min-w-0",children:[Oa("div",{className:"flex items-center gap-2 mb-1",children:Oa("h3",{className:S("font-medium truncate font-mono text-sm"),children:o})}),r&&Oa("p",{className:"text-sm text-gray-600 dark:text-gray-400 line-clamp-2",children:r})]}),s&&Oa("div",{className:"flex-shrink-0 flex items-center self-center",children:s})]})})}import{forwardRef as iS}from"react";import{cva as lS}from"class-variance-authority";import{jsx as Ll}from"react/jsx-runtime";var cS={gray:"#a3a3a3",red:"#ef4444",orange:"#f97316",amber:"#f59e0b",yellow:"#eab308",lime:"#84cc16",green:"#22c55e",emerald:"#10b981",teal:"#14b8a6",cyan:"#06b6d4",blue:"#3b82f6",indigo:"#6366f1",violet:"#8b5cf6",purple:"#a855f7",fuchsia:"#d946ef",pink:"#ec4899",rose:"#f43f5e"},dS=lS("inline-flex items-center font-medium whitespace-nowrap",{variants:{variant:{solid:"",outline:"border border-border text-foreground"},size:{sm:"h-5 px-2 text-[11px] gap-1",md:"h-6 px-2.5 text-[12px] gap-1.5",lg:"h-7 px-3 text-[13px] gap-1.5"}},defaultVariants:{variant:"solid",size:"md"}}),Xg={default:{variant:"solid",color:"blue"},secondary:{variant:"solid",color:"green"},destructive:{variant:"solid",color:"red"},outline:{variant:"outline",color:"gray"}};function uS(e){return typeof e=="string"||typeof e=="number"}function mS({children:e}){return uS(e)?Ll("span",{className:"[text-box:trim-both_cap_alphabetic]",children:e}):Ll("span",{className:"inline-flex items-center gap-1",children:e})}var mn=iS(({className:e,variant:t="solid",size:n="md",color:o,children:r,style:s,...a},i)=>{let c=t&&t in Xg?Xg[t]:null,l=c?.variant??t,u=o??c?.color??"gray",f=kt(),d=cS[u],m=l==="solid"?u==="gray"?{backgroundColor:"var(--accent)",color:"var(--foreground)"}:{color:"var(--foreground)",backgroundColor:`color-mix(in srgb, ${d} 15%, var(--background))`}:{};return Ll("span",{ref:i,className:S(dS({variant:l,size:n}),f.item,e),style:{...m,...s},...a,children:Ll(mS,{children:r})})});mn.displayName="Badge";import{RefreshCw as fS,Search as gS}from"lucide-react";import{jsx as pS}from"react/jsx-runtime";function Ms({className:e,...t}){return pS("kbd",{"data-slot":"kbd",className:S("bg-muted text-muted-foreground pointer-events-none inline-flex h-5 w-fit min-w-5 items-center justify-center gap-1 rounded-sm px-1 font-sans text-xs font-medium select-none","[&_svg:not([class*='size-'])]:size-3","[[data-slot=tooltip-content]_&]:bg-background/20 [[data-slot=tooltip-content]_&]:text-background dark:[[data-slot=tooltip-content]_&]:bg-background/10",e),...t})}import{Fragment as Qg,jsx as Nn,jsxs as Ao}from"react/jsx-runtime";var hS="h-3.5 w-3.5 shrink-0 text-muted-foreground";function $r({activeTab:e,isSearchExpanded:t,searchQuery:n,primaryTabTitle:o,secondaryTabTitle:r,primaryCount:s,secondaryCount:a,secondaryIcon:i,primaryIcon:c,searchPlaceholder:l="Search...",onSearchExpand:u,onSearchChange:f,onSearchBlur:d,onTabSwitch:h,searchInputRef:m,primaryTabName:b,onRefresh:p,isRefreshing:v=!1,isScrolled:x=!1}){let y=e===b,g=y?c:i,N=y?o:r;return Ao("div",{className:`flex flex-row items-center justify-between gap-2 ${Vi(x)} ${jo}`,children:[Nn("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:t?Nn(Ae,{ref:m,placeholder:l,value:n,onChange:k=>f(k.target.value),onBlur:d,className:"h-8 border-gray-300 dark:border-zinc-600"}):Ao(Qg,{children:[Ao("h2",{className:`${qo} flex items-center gap-1.5`,children:[Nn(g,{className:hS,"aria-hidden":!0}),N]}),y&&Ao(Qg,{children:[Nn(mn,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:s}),Ao(Ie,{children:[Nn(Re,{render:Nn(A,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:Nn(gS,{className:"h-4 w-4"})}),nativeButton:!0}),Ao(Me,{side:"bottom",className:"flex gap-2",children:["Search",Nn(Ms,{children:"F"})]})]}),p&&Ao(Ie,{children:[Nn(Re,{render:Nn(A,{variant:"ghost",size:"sm",onClick:p,disabled:v,className:"h-8 w-8 p-0",children:Nn(fS,{className:`h-4 w-4 ${v?"animate-spin":""}`})}),nativeButton:!0}),Ao(Me,{side:"bottom",className:"flex gap-2",children:["Refresh list",Nn(Ms,{children:"R"})]})]})]})]})}),Ao(A,{variant:"ghost",size:"sm",onClick:h,className:"gap-2 flex-shrink-0",children:[Nn("span",{className:"hidden sm:inline",children:y?r:o}),y&&a>0&&Nn(mn,{className:"bg-purple-500/20 text-purple-600 dark:text-purple-400 border-transparent",variant:"outline",children:a})]})]})}import{RefreshCw as vS,Search as bS}from"lucide-react";import{Fragment as yS,jsx as sn,jsxs as cr}from"react/jsx-runtime";function Dl({title:e,count:t,icon:n,isSearchExpanded:o,searchQuery:r,searchPlaceholder:s,onSearchExpand:a,onSearchChange:i,onSearchBlur:c,searchInputRef:l,titleTestId:u,bulkAction:f,onRefresh:d,isRefreshing:h=!1,isScrolled:m=!1}){let b=f?.icon;return cr("div",{className:`flex flex-row items-center justify-between gap-2 ${Vi(m)} ${jo}`,children:[sn("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:o?sn(Ae,{ref:l,placeholder:s,value:r,onChange:v=>i(v.target.value),onBlur:c,className:"h-8 border-gray-300 dark:border-zinc-600"}):cr(yS,{children:[cr("h2",{className:`${qo} flex items-center gap-1.5`,"data-testid":u,children:[n?sn(n,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-hidden":!0}):null,e]}),sn(mn,{className:"bg-zinc-500/20 text-zinc-600 dark:text-zinc-400 border-transparent",variant:"outline",children:t}),cr(Ie,{children:[sn(Re,{render:sn(A,{variant:"ghost",size:"sm",onClick:a,className:"h-8 w-8 p-0",children:sn(bS,{className:"h-4 w-4"})}),nativeButton:!0}),cr(Me,{side:"bottom",className:"flex gap-2",children:["Search",sn(Ms,{children:"F"})]})]}),d&&cr(Ie,{children:[sn(Re,{render:sn(A,{variant:"ghost",size:"sm",onClick:d,disabled:h,className:"h-8 w-8 p-0",children:sn(vS,{className:`h-4 w-4 ${h?"animate-spin":""}`})}),nativeButton:!0}),cr(Me,{side:"bottom",className:"flex gap-2",children:["Refresh list",sn(Ms,{children:"R"})]})]})]})}),f&&b&&sn("div",{className:"flex items-center gap-2",children:cr(Ie,{children:[sn(Re,{render:sn(A,{variant:"ghost",size:"sm",onClick:f.onClick,disabled:f.disabled,className:"h-8 w-8 p-0",children:sn(b,{className:"h-4 w-4"})}),nativeButton:!0}),sn(Me,{side:"bottom",children:f.label})]})})]})}import{Database as xS,Trash2 as wS}from"lucide-react";import{jsx as Dn,jsxs as Ld}from"react/jsx-runtime";function Dd({savedRequests:e,selectedRequest:t,onLoadRequest:n,onDeleteRequest:o,focusedIndex:r}){if(e.length===0)return Ld("div",{className:"flex flex-1 flex-col items-center justify-center p-4 text-center",children:[Dn(xS,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),Dn("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"No saved requests yet"}),Dn("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Execute a tool and click Save to store requests"})]});let s=(a,i)=>{a.stopPropagation(),i()};return Dn("div",{children:e.map((a,i)=>Ld("div",{className:"relative group",children:[Dn(no,{id:`saved-${a.id}`,isSelected:t?.id===a.id,isFocused:r===i,title:a.name,description:a.toolName,metadata:Dn("div",{className:"flex flex-col gap-1",children:Dn("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:new Date(a.savedAt).toLocaleString()})}),onClick:()=>n(a)}),Dn("div",{className:"absolute top-1/2 right-2 -translate-y-1/2 opacity-0 group-hover:opacity-100 transition-opacity z-10",children:Ld(Ie,{children:[Dn(Re,{render:Dn(A,{variant:"secondary",size:"sm",onClick:c=>s(c,()=>o(a.id)),className:"h-8 w-8 p-0",children:Dn(wS,{className:"h-4 w-4"})}),nativeButton:!0}),Dn(Me,{children:Dn("p",{children:"Delete saved request"})})]})})]},a.id))})}import{Save as CS}from"lucide-react";import{jsx as Is,jsxs as za}from"react/jsx-runtime";function _d({isOpen:e,requestName:t,defaultPlaceholder:n,onRequestNameChange:o,onSave:r,onCancel:s}){return e?Is("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",onClick:s,children:za("div",{className:"bg-white dark:bg-zinc-800 rounded-lg p-6 w-[400px] shadow-xl border border-gray-200 dark:border-zinc-700",onClick:a=>a.stopPropagation(),children:[Is("h3",{className:"text-lg font-semibold mb-4 text-gray-900 dark:text-gray-100",children:"Save Request"}),za("div",{className:"space-y-4",children:[za("div",{children:[Is(Be,{htmlFor:"request-name",children:"Request Name (optional)"}),Is(Ae,{id:"request-name",value:t,onChange:a=>o(a.target.value),placeholder:n,className:"mt-2",onKeyDown:a=>{a.key==="Enter"&&r()},autoFocus:!0})]}),za("div",{className:"flex justify-end gap-2",children:[Is(A,{variant:"outline",onClick:s,children:"Cancel"}),za(A,{onClick:r,children:[Is(CS,{className:"h-4 w-4 mr-2"}),"Save"]})]})]})]})}):null}import{Check as SS,ChevronDown as NS,ChevronUp as TS,Code as kS,Copy as PS,Play as RS,Save as MS,X as IS}from"lucide-react";import{useEffect as Zg,useRef as ES,useState as Ba}from"react";import{Fragment as Es,jsx as Pe,jsxs as Ht}from"react/jsx-runtime";function Od({selectedTool:e,toolArgs:t,payloadToSend:n,isExecuting:o,isConnected:r,onArgChange:s,onExecute:a,onSave:i,onCancel:c,onBulkPaste:l,autoFilledFields:u,setFields:f,sendEmptyFields:d,onToggleEmpty:h}){let m="hidden @[700px]/tool-exec:inline",b="hidden @[700px]/tool-exec:inline shrink-0 text-[10px] leading-none border border-current/30 p-1 rounded-full",p="@max-[699px]/tool-exec:size-8 @max-[699px]/tool-exec:min-w-8 @max-[699px]/tool-exec:shrink-0 @max-[699px]/tool-exec:gap-0 @max-[699px]/tool-exec:rounded-full @max-[699px]/tool-exec:!px-0 @max-[699px]/tool-exec:!py-0",v="@max-[699px]/tool-exec:!pr-0",[x,y]=Ba(!1),[g,N]=Ba(!1),[k,I]=Ba(!1),[R,C]=Ba(!1),[E,T]=Ba(!1),w=ES(null);Zg(()=>{if(w.current&&e?.description){let M=w.current,q=parseFloat(getComputedStyle(M).lineHeight),U=M.scrollHeight,K=Math.round(U/q);T(K>3),C(!1)}},[e?.description]);let P=async()=>{e&&await st(JSON.stringify(e,null,2))},L=async()=>{if(e)try{await st(JSON.stringify(n??t,null,2)),I(!0),setTimeout(()=>I(!1),2e3)}catch{}};return Zg(()=>{let M=q=>{if(q.key==="Escape"&&o&&c){q.preventDefault(),c();return}if(q.key!=="Enter")return;let U=q.metaKey||q.ctrlKey,K=!q.metaKey&&!q.ctrlKey&&!q.altKey&&!q.shiftKey,H=q.target,J=H instanceof HTMLInputElement&&H.dataset.toolArgumentInput==="true";(U||K&&J)&&e&&!o&&r&&(q.preventDefault(),a())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[e,o,r,a,c]),e?Ht("div",{className:"flex flex-col h-full @container/tool-exec",children:[Pe("div",{className:"shrink-0 p-3 sm:p-5 pt-3 sm:pt-4 pb-2 sm:pb-2 sm:pr-4",children:Pe("div",{children:Ht("div",{className:"flex flex-row items-center justify-between mb-0 gap-2",children:[Pe("h3",{className:"text-base sm:text-lg font-semibold","data-testid":"tool-execution-title",children:e.name}),Ht("div",{className:"flex gap-2 shrink-0",children:[Ht(Ie,{children:[Pe(Re,{render:Ht(A,{"data-testid":"tool-execution-metadata-button",variant:g?"default":"outline",onClick:()=>N(!g),disabled:o,size:"sm",className:S(Nr,p),title:"View tool metadata",children:[Pe(kS,{}),Pe("span",{className:m,children:"Metadata"})]}),nativeButton:!0}),Pe(Me,{children:Pe("p",{children:"View tool definition metadata"})})]}),Ht(Ie,{children:[Pe(Re,{render:Ht(A,{"data-testid":"tool-execution-copy-payload-button",variant:"outline",onClick:L,disabled:o,size:"sm",className:S(Nr,p),title:"Copy payload as JSON",children:[k?Pe(SS,{className:"text-green-600"}):Pe(PS,{}),Pe("span",{className:m,children:k?"Copied!":"Payload"})]}),nativeButton:!0}),Pe(Me,{children:Pe("p",{children:"Copy payload as JSON"})})]}),Ht(Ie,{children:[Pe(Re,{render:Ht(A,{"data-testid":"tool-execution-save-button",variant:"outline",onClick:i,disabled:o,size:"sm",className:S(Nr,p),title:"Save request",children:[Pe(MS,{}),Pe("span",{className:m,children:"Save"})]}),nativeButton:!0}),Pe(Me,{children:Pe("p",{children:"Save request"})})]}),o&&c?Ht(Ie,{open:x?void 0:!1,children:[Pe(Re,{render:Pe("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1),className:"relative",children:Pe(A,{"data-testid":"tool-execution-cancel-button",onClick:c,variant:x?"destructive":"default",size:"sm",className:S(da,p,v,"transition-all"),children:x?Ht(Es,{children:[Pe(IS,{}),Pe("span",{className:m,children:"Cancel"}),Pe("span",{className:b,children:"Esc"})]}):Ht(Es,{children:[Pe(An,{}),Pe("span",{className:m,children:"Executing..."})]})})}),nativeButton:!1}),Pe(Me,{children:Pe("p",{children:"Hover to cancel (or press Esc)"})})]}):Pe(A,{"data-testid":"tool-execution-execute-button",onClick:a,disabled:o||!r,size:"sm",className:S(da,p,v),children:o?Ht(Es,{children:[Pe(An,{}),Pe("span",{className:m,children:"Executing..."})]}):Ht(Es,{children:[Pe(RS,{}),Pe("span",{className:m,children:"Execute"}),Pe("span",{className:b,children:"\u2318\u21B5"})]})})]})]})})}),Ht("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 pb-4 pr-3",children:[e.description&&Ht("div",{className:"relative mb-6",children:[Ht("div",{className:"relative",children:[Pe("p",{ref:w,"data-testid":"tool-execution-description",className:`text-sm text-gray-600 dark:text-gray-400 leading-relaxed transition-all duration-300 ${!R&&E?"line-clamp-3":""}`,children:e.description}),E&&!R&&Pe("div",{className:"absolute bottom-0 left-0 right-0 h-[1.4em] bg-linear-to-t from-white/95 dark:from-black/95 via-white/55 dark:via-black/55 to-transparent pointer-events-none"})]}),E&&Pe("div",{className:"flex justify-end",children:Pe("button",{onClick:()=>C(!R),className:"relative z-10 inline-flex items-center gap-1 text-xs text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 mt-1 transition-colors",children:R?Ht(Es,{children:["Show less",Pe(TS,{className:"h-3 w-3"})]}):Ht(Es,{children:["Show more",Pe(NS,{className:"h-3 w-3"})]})})})]}),Pe(fd,{selectedTool:e,toolArgs:t,onArgChange:s,onBulkPaste:l,autoFilledFields:u,setFields:f,sendEmptyFields:d,onToggleEmpty:h})]}),Pe(on,{open:g,onOpenChange:N,children:Ht(Xt,{scrollable:!0,className:"max-w-3xl max-h-[80vh]",children:[Pe(Gt,{sticky:!0,children:Pe($t,{children:"Tool Definition"})}),Pe(pn,{children:Pe(Fi,{onCopy:P,children:Pe(Dt,{data:e,filename:`tool-definition-${e.name}-${Date.now()}.json`})})})]})})]}):Ht("div",{className:"flex flex-col items-center justify-center h-full p-4 text-center",children:[Pe("p",{className:"text-gray-500 dark:text-gray-400 mb-2",children:"Select a tool to get started"}),Pe("p",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Choose a tool from the list to view its details and execute it"})]})}import{PanelsTopLeft as AS,Wrench as LS}from"lucide-react";import{isViewTool as DS}from"@mcp-use/client/react";import{jsx as Lo,jsxs as _l}from"react/jsx-runtime";function zd({tools:e,selectedTool:t,onToolSelect:n,focusedIndex:o}){if(e.length===0)return _l("div",{className:"flex flex-1 flex-col items-center justify-center p-4 text-center",children:[Lo(LS,{className:"h-12 w-12 text-gray-400 dark:text-gray-600 mb-3"}),Lo("p",{className:"text-gray-500 dark:text-gray-400",children:"No tools available"})]});let r=e.some(s=>s.inputSchema?.properties&&Object.keys(s.inputSchema.properties).length>0);return Lo("div",{children:e.map((s,a)=>{let i=s._meta,c=DS(i)?"mcp-apps":null,l=s.inputSchema?.properties,u=l?Object.keys(l).length:0,f=r&&u>0&&_l(mn,{variant:"outline",className:"text-xs border-gray-300 dark:border-zinc-600 text-gray-600 dark:text-gray-400",children:[u," params"]}),h=c==="mcp-apps"||f?_l("div",{className:"flex items-center gap-1.5",children:[c==="mcp-apps"&&_l(Ie,{children:[Lo(Re,{render:Lo("span",{className:"inline-flex",children:Lo(AS,{className:"h-3.5 w-3.5"})}),nativeButton:!1}),Lo(Me,{children:Lo("p",{children:"UI widget"})})]}),f]}):void 0;return Lo(no,{id:`tool-${s.name}`,"data-testid":`tool-item-${s.name}`,isSelected:t?.name===s.name,isFocused:o===a,title:s.name,description:s.description,metadata:h,onClick:()=>n(s)},s.name)})})}import{AlertDialog as Vr}from"@base-ui/react/alert-dialog";import{jsx as jn,jsxs as zS}from"react/jsx-runtime";function Bd({...e}){return jn(Vr.Root,{"data-slot":"alert-dialog",...e})}function _S({...e}){return jn(Vr.Portal,{"data-slot":"alert-dialog-portal",...e})}function OS({className:e,...t}){return jn(Vr.Backdrop,{"data-slot":"alert-dialog-overlay",className:S("fixed inset-0 isolate z-50 bg-black/50 duration-100 data-open:animate-in data-open:fade-in-0 data-closed:animate-out data-closed:fade-out-0",e),...t})}function Hd({className:e,size:t="default",...n}){return zS(_S,{children:[jn(OS,{}),jn(Vr.Popup,{"data-slot":"alert-dialog-content","data-size":t,className:S("group/alert-dialog-content fixed top-1/2 left-1/2 z-50 grid w-full -translate-x-1/2 -translate-y-1/2 gap-6 rounded-xl bg-popover p-6 text-popover-foreground ring-1 ring-foreground/10 duration-100 outline-none data-[size=default]:max-w-xs data-[size=sm]:max-w-xs data-[size=default]:sm:max-w-lg data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95",e),...n})]})}function Ud({className:e,...t}){return jn("div",{"data-slot":"alert-dialog-header",className:S("grid grid-rows-[auto_1fr] place-items-center gap-1.5 text-center has-data-[slot=alert-dialog-media]:grid-rows-[auto_auto_1fr] has-data-[slot=alert-dialog-media]:gap-x-6 sm:group-data-[size=default]/alert-dialog-content:place-items-start sm:group-data-[size=default]/alert-dialog-content:text-left sm:group-data-[size=default]/alert-dialog-content:has-data-[slot=alert-dialog-media]:grid-rows-[auto_1fr]",e),...t})}function Fd({className:e,...t}){return jn("div",{"data-slot":"alert-dialog-footer",className:S("flex flex-col-reverse gap-2 group-data-[size=sm]/alert-dialog-content:grid group-data-[size=sm]/alert-dialog-content:grid-cols-2 sm:flex-row sm:justify-end",e),...t})}function $d({className:e,...t}){return jn(Vr.Title,{"data-slot":"alert-dialog-title",className:S("text-lg font-medium sm:group-data-[size=default]/alert-dialog-content:group-has-data-[slot=alert-dialog-media]/alert-dialog-content:col-start-2",e),...t})}function Vd({className:e,...t}){return jn(Vr.Description,{"data-slot":"alert-dialog-description",className:S("text-sm text-balance text-muted-foreground md:text-pretty *:[a]:underline *:[a]:underline-offset-3 *:[a]:hover:text-foreground",e),...t})}function jd({className:e,...t}){return jn(A,{"data-slot":"alert-dialog-action",className:S(e),...t})}function qd({className:e,variant:t="outline",size:n="default",...o}){return jn(Vr.Close,{"data-slot":"alert-dialog-cancel",className:S(e),render:jn(A,{variant:t,size:n}),...o})}import{useCallback as BS,useEffect as eh,useState as HS}from"react";var Wd="mcp-inspector-saved-requests";function th(){let[e,t]=HS([]);eh(()=>{try{let o=localStorage.getItem(Wd);o&&t(JSON.parse(o))}catch(o){console.error("[useSavedRequests] Failed to load saved requests:",o)}},[]),eh(()=>{let o=r=>{if(r.key===Wd&&r.newValue)try{t(JSON.parse(r.newValue))}catch(s){console.error("[useSavedRequests] Failed to parse saved requests:",s)}};return window.addEventListener("storage",o),()=>window.removeEventListener("storage",o)},[]);let n=BS(o=>{try{localStorage.setItem(Wd,JSON.stringify(o)),t(o)}catch(r){console.error("[useSavedRequests] Failed to save requests:",r)}},[]);return{savedRequests:e,saveSavedRequests:n}}import{isOAuthInteractionRequired as VS}from"@mcp-use/client/react";import{useCallback as jr,useEffect as jS,useMemo as qS,useRef as Ol,useState as qr}from"react";var US="__mcpUseInspectorPendingToolExecution";function Kd(){try{return typeof sessionStorage>"u"?void 0:sessionStorage}catch{return}}function Jd(e){return`${US}:${encodeURIComponent(e)}`}function Ha(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function FS(e){return Ha(e)?typeof e.serverId=="string"&&typeof e.toolName=="string"&&e.toolName.length>0&&Ha(e.args)&&Ha(e.displayArgs)&&typeof e.timestamp=="number"&&Number.isFinite(e.timestamp)&&(e.toolMeta===void 0||Ha(e.toolMeta))&&(e.widgetResourceUri===void 0||typeof e.widgetResourceUri=="string"):!1}function $S(e){return Ha(e)&&typeof e.savedAt=="number"&&Number.isFinite(e.savedAt)&&FS(e.execution)}function nh(e,t=Kd()){if(!t)return null;let n=Jd(e);try{let o=t.getItem(n);if(!o)return null;let r=JSON.parse(o);return!$S(r)||r.execution.serverId!==e||Date.now()-r.savedAt>9e5?(t.removeItem(n),null):r.execution}catch{try{t.removeItem(n)}catch{}return null}}function oh(e,t=Kd()){if(t)try{t.setItem(Jd(e.serverId),JSON.stringify({savedAt:Date.now(),execution:e}))}catch{}}function Gd(e,t=Kd()){if(t)try{t.removeItem(Jd(e))}catch{}}function rh(e,t){if(!e)return t;if(!t)return e;let n=e.ui&&typeof e.ui=="object"&&!Array.isArray(e.ui)?e.ui:void 0,o=t.ui&&typeof t.ui=="object"&&!Array.isArray(t.ui)?t.ui:void 0;return{...e,...t,...n||o?{ui:{...n,...o}}:{}}}function sh(e,t=0){return{toolName:e.toolName,args:e.displayArgs,result:null,authorizationRequired:!0,timestamp:e.timestamp,duration:t,toolMeta:e.toolMeta}}function ah({selectedTool:e,payloadToSend:t,toolArgs:n,callTool:o,readResource:r,serverId:s,isConnected:a,authenticate:i,isAuthenticating:c=!1}){let[l,u]=qr(()=>nh(s)),[f,d]=qr(()=>l?[sh(l)]:[]),[h,m]=qr(!1),[b,p]=qr(!1),[v,x]=qr(null),[y,g]=qr(null),N=Ol(!1),k=Ol(null),I=Ol(new WeakSet),R=Ol(l!==null),[C,E]=qr(0),T=jr(async H=>{if(N.current)return;let J=new AbortController;N.current=!0,k.current=J,m(!0);let Y=Date.now();try{if(H.widgetResourceUri){try{await r(H.widgetResourceUri)}catch{}d([{toolName:H.toolName,args:H.args,result:null,timestamp:H.timestamp,duration:0,toolMeta:H.toolMeta}])}let $=await o(H.toolName,H.args,{timeout:6e5,resetTimeoutOnProgress:!0,signal:J.signal}),G=Date.now()-Y,te=rh(H.toolMeta,$?._meta);Jt(new ra({toolName:H.toolName,serverId:s,success:!0,duration:G})).catch(()=>{}),window.dispatchEvent(new Event("mcp-tool-executed")),H.widgetResourceUri?d(Z=>Z.map((z,F)=>F===0?{...z,result:$,duration:G,toolMeta:te}:z)):d(Z=>[{toolName:H.toolName,args:H.displayArgs,result:$,timestamp:H.timestamp,duration:G,toolMeta:te},...Z])}catch($){if(I.current.has(J))return;let G=Date.now()-Y;if(Jt(new ra({toolName:H.toolName,serverId:s,success:!1,duration:G,error:$ instanceof Error?$.message:String($)})).catch(()=>{}),window.dispatchEvent(new Event("mcp-tool-executed")),VS($)){let Z={...H,serverId:s};R.current=!1,u(Z),x(null);let z=sh(H,G);H.widgetResourceUri?d([z]):d(F=>[z,...F.filter(ie=>!(ie.authorizationRequired&&ie.timestamp===H.timestamp))]);return}let te={toolName:H.toolName,args:H.displayArgs,result:null,error:$ instanceof Error?$.message:String($),timestamp:H.timestamp,duration:G,toolMeta:H.toolMeta};H.widgetResourceUri?d([te]):d(Z=>[te,...Z])}finally{k.current===J&&(k.current=null,N.current=!1,m(!1))}},[o,r,s]),w=jr(async()=>{if(!e||N.current)return;let H=e?._meta||e?.metadata,J=H?.ui?.resourceUri;await T({toolName:e.name,args:t,displayArgs:n,timestamp:Date.now(),toolMeta:H,...typeof J=="string"?{widgetResourceUri:J}:{}})},[e,t,n,T]);jS(()=>{!l||!a||!R.current||N.current||(R.current=!1,Gd(s),u(null),x(null),p(!1),d(H=>H.filter(J=>!(J.authorizationRequired&&J.timestamp===l.timestamp))),T(l))},[T,a,l,C,s]);let P=jr(async H=>{if(!(!l||l.timestamp!==H||!i||b)){oh(l),x(null),p(!0);try{await i(),R.current=!0,E(J=>J+1)}catch(J){Gd(s),x(J instanceof Error?J.message:"Authentication failed")}finally{p(!1)}}},[i,b,l,s]),L=jr(async(H,J)=>{try{await st(J),g(H),setTimeout(()=>g(null),2e3)}catch(Y){console.error("[ToolsTab] Failed to copy result:",Y)}},[]),M=jr(H=>{d(J=>J.filter((Y,$)=>$!==H))},[]),q=qS(()=>{let H=e?.name??f[0]?.toolName;return H?f.filter(J=>J.toolName===H):[]},[f,e]),U=jr(H=>{let J=q[H];if(!J)return;let Y=window.open("","_blank","width=800,height=600");Y&&(Y.document.write(`
|
|
103
103
|
<html>
|
|
104
104
|
<head><title>${J.toolName} Result</title></head>
|
|
105
105
|
<body><pre>${JSON.stringify(J.result,null,2)}</pre></body>
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var rr=Object.create;var Ne=Object.defineProperty;var nr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var sr=Object.getPrototypeOf,ir=Object.prototype.hasOwnProperty;var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ar=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of or(e))!ir.call(t,o)&&o!==r&&Ne(t,o,{get:()=>e[o],enumerable:!(n=nr(e,o))||n.enumerable});return t};var cr=(t,e,r)=>(r=t!=null?rr(sr(t)):{},ar(e||!t||!t.__esModule?Ne(r,"default",{value:t,enumerable:!0}):r,t));var pt=V((es,dt)=>{"use strict";dt.exports=class{constructor(e={}){this.points=e.points,this.duration=e.duration,this.blockDuration=e.blockDuration,this.execEvenly=e.execEvenly,this.execEvenlyMinDelayMs=e.execEvenlyMinDelayMs,this.keyPrefix=e.keyPrefix}get points(){return this._points}set points(e){if(Number.isFinite(e))this._points=e;else throw new Error("points must be set and must be a finite number")}get duration(){return this._duration}set duration(e){if(typeof e=="number"&&Number.isFinite(e)&&e>=0)this._duration=e;else throw new Error("duration must be set and must be a finite, non-negative number")}get msDuration(){return this.duration*1e3}get blockDuration(){return this._blockDuration}set blockDuration(e){this._blockDuration=typeof e>"u"?0:e}get msBlockDuration(){return this.blockDuration*1e3}get execEvenly(){return this._execEvenly}set execEvenly(e){this._execEvenly=typeof e>"u"?!1:!!e}get execEvenlyMinDelayMs(){return this._execEvenlyMinDelayMs===void 0?this._getExecEvenlyMinDelayMsDefault():this._execEvenlyMinDelayMs}set execEvenlyMinDelayMs(e){this._execEvenlyMinDelayMs=e}_getExecEvenlyMinDelayMsDefault(){return this.points>0?Math.ceil(this.msDuration/this.points):0}get keyPrefix(){return this._keyPrefix}set keyPrefix(e){if(typeof e>"u"&&(e="rlflx"),typeof e!="string")throw new Error("keyPrefix must be string");this._keyPrefix=e}_getKeySecDuration(e={}){return e&&e.customDuration>=0?e.customDuration:this.duration}getKey(e){return this.keyPrefix.length>0?`${this.keyPrefix}:${e}`:e}parseKey(e){return this.keyPrefix.length>0?e.substring(this.keyPrefix.length+1):e}consume(){throw new Error("You have to implement the method 'consume'!")}penalty(){throw new Error("You have to implement the method 'penalty'!")}reward(){throw new Error("You have to implement the method 'reward'!")}get(){throw new Error("You have to implement the method 'get'!")}set(){throw new Error("You have to implement the method 'set'!")}block(){throw new Error("You have to implement the method 'block'!")}delete(){throw new Error("You have to implement the method 'delete'!")}}});var ft=V((rs,ht)=>{"use strict";ht.exports=class{constructor(e,r,n=null){this.value=e,this.expiresAt=r,this.timeoutId=n}get value(){return this._value}set value(e){this._value=parseInt(e,10)}get expiresAt(){return this._expiresAt}set expiresAt(e){e instanceof Date?this._expiresAt=e.getTime():this._expiresAt=e}get timeoutId(){return this._timeoutId}set timeoutId(e){this._timeoutId=e}}});var Re=V((os,mt)=>{"use strict";mt.exports=class{constructor(e,r,n,o){this.remainingPoints=typeof e>"u"?0:e,this.msBeforeNext=typeof r>"u"?0:r,this.consumedPoints=typeof n>"u"?0:n,this.isFirstInDuration=typeof o>"u"?!1:o}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(e){return this._msBeforeNext=e,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(e){return this._remainingPoints=e,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(e){return this._consumedPoints=e,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(e){this._isFirstInDuration=!!e}_getDecoratedProperties(){return{remainingPoints:this.remainingPoints,msBeforeNext:this.msBeforeNext,consumedPoints:this.consumedPoints,isFirstInDuration:this.isFirstInDuration}}[Symbol.for("nodejs.util.inspect.custom")](){return this._getDecoratedProperties()}toString(){return JSON.stringify(this._getDecoratedProperties())}toJSON(){return this._getDecoratedProperties()}}});var wt=V((is,yt)=>{"use strict";var gt=ft(),Pe=Re();yt.exports=class{constructor(){this._storage=new Map}incrby(e,r,n){let o=this._storage.get(e);if(o){let s=o.expiresAt?o.expiresAt-Date.now():-1;return!o.expiresAt||s>0?(o.value=o.value+r,new Pe(0,s,o.value,!1)):this.set(e,r,n)}return this.set(e,r,n)}set(e,r,n){let o=n*1e3,s=this._storage.get(e);s&&s.timeoutId&&clearTimeout(s.timeoutId);let a=new gt(r,o>0?Date.now()+o:null);return this._storage.set(e,a),o>0&&(a.timeoutId=setTimeout(()=>{this._storage.delete(e)},o),a.timeoutId.unref&&a.timeoutId.unref()),new Pe(0,o===0?-1:o,a.value,!0)}get(e){let r=this._storage.get(e);if(r){let n=r.expiresAt?r.expiresAt-Date.now():-1;return new Pe(0,n,r.value,!1)}return null}delete(e){let r=this._storage.get(e);return r?(r.timeoutId&&clearTimeout(r.timeoutId),this._storage.delete(e),!0):!1}_restoreRecord(e,r,n){let o=Date.now(),s=n!==null;if(s&&!Number.isFinite(n)||s&&n<=o)return;let a=s?n-o:0,i=this._storage.get(e);i&&i.timeoutId&&clearTimeout(i.timeoutId);let c=new gt(r,n);this._storage.set(e,c),a>0&&(c.timeoutId=setTimeout(()=>{this._storage.delete(e)},a),c.timeoutId.unref&&c.timeoutId.unref())}}});var vt=V((as,xt)=>{"use strict";var Rr=pt(),Pr=wt(),bt=Re(),_e=class extends Rr{constructor(e={}){super(e),this._memoryStorage=new Pr}consume(e,r=1,n={}){return new Promise((o,s)=>{let a=this.getKey(e),i=this._getKeySecDuration(n),c=this._memoryStorage.incrby(a,r,i);if(c.remainingPoints=Math.max(this.points-c.consumedPoints,0),c.consumedPoints>this.points)this.blockDuration>0&&c.consumedPoints<=this.points+r&&(c=this._memoryStorage.set(a,c.consumedPoints,this.blockDuration)),s(c);else if(this.execEvenly&&this.points>0&&c.msBeforeNext>0&&!c.isFirstInDuration){let l=Math.ceil(c.msBeforeNext/(c.remainingPoints+2));l<this.execEvenlyMinDelayMs&&(l=c.consumedPoints*this.execEvenlyMinDelayMs),c.msBeforeNext=Math.max(c.msBeforeNext-l,0),setTimeout(o,l,c)}else o(c)})}penalty(e,r=1,n={}){let o=this.getKey(e);return new Promise(s=>{let a=this._getKeySecDuration(n),i=this._memoryStorage.incrby(o,r,a);i.remainingPoints=Math.max(this.points-i.consumedPoints,0),s(i)})}reward(e,r=1,n={}){let o=this.getKey(e);return new Promise(s=>{let a=this._getKeySecDuration(n),i=this._memoryStorage.incrby(o,-r,a);i.remainingPoints=Math.max(this.points-i.consumedPoints,0),s(i)})}block(e,r){let n=r*1e3,o=this.points+1;return this._memoryStorage.set(this.getKey(e),o,r),Promise.resolve(new bt(0,n===0?-1:n,o))}set(e,r,n){let o=(n>=0?n:this.duration)*1e3;return this._memoryStorage.set(this.getKey(e),r,n),Promise.resolve(new bt(0,o===0?-1:o,r))}get(e){let r=this._memoryStorage.get(this.getKey(e));return r!==null&&(r.remainingPoints=Math.max(this.points-r.consumedPoints,0)),Promise.resolve(r)}delete(e){return Promise.resolve(this._memoryStorage.delete(this.getKey(e)))}dump(){let e=[];for(let[r,n]of this._memoryStorage._storage)e.push({key:this.parseKey(r),value:n.value,expiresAt:n.expiresAt});return{version:1,dumpedAt:Date.now(),storage:e}}restore(e,r=!1){if(!e||typeof e!="object"||e.version!==1)return;let n=r?{invalid:{count:0,keys:[]},expired:{count:0,keys:[]},restored:{count:0,keys:[]}}:{invalid:0,expired:0,restored:0},o=(s,a)=>{r?(n[s].count+=1,n[s].keys.push(a)):n[s]+=1};if(!Array.isArray(e.storage))return n;for(let s of e.storage){if(!s||typeof s!="object"){o("invalid","N/A");continue}let a=typeof s.key=="string"||typeof s.key=="number",i=Number.isFinite(s.value),c=s.expiresAt===null||Number.isFinite(s.expiresAt);if(!a||!i||!c){o("invalid",s.key);continue}if(s.expiresAt!==null&&s.expiresAt<=Date.now()){o("expired",s.key);continue}this._memoryStorage._restoreRecord(this.getKey(s.key),s.value,s.expiresAt),o("restored",s.key)}return n}};xt.exports=_e});var ce=(t,e,r)=>(n,o)=>{let s=-1;return a(0);async function a(i){if(i<=s)throw new Error("next() called multiple times");s=i;let c,l=!1,u;if(t[i]?(u=t[i][0][0],n.req.routeIndex=i):u=i===t.length&&o||void 0,u)try{c=await u(n,()=>a(i+1))}catch(p){if(p instanceof Error&&e)n.error=p,c=await e(p,n),l=!0;else throw p}else n.finalized===!1&&r&&(c=await r(n));return c&&(n.finalized===!1||l)&&(n.res=c),n}};var Ue=Symbol();var je=(t,e)=>new Response(t,{headers:{"Content-Type":e.replace(/^[^;]+/,n=>n.toLowerCase())}}).formData();var He=32,lr=1e4,G=t=>"headers"in t,qe=async(t,e=Object.create(null))=>{let{all:r=!1,dot:n=!1}=e,a=(G(t)?t.headers:t.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();return a==="multipart/form-data"||a==="application/x-www-form-urlencoded"?ur(t,{all:r,dot:n}):{}};async function ur(t,e){if(!G(t)&&t.bodyCache.formData)return $e(await t.bodyCache.formData,e);let r=G(t)?t.headers:t.raw.headers,n=await t.arrayBuffer(),o=je(n,r.get("Content-Type")||"");G(t)||(t.bodyCache.formData=o);let s=await o;return s?$e(s,e):{}}function $e(t,e){let r=Object.create(null),n={count:0};return t.forEach((o,s)=>{e.all||s.endsWith("[]")?dr(r,s,o):r[s]=o}),e.dot&&Object.entries(r).forEach(([o,s])=>{o.includes(".")&&(pr(r,o,s,n),delete r[o])}),r}var dr=(t,e,r)=>{t[e]!==void 0?Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r]:e.endsWith("[]")?t[e]=[r]:t[e]=r},pr=(t,e,r,n)=>{if(/(?:^|\.)__proto__\./.test(e))return;let o=t,s=e.split(".",He+2);s.length>He+1&&Be(),s.forEach((a,i)=>{i===s.length-1?o[a]=r:((!o[a]||typeof o[a]!="object"||Array.isArray(o[a])||o[a]instanceof File)&&(n.count++>=lr&&Be(),o[a]=Object.create(null)),o=o[a])})},Be=()=>{throw new Error("Nesting limit exceeded")};var ue=t=>{let e=t.split("/");return e[0]===""&&e.shift(),e},ze=t=>{let{groups:e,path:r}=hr(t),n=ue(r);return fr(n,e)},hr=t=>{let e=[];return t=t.replace(/\{[^}]+\}/g,(r,n)=>{let o=`@${n}`;return e.push([o,r]),o}),{groups:e,path:t}},fr=(t,e)=>{for(let r=e.length-1;r>=0;r--){let[n]=e[r];for(let o=t.length-1;o>=0;o--)if(t[o].includes(n)){t[o]=t[o].replace(n,e[r][1]);break}}return t},X={},Fe=(t,e)=>{if(t==="*")return"*";let r=t.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(r){let n=`${t}#${e}`;return X[n]||(r[2]?X[n]=e&&e[0]!==":"&&e[0]!=="*"?[n,r[1],new RegExp(`^${r[2]}(?=/${e})`)]:[t,r[1],new RegExp(`^${r[2]}$`)]:X[n]=[t,r[1],!0]),X[n]}return null},We=(t,e)=>{try{return e(t)}catch{return t.replace(/(?:%[0-9A-Fa-f]{2})+/g,r=>{try{return e(r)}catch{return r}})}},mr=t=>We(t,decodeURI),de=t=>{let e=t.url,r=e.indexOf("/",e.indexOf(":")+4),n=r;for(;n<e.length;n++){let o=e.charCodeAt(n);if(o===37){let s=e.indexOf("?",n),a=e.indexOf("#",n),i=s===-1?a===-1?void 0:a:a===-1?s:Math.min(s,a),c=e.slice(r,i);return mr(c.includes("%25")?c.replace(/%25/g,"%2525"):c)}else if(o===63||o===35)break}return e.slice(r,n)};var Ve=t=>{let e=de(t);return e.length>1&&e.at(-1)==="/"?e.slice(0,-1):e},N=(t,e,...r)=>(r.length&&(e=N(e,...r)),`${t?.[0]==="/"?"":"/"}${t}${e==="/"?"":`${t?.at(-1)==="/"?"":"/"}${e?.[0]==="/"?e.slice(1):e}`}`),Y=t=>{if(t.charCodeAt(t.length-1)!==63||!t.includes(":"))return null;let e=t.split("/"),r=[],n="";return e.forEach(o=>{if(o!==""&&!/\:/.test(o))n+="/"+o;else if(/\:/.test(o))if(o.charCodeAt(o.length-1)===63){r.length===0&&n===""?r.push("/"):r.push(n);let s=o.slice(0,-1);n+="/"+s,r.push(n)}else n+="/"+o}),r.filter((o,s,a)=>a.indexOf(o)===s)},Q=t=>t.indexOf("%")!==-1?We(t,gr):t,le=t=>(t.indexOf("+")!==-1&&(t=t.replace(/\+/g," ")),Q(t)),Ke=(t,e,r)=>{let n=t.indexOf("#",8);n!==-1&&(t=t.slice(0,n));let o;if(!r&&e&&e.indexOf("%")===-1&&e.indexOf("+")===-1){let i=t.indexOf("?",8);if(i===-1)return;for(t.startsWith(e,i+1)||(i=t.indexOf(`&${e}`,i+1));i!==-1;){let c=t.charCodeAt(i+e.length+1);if(c===61){let l=i+e.length+2,u=t.indexOf("&",l);return le(t.slice(l,u===-1?void 0:u))}else if(c==38||isNaN(c))return"";i=t.indexOf(`&${e}`,i+1)}if(o=/[%+]/.test(t),!o)return}let s=Object.create(null);o??=/[%+]/.test(t);let a=t.indexOf("?",8);for(;a!==-1;){let i=t.indexOf("&",a+1),c=t.indexOf("=",a);c>i&&i!==-1&&(c=-1);let l=t.slice(a+1,c===-1?i===-1?void 0:i:c);if(o&&(l=le(l)),a=i,l==="")continue;let u;c===-1?u="":(u=t.slice(c+1,i===-1?void 0:i),o&&(u=le(u))),r?(s[l]&&Array.isArray(s[l])||(s[l]=[]),s[l].push(u)):s[l]??=u}return e?s[e]:s},Je=Ke,Ge=(t,e)=>Ke(t,e,!0),gr=decodeURIComponent;var Xe=class{raw;#t;#e;routeIndex=0;path;bodyCache={};constructor(t,e="/",r=[[]]){this.raw=t,this.path=e,this.#e=r}param(t){return t?this.#r(t):this.#s()}#r(t){let e=this.#e[0][this.routeIndex]?.[1][t],r=this.#n(e);return r&&Q(r)}#s(){let t={},e=Object.keys(this.#e[0][this.routeIndex]?.[1]??{});for(let r of e){let n=this.#n(this.#e[0][this.routeIndex][1][r]);n!==void 0&&(t[r]=Q(n))}return t}#n(t){return this.#e[1]?this.#e[1][t]:t}query(t){return Je(this.url,t)}queries(t){return Ge(this.url,t)}header(t){if(t)return this.raw.headers.get(t)??void 0;let e=Object.create(null);return this.raw.headers.forEach((r,n)=>{e[n]=r}),e}async parseBody(t){return qe(this,t)}#o=t=>{let{bodyCache:e,raw:r}=this,n=e[t];if(n)return n;for(let o in e)return e[o].then(s=>(o==="json"&&(s=JSON.stringify(s)),new Response(s)[t]()));return e[t]=r[t]()};json(){return this.#o("text").then(t=>JSON.parse(t))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}bytes(){return this.#o("arrayBuffer").then(t=>new Uint8Array(t))}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(t,e){(this.#t??={})[t]=e}valid(t){return this.#t?.[t]}get url(){return this.raw.url}get method(){return this.raw.method}get[Ue](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,t]])=>t)}get routePath(){return this.#e[0].map(([[,t]])=>t)[this.routeIndex].path}};var Ye={Stringify:1,BeforeStream:2,Stream:3},yr=(t,e)=>{let r=new String(t);return r.isEscaped=!0,r.callbacks=e,r};var pe=async(t,e,r,n,o)=>{typeof t=="object"&&!(t instanceof String)&&(t instanceof Promise||(t=t.toString()),t instanceof Promise&&(t=await t));let s=t.callbacks;if(!s?.length)return Promise.resolve(t);o?o[0]+=t:o=[t];let a=Promise.all(s.map(i=>i({phase:e,buffer:o,context:n}))).then(i=>Promise.all(i.filter(Boolean).map(c=>pe(c,e,!1,n,o))).then(()=>o[0]));return r?yr(await a,s):a};var wr="text/plain; charset=UTF-8",he=(t,e)=>({"Content-Type":t,...e}),K=(t,e)=>new Response(t,e),fe=class{#t;#e;env={};#r;finalized=!1;error;#s;#n;#o;#u;#c;#l;#a;#d;#p;constructor(t,e){this.#t=t,e&&(this.#n=e.executionCtx,this.env=e.env,this.#l=e.notFoundHandler,this.#p=e.path,this.#d=e.matchResult)}get req(){return this.#e??=new Xe(this.#t,this.#p,this.#d),this.#e}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;throw Error("This context has no ExecutionContext")}get res(){return this.#o||=K(null,{headers:this.#a??=new Headers})}set res(t){if(this.#o&&t){t=K(t.body,t);for(let[e,r]of this.#o.headers.entries())if(e!=="content-type")if(e==="set-cookie"){let n=this.#o.headers.getSetCookie();t.headers.delete("set-cookie");for(let o of n)t.headers.append("set-cookie",o)}else t.headers.set(e,r)}this.#o=t,this.finalized=!0}render=(...t)=>(this.#c??=e=>this.html(e),this.#c(...t));setLayout=t=>this.#u=t;getLayout=()=>this.#u;setRenderer=t=>{this.#c=t};header=(t,e,r)=>{this.finalized&&(this.#o=K(this.#o.body,this.#o));let n=this.#o?this.#o.headers:this.#a??=new Headers;e===void 0?n.delete(t):r?.append?n.append(t,e):n.set(t,e)};status=t=>{this.#s=t};set=(t,e)=>{this.#r??=new Map,this.#r.set(t,e)};get=t=>this.#r?this.#r.get(t):void 0;get var(){return this.#r?Object.fromEntries(this.#r):{}}#i(t,e,r){let n=this.#o?new Headers(this.#o.headers):this.#a;if(typeof e=="object"&&e.headers){n??=new Headers;for(let[s,a]of new Headers(e.headers))s==="set-cookie"?n.append(s,a):n.set(s,a)}if(r){if(!n){let s=0;for(let a in r)if(++s>1||typeof r[a]!="string"){n=new Headers;break}}if(n)for(let s in r){let a=r[s];if(typeof a=="string")n.set(s,a);else{n.delete(s);for(let i of a)n.append(s,i)}}}let o=typeof e=="number"?e:e?.status??this.#s;return K(t,{status:o,headers:n??r})}newResponse=(...t)=>this.#i(...t);body=(t,e,r)=>this.#i(t,e,r);text=(t,e,r)=>!this.#a&&!this.#s&&!e&&!r&&!this.finalized?new Response(t):this.#i(t,e,he(wr,r));json=(t,e,r)=>this.#i(JSON.stringify(t),e,he("application/json",r));html=(t,e,r)=>{let n=o=>this.#i(o,e,he("text/html; charset=UTF-8",r));return typeof t=="object"?pe(t,Ye.Stringify,!1,{}).then(n):n(t)};redirect=(t,e)=>{let r=String(t);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,e??302)};notFound=()=>(this.#l??=()=>K(),this.#l(this))};var A="ALL",Qe="all",Ze=["get","post","put","delete","options","patch","query"],Z="Can not add a route since the matcher is already built.",ee=class extends Error{};var et="__COMPOSED_HANDLER";var br=t=>t.text("404 Not Found",404),tt=(t,e)=>{if("getResponse"in t){let r=t.getResponse();return e.newResponse(r.body,r)}return console.error(t),e.text("Internal Server Error",500)},rt=class nt{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(e={}){[...Ze,Qe].forEach(s=>{this[s]=(a,...i)=>(typeof a=="string"?this.#t=a:this.#s(s,this.#t,a),i.forEach(c=>{this.#s(s,this.#t,c)}),this)}),this.on=(s,a,...i)=>{for(let c of[a].flat()){this.#t=c;for(let l of[s].flat())i.map(u=>{this.#s(l.toUpperCase(),this.#t,u)})}return this},this.use=(s,...a)=>(typeof s=="string"?this.#t=s:(this.#t="*",a.unshift(s)),a.forEach(i=>{this.#s(A,this.#t,i)}),this);let{strict:n,...o}=e;Object.assign(this,o),this.getPath=n??!0?e.getPath??de:Ve}#e(){let e=new nt({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#r=this.#r,e.routes=this.routes,e}#r=br;errorHandler=tt;route(e,r){let n=this.basePath(e);return r.routes.map(o=>{let s;r.errorHandler===tt?s=o.handler:(s=async(a,i)=>(await ce([],r.errorHandler)(a,()=>o.handler(a,i))).res,s[et]=o.handler),n.#s(o.method,o.path,s,o.basePath)}),this}basePath(e){let r=this.#e();return r._basePath=N(this._basePath,e),r}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#r=e,this);mount(e,r,n){let o,s;n&&(typeof n=="function"?s=n:(s=n.optionHandler,n.replaceRequest===!1?o=c=>c:o=n.replaceRequest));let a=s?c=>{let l=s(c);return Array.isArray(l)?l:[l]}:c=>{let l;try{l=c.executionCtx}catch{}return[c.env,l]};o||=(()=>{let c=N(this._basePath,e),l=c==="/"?0:c.length;return u=>{let p=new URL(u.url);return p.pathname=this.getPath(u).slice(l)||"/",new Request(p,u)}})();let i=async(c,l)=>{let u=await r(o(c.req.raw),...a(c));if(u)return u;await l()};return this.#s(A,N(e,"*"),i),this}#s(e,r,n,o){e=e.toUpperCase(),r=N(this._basePath,r);let s={basePath:o!==void 0?N(this._basePath,o):this._basePath,path:r,method:e,handler:n};this.router.add(e,r,[n,s]),this.routes.push(s)}#n(e,r){if(e instanceof Error)return this.errorHandler(e,r);throw e}#o(e,r,n,o){if(o==="HEAD")return(async()=>new Response(null,await this.#o(e,r,n,"GET")))();let s=this.getPath(e,{env:n}),a=this.router.match(o,s),i=new fe(e,{path:s,matchResult:a,env:n,executionCtx:r,notFoundHandler:this.#r});if(a[0].length===1){let l;try{l=a[0][0][0][0](i,async()=>{i.res=await this.#r(i)})}catch(u){return this.#n(u,i)}return l instanceof Promise?l.then(u=>u||(i.finalized?i.res:this.#r(i))).catch(u=>this.#n(u,i)):l??this.#r(i)}let c=ce(a[0],this.errorHandler,this.#r);return(async()=>{try{let l=await c(i);if(!l.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return l.res}catch(l){return this.#n(l,i)}})()}fetch=(e,...r)=>this.#o(e,r[1],r[0],e.method);request=(e,r,n,o)=>e instanceof Request?this.fetch(r?new Request(e,r):e,n,o):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${N("/",e)}`,r),n,o));fire=()=>{addEventListener("fetch",e=>{e.respondWith(this.#o(e.request,e,void 0,e.request.method))})}};var R=()=>Object.create(null);var te=[];function me(t,e){let r=this.buildAllMatchers(),n=((o,s)=>{let a=r[o]||r[A],i=a[2][s];if(i)return i;let c=s.match(a[0]);if(!c)return[[],te];let l=c.indexOf("",1);return[a[1][l],c]});return this.match=n,n(t,e)}var F="[^/]+",j=".*",I="(?:|/.*)",U=Symbol(),ot=new Set(".\\+*[^]$()");function xr(t,e){return t.length===1?e.length===1?t<e?-1:1:-1:e.length===1?1:t===j||t===I?e===I?-1:1:e===j||e===I?-1:t===F?1:e===F?-1:t.length===e.length?t<e?-1:1:e.length-t.length}var st=class ge{#t;#e;#r=R();insert(e,r,n,o,s){let a=this;for(let i=0,c=e.length;i<c;i++){let l=e[i],u=l.length===1?l==="*"?i===c-1?["","",j]:["","",F]:null:l==="/*"?["","",I]:l.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),p;if(u){let h=u[1],f=u[2]||F;if(h&&u[2]&&(f===".*"||(f=f.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(f))||f.length===1&&ot.has(f)))throw U;if(p=a.#r[f],!p){if(f!==j&&f!==I){for(let x in a.#r)if((f.length>1||x.length>1)&&x!==j&&x!==I)throw U}p=a.#r[f]=new ge}h!==""&&(p.#e??=o.varIndex++,n.push([h,p.#e]))}else if(p=a.#r[l],!p){for(let h in a.#r)if(h.length>1&&h!==j&&h!==I)throw U;p=a.#r[l]=new ge}a=p}if(a.#t!==void 0)throw U;a.#t=s?-1:r}buildRegExpStr(){let r=Object.keys(this.#r).sort(xr).map(n=>{let o=this.#r[n],s=o.buildRegExpStr();return s===""?"":(typeof o.#e=="number"?`(${n})@${o.#e}`:ot.has(n)?`\\${n}`:n)+s}).filter(Boolean);return typeof this.#t=="number"&&this.#t!==-1&&r.unshift(`#${this.#t}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}};var ye=class{#t={varIndex:0};#e=new st;#r=0;paths=R();insert(t,e){if(e){this.#e.insert(t.split(""),0,[],this.#t,!0);return}let r=[],n=[],o=t;for(let a=0;;){let i=!1;if(o=o.replace(/\{[^}]+\}/g,c=>{let l=`@\\${a}`;return n[a]=[l,c],a++,i=!0,l}),!i)break}let s=o.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=n.length-1;a>=0;a--){let[i]=n[a];for(let c=s.length-1;c>=0;c--)if(s[c].indexOf(i)!==-1){s[c]=s[c].replace(i,n[a][1]);break}}this.#e.insert(s,this.#r,r,this.#t,!1),this.paths[t]=[this.#r++,r]}buildRegExp(){let t=this.#e.buildRegExpStr();if(t==="")return[/^$/,[],[]];let e=0,r=[],n=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(o,s,a)=>s!==void 0?(r[++e]=Number(s),"$()"):(a!==void 0&&(n[Number(a)]=++e),"")),[new RegExp(`^${t}`),r,n]}};var it=R();function at(t){return it[t]??=new RegExp(`^${t.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(e,r)=>r?`\\${r}`:e==="/*"?I:e==="*"?j:`/:${F}`)}$`)}function re(t,e){for(let r of Object.keys(t).sort((n,o)=>o.length-n.length))if(at(r).test(e))return[...t[r]]}var ne=class{name="RegExpRouter";#t;#e;#r;constructor(){this.#t={[A]:R()},this.#e={[A]:R()},this.#r={[A]:new ye}}#s(t,e){try{this.#r[t].insert(e,!/\*|\/:/.test(e))}catch(r){throw r===U?new ee(e):r}}add(t,e,r){let n=this.#t,o=this.#e;if(!n)throw new Error(Z);if(!n[t]){this.#r[t]=new ye;for(let i of[n,o]){i[t]=R();for(let c in i[A])i[t][c]=[...i[A][c]],this.#s(t,c)}}e==="/*"&&(e="*");let s=t===A?Object.keys(n):[t];if(/\*$/.test(e)){let i=at(e);for(let c of s)n[c][e]||(this.#s(c,e),n[c][e]=re(n[c],e)||re(n[A],e)||[]);for(let c of[n,o])for(let l of s)for(let u in c[l])i.test(u)&&c[l][u].push([r,e]);return}let a=Y(e)||[e];for(let i of a)for(let c of s)o[c][i]||(this.#s(c,i),o[c][i]=re(n[c],i)||re(n[A],i)||[]),o[c][i].push([r,i])}match=me;buildAllMatchers(){let t=R();for(let e of Object.keys(this.#e))t[e]=this.#n(e);return this.#t=this.#e=this.#r=void 0,it=R(),t}#n(t){let e=this.#t[t],r=this.#e[t],n=this.#r[t],o=R(),s=[],[a,i,c]=n.buildRegExp();for(let l of[e,r])for(let u in l){let p=l[u],h=n.paths[u];if(!h){o[u]=[p.map(([f])=>[f,R()]),te];continue}s[h[0]]=p.map(([f,x])=>[f,n.paths[x][1].reduceRight((b,[v],g)=>(b[v]=c[h[1][g][1]],b),R())])}return[a,i.map(l=>s[l]),o]}};var we=class{name="SmartRouter";#t=[];#e=[];constructor(t){this.#t=t.routers}add(t,e,r){if(!this.#e)throw new Error(Z);this.#e.push([t,e,r])}match(t,e){if(!this.#e)throw new Error("Fatal error");let r=this.#t,n=this.#e,o=r.length,s=0,a;for(;s<o;s++){let i=r[s];try{for(let c=0,l=n.length;c<l;c++)i.add(...n[c]);a=i.match(t,e)}catch(c){if(c instanceof ee)continue;throw c}this.match=i.match.bind(i),this.#t=[i],this.#e=void 0;break}if(s===o)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#e||this.#t.length!==1)throw new Error("No active router has been determined yet.");return this.#t[0]}};var be=R(),vr=0,ct=class lt{#t=[];#e=R();#r=[];#s;#n=be;insert(e,r,n){let o=this,s=ze(r),a=new Set,i=0;for(let c of s){let l=s[++i],u=Fe(c,l)||(l===void 0&&c&&c.indexOf("*")===c.length-1?c:null),p=Array.isArray(u),h=p?u[0]:u||c,f=o.#e[h]||=new lt;u&&!f.#s&&(f.#s=u,o.#r.push(f)),o=f,p&&a.add(u[1])}o.#t.push({[e]:{handler:n,possibleKeys:[...a],score:++vr}})}#o(e,r,n,o,s){for(let a=0,i=r.#t.length;a<i;a++){let c=r.#t[a],l=c[n]||c[A];if(l){l.params=R(),e.push(l);for(let u=0,p=l.possibleKeys.length;u<p;u++){let h=l.possibleKeys[u];l.params[h]=s?.[h]&&!u?s[h]:o[h]??s?.[h]}}}}search(e,r){let n=[];this.#n=be;let s=[this],a=ue(r),i=[],c=a.length,l=null;for(let u=0;u<c;u++){let p=a[u],h=u===c-1,f=[];for(let b=0,v=s.length;b<v;b++){let g=s[b],d=g.#e[p];d&&(d.#n=g.#n,h?(d.#e["*"]&&this.#o(n,d.#e["*"],e,g.#n),this.#o(n,d,e,g.#n)):f.push(d));for(let m of g.#r){let y=m.#s,P=g.#n===be?{}:{...g.#n};if(typeof y=="string"){(y==="*"||p.startsWith(y.slice(0,-1)))&&(this.#o(n,m,e,g.#n),y==="*"&&(m.#n=P,f.push(m)));continue}let[,L,O]=y;if(!(!p&&O===!0)){if(O!==!0){if(!l){l=[];let S=r[0]==="/"?1:0;for(let w=0;w<c;w++)l[w]=S,S+=a[w].length+1}let _=r.slice(l[u]),E=O.exec(_);if(E){P[L]=E[0],this.#o(n,m,e,g.#n,P),E[0].length===_.length&&m.#e["*"]&&this.#o(n,m.#e["*"],e,g.#n,P);for(let S in m.#e){m.#n=P;let w=E[0].match(/\//g)?.length??0;(i[w]||=[]).push(m);break}continue}}(O===!0||O.test(p))&&(P[L]=p,h?(this.#o(n,m,e,P,g.#n),m.#e["*"]&&this.#o(n,m.#e["*"],e,P,g.#n)):(m.#n=P,f.push(m)))}}}let x=i.shift();s=x?f.concat(x):f}return n[1]&&n.sort((u,p)=>u.score-p.score),[n.map(({handler:u,params:p})=>[u,p])]}};var xe=class{name="TrieRouter";#t=new ct;add(t,e,r){for(let n of Y(e)||[e])this.#t.insert(t,n,r)}match(t,e){return this.#t.search(t,e)}};var ve=class extends rt{constructor(t={}){super(t),this.router=t.router??new we({routers:[new ne,new xe]})}};import{Readable as fn}from"stream";function ut(t=""){return`<link rel="icon" type="image/svg+xml" href="${`${t.replace(/\/$/,"")}/favicon-black.svg?v=4`}" />`}import{existsSync as Rt,readFileSync as Sr}from"fs";import k from"path";import{fileURLToPath as Ar}from"url";import{gunzipSync as Cr}from"zlib";var D=cr(vt(),1);function W(t,e){return t.header("Retry-After",String(_r(e))),t.json({error:"Too Many Requests"},429)}function _r(t){return t&&typeof t=="object"&&"msBeforeNext"in t&&typeof t.msBeforeNext=="number"&&Number.isFinite(t.msBeforeNext)?Math.max(1,Math.ceil(t.msBeforeNext/1e3)):60}var Or={".js":"application/javascript",".css":"text/css",".svg":"image/svg+xml",".png":"image/png",".ico":"image/x-icon",".webmanifest":"application/manifest+json"};function Lr(){let t=k.dirname(Ar(import.meta.url));for(let e of[k.resolve(t,"app"),k.resolve(t,"../app"),k.resolve(t,"../../dist/app")])if(Rt(k.join(e,"inspector.js.gz")))return e;throw new Error("Inspector bundle not found (expected dist/app/inspector.js.gz)")}function Pt(t,e="/inspector/assets"){let r=Lr(),n=new Map,o=new D.default({points:600,duration:60}),s=async(a,i)=>{try{await o.consume(a.req)}catch(c){return W(a,c)}return i()};t.use(`${e}/*`,s),t.get(`${e}/*`,async a=>{let i=a.req.path.slice(e.length),c=i.startsWith("/")?i.slice(1):i;if(!c||c.includes(".."))return a.notFound();let l=c==="inspector.js"||c==="inspector.css"?`${c}.gz`:c,u=k.resolve(r,l),p=r.endsWith(k.sep)?r:`${r}${k.sep}`;if(!u.startsWith(p)||!Rt(u))return a.notFound();let h=k.extname(c),f=l.endsWith(".gz"),x=/(?:^|,)\s*gzip\s*(?:,|$)/i.test(a.req.header("accept-encoding")??""),b=Sr(u),v=f&&!x?n.get(u)??Tr(n,u,b):b,g=v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength);return a.body(g,200,{"Content-Type":Or[h]??"application/octet-stream",...f&&x?{"Content-Encoding":"gzip"}:{},...f?{Vary:"Accept-Encoding"}:{},"Cache-Control":"no-cache"})})}function Tr(t,e,r){let n=Cr(r);return t.set(e,n),n}var _t={name:"@mcp-use/inspector",type:"module",version:"20.3.9",description:"MCP Inspector - A tool for inspecting and debugging MCP servers",author:"",license:"MIT",homepage:"https://github.com/mcp-use/mcp-use#readme",repository:{type:"git",url:"git+https://github.com/mcp-use/mcp-use.git",directory:"libraries/typescript/packages/inspector"},bugs:{url:"https://github.com/mcp-use/mcp-use/issues"},keywords:["mcp","inspector","debug","tools"],exports:{".":{types:"./dist/server/index.d.ts",import:"./dist/server/index.js"},"./client":{types:"./dist/client/index.d.ts",import:"./dist/client/index.js"},"./client/styles.css":{default:"./dist/client/styles.css"}},main:"./dist/server/index.js",types:"./dist/server/index.d.ts",bin:{"mcp-inspect":"./dist/cli.js"},files:["dist"],scripts:{dev:"rimraf node_modules/.vite && vite --strictPort","dev:client":"pnpm run dev","dev:server":"VITE_DEV=true tsx watch src/server/server.ts","dev:standalone":"tsx watch src/server/server.ts",clean:"rimraf dist",build:"pnpm run clean && pnpm run build:client-exports && pnpm run build:server && pnpm run build:app && pnpm run verify:package","build:app":"vite build --config vite.app.config.ts && node scripts/compress-app.mjs","watch:app":"vite build --watch --config vite.app.config.ts","preview:app":"vite preview --config vite.app.config.ts --host 127.0.0.1","serve:app":"pnpm build:app && pnpm preview:app","analyze:app":"ANALYZE=true vite build --config vite.app.config.ts","build:client-exports":"tsup --config tsup.client.ts && node scripts/copy-client-styles.mjs","build:server":"tsup --config tsup.server.ts","verify:package":"node scripts/verify-package.mjs",start:"node dist/cli.js --port 3000",preview:"vite preview","type-check":"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix","test:e2e":"playwright test","test:e2e:ui":"playwright test --ui","test:e2e:debug":"playwright test --debug","test:e2e:builtin":"node tests/e2e/scripts/run-test-matrix.mjs builtin","test:e2e:prod":"node tests/e2e/scripts/run-test-matrix.mjs prod","test:e2e:mix":"node tests/e2e/scripts/run-test-matrix.mjs mix","test:e2e:prod:ui":"TEST_MODE=production playwright test --ui","test:e2e:codegen":"playwright codegen http://localhost:3000/inspector","test:e2e:report":"playwright show-report","test:e2e:python":"node tests/e2e/scripts/run-python-e2e.mjs",test:"vitest run","test:unit":"vitest run","test:unit:watch":"vitest","test:e2e:tunnel":"node tests/e2e/scripts/run-tunnel-test.mjs","install:pnpm":"pnpm install","install:npm":"npm install","lint:npm":"npm run lint:fix","lint:pnpm":"pnpm lint:fix"},engines:{node:">=22.22.2"},peerDependencies:{"@base-ui/react":"^1.6.0","@mcp-use/agent":"^2.0.16 || ^2.0.17","@mcp-use/client":"^2.0.1 || ^2.1.0 || ^2.1.1 || ^2.1.2 || ^2.1.3 || ^2.1.4 || ^2.1.5 || ^2.2.0 || ^2.2.1 || ^2.2.2 || ^2.2.3 || ^2.2.4 || ^2.2.5 || ^2.3.0 || ^2.3.1 || ^2.3.2","class-variance-authority":"^0.7.1",clsx:"^2.1.1",express:"^4.21.2 || ^5.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4","mcp-use":"^2.4.3 || ^2.4.4 || ^2.5.0 || ^2.5.1",motion:"^12.34.2",react:"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0","react-resizable-panels":"^4.6.4",sonner:"^2.0.7","tailwind-merge":"^3.5.0"},peerDependenciesMeta:{"@base-ui/react":{optional:!0},"@mcp-use/agent":{optional:!0},"@mcp-use/client":{optional:!0},"class-variance-authority":{optional:!0},clsx:{optional:!0},express:{optional:!0},"lucide-react":{optional:!0},"markdown-to-jsx":{optional:!0},"mcp-use":{optional:!0},motion:{optional:!0},react:{optional:!0},"react-dom":{optional:!0},"react-resizable-panels":{optional:!0},sonner:{optional:!0},"tailwind-merge":{optional:!0}},dependencies:{},publishConfig:{access:"public"},devDependencies:{"@base-ui/react":"^1.6.0","@hono/node-server":"^2.0.5","@mcp-use/agent":"workspace:*","@mcp-use/client":"workspace:*","@playwright/test":"^1.58.2","@tailwindcss/vite":"^4.2.0","@types/express":"^5.0.6","@vitejs/plugin-react":"^6.0.0","class-variance-authority":"^0.7.1",clsx:"^2.1.1",emulate:"0.5.0",eslint:"^9.39.2",express:"^5.2.1",hono:"^4.13.5",jsdom:"^27.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4",motion:"^12.34.2","oauth2-mock-server":"^8.2.2",open:"^11.0.0",react:"^19.2.3","react-dom":"^19.2.3","react-router":"^8.3.0","react-resizable-panels":"^4.6.4","rate-limiter-flexible":"^11.2.0","rollup-plugin-visualizer":"^6.0.3",sonner:"^2.0.7","tailwind-merge":"^3.5.0",tailwindcss:"^4.2.0",tsup:"^8.5.1",tsx:"^4.21.0","tw-animate-css":"^1.4.0",typescript:"^5.9.3",vite:"^8.0.16",vitest:"^4.1.0","wait-on":"^9.0.4",yaml:"^2.8.3",zod:"^4.2.0"}};var Ir=_t.version;function Et(){return Ir}var Dr=`<!doctype html>
|
|
1
|
+
var rr=Object.create;var Ne=Object.defineProperty;var nr=Object.getOwnPropertyDescriptor;var or=Object.getOwnPropertyNames;var sr=Object.getPrototypeOf,ir=Object.prototype.hasOwnProperty;var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ar=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of or(e))!ir.call(t,o)&&o!==r&&Ne(t,o,{get:()=>e[o],enumerable:!(n=nr(e,o))||n.enumerable});return t};var cr=(t,e,r)=>(r=t!=null?rr(sr(t)):{},ar(e||!t||!t.__esModule?Ne(r,"default",{value:t,enumerable:!0}):r,t));var pt=V((es,dt)=>{"use strict";dt.exports=class{constructor(e={}){this.points=e.points,this.duration=e.duration,this.blockDuration=e.blockDuration,this.execEvenly=e.execEvenly,this.execEvenlyMinDelayMs=e.execEvenlyMinDelayMs,this.keyPrefix=e.keyPrefix}get points(){return this._points}set points(e){if(Number.isFinite(e))this._points=e;else throw new Error("points must be set and must be a finite number")}get duration(){return this._duration}set duration(e){if(typeof e=="number"&&Number.isFinite(e)&&e>=0)this._duration=e;else throw new Error("duration must be set and must be a finite, non-negative number")}get msDuration(){return this.duration*1e3}get blockDuration(){return this._blockDuration}set blockDuration(e){this._blockDuration=typeof e>"u"?0:e}get msBlockDuration(){return this.blockDuration*1e3}get execEvenly(){return this._execEvenly}set execEvenly(e){this._execEvenly=typeof e>"u"?!1:!!e}get execEvenlyMinDelayMs(){return this._execEvenlyMinDelayMs===void 0?this._getExecEvenlyMinDelayMsDefault():this._execEvenlyMinDelayMs}set execEvenlyMinDelayMs(e){this._execEvenlyMinDelayMs=e}_getExecEvenlyMinDelayMsDefault(){return this.points>0?Math.ceil(this.msDuration/this.points):0}get keyPrefix(){return this._keyPrefix}set keyPrefix(e){if(typeof e>"u"&&(e="rlflx"),typeof e!="string")throw new Error("keyPrefix must be string");this._keyPrefix=e}_getKeySecDuration(e={}){return e&&e.customDuration>=0?e.customDuration:this.duration}getKey(e){return this.keyPrefix.length>0?`${this.keyPrefix}:${e}`:e}parseKey(e){return this.keyPrefix.length>0?e.substring(this.keyPrefix.length+1):e}consume(){throw new Error("You have to implement the method 'consume'!")}penalty(){throw new Error("You have to implement the method 'penalty'!")}reward(){throw new Error("You have to implement the method 'reward'!")}get(){throw new Error("You have to implement the method 'get'!")}set(){throw new Error("You have to implement the method 'set'!")}block(){throw new Error("You have to implement the method 'block'!")}delete(){throw new Error("You have to implement the method 'delete'!")}}});var ft=V((rs,ht)=>{"use strict";ht.exports=class{constructor(e,r,n=null){this.value=e,this.expiresAt=r,this.timeoutId=n}get value(){return this._value}set value(e){this._value=parseInt(e,10)}get expiresAt(){return this._expiresAt}set expiresAt(e){e instanceof Date?this._expiresAt=e.getTime():this._expiresAt=e}get timeoutId(){return this._timeoutId}set timeoutId(e){this._timeoutId=e}}});var Re=V((os,mt)=>{"use strict";mt.exports=class{constructor(e,r,n,o){this.remainingPoints=typeof e>"u"?0:e,this.msBeforeNext=typeof r>"u"?0:r,this.consumedPoints=typeof n>"u"?0:n,this.isFirstInDuration=typeof o>"u"?!1:o}get msBeforeNext(){return this._msBeforeNext}set msBeforeNext(e){return this._msBeforeNext=e,this}get remainingPoints(){return this._remainingPoints}set remainingPoints(e){return this._remainingPoints=e,this}get consumedPoints(){return this._consumedPoints}set consumedPoints(e){return this._consumedPoints=e,this}get isFirstInDuration(){return this._isFirstInDuration}set isFirstInDuration(e){this._isFirstInDuration=!!e}_getDecoratedProperties(){return{remainingPoints:this.remainingPoints,msBeforeNext:this.msBeforeNext,consumedPoints:this.consumedPoints,isFirstInDuration:this.isFirstInDuration}}[Symbol.for("nodejs.util.inspect.custom")](){return this._getDecoratedProperties()}toString(){return JSON.stringify(this._getDecoratedProperties())}toJSON(){return this._getDecoratedProperties()}}});var wt=V((is,yt)=>{"use strict";var gt=ft(),Pe=Re();yt.exports=class{constructor(){this._storage=new Map}incrby(e,r,n){let o=this._storage.get(e);if(o){let s=o.expiresAt?o.expiresAt-Date.now():-1;return!o.expiresAt||s>0?(o.value=o.value+r,new Pe(0,s,o.value,!1)):this.set(e,r,n)}return this.set(e,r,n)}set(e,r,n){let o=n*1e3,s=this._storage.get(e);s&&s.timeoutId&&clearTimeout(s.timeoutId);let a=new gt(r,o>0?Date.now()+o:null);return this._storage.set(e,a),o>0&&(a.timeoutId=setTimeout(()=>{this._storage.delete(e)},o),a.timeoutId.unref&&a.timeoutId.unref()),new Pe(0,o===0?-1:o,a.value,!0)}get(e){let r=this._storage.get(e);if(r){let n=r.expiresAt?r.expiresAt-Date.now():-1;return new Pe(0,n,r.value,!1)}return null}delete(e){let r=this._storage.get(e);return r?(r.timeoutId&&clearTimeout(r.timeoutId),this._storage.delete(e),!0):!1}_restoreRecord(e,r,n){let o=Date.now(),s=n!==null;if(s&&!Number.isFinite(n)||s&&n<=o)return;let a=s?n-o:0,i=this._storage.get(e);i&&i.timeoutId&&clearTimeout(i.timeoutId);let c=new gt(r,n);this._storage.set(e,c),a>0&&(c.timeoutId=setTimeout(()=>{this._storage.delete(e)},a),c.timeoutId.unref&&c.timeoutId.unref())}}});var vt=V((as,xt)=>{"use strict";var Rr=pt(),Pr=wt(),bt=Re(),_e=class extends Rr{constructor(e={}){super(e),this._memoryStorage=new Pr}consume(e,r=1,n={}){return new Promise((o,s)=>{let a=this.getKey(e),i=this._getKeySecDuration(n),c=this._memoryStorage.incrby(a,r,i);if(c.remainingPoints=Math.max(this.points-c.consumedPoints,0),c.consumedPoints>this.points)this.blockDuration>0&&c.consumedPoints<=this.points+r&&(c=this._memoryStorage.set(a,c.consumedPoints,this.blockDuration)),s(c);else if(this.execEvenly&&this.points>0&&c.msBeforeNext>0&&!c.isFirstInDuration){let l=Math.ceil(c.msBeforeNext/(c.remainingPoints+2));l<this.execEvenlyMinDelayMs&&(l=c.consumedPoints*this.execEvenlyMinDelayMs),c.msBeforeNext=Math.max(c.msBeforeNext-l,0),setTimeout(o,l,c)}else o(c)})}penalty(e,r=1,n={}){let o=this.getKey(e);return new Promise(s=>{let a=this._getKeySecDuration(n),i=this._memoryStorage.incrby(o,r,a);i.remainingPoints=Math.max(this.points-i.consumedPoints,0),s(i)})}reward(e,r=1,n={}){let o=this.getKey(e);return new Promise(s=>{let a=this._getKeySecDuration(n),i=this._memoryStorage.incrby(o,-r,a);i.remainingPoints=Math.max(this.points-i.consumedPoints,0),s(i)})}block(e,r){let n=r*1e3,o=this.points+1;return this._memoryStorage.set(this.getKey(e),o,r),Promise.resolve(new bt(0,n===0?-1:n,o))}set(e,r,n){let o=(n>=0?n:this.duration)*1e3;return this._memoryStorage.set(this.getKey(e),r,n),Promise.resolve(new bt(0,o===0?-1:o,r))}get(e){let r=this._memoryStorage.get(this.getKey(e));return r!==null&&(r.remainingPoints=Math.max(this.points-r.consumedPoints,0)),Promise.resolve(r)}delete(e){return Promise.resolve(this._memoryStorage.delete(this.getKey(e)))}dump(){let e=[];for(let[r,n]of this._memoryStorage._storage)e.push({key:this.parseKey(r),value:n.value,expiresAt:n.expiresAt});return{version:1,dumpedAt:Date.now(),storage:e}}restore(e,r=!1){if(!e||typeof e!="object"||e.version!==1)return;let n=r?{invalid:{count:0,keys:[]},expired:{count:0,keys:[]},restored:{count:0,keys:[]}}:{invalid:0,expired:0,restored:0},o=(s,a)=>{r?(n[s].count+=1,n[s].keys.push(a)):n[s]+=1};if(!Array.isArray(e.storage))return n;for(let s of e.storage){if(!s||typeof s!="object"){o("invalid","N/A");continue}let a=typeof s.key=="string"||typeof s.key=="number",i=Number.isFinite(s.value),c=s.expiresAt===null||Number.isFinite(s.expiresAt);if(!a||!i||!c){o("invalid",s.key);continue}if(s.expiresAt!==null&&s.expiresAt<=Date.now()){o("expired",s.key);continue}this._memoryStorage._restoreRecord(this.getKey(s.key),s.value,s.expiresAt),o("restored",s.key)}return n}};xt.exports=_e});var ce=(t,e,r)=>(n,o)=>{let s=-1;return a(0);async function a(i){if(i<=s)throw new Error("next() called multiple times");s=i;let c,l=!1,u;if(t[i]?(u=t[i][0][0],n.req.routeIndex=i):u=i===t.length&&o||void 0,u)try{c=await u(n,()=>a(i+1))}catch(p){if(p instanceof Error&&e)n.error=p,c=await e(p,n),l=!0;else throw p}else n.finalized===!1&&r&&(c=await r(n));return c&&(n.finalized===!1||l)&&(n.res=c),n}};var Ue=Symbol();var je=(t,e)=>new Response(t,{headers:{"Content-Type":e.replace(/^[^;]+/,n=>n.toLowerCase())}}).formData();var He=32,lr=1e4,G=t=>"headers"in t,qe=async(t,e=Object.create(null))=>{let{all:r=!1,dot:n=!1}=e,a=(G(t)?t.headers:t.raw.headers).get("Content-Type")?.split(";")[0].trim().toLowerCase();return a==="multipart/form-data"||a==="application/x-www-form-urlencoded"?ur(t,{all:r,dot:n}):{}};async function ur(t,e){if(!G(t)&&t.bodyCache.formData)return $e(await t.bodyCache.formData,e);let r=G(t)?t.headers:t.raw.headers,n=await t.arrayBuffer(),o=je(n,r.get("Content-Type")||"");G(t)||(t.bodyCache.formData=o);let s=await o;return s?$e(s,e):{}}function $e(t,e){let r=Object.create(null),n={count:0};return t.forEach((o,s)=>{e.all||s.endsWith("[]")?dr(r,s,o):r[s]=o}),e.dot&&Object.entries(r).forEach(([o,s])=>{o.includes(".")&&(pr(r,o,s,n),delete r[o])}),r}var dr=(t,e,r)=>{t[e]!==void 0?Array.isArray(t[e])?t[e].push(r):t[e]=[t[e],r]:e.endsWith("[]")?t[e]=[r]:t[e]=r},pr=(t,e,r,n)=>{if(/(?:^|\.)__proto__\./.test(e))return;let o=t,s=e.split(".",He+2);s.length>He+1&&Be(),s.forEach((a,i)=>{i===s.length-1?o[a]=r:((!o[a]||typeof o[a]!="object"||Array.isArray(o[a])||o[a]instanceof File)&&(n.count++>=lr&&Be(),o[a]=Object.create(null)),o=o[a])})},Be=()=>{throw new Error("Nesting limit exceeded")};var ue=t=>{let e=t.split("/");return e[0]===""&&e.shift(),e},ze=t=>{let{groups:e,path:r}=hr(t),n=ue(r);return fr(n,e)},hr=t=>{let e=[];return t=t.replace(/\{[^}]+\}/g,(r,n)=>{let o=`@${n}`;return e.push([o,r]),o}),{groups:e,path:t}},fr=(t,e)=>{for(let r=e.length-1;r>=0;r--){let[n]=e[r];for(let o=t.length-1;o>=0;o--)if(t[o].includes(n)){t[o]=t[o].replace(n,e[r][1]);break}}return t},X={},Fe=(t,e)=>{if(t==="*")return"*";let r=t.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/);if(r){let n=`${t}#${e}`;return X[n]||(r[2]?X[n]=e&&e[0]!==":"&&e[0]!=="*"?[n,r[1],new RegExp(`^${r[2]}(?=/${e})`)]:[t,r[1],new RegExp(`^${r[2]}$`)]:X[n]=[t,r[1],!0]),X[n]}return null},We=(t,e)=>{try{return e(t)}catch{return t.replace(/(?:%[0-9A-Fa-f]{2})+/g,r=>{try{return e(r)}catch{return r}})}},mr=t=>We(t,decodeURI),de=t=>{let e=t.url,r=e.indexOf("/",e.indexOf(":")+4),n=r;for(;n<e.length;n++){let o=e.charCodeAt(n);if(o===37){let s=e.indexOf("?",n),a=e.indexOf("#",n),i=s===-1?a===-1?void 0:a:a===-1?s:Math.min(s,a),c=e.slice(r,i);return mr(c.includes("%25")?c.replace(/%25/g,"%2525"):c)}else if(o===63||o===35)break}return e.slice(r,n)};var Ve=t=>{let e=de(t);return e.length>1&&e.at(-1)==="/"?e.slice(0,-1):e},N=(t,e,...r)=>(r.length&&(e=N(e,...r)),`${t?.[0]==="/"?"":"/"}${t}${e==="/"?"":`${t?.at(-1)==="/"?"":"/"}${e?.[0]==="/"?e.slice(1):e}`}`),Y=t=>{if(t.charCodeAt(t.length-1)!==63||!t.includes(":"))return null;let e=t.split("/"),r=[],n="";return e.forEach(o=>{if(o!==""&&!/\:/.test(o))n+="/"+o;else if(/\:/.test(o))if(o.charCodeAt(o.length-1)===63){r.length===0&&n===""?r.push("/"):r.push(n);let s=o.slice(0,-1);n+="/"+s,r.push(n)}else n+="/"+o}),r.filter((o,s,a)=>a.indexOf(o)===s)},Q=t=>t.indexOf("%")!==-1?We(t,gr):t,le=t=>(t.indexOf("+")!==-1&&(t=t.replace(/\+/g," ")),Q(t)),Ke=(t,e,r)=>{let n=t.indexOf("#",8);n!==-1&&(t=t.slice(0,n));let o;if(!r&&e&&e.indexOf("%")===-1&&e.indexOf("+")===-1){let i=t.indexOf("?",8);if(i===-1)return;for(t.startsWith(e,i+1)||(i=t.indexOf(`&${e}`,i+1));i!==-1;){let c=t.charCodeAt(i+e.length+1);if(c===61){let l=i+e.length+2,u=t.indexOf("&",l);return le(t.slice(l,u===-1?void 0:u))}else if(c==38||isNaN(c))return"";i=t.indexOf(`&${e}`,i+1)}if(o=/[%+]/.test(t),!o)return}let s=Object.create(null);o??=/[%+]/.test(t);let a=t.indexOf("?",8);for(;a!==-1;){let i=t.indexOf("&",a+1),c=t.indexOf("=",a);c>i&&i!==-1&&(c=-1);let l=t.slice(a+1,c===-1?i===-1?void 0:i:c);if(o&&(l=le(l)),a=i,l==="")continue;let u;c===-1?u="":(u=t.slice(c+1,i===-1?void 0:i),o&&(u=le(u))),r?(s[l]&&Array.isArray(s[l])||(s[l]=[]),s[l].push(u)):s[l]??=u}return e?s[e]:s},Je=Ke,Ge=(t,e)=>Ke(t,e,!0),gr=decodeURIComponent;var Xe=class{raw;#t;#e;routeIndex=0;path;bodyCache={};constructor(t,e="/",r=[[]]){this.raw=t,this.path=e,this.#e=r}param(t){return t?this.#r(t):this.#s()}#r(t){let e=this.#e[0][this.routeIndex]?.[1][t],r=this.#n(e);return r&&Q(r)}#s(){let t={},e=Object.keys(this.#e[0][this.routeIndex]?.[1]??{});for(let r of e){let n=this.#n(this.#e[0][this.routeIndex][1][r]);n!==void 0&&(t[r]=Q(n))}return t}#n(t){return this.#e[1]?this.#e[1][t]:t}query(t){return Je(this.url,t)}queries(t){return Ge(this.url,t)}header(t){if(t)return this.raw.headers.get(t)??void 0;let e=Object.create(null);return this.raw.headers.forEach((r,n)=>{e[n]=r}),e}async parseBody(t){return qe(this,t)}#o=t=>{let{bodyCache:e,raw:r}=this,n=e[t];if(n)return n;for(let o in e)return e[o].then(s=>(o==="json"&&(s=JSON.stringify(s)),new Response(s)[t]()));return e[t]=r[t]()};json(){return this.#o("text").then(t=>JSON.parse(t))}text(){return this.#o("text")}arrayBuffer(){return this.#o("arrayBuffer")}bytes(){return this.#o("arrayBuffer").then(t=>new Uint8Array(t))}blob(){return this.#o("blob")}formData(){return this.#o("formData")}addValidatedData(t,e){(this.#t??={})[t]=e}valid(t){return this.#t?.[t]}get url(){return this.raw.url}get method(){return this.raw.method}get[Ue](){return this.#e}get matchedRoutes(){return this.#e[0].map(([[,t]])=>t)}get routePath(){return this.#e[0].map(([[,t]])=>t)[this.routeIndex].path}};var Ye={Stringify:1,BeforeStream:2,Stream:3},yr=(t,e)=>{let r=new String(t);return r.isEscaped=!0,r.callbacks=e,r};var pe=async(t,e,r,n,o)=>{typeof t=="object"&&!(t instanceof String)&&(t instanceof Promise||(t=t.toString()),t instanceof Promise&&(t=await t));let s=t.callbacks;if(!s?.length)return Promise.resolve(t);o?o[0]+=t:o=[t];let a=Promise.all(s.map(i=>i({phase:e,buffer:o,context:n}))).then(i=>Promise.all(i.filter(Boolean).map(c=>pe(c,e,!1,n,o))).then(()=>o[0]));return r?yr(await a,s):a};var wr="text/plain; charset=UTF-8",he=(t,e)=>({"Content-Type":t,...e}),K=(t,e)=>new Response(t,e),fe=class{#t;#e;env={};#r;finalized=!1;error;#s;#n;#o;#u;#c;#l;#a;#d;#p;constructor(t,e){this.#t=t,e&&(this.#n=e.executionCtx,this.env=e.env,this.#l=e.notFoundHandler,this.#p=e.path,this.#d=e.matchResult)}get req(){return this.#e??=new Xe(this.#t,this.#p,this.#d),this.#e}get event(){if(this.#n&&"respondWith"in this.#n)return this.#n;throw Error("This context has no FetchEvent")}get executionCtx(){if(this.#n)return this.#n;throw Error("This context has no ExecutionContext")}get res(){return this.#o||=K(null,{headers:this.#a??=new Headers})}set res(t){if(this.#o&&t){t=K(t.body,t);for(let[e,r]of this.#o.headers.entries())if(e!=="content-type")if(e==="set-cookie"){let n=this.#o.headers.getSetCookie();t.headers.delete("set-cookie");for(let o of n)t.headers.append("set-cookie",o)}else t.headers.set(e,r)}this.#o=t,this.finalized=!0}render=(...t)=>(this.#c??=e=>this.html(e),this.#c(...t));setLayout=t=>this.#u=t;getLayout=()=>this.#u;setRenderer=t=>{this.#c=t};header=(t,e,r)=>{this.finalized&&(this.#o=K(this.#o.body,this.#o));let n=this.#o?this.#o.headers:this.#a??=new Headers;e===void 0?n.delete(t):r?.append?n.append(t,e):n.set(t,e)};status=t=>{this.#s=t};set=(t,e)=>{this.#r??=new Map,this.#r.set(t,e)};get=t=>this.#r?this.#r.get(t):void 0;get var(){return this.#r?Object.fromEntries(this.#r):{}}#i(t,e,r){let n=this.#o?new Headers(this.#o.headers):this.#a;if(typeof e=="object"&&e.headers){n??=new Headers;for(let[s,a]of new Headers(e.headers))s==="set-cookie"?n.append(s,a):n.set(s,a)}if(r){if(!n){let s=0;for(let a in r)if(++s>1||typeof r[a]!="string"){n=new Headers;break}}if(n)for(let s in r){let a=r[s];if(typeof a=="string")n.set(s,a);else{n.delete(s);for(let i of a)n.append(s,i)}}}let o=typeof e=="number"?e:e?.status??this.#s;return K(t,{status:o,headers:n??r})}newResponse=(...t)=>this.#i(...t);body=(t,e,r)=>this.#i(t,e,r);text=(t,e,r)=>!this.#a&&!this.#s&&!e&&!r&&!this.finalized?new Response(t):this.#i(t,e,he(wr,r));json=(t,e,r)=>this.#i(JSON.stringify(t),e,he("application/json",r));html=(t,e,r)=>{let n=o=>this.#i(o,e,he("text/html; charset=UTF-8",r));return typeof t=="object"?pe(t,Ye.Stringify,!1,{}).then(n):n(t)};redirect=(t,e)=>{let r=String(t);return this.header("Location",/[^\x00-\xFF]/.test(r)?encodeURI(r):r),this.newResponse(null,e??302)};notFound=()=>(this.#l??=()=>K(),this.#l(this))};var A="ALL",Qe="all",Ze=["get","post","put","delete","options","patch","query"],Z="Can not add a route since the matcher is already built.",ee=class extends Error{};var et="__COMPOSED_HANDLER";var br=t=>t.text("404 Not Found",404),tt=(t,e)=>{if("getResponse"in t){let r=t.getResponse();return e.newResponse(r.body,r)}return console.error(t),e.text("Internal Server Error",500)},rt=class nt{get;post;put;delete;options;patch;query;all;on;use;router;getPath;_basePath="/";#t="/";routes=[];constructor(e={}){[...Ze,Qe].forEach(s=>{this[s]=(a,...i)=>(typeof a=="string"?this.#t=a:this.#s(s,this.#t,a),i.forEach(c=>{this.#s(s,this.#t,c)}),this)}),this.on=(s,a,...i)=>{for(let c of[a].flat()){this.#t=c;for(let l of[s].flat())i.map(u=>{this.#s(l.toUpperCase(),this.#t,u)})}return this},this.use=(s,...a)=>(typeof s=="string"?this.#t=s:(this.#t="*",a.unshift(s)),a.forEach(i=>{this.#s(A,this.#t,i)}),this);let{strict:n,...o}=e;Object.assign(this,o),this.getPath=n??!0?e.getPath??de:Ve}#e(){let e=new nt({router:this.router,getPath:this.getPath});return e.errorHandler=this.errorHandler,e.#r=this.#r,e.routes=this.routes,e}#r=br;errorHandler=tt;route(e,r){let n=this.basePath(e);return r.routes.map(o=>{let s;r.errorHandler===tt?s=o.handler:(s=async(a,i)=>(await ce([],r.errorHandler)(a,()=>o.handler(a,i))).res,s[et]=o.handler),n.#s(o.method,o.path,s,o.basePath)}),this}basePath(e){let r=this.#e();return r._basePath=N(this._basePath,e),r}onError=e=>(this.errorHandler=e,this);notFound=e=>(this.#r=e,this);mount(e,r,n){let o,s;n&&(typeof n=="function"?s=n:(s=n.optionHandler,n.replaceRequest===!1?o=c=>c:o=n.replaceRequest));let a=s?c=>{let l=s(c);return Array.isArray(l)?l:[l]}:c=>{let l;try{l=c.executionCtx}catch{}return[c.env,l]};o||=(()=>{let c=N(this._basePath,e),l=c==="/"?0:c.length;return u=>{let p=new URL(u.url);return p.pathname=this.getPath(u).slice(l)||"/",new Request(p,u)}})();let i=async(c,l)=>{let u=await r(o(c.req.raw),...a(c));if(u)return u;await l()};return this.#s(A,N(e,"*"),i),this}#s(e,r,n,o){e=e.toUpperCase(),r=N(this._basePath,r);let s={basePath:o!==void 0?N(this._basePath,o):this._basePath,path:r,method:e,handler:n};this.router.add(e,r,[n,s]),this.routes.push(s)}#n(e,r){if(e instanceof Error)return this.errorHandler(e,r);throw e}#o(e,r,n,o){if(o==="HEAD")return(async()=>new Response(null,await this.#o(e,r,n,"GET")))();let s=this.getPath(e,{env:n}),a=this.router.match(o,s),i=new fe(e,{path:s,matchResult:a,env:n,executionCtx:r,notFoundHandler:this.#r});if(a[0].length===1){let l;try{l=a[0][0][0][0](i,async()=>{i.res=await this.#r(i)})}catch(u){return this.#n(u,i)}return l instanceof Promise?l.then(u=>u||(i.finalized?i.res:this.#r(i))).catch(u=>this.#n(u,i)):l??this.#r(i)}let c=ce(a[0],this.errorHandler,this.#r);return(async()=>{try{let l=await c(i);if(!l.finalized)throw new Error("Context is not finalized. Did you forget to return a Response object or `await next()`?");return l.res}catch(l){return this.#n(l,i)}})()}fetch=(e,...r)=>this.#o(e,r[1],r[0],e.method);request=(e,r,n,o)=>e instanceof Request?this.fetch(r?new Request(e,r):e,n,o):(e=e.toString(),this.fetch(new Request(/^https?:\/\//.test(e)?e:`http://localhost${N("/",e)}`,r),n,o));fire=()=>{addEventListener("fetch",e=>{e.respondWith(this.#o(e.request,e,void 0,e.request.method))})}};var R=()=>Object.create(null);var te=[];function me(t,e){let r=this.buildAllMatchers(),n=((o,s)=>{let a=r[o]||r[A],i=a[2][s];if(i)return i;let c=s.match(a[0]);if(!c)return[[],te];let l=c.indexOf("",1);return[a[1][l],c]});return this.match=n,n(t,e)}var F="[^/]+",j=".*",I="(?:|/.*)",U=Symbol(),ot=new Set(".\\+*[^]$()");function xr(t,e){return t.length===1?e.length===1?t<e?-1:1:-1:e.length===1?1:t===j||t===I?e===I?-1:1:e===j||e===I?-1:t===F?1:e===F?-1:t.length===e.length?t<e?-1:1:e.length-t.length}var st=class ge{#t;#e;#r=R();insert(e,r,n,o,s){let a=this;for(let i=0,c=e.length;i<c;i++){let l=e[i],u=l.length===1?l==="*"?i===c-1?["","",j]:["","",F]:null:l==="/*"?["","",I]:l.match(/^\:([^\{\}]+)(?:\{(.+)\})?$/),p;if(u){let h=u[1],f=u[2]||F;if(h&&u[2]&&(f===".*"||(f=f.replace(/^\((?!\?:)(?=[^)]+\)$)/,"(?:"),/\((?!\?:)/.test(f))||f.length===1&&ot.has(f)))throw U;if(p=a.#r[f],!p){if(f!==j&&f!==I){for(let x in a.#r)if((f.length>1||x.length>1)&&x!==j&&x!==I)throw U}p=a.#r[f]=new ge}h!==""&&(p.#e??=o.varIndex++,n.push([h,p.#e]))}else if(p=a.#r[l],!p){for(let h in a.#r)if(h.length>1&&h!==j&&h!==I)throw U;p=a.#r[l]=new ge}a=p}if(a.#t!==void 0)throw U;a.#t=s?-1:r}buildRegExpStr(){let r=Object.keys(this.#r).sort(xr).map(n=>{let o=this.#r[n],s=o.buildRegExpStr();return s===""?"":(typeof o.#e=="number"?`(${n})@${o.#e}`:ot.has(n)?`\\${n}`:n)+s}).filter(Boolean);return typeof this.#t=="number"&&this.#t!==-1&&r.unshift(`#${this.#t}`),r.length===0?"":r.length===1?r[0]:"(?:"+r.join("|")+")"}};var ye=class{#t={varIndex:0};#e=new st;#r=0;paths=R();insert(t,e){if(e){this.#e.insert(t.split(""),0,[],this.#t,!0);return}let r=[],n=[],o=t;for(let a=0;;){let i=!1;if(o=o.replace(/\{[^}]+\}/g,c=>{let l=`@\\${a}`;return n[a]=[l,c],a++,i=!0,l}),!i)break}let s=o.match(/(?::[^\/]+)|(?:\/\*$)|./g)||[];for(let a=n.length-1;a>=0;a--){let[i]=n[a];for(let c=s.length-1;c>=0;c--)if(s[c].indexOf(i)!==-1){s[c]=s[c].replace(i,n[a][1]);break}}this.#e.insert(s,this.#r,r,this.#t,!1),this.paths[t]=[this.#r++,r]}buildRegExp(){let t=this.#e.buildRegExpStr();if(t==="")return[/^$/,[],[]];let e=0,r=[],n=[];return t=t.replace(/#(\d+)|@(\d+)|\.\*\$/g,(o,s,a)=>s!==void 0?(r[++e]=Number(s),"$()"):(a!==void 0&&(n[Number(a)]=++e),"")),[new RegExp(`^${t}`),r,n]}};var it=R();function at(t){return it[t]??=new RegExp(`^${t.replace(/\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,(e,r)=>r?`\\${r}`:e==="/*"?I:e==="*"?j:`/:${F}`)}$`)}function re(t,e){for(let r of Object.keys(t).sort((n,o)=>o.length-n.length))if(at(r).test(e))return[...t[r]]}var ne=class{name="RegExpRouter";#t;#e;#r;constructor(){this.#t={[A]:R()},this.#e={[A]:R()},this.#r={[A]:new ye}}#s(t,e){try{this.#r[t].insert(e,!/\*|\/:/.test(e))}catch(r){throw r===U?new ee(e):r}}add(t,e,r){let n=this.#t,o=this.#e;if(!n)throw new Error(Z);if(!n[t]){this.#r[t]=new ye;for(let i of[n,o]){i[t]=R();for(let c in i[A])i[t][c]=[...i[A][c]],this.#s(t,c)}}e==="/*"&&(e="*");let s=t===A?Object.keys(n):[t];if(/\*$/.test(e)){let i=at(e);for(let c of s)n[c][e]||(this.#s(c,e),n[c][e]=re(n[c],e)||re(n[A],e)||[]);for(let c of[n,o])for(let l of s)for(let u in c[l])i.test(u)&&c[l][u].push([r,e]);return}let a=Y(e)||[e];for(let i of a)for(let c of s)o[c][i]||(this.#s(c,i),o[c][i]=re(n[c],i)||re(n[A],i)||[]),o[c][i].push([r,i])}match=me;buildAllMatchers(){let t=R();for(let e of Object.keys(this.#e))t[e]=this.#n(e);return this.#t=this.#e=this.#r=void 0,it=R(),t}#n(t){let e=this.#t[t],r=this.#e[t],n=this.#r[t],o=R(),s=[],[a,i,c]=n.buildRegExp();for(let l of[e,r])for(let u in l){let p=l[u],h=n.paths[u];if(!h){o[u]=[p.map(([f])=>[f,R()]),te];continue}s[h[0]]=p.map(([f,x])=>[f,n.paths[x][1].reduceRight((b,[v],g)=>(b[v]=c[h[1][g][1]],b),R())])}return[a,i.map(l=>s[l]),o]}};var we=class{name="SmartRouter";#t=[];#e=[];constructor(t){this.#t=t.routers}add(t,e,r){if(!this.#e)throw new Error(Z);this.#e.push([t,e,r])}match(t,e){if(!this.#e)throw new Error("Fatal error");let r=this.#t,n=this.#e,o=r.length,s=0,a;for(;s<o;s++){let i=r[s];try{for(let c=0,l=n.length;c<l;c++)i.add(...n[c]);a=i.match(t,e)}catch(c){if(c instanceof ee)continue;throw c}this.match=i.match.bind(i),this.#t=[i],this.#e=void 0;break}if(s===o)throw new Error("Fatal error");return this.name=`SmartRouter + ${this.activeRouter.name}`,a}get activeRouter(){if(this.#e||this.#t.length!==1)throw new Error("No active router has been determined yet.");return this.#t[0]}};var be=R(),vr=0,ct=class lt{#t=[];#e=R();#r=[];#s;#n=be;insert(e,r,n){let o=this,s=ze(r),a=new Set,i=0;for(let c of s){let l=s[++i],u=Fe(c,l)||(l===void 0&&c&&c.indexOf("*")===c.length-1?c:null),p=Array.isArray(u),h=p?u[0]:u||c,f=o.#e[h]||=new lt;u&&!f.#s&&(f.#s=u,o.#r.push(f)),o=f,p&&a.add(u[1])}o.#t.push({[e]:{handler:n,possibleKeys:[...a],score:++vr}})}#o(e,r,n,o,s){for(let a=0,i=r.#t.length;a<i;a++){let c=r.#t[a],l=c[n]||c[A];if(l){l.params=R(),e.push(l);for(let u=0,p=l.possibleKeys.length;u<p;u++){let h=l.possibleKeys[u];l.params[h]=s?.[h]&&!u?s[h]:o[h]??s?.[h]}}}}search(e,r){let n=[];this.#n=be;let s=[this],a=ue(r),i=[],c=a.length,l=null;for(let u=0;u<c;u++){let p=a[u],h=u===c-1,f=[];for(let b=0,v=s.length;b<v;b++){let g=s[b],d=g.#e[p];d&&(d.#n=g.#n,h?(d.#e["*"]&&this.#o(n,d.#e["*"],e,g.#n),this.#o(n,d,e,g.#n)):f.push(d));for(let m of g.#r){let y=m.#s,P=g.#n===be?{}:{...g.#n};if(typeof y=="string"){(y==="*"||p.startsWith(y.slice(0,-1)))&&(this.#o(n,m,e,g.#n),y==="*"&&(m.#n=P,f.push(m)));continue}let[,L,O]=y;if(!(!p&&O===!0)){if(O!==!0){if(!l){l=[];let S=r[0]==="/"?1:0;for(let w=0;w<c;w++)l[w]=S,S+=a[w].length+1}let _=r.slice(l[u]),E=O.exec(_);if(E){P[L]=E[0],this.#o(n,m,e,g.#n,P),E[0].length===_.length&&m.#e["*"]&&this.#o(n,m.#e["*"],e,g.#n,P);for(let S in m.#e){m.#n=P;let w=E[0].match(/\//g)?.length??0;(i[w]||=[]).push(m);break}continue}}(O===!0||O.test(p))&&(P[L]=p,h?(this.#o(n,m,e,P,g.#n),m.#e["*"]&&this.#o(n,m.#e["*"],e,P,g.#n)):(m.#n=P,f.push(m)))}}}let x=i.shift();s=x?f.concat(x):f}return n[1]&&n.sort((u,p)=>u.score-p.score),[n.map(({handler:u,params:p})=>[u,p])]}};var xe=class{name="TrieRouter";#t=new ct;add(t,e,r){for(let n of Y(e)||[e])this.#t.insert(t,n,r)}match(t,e){return this.#t.search(t,e)}};var ve=class extends rt{constructor(t={}){super(t),this.router=t.router??new we({routers:[new ne,new xe]})}};import{Readable as fn}from"stream";function ut(t=""){return`<link rel="icon" type="image/svg+xml" href="${`${t.replace(/\/$/,"")}/favicon-black.svg?v=4`}" />`}import{existsSync as Rt,readFileSync as Sr}from"fs";import k from"path";import{fileURLToPath as Ar}from"url";import{gunzipSync as Cr}from"zlib";var D=cr(vt(),1);function W(t,e){return t.header("Retry-After",String(_r(e))),t.json({error:"Too Many Requests"},429)}function _r(t){return t&&typeof t=="object"&&"msBeforeNext"in t&&typeof t.msBeforeNext=="number"&&Number.isFinite(t.msBeforeNext)?Math.max(1,Math.ceil(t.msBeforeNext/1e3)):60}var Or={".js":"application/javascript",".css":"text/css",".svg":"image/svg+xml",".png":"image/png",".ico":"image/x-icon",".webmanifest":"application/manifest+json"};function Lr(){let t=k.dirname(Ar(import.meta.url));for(let e of[k.resolve(t,"app"),k.resolve(t,"../app"),k.resolve(t,"../../dist/app")])if(Rt(k.join(e,"inspector.js.gz")))return e;throw new Error("Inspector bundle not found (expected dist/app/inspector.js.gz)")}function Pt(t,e="/inspector/assets"){let r=Lr(),n=new Map,o=new D.default({points:600,duration:60}),s=async(a,i)=>{try{await o.consume(a.req)}catch(c){return W(a,c)}return i()};t.use(`${e}/*`,s),t.get(`${e}/*`,async a=>{let i=a.req.path.slice(e.length),c=i.startsWith("/")?i.slice(1):i;if(!c||c.includes(".."))return a.notFound();let l=c==="inspector.js"||c==="inspector.css"?`${c}.gz`:c,u=k.resolve(r,l),p=r.endsWith(k.sep)?r:`${r}${k.sep}`;if(!u.startsWith(p)||!Rt(u))return a.notFound();let h=k.extname(c),f=l.endsWith(".gz"),x=/(?:^|,)\s*gzip\s*(?:,|$)/i.test(a.req.header("accept-encoding")??""),b=Sr(u),v=f&&!x?n.get(u)??Tr(n,u,b):b,g=v.buffer.slice(v.byteOffset,v.byteOffset+v.byteLength);return a.body(g,200,{"Content-Type":Or[h]??"application/octet-stream",...f&&x?{"Content-Encoding":"gzip"}:{},...f?{Vary:"Accept-Encoding"}:{},"Cache-Control":"no-cache"})})}function Tr(t,e,r){let n=Cr(r);return t.set(e,n),n}var _t={name:"@mcp-use/inspector",type:"module",version:"20.3.10",description:"MCP Inspector - A tool for inspecting and debugging MCP servers",author:"",license:"MIT",homepage:"https://github.com/mcp-use/mcp-use#readme",repository:{type:"git",url:"git+https://github.com/mcp-use/mcp-use.git",directory:"libraries/typescript/packages/inspector"},bugs:{url:"https://github.com/mcp-use/mcp-use/issues"},keywords:["mcp","inspector","debug","tools"],exports:{".":{types:"./dist/server/index.d.ts",import:"./dist/server/index.js"},"./client":{types:"./dist/client/index.d.ts",import:"./dist/client/index.js"},"./client/styles.css":{default:"./dist/client/styles.css"}},main:"./dist/server/index.js",types:"./dist/server/index.d.ts",bin:{"mcp-inspect":"./dist/cli.js"},files:["dist"],scripts:{dev:"rimraf node_modules/.vite && vite --strictPort","dev:client":"pnpm run dev","dev:server":"VITE_DEV=true tsx watch src/server/server.ts","dev:standalone":"tsx watch src/server/server.ts",clean:"rimraf dist",build:"pnpm run clean && pnpm run build:client-exports && pnpm run build:server && pnpm run build:app && pnpm run verify:package","build:app":"vite build --config vite.app.config.ts && node scripts/compress-app.mjs","watch:app":"vite build --watch --config vite.app.config.ts","preview:app":"vite preview --config vite.app.config.ts --host 127.0.0.1","serve:app":"pnpm build:app && pnpm preview:app","analyze:app":"ANALYZE=true vite build --config vite.app.config.ts","build:client-exports":"tsup --config tsup.client.ts && node scripts/copy-client-styles.mjs","build:server":"tsup --config tsup.server.ts","verify:package":"node scripts/verify-package.mjs",start:"node dist/cli.js --port 3000",preview:"vite preview","type-check":"tsc --noEmit",lint:"eslint .","lint:fix":"eslint . --fix","test:e2e":"playwright test","test:e2e:ui":"playwright test --ui","test:e2e:debug":"playwright test --debug","test:e2e:builtin":"node tests/e2e/scripts/run-test-matrix.mjs builtin","test:e2e:prod":"node tests/e2e/scripts/run-test-matrix.mjs prod","test:e2e:mix":"node tests/e2e/scripts/run-test-matrix.mjs mix","test:e2e:prod:ui":"TEST_MODE=production playwright test --ui","test:e2e:codegen":"playwright codegen http://localhost:3000/inspector","test:e2e:report":"playwright show-report","test:e2e:python":"node tests/e2e/scripts/run-python-e2e.mjs",test:"vitest run","test:unit":"vitest run","test:unit:watch":"vitest","test:e2e:tunnel":"node tests/e2e/scripts/run-tunnel-test.mjs","install:pnpm":"pnpm install","install:npm":"npm install","lint:npm":"npm run lint:fix","lint:pnpm":"pnpm lint:fix"},engines:{node:">=22.22.2"},peerDependencies:{"@base-ui/react":"^1.6.0","@mcp-use/agent":"^2.0.16 || ^2.0.17","@mcp-use/client":"^2.0.1 || ^2.1.0 || ^2.1.1 || ^2.1.2 || ^2.1.3 || ^2.1.4 || ^2.1.5 || ^2.2.0 || ^2.2.1 || ^2.2.2 || ^2.2.3 || ^2.2.4 || ^2.2.5 || ^2.3.0 || ^2.3.1 || ^2.3.2","class-variance-authority":"^0.7.1",clsx:"^2.1.1",express:"^4.21.2 || ^5.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4","mcp-use":"^2.4.3 || ^2.4.4 || ^2.5.0 || ^2.5.1 || ^2.5.2",motion:"^12.34.2",react:"^18.0.0 || ^19.0.0","react-dom":"^18.0.0 || ^19.0.0","react-resizable-panels":"^4.6.4",sonner:"^2.0.7","tailwind-merge":"^3.5.0"},peerDependenciesMeta:{"@base-ui/react":{optional:!0},"@mcp-use/agent":{optional:!0},"@mcp-use/client":{optional:!0},"class-variance-authority":{optional:!0},clsx:{optional:!0},express:{optional:!0},"lucide-react":{optional:!0},"markdown-to-jsx":{optional:!0},"mcp-use":{optional:!0},motion:{optional:!0},react:{optional:!0},"react-dom":{optional:!0},"react-resizable-panels":{optional:!0},sonner:{optional:!0},"tailwind-merge":{optional:!0}},dependencies:{},publishConfig:{access:"public"},devDependencies:{"@base-ui/react":"^1.6.0","@hono/node-server":"^2.0.5","@mcp-use/agent":"workspace:*","@mcp-use/client":"workspace:*","@playwright/test":"^1.58.2","@tailwindcss/vite":"^4.2.0","@types/express":"^5.0.6","@vitejs/plugin-react":"^6.0.0","class-variance-authority":"^0.7.1",clsx:"^2.1.1",emulate:"0.5.0",eslint:"^9.39.2",express:"^5.2.1",hono:"^4.13.5",jsdom:"^27.0.0","lucide-react":"^0.562.0","markdown-to-jsx":"^9.7.4",motion:"^12.34.2","oauth2-mock-server":"^8.2.2",open:"^11.0.0",react:"^19.2.3","react-dom":"^19.2.3","react-router":"^8.3.0","react-resizable-panels":"^4.6.4","rate-limiter-flexible":"^11.2.0","rollup-plugin-visualizer":"^6.0.3",sonner:"^2.0.7","tailwind-merge":"^3.5.0",tailwindcss:"^4.2.0",tsup:"^8.5.1",tsx:"^4.21.0","tw-animate-css":"^1.4.0",typescript:"^5.9.3",vite:"^8.0.16",vitest:"^4.1.0","wait-on":"^9.0.4",yaml:"^2.8.3",zod:"^4.2.0"}};var Ir=_t.version;function Et(){return Ir}var Dr=`<!doctype html>
|
|
2
2
|
<html>
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcp-use/inspector",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "20.3.
|
|
4
|
+
"version": "20.3.10",
|
|
5
5
|
"description": "MCP Inspector - A tool for inspecting and debugging MCP servers",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"express": "^4.21.2 || ^5.0.0",
|
|
54
54
|
"lucide-react": "^0.562.0",
|
|
55
55
|
"markdown-to-jsx": "^9.7.4",
|
|
56
|
-
"mcp-use": "^2.4.3 || ^2.4.4 || ^2.5.0 || ^2.5.1",
|
|
56
|
+
"mcp-use": "^2.4.3 || ^2.4.4 || ^2.5.0 || ^2.5.1 || ^2.5.2",
|
|
57
57
|
"motion": "^12.34.2",
|
|
58
58
|
"react": "^18.0.0 || ^19.0.0",
|
|
59
59
|
"react-dom": "^18.0.0 || ^19.0.0",
|