@modelcontextprotocol/inspector 0.1.1 → 0.1.3
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/bin/cli.js
CHANGED
|
@@ -6,20 +6,24 @@ import concurrently from "concurrently";
|
|
|
6
6
|
|
|
7
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
8
8
|
|
|
9
|
-
//
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
// Get command line arguments
|
|
10
|
+
const [, , environment, ...mcpServerArgs] = process.argv;
|
|
11
|
+
|
|
12
|
+
const inspectorServerPath = join(__dirname, "../server/build/index.js");
|
|
13
|
+
|
|
14
|
+
// Path to the client entry point
|
|
15
|
+
const inspectorClientPath = join(__dirname, "../client/bin/cli.js");
|
|
12
16
|
|
|
13
17
|
console.log("Starting MCP inspector...");
|
|
14
18
|
|
|
15
19
|
const { result } = concurrently(
|
|
16
20
|
[
|
|
17
21
|
{
|
|
18
|
-
command: `node ${
|
|
22
|
+
command: `node ${inspectorServerPath}${environment ? ` --env ${environment}` : ""}${mcpServerArgs.length ? ` --args "${mcpServerArgs.join(" ")}"` : ""}`,
|
|
19
23
|
name: "server",
|
|
20
24
|
},
|
|
21
25
|
{
|
|
22
|
-
command: `node ${
|
|
26
|
+
command: `node ${inspectorClientPath}`,
|
|
23
27
|
name: "client",
|
|
24
28
|
},
|
|
25
29
|
],
|
|
@@ -192,4 +192,4 @@ Error generating stack: `+s.message+`
|
|
|
192
192
|
`)},pp=function(){var e=parseInt(document.body.getAttribute(oo)||"0",10);return isFinite(e)?e:0},Kk=function(){h.useEffect(function(){return document.body.setAttribute(oo,(pp()+1).toString()),function(){var e=pp()-1;e<=0?document.body.removeAttribute(oo):document.body.setAttribute(oo,e.toString())}},[])},Gk=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Kk();var s=h.useMemo(function(){return Wk(o)},[o]);return h.createElement(Zk,{styles:qk(s,!t,o,n?"":"!important")})},Yc=!1;if(typeof window<"u")try{var gi=Object.defineProperty({},"passive",{get:function(){return Yc=!0,!0}});window.addEventListener("test",gi,gi),window.removeEventListener("test",gi,gi)}catch{Yc=!1}var Or=Yc?{passive:!1}:!1,Qk=function(e){return e.tagName==="TEXTAREA"},hv=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Qk(e)&&n[t]==="visible")},Yk=function(e){return hv(e,"overflowY")},Xk=function(e){return hv(e,"overflowX")},mp=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=gv(e,r);if(o){var s=vv(e,r),i=s[1],a=s[2];if(i>a)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Jk=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},e2=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},gv=function(e,t){return e==="v"?Yk(t):Xk(t)},vv=function(e,t){return e==="v"?Jk(t):e2(t)},t2=function(e,t){return e==="h"&&t==="rtl"?-1:1},n2=function(e,t,n,r,o){var s=t2(e,window.getComputedStyle(t).direction),i=s*r,a=n.target,l=t.contains(a),c=!1,u=i>0,f=0,g=0;do{var x=vv(e,a),w=x[0],v=x[1],_=x[2],m=v-_-s*w;(w||m)&&gv(e,a)&&(f+=m,g+=w),a instanceof ShadowRoot?a=a.host:a=a.parentNode}while(!l&&a!==document.body||l&&(t.contains(a)||t===a));return(u&&(Math.abs(f)<1||!o)||!u&&(Math.abs(g)<1||!o))&&(c=!0),c},vi=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},hp=function(e){return[e.deltaX,e.deltaY]},gp=function(e){return e&&"current"in e?e.current:e},r2=function(e,t){return e[0]===t[0]&&e[1]===t[1]},o2=function(e){return`
|
|
193
193
|
.block-interactivity-`.concat(e,` {pointer-events: none;}
|
|
194
194
|
.allow-interactivity-`).concat(e,` {pointer-events: all;}
|
|
195
|
-
`)},s2=0,Mr=[];function i2(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(s2++)[0],s=h.useState(mv)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=Nk([e.lockRef.current],(e.shards||[]).map(gp),!0).filter(Boolean);return v.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(v,_){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var m=vi(v),d=n.current,y="deltaX"in v?v.deltaX:d[0]-m[0],C="deltaY"in v?v.deltaY:d[1]-m[1],k,T=v.target,b=Math.abs(y)>Math.abs(C)?"h":"v";if("touches"in v&&b==="h"&&T.type==="range")return!1;var E=mp(b,T);if(!E)return!0;if(E?k=b:(k=b==="v"?"h":"v",E=mp(b,T)),!E)return!1;if(!r.current&&"changedTouches"in v&&(y||C)&&(r.current=k),!k)return!0;var I=r.current||k;return n2(I,_,v,I==="h"?y:C,!0)},[]),l=h.useCallback(function(v){var _=v;if(!(!Mr.length||Mr[Mr.length-1]!==s)){var m="deltaY"in _?hp(_):vi(_),d=t.current.filter(function(k){return k.name===_.type&&(k.target===_.target||_.target===k.shadowParent)&&r2(k.delta,m)})[0];if(d&&d.should){_.cancelable&&_.preventDefault();return}if(!d){var y=(i.current.shards||[]).map(gp).filter(Boolean).filter(function(k){return k.contains(_.target)}),C=y.length>0?a(_,y[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),c=h.useCallback(function(v,_,m,d){var y={name:v,delta:_,target:m,should:d,shadowParent:a2(m)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(C){return C!==y})},1)},[]),u=h.useCallback(function(v){n.current=vi(v),r.current=void 0},[]),f=h.useCallback(function(v){c(v.type,hp(v),v.target,a(v,e.lockRef.current))},[]),g=h.useCallback(function(v){c(v.type,vi(v),v.target,a(v,e.lockRef.current))},[]);h.useEffect(function(){return Mr.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Or),document.addEventListener("touchmove",l,Or),document.addEventListener("touchstart",u,Or),function(){Mr=Mr.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,Or),document.removeEventListener("touchmove",l,Or),document.removeEventListener("touchstart",u,Or)}},[]);var x=e.removeScrollBar,w=e.inert;return h.createElement(h.Fragment,null,w?h.createElement(s,{styles:o2(o)}):null,x?h.createElement(Gk,{gapMode:e.gapMode}):null)}function a2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const l2=Lk(pv,i2);var yv=h.forwardRef(function(e,t){return h.createElement(Ya,qt({},e,{ref:t,sideCar:l2}))});yv.classNames=Ya.classNames;var c2=[" ","Enter","ArrowUp","ArrowDown"],u2=[" ","Enter"],Ws="Select",[Xa,Ja,d2]=ig(Ws),[Eo,H2]=Z_(Ws,[d2,Jg]),el=Jg(),[f2,or]=Eo(Ws),[p2,m2]=Eo(Ws),xv=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:g,required:x,form:w}=e,v=el(t),[_,m]=h.useState(null),[d,y]=h.useState(null),[C,k]=h.useState(!1),T=cd(c),[b=!1,E]=fa({prop:r,defaultProp:o,onChange:s}),[I,j]=fa({prop:i,defaultProp:a,onChange:l}),V=h.useRef(null),M=_?w||!!_.closest("form"):!0,[q,W]=h.useState(new Set),J=Array.from(q).map(F=>F.props.value).join(";");return p.jsx(gk,{...v,children:p.jsxs(f2,{required:x,scope:t,trigger:_,onTriggerChange:m,valueNode:d,onValueNodeChange:y,valueNodeHasChildren:C,onValueNodeHasChildrenChange:k,contentId:Us(),value:I,onValueChange:j,open:b,onOpenChange:E,dir:T,triggerPointerDownPosRef:V,disabled:g,children:[p.jsx(Xa.Provider,{scope:t,children:p.jsx(p2,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(F=>{W(K=>new Set(K).add(F))},[]),onNativeOptionRemove:h.useCallback(F=>{W(K=>{const N=new Set(K);return N.delete(F),N})},[]),children:n})}),M?p.jsxs(Hv,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:f,value:I,onChange:F=>j(F.target.value),disabled:g,form:w,children:[I===void 0?p.jsx("option",{value:""}):null,Array.from(q)]},J):null]})})};xv.displayName=Ws;var wv="SelectTrigger",Sv=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=el(n),i=or(wv,n),a=i.disabled||r,l=Oe(t,i.onTriggerChange),c=Ja(n),u=h.useRef("touch"),[f,g,x]=Wv(v=>{const _=c().filter(y=>!y.disabled),m=_.find(y=>y.value===i.value),d=Zv(_,v,m);d!==void 0&&i.onValueChange(d.value)}),w=v=>{a||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return p.jsx(vk,{asChild:!0,...s,children:p.jsx(me.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Uv(i.value)?"":void 0,...o,ref:l,onClick:ue(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&w(v)}),onPointerDown:ue(o.onPointerDown,v=>{u.current=v.pointerType;const _=v.target;_.hasPointerCapture(v.pointerId)&&_.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(w(v),v.preventDefault())}),onKeyDown:ue(o.onKeyDown,v=>{const _=f.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&g(v.key),!(_&&v.key===" ")&&c2.includes(v.key)&&(w(),v.preventDefault())})})})});Sv.displayName=wv;var _v="SelectValue",Cv=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,l=or(_v,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,f=Oe(t,l.onValueNodeChange);return et(()=>{c(u)},[c,u]),p.jsx(me.span,{...a,ref:f,style:{pointerEvents:"none"},children:Uv(l.value)?p.jsx(p.Fragment,{children:i}):s})});Cv.displayName=_v;var h2="SelectIcon",kv=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.jsx(me.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});kv.displayName=h2;var g2="SelectPortal",Ev=e=>p.jsx(lv,{asChild:!0,...e});Ev.displayName=g2;var Nr="SelectContent",bv=h.forwardRef((e,t)=>{const n=or(Nr,e.__scopeSelect),[r,o]=h.useState();if(et(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?So.createPortal(p.jsx(Nv,{scope:e.__scopeSelect,children:p.jsx(Xa.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),s):null}return p.jsx(Tv,{...e,ref:t})});bv.displayName=Nr;var Rt=10,[Nv,sr]=Eo(Nr),v2="SelectContentImpl",Tv=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:g,collisionPadding:x,sticky:w,hideWhenDetached:v,avoidCollisions:_,...m}=e,d=or(Nr,n),[y,C]=h.useState(null),[k,T]=h.useState(null),b=Oe(t,B=>C(B)),[E,I]=h.useState(null),[j,V]=h.useState(null),M=Ja(n),[q,W]=h.useState(!1),J=h.useRef(!1);h.useEffect(()=>{if(y)return bk(y)},[y]),nC();const F=h.useCallback(B=>{const[ce,...Ae]=M().map(ie=>ie.ref.current),[fe]=Ae.slice(-1),le=document.activeElement;for(const ie of B)if(ie===le||(ie==null||ie.scrollIntoView({block:"nearest"}),ie===ce&&k&&(k.scrollTop=0),ie===fe&&k&&(k.scrollTop=k.scrollHeight),ie==null||ie.focus(),document.activeElement!==le))return},[M,k]),K=h.useCallback(()=>F([E,y]),[F,E,y]);h.useEffect(()=>{q&&K()},[q,K]);const{onOpenChange:N,triggerPointerDownPosRef:O}=d;h.useEffect(()=>{if(y){let B={x:0,y:0};const ce=fe=>{var le,ie;B={x:Math.abs(Math.round(fe.pageX)-(((le=O.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((ie=O.current)==null?void 0:ie.y)??0))}},Ae=fe=>{B.x<=10&&B.y<=10?fe.preventDefault():y.contains(fe.target)||N(!1),document.removeEventListener("pointermove",ce),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",Ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",Ae,{capture:!0})}}},[y,N,O]),h.useEffect(()=>{const B=()=>N(!1);return window.addEventListener("blur",B),window.addEventListener("resize",B),()=>{window.removeEventListener("blur",B),window.removeEventListener("resize",B)}},[N]);const[D,H]=Wv(B=>{const ce=M().filter(le=>!le.disabled),Ae=ce.find(le=>le.ref.current===document.activeElement),fe=Zv(ce,B,Ae);fe&&setTimeout(()=>fe.ref.current.focus())}),ee=h.useCallback((B,ce,Ae)=>{const fe=!J.current&&!Ae;(d.value!==void 0&&d.value===ce||fe)&&(I(B),fe&&(J.current=!0))},[d.value]),he=h.useCallback(()=>y==null?void 0:y.focus(),[y]),ae=h.useCallback((B,ce,Ae)=>{const fe=!J.current&&!Ae;(d.value!==void 0&&d.value===ce||fe)&&V(B)},[d.value]),_e=r==="popper"?Xc:Rv,ve=_e===Xc?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:g,collisionPadding:x,sticky:w,hideWhenDetached:v,avoidCollisions:_}:{};return p.jsx(Nv,{scope:n,content:y,viewport:k,onViewportChange:T,itemRefCallback:ee,selectedItem:E,onItemLeave:he,itemTextRefCallback:ae,focusSelectedItem:K,selectedItemText:j,position:r,isPositioned:q,searchRef:D,children:p.jsx(yv,{as:go,allowPinchZoom:!0,children:p.jsx(Vg,{asChild:!0,trapped:d.open,onMountAutoFocus:B=>{B.preventDefault()},onUnmountAutoFocus:ue(o,B=>{var ce;(ce=d.trigger)==null||ce.focus({preventScroll:!0}),B.preventDefault()}),children:p.jsx($g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:B=>B.preventDefault(),onDismiss:()=>d.onOpenChange(!1),children:p.jsx(_e,{role:"listbox",id:d.contentId,"data-state":d.open?"open":"closed",dir:d.dir,onContextMenu:B=>B.preventDefault(),...m,...ve,onPlaced:()=>W(!0),ref:b,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:ue(m.onKeyDown,B=>{const ce=B.ctrlKey||B.altKey||B.metaKey;if(B.key==="Tab"&&B.preventDefault(),!ce&&B.key.length===1&&H(B.key),["ArrowUp","ArrowDown","Home","End"].includes(B.key)){let fe=M().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(B.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(B.key)){const le=B.target,ie=fe.indexOf(le);fe=fe.slice(ie+1)}setTimeout(()=>F(fe)),B.preventDefault()}})})})})})})});Tv.displayName=v2;var y2="SelectItemAlignedPosition",Rv=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=or(Nr,n),i=sr(Nr,n),[a,l]=h.useState(null),[c,u]=h.useState(null),f=Oe(t,b=>u(b)),g=Ja(n),x=h.useRef(!1),w=h.useRef(!0),{viewport:v,selectedItem:_,selectedItemText:m,focusSelectedItem:d}=i,y=h.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&v&&_&&m){const b=s.trigger.getBoundingClientRect(),E=c.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),j=m.getBoundingClientRect();if(s.dir!=="rtl"){const le=j.left-E.left,ie=I.left-le,Ge=b.left-ie,rt=b.width+Ge,ir=Math.max(rt,E.width),rn=window.innerWidth-Rt,ar=Qf(ie,[Rt,Math.max(Rt,rn-ir)]);a.style.minWidth=rt+"px",a.style.left=ar+"px"}else{const le=E.right-j.right,ie=window.innerWidth-I.right-le,Ge=window.innerWidth-b.right-ie,rt=b.width+Ge,ir=Math.max(rt,E.width),rn=window.innerWidth-Rt,ar=Qf(ie,[Rt,Math.max(Rt,rn-ir)]);a.style.minWidth=rt+"px",a.style.right=ar+"px"}const V=g(),M=window.innerHeight-Rt*2,q=v.scrollHeight,W=window.getComputedStyle(c),J=parseInt(W.borderTopWidth,10),F=parseInt(W.paddingTop,10),K=parseInt(W.borderBottomWidth,10),N=parseInt(W.paddingBottom,10),O=J+F+q+N+K,D=Math.min(_.offsetHeight*5,O),H=window.getComputedStyle(v),ee=parseInt(H.paddingTop,10),he=parseInt(H.paddingBottom,10),ae=b.top+b.height/2-Rt,_e=M-ae,ve=_.offsetHeight/2,B=_.offsetTop+ve,ce=J+F+B,Ae=O-ce;if(ce<=ae){const le=V.length>0&&_===V[V.length-1].ref.current;a.style.bottom="0px";const ie=c.clientHeight-v.offsetTop-v.offsetHeight,Ge=Math.max(_e,ve+(le?he:0)+ie+K),rt=ce+Ge;a.style.height=rt+"px"}else{const le=V.length>0&&_===V[0].ref.current;a.style.top="0px";const Ge=Math.max(ae,J+v.offsetTop+(le?ee:0)+ve)+Ae;a.style.height=Ge+"px",v.scrollTop=ce-ae+v.offsetTop}a.style.margin=`${Rt}px 0`,a.style.minHeight=D+"px",a.style.maxHeight=M+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[g,s.trigger,s.valueNode,a,c,v,_,m,s.dir,r]);et(()=>y(),[y]);const[C,k]=h.useState();et(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const T=h.useCallback(b=>{b&&w.current===!0&&(y(),d==null||d(),w.current=!1)},[y,d]);return p.jsx(w2,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:T,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:p.jsx(me.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Rv.displayName=y2;var x2="SelectPopperPosition",Xc=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Rt,...s}=e,i=el(n);return p.jsx(yk,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Xc.displayName=x2;var[w2,Ed]=Eo(Nr,{}),Jc="SelectViewport",Pv=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=sr(Jc,n),i=Ed(Jc,n),a=Oe(t,s.onViewportChange),l=h.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(Xa.Slot,{scope:n,children:p.jsx(me.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ue(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&f){const x=Math.abs(l.current-u.scrollTop);if(x>0){const w=window.innerHeight-Rt*2,v=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),m=Math.max(v,_);if(m<w){const d=m+x,y=Math.min(w,d),C=d-y;f.style.height=y+"px",f.style.bottom==="0px"&&(u.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Pv.displayName=Jc;var jv="SelectGroup",[S2,_2]=Eo(jv),C2=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Us();return p.jsx(S2,{scope:n,id:o,children:p.jsx(me.div,{role:"group","aria-labelledby":o,...r,ref:t})})});C2.displayName=jv;var Iv="SelectLabel",Ov=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=_2(Iv,n);return p.jsx(me.div,{id:o.id,...r,ref:t})});Ov.displayName=Iv;var ya="SelectItem",[k2,Mv]=Eo(ya),Av=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=or(ya,n),l=sr(ya,n),c=a.value===r,[u,f]=h.useState(s??""),[g,x]=h.useState(!1),w=Oe(t,d=>{var y;return(y=l.itemRefCallback)==null?void 0:y.call(l,d,r,o)}),v=Us(),_=h.useRef("touch"),m=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(k2,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:h.useCallback(d=>{f(y=>y||((d==null?void 0:d.textContent)??"").trim())},[]),children:p.jsx(Xa.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:p.jsx(me.div,{role:"option","aria-labelledby":v,"data-highlighted":g?"":void 0,"aria-selected":c&&g,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:w,onFocus:ue(i.onFocus,()=>x(!0)),onBlur:ue(i.onBlur,()=>x(!1)),onClick:ue(i.onClick,()=>{_.current!=="mouse"&&m()}),onPointerUp:ue(i.onPointerUp,()=>{_.current==="mouse"&&m()}),onPointerDown:ue(i.onPointerDown,d=>{_.current=d.pointerType}),onPointerMove:ue(i.onPointerMove,d=>{var y;_.current=d.pointerType,o?(y=l.onItemLeave)==null||y.call(l):_.current==="mouse"&&d.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ue(i.onPointerLeave,d=>{var y;d.currentTarget===document.activeElement&&((y=l.onItemLeave)==null||y.call(l))}),onKeyDown:ue(i.onKeyDown,d=>{var C;((C=l.searchRef)==null?void 0:C.current)!==""&&d.key===" "||(u2.includes(d.key)&&m(),d.key===" "&&d.preventDefault())})})})})});Av.displayName=ya;var Uo="SelectItemText",Lv=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=or(Uo,n),a=sr(Uo,n),l=Mv(Uo,n),c=m2(Uo,n),[u,f]=h.useState(null),g=Oe(t,m=>f(m),l.onItemTextChange,m=>{var d;return(d=a.itemTextRefCallback)==null?void 0:d.call(a,m,l.value,l.disabled)}),x=u==null?void 0:u.textContent,w=h.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:v,onNativeOptionRemove:_}=c;return et(()=>(v(w),()=>_(w)),[v,_,w]),p.jsxs(p.Fragment,{children:[p.jsx(me.span,{id:l.textId,...s,ref:g}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?So.createPortal(s.children,i.valueNode):null]})});Lv.displayName=Uo;var Dv="SelectItemIndicator",zv=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Mv(Dv,n).isSelected?p.jsx(me.span,{"aria-hidden":!0,...r,ref:t}):null});zv.displayName=Dv;var eu="SelectScrollUpButton",$v=h.forwardRef((e,t)=>{const n=sr(eu,e.__scopeSelect),r=Ed(eu,e.__scopeSelect),[o,s]=h.useState(!1),i=Oe(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?p.jsx(Vv,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});$v.displayName=eu;var tu="SelectScrollDownButton",Fv=h.forwardRef((e,t)=>{const n=sr(tu,e.__scopeSelect),r=Ed(tu,e.__scopeSelect),[o,s]=h.useState(!1),i=Oe(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?p.jsx(Vv,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Fv.displayName=tu;var Vv=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=sr("SelectScrollButton",n),i=h.useRef(null),a=Ja(n),l=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>l(),[l]),et(()=>{var u;const c=a().find(f=>f.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),p.jsx(me.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ue(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ue(o.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ue(o.onPointerLeave,()=>{l()})})}),E2="SelectSeparator",Bv=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(me.div,{"aria-hidden":!0,...r,ref:t})});Bv.displayName=E2;var nu="SelectArrow",b2=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=el(n),s=or(nu,n),i=sr(nu,n);return s.open&&i.position==="popper"?p.jsx(xk,{...o,...r,ref:t}):null});b2.displayName=nu;function Uv(e){return e===""||e===void 0}var Hv=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=h.useRef(null),s=Oe(t,o),i=Sk(n);return h.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&u){const f=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(f)}},[i,n]),p.jsx(cv,{asChild:!0,children:p.jsx("select",{...r,ref:s,defaultValue:n})})});Hv.displayName="BubbleSelect";function Wv(e){const t=Jt(e),n=h.useRef(""),r=h.useRef(0),o=h.useCallback(i=>{const a=n.current+i;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Zv(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=N2(e,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function N2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var T2=xv,qv=Sv,R2=Cv,P2=kv,j2=Ev,Kv=bv,I2=Pv,Gv=Ov,Qv=Av,O2=Lv,M2=zv,Yv=$v,Xv=Fv,Jv=Bv;const A2=T2,L2=R2,ey=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(qv,{ref:r,className:$e("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,p.jsx(P2,{asChild:!0,children:p.jsx($_,{className:"h-4 w-4 opacity-50"})})]}));ey.displayName=qv.displayName;const ty=h.forwardRef(({className:e,...t},n)=>p.jsx(Yv,{ref:n,className:$e("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(W_,{})}));ty.displayName=Yv.displayName;const ny=h.forwardRef(({className:e,...t},n)=>p.jsx(Xv,{ref:n,className:$e("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(U_,{})}));ny.displayName=Xv.displayName;const ry=h.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>p.jsx(j2,{children:p.jsxs(Kv,{ref:o,className:$e("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[p.jsx(ty,{}),p.jsx(I2,{className:$e("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),p.jsx(ny,{})]})}));ry.displayName=Kv.displayName;const D2=h.forwardRef(({className:e,...t},n)=>p.jsx(Gv,{ref:n,className:$e("px-2 py-1.5 text-sm font-semibold",e),...t}));D2.displayName=Gv.displayName;const ru=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Qv,{ref:r,className:$e("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(M2,{children:p.jsx(V_,{className:"h-4 w-4"})})}),p.jsx(O2,{children:t})]}));ru.displayName=Qv.displayName;const z2=h.forwardRef(({className:e,...t},n)=>p.jsx(Jv,{ref:n,className:$e("-mx-1 my-1 h-px bg-muted",e),...t}));z2.displayName=Jv.displayName;const $2=({connectionStatus:e,transportType:t,setTransportType:n,command:r,setCommand:o,args:s,setArgs:i,url:a,setUrl:l,env:c,setEnv:u,onConnect:f})=>{const[g,x]=h.useState(!1);return p.jsxs("div",{className:"w-80 bg-card border-r border-border flex flex-col h-full",children:[p.jsxs("div",{className:"flex items-center p-4 border-b border-gray-200",children:[p.jsx(k_,{className:"w-6 h-6 text-gray-500"}),p.jsx("h1",{className:"ml-2 text-lg font-semibold",children:"MCP Inspector"})]}),p.jsx("div",{className:"p-4 flex-1 overflow-auto",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"Transport Type"}),p.jsxs(A2,{value:t,onValueChange:w=>n(w),children:[p.jsx(ey,{children:p.jsx(L2,{placeholder:"Select transport type"})}),p.jsxs(ry,{children:[p.jsx(ru,{value:"stdio",children:"STDIO"}),p.jsx(ru,{value:"sse",children:"SSE"})]})]})]}),t==="stdio"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"Command"}),p.jsx(Zt,{placeholder:"Command",value:r,onChange:w=>o(w.target.value)})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"Arguments"}),p.jsx(Zt,{placeholder:"Arguments (space-separated)",value:s,onChange:w=>i(w.target.value)})]})]}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"URL"}),p.jsx(Zt,{placeholder:"URL",value:a,onChange:w=>l(w.target.value)})]}),t==="stdio"&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs(Ze,{variant:"outline",onClick:()=>x(!g),className:"flex items-center w-full",children:[g?p.jsx(p_,{className:"w-4 h-4 mr-2"}):p.jsx(Wc,{className:"w-4 h-4 mr-2"}),"Environment Variables"]}),g&&p.jsxs("div",{className:"space-y-2",children:[Object.entries(c).map(([w,v],_)=>p.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(Zt,{placeholder:"Key",value:w,onChange:m=>{const d={...c};delete d[w],d[m.target.value]=v,u(d)}}),p.jsx(Zt,{placeholder:"Value",value:v,onChange:m=>{const d={...c};d[w]=m.target.value,u(d)}})]}),p.jsx(Ze,{variant:"destructive",onClick:()=>{const{[w]:m,...d}=c;u(d)},children:"Remove"})]},_)),p.jsx(Ze,{variant:"outline",onClick:()=>{const w={...c};w[""]="",u(w)},children:"Add Environment Variable"})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs(Ze,{className:"w-full",onClick:f,children:[p.jsx(w_,{className:"w-4 h-4 mr-2"}),"Connect"]}),p.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[p.jsx("div",{className:`w-2 h-2 rounded-full ${e==="connected"?"bg-green-500":e==="error"?"bg-red-500":"bg-gray-500"}`}),p.jsx("span",{className:"text-sm text-gray-600",children:e==="connected"?"Connected":e==="error"?"Connection Error":"Disconnected"})]})]})]})})]})},F2=({tools:e,listTools:t,callTool:n,selectedTool:r,setSelectedTool:o,toolResult:s,nextCursor:i,error:a})=>{const[l,c]=h.useState({}),u=()=>{if(!s)return null;if("content"in s){const f=s,g=f.isError??!1;return p.jsxs(p.Fragment,{children:[p.jsxs("h4",{className:"font-semibold mb-2",children:["Tool Result: ",g?"Error":"Success"]}),f.content.map((x,w)=>p.jsxs("div",{className:"mb-2",children:[x.type==="text"&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded text-sm overflow-auto max-h-64",children:x.text}),x.type==="image"&&p.jsx("img",{src:`data:${x.mimeType};base64,${x.data}`,alt:"Tool result image",className:"max-w-full h-auto"}),x.type==="resource"&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded text-sm overflow-auto max-h-64",children:JSON.stringify(x.resource,null,2)})]},w))]})}else if("toolResult"in s)return p.jsxs(p.Fragment,{children:[p.jsx("h4",{className:"font-semibold mb-2",children:"Tool Result (Legacy):"}),p.jsx("pre",{className:"bg-gray-50 p-4 rounded text-sm overflow-auto max-h-64",children:JSON.stringify(s.toolResult,null,2)})]})};return p.jsxs(rr,{value:"tools",className:"grid grid-cols-2 gap-4",children:[p.jsx(pa,{items:e,listItems:t,setSelectedItem:o,renderItem:f=>p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"flex-1",children:f.name}),p.jsx("span",{className:"text-sm text-gray-500 text-right",children:f.description})]}),title:"Tools",buttonText:i?"List More Tools":"List Tools",isButtonDisabled:!i&&e.length>0}),p.jsxs("div",{className:"bg-card rounded-lg shadow",children:[p.jsx("div",{className:"p-4 border-b border-gray-200",children:p.jsx("h3",{className:"font-semibold",children:r?r.name:"Select a tool"})}),p.jsx("div",{className:"p-4",children:a?p.jsxs(xn,{variant:"destructive",children:[p.jsx(pd,{className:"h-4 w-4"}),p.jsx(Za,{children:"Error"}),p.jsx(wn,{children:a})]}):r?p.jsxs("div",{className:"space-y-4",children:[p.jsx("p",{className:"text-sm text-gray-600",children:r.description}),Object.entries(r.inputSchema.properties??[]).map(([f,g])=>p.jsxs("div",{children:[p.jsx(hd,{htmlFor:f,className:"block text-sm font-medium text-gray-700",children:f}),g.type==="string"?p.jsx(gd,{id:f,name:f,placeholder:g.description,onChange:x=>c({...l,[f]:x.target.value}),className:"mt-1"}):p.jsx(Zt,{type:g.type==="number"?"number":"text",id:f,name:f,placeholder:g.description,onChange:x=>c({...l,[f]:g.type==="number"?Number(x.target.value):x.target.value}),className:"mt-1"})]},f)),p.jsxs(Ze,{onClick:()=>n(r.name,l),children:[p.jsx(Mg,{className:"w-4 h-4 mr-2"}),"Run Tool"]}),s&&u()]}):p.jsx(xn,{children:p.jsx(wn,{children:"Select a tool from the list to view its details and run it"})})})]})]})};window.matchMedia("(prefers-color-scheme: dark)").matches&&document.documentElement.classList.add("dark");const V2=1e4,B2=()=>{const[e,t]=h.useState("disconnected"),[n,r]=h.useState([]),[o,s]=h.useState([]),[i,a]=h.useState(""),[l,c]=h.useState([]),[u,f]=h.useState(""),[g,x]=h.useState([]),[w,v]=h.useState(null),[_,m]=h.useState({resources:null,prompts:null,tools:null}),[d,y]=h.useState(()=>localStorage.getItem("lastCommand")||"mcp-server-everything"),[C,k]=h.useState(()=>localStorage.getItem("lastArgs")||""),[T,b]=h.useState("http://localhost:3001/sse"),[E,I]=h.useState("stdio"),[j,V]=h.useState([]),[M,q]=h.useState(null),[W,J]=h.useState([]),[F,K]=h.useState([]),[N,O]=h.useState({}),[D,H]=h.useState([]),ee=h.useRef(0),he=h.useRef([]),ae=($,re)=>{H(Te=>{const Le=Te.find(wt=>wt.id===$);return Le==null||Le.resolve(re),Te.filter(wt=>wt.id!==$)})},_e=$=>{H(re=>{const Te=re.find(Le=>Le.id===$);return Te==null||Te.reject(new Error("Sampling request rejected")),re.filter(Le=>Le.id!==$)})},[ve,B]=h.useState(null),[ce,Ae]=h.useState(null),[fe,le]=h.useState(null),[ie,Ge]=h.useState(),[rt,ir]=h.useState(),[rn,ar]=h.useState(),[bo,Pr]=h.useState(),oy=h.useRef(0),[tl,sy]=h.useState(300),[Zs,bd]=h.useState(!1),Nd=h.useRef(0),Td=h.useRef(0),iy=h.useCallback($=>{bd(!0),Nd.current=$.clientY,Td.current=tl,document.body.style.userSelect="none"},[tl]),nl=h.useCallback($=>{if(!Zs)return;const re=Nd.current-$.clientY,Te=Math.max(100,Math.min(800,Td.current+re));sy(Te)},[Zs]),rl=h.useCallback(()=>{bd(!1),document.body.style.userSelect=""},[]);h.useEffect(()=>{if(Zs)return window.addEventListener("mousemove",nl),window.addEventListener("mouseup",rl),()=>{window.removeEventListener("mousemove",nl),window.removeEventListener("mouseup",rl)}},[Zs,nl,rl]),h.useEffect(()=>{localStorage.setItem("lastCommand",d)},[d]),h.useEffect(()=>{localStorage.setItem("lastArgs",C)},[C]),h.useEffect(()=>{fetch("http://localhost:3000/default-environment").then($=>$.json()).then($=>O($)).catch($=>console.error("Error fetching default environment:",$))},[]),h.useEffect(()=>{he.current=F},[F]);const Rd=($,re)=>{V(Te=>[...Te,{request:JSON.stringify($),response:re!==void 0?JSON.stringify(re):void 0}])},Nt=$=>{m(re=>({...re,[$]:null}))},kn=async($,re,Te)=>{if(!M)throw new Error("MCP client not connected");try{const Le=new AbortController,wt=setTimeout(()=>{Le.abort("Request timed out")},V2);let lr;try{lr=await M.request($,re,{signal:Le.signal})}finally{clearTimeout(wt)}return Rd($,lr),Te!==void 0&&Nt(Te),lr}catch(Le){const wt=Le.message??String(Le);throw Te===void 0?pe.error(wt):m(lr=>({...lr,[Te]:wt})),Le}},ay=async $=>{if(!M)throw new Error("MCP client not connected");try{await M.notification($),Rd($)}catch(re){throw pe.error(re.message??String(re)),re}},ly=async()=>{const $=await kn({method:"resources/list",params:ie?{cursor:ie}:{}},td,"resources");r(n.concat($.resources??[])),Ge($.nextCursor)},cy=async()=>{const $=await kn({method:"resources/templates/list",params:rt?{cursor:rt}:{}},nd,"resources");s(o.concat($.resourceTemplates??[])),ir($.nextCursor)},uy=async $=>{const re=await kn({method:"resources/read",params:{uri:$}},rd,"resources");a(JSON.stringify(re,null,2))},dy=async()=>{const $=await kn({method:"prompts/list",params:rn?{cursor:rn}:{}},od,"prompts");c($.prompts),ar($.nextCursor)},fy=async($,re={})=>{const Te=await kn({method:"prompts/get",params:{name:$,arguments:re}},sd,"prompts");f(JSON.stringify(Te,null,2))},py=async()=>{const $=await kn({method:"tools/list",params:bo?{cursor:bo}:{}},id,"tools");x($.tools),Pr($.nextCursor)},my=async($,re)=>{const Te=await kn({method:"tools/call",params:{name:$,arguments:re,_meta:{progressToken:oy.current++}}},Mw,"tools");v(Te)},hy=async()=>{await ay({method:"notifications/roots/list_changed"})},gy=async()=>{try{const $=new Qw({name:"mcp-inspector",version:"0.0.1"},{capabilities:{sampling:{},roots:{listChanged:!0}}}),re=new URL("http://localhost:3000/sse");re.searchParams.append("transportType",E),E==="stdio"?(re.searchParams.append("command",d),re.searchParams.append("args",C),re.searchParams.append("env",JSON.stringify(N))):re.searchParams.append("url",T);const Te=new Yw(re);await $.connect(Te),$.setNotificationHandler(Fa,Le=>{J(wt=>[...wt,Le])}),$.setRequestHandler(ng,Le=>new Promise((wt,lr)=>{H(vy=>[...vy,{id:ee.current++,request:Le,resolve:wt,reject:lr}])})),$.setRequestHandler(og,async()=>({roots:he.current})),q($),t("connected")}catch($){console.error($),t("error")}};return p.jsxs("div",{className:"flex h-screen bg-background",children:[p.jsx($2,{connectionStatus:e,transportType:E,setTransportType:I,command:d,setCommand:y,args:C,setArgs:k,url:T,setUrl:b,env:N,setEnv:O,onConnect:gy}),p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsx("div",{className:"flex-1 overflow-auto",children:M?p.jsxs(l_,{defaultValue:"resources",className:"w-full p-4",children:[p.jsxs(Ig,{className:"mb-4 p-0",children:[p.jsxs(an,{value:"resources",children:[p.jsx(m_,{className:"w-4 h-4 mr-2"}),"Resources"]}),p.jsxs(an,{value:"prompts",children:[p.jsx(y_,{className:"w-4 h-4 mr-2"}),"Prompts"]}),p.jsxs(an,{value:"requests",disabled:!0,children:[p.jsx(Mg,{className:"w-4 h-4 mr-2"}),"Requests"]}),p.jsxs(an,{value:"tools",children:[p.jsx(g_,{className:"w-4 h-4 mr-2"}),"Tools"]}),p.jsxs(an,{value:"console",disabled:!0,children:[p.jsx(E_,{className:"w-4 h-4 mr-2"}),"Console"]}),p.jsxs(an,{value:"ping",children:[p.jsx(f_,{className:"w-4 h-4 mr-2"}),"Ping"]}),p.jsxs(an,{value:"sampling",className:"relative",children:[p.jsx(v_,{className:"w-4 h-4 mr-2"}),"Sampling",D.length>0&&p.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:D.length})]}),p.jsxs(an,{value:"roots",children:[p.jsx(h_,{className:"w-4 h-4 mr-2"}),"Roots"]})]}),p.jsxs("div",{className:"w-full",children:[p.jsx(A_,{resources:n,resourceTemplates:o,listResources:()=>{Nt("resources"),ly()},listResourceTemplates:()=>{Nt("resources"),cy()},readResource:$=>{Nt("resources"),uy($)},selectedResource:ve,setSelectedResource:$=>{Nt("resources"),B($)},resourceContent:i,nextCursor:ie,nextTemplateCursor:rt,error:_.resources}),p.jsx(M_,{prompts:l,listPrompts:()=>{Nt("prompts"),dy()},getPrompt:($,re)=>{Nt("prompts"),fy($,re)},selectedPrompt:ce,setSelectedPrompt:$=>{Nt("prompts"),Ae($)},promptContent:u,nextCursor:rn,error:_.prompts}),p.jsx(F2,{tools:g,listTools:()=>{Nt("tools"),py()},callTool:($,re)=>{Nt("tools"),my($,re)},selectedTool:fe,setSelectedTool:$=>{Nt("tools"),le($),v(null)},toolResult:w,nextCursor:bo,error:_.tools}),p.jsx(b_,{}),p.jsx(P_,{onPingClick:()=>{kn({method:"ping"},mr)}}),p.jsx(D_,{pendingRequests:D,onApprove:ae,onReject:_e}),p.jsx(L_,{roots:F,setRoots:K,onRootsChange:hy})]})]}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("p",{className:"text-lg text-gray-500",children:"Connect to an MCP server to start inspecting"})})}),p.jsxs("div",{className:"relative border-t border-border",style:{height:`${tl}px`},children:[p.jsx("div",{className:"absolute w-full h-4 -top-2 cursor-row-resize flex items-center justify-center hover:bg-accent/50",onMouseDown:iy,children:p.jsx("div",{className:"w-8 h-1 rounded-full bg-border"})}),p.jsx("div",{className:"h-full overflow-auto",children:p.jsx(N_,{requestHistory:j,serverNotifications:W})})]})]})]})};Ph(document.getElementById("root")).render(p.jsxs(h.StrictMode,{children:[p.jsx(B2,{}),p.jsx(rx,{})]}));
|
|
195
|
+
`)},s2=0,Mr=[];function i2(e){var t=h.useRef([]),n=h.useRef([0,0]),r=h.useRef(),o=h.useState(s2++)[0],s=h.useState(mv)[0],i=h.useRef(e);h.useEffect(function(){i.current=e},[e]),h.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var v=Nk([e.lockRef.current],(e.shards||[]).map(gp),!0).filter(Boolean);return v.forEach(function(_){return _.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),v.forEach(function(_){return _.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var a=h.useCallback(function(v,_){if("touches"in v&&v.touches.length===2||v.type==="wheel"&&v.ctrlKey)return!i.current.allowPinchZoom;var m=vi(v),d=n.current,y="deltaX"in v?v.deltaX:d[0]-m[0],C="deltaY"in v?v.deltaY:d[1]-m[1],k,T=v.target,b=Math.abs(y)>Math.abs(C)?"h":"v";if("touches"in v&&b==="h"&&T.type==="range")return!1;var E=mp(b,T);if(!E)return!0;if(E?k=b:(k=b==="v"?"h":"v",E=mp(b,T)),!E)return!1;if(!r.current&&"changedTouches"in v&&(y||C)&&(r.current=k),!k)return!0;var I=r.current||k;return n2(I,_,v,I==="h"?y:C,!0)},[]),l=h.useCallback(function(v){var _=v;if(!(!Mr.length||Mr[Mr.length-1]!==s)){var m="deltaY"in _?hp(_):vi(_),d=t.current.filter(function(k){return k.name===_.type&&(k.target===_.target||_.target===k.shadowParent)&&r2(k.delta,m)})[0];if(d&&d.should){_.cancelable&&_.preventDefault();return}if(!d){var y=(i.current.shards||[]).map(gp).filter(Boolean).filter(function(k){return k.contains(_.target)}),C=y.length>0?a(_,y[0]):!i.current.noIsolation;C&&_.cancelable&&_.preventDefault()}}},[]),c=h.useCallback(function(v,_,m,d){var y={name:v,delta:_,target:m,should:d,shadowParent:a2(m)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(C){return C!==y})},1)},[]),u=h.useCallback(function(v){n.current=vi(v),r.current=void 0},[]),f=h.useCallback(function(v){c(v.type,hp(v),v.target,a(v,e.lockRef.current))},[]),g=h.useCallback(function(v){c(v.type,vi(v),v.target,a(v,e.lockRef.current))},[]);h.useEffect(function(){return Mr.push(s),e.setCallbacks({onScrollCapture:f,onWheelCapture:f,onTouchMoveCapture:g}),document.addEventListener("wheel",l,Or),document.addEventListener("touchmove",l,Or),document.addEventListener("touchstart",u,Or),function(){Mr=Mr.filter(function(v){return v!==s}),document.removeEventListener("wheel",l,Or),document.removeEventListener("touchmove",l,Or),document.removeEventListener("touchstart",u,Or)}},[]);var x=e.removeScrollBar,w=e.inert;return h.createElement(h.Fragment,null,w?h.createElement(s,{styles:o2(o)}):null,x?h.createElement(Gk,{gapMode:e.gapMode}):null)}function a2(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const l2=Lk(pv,i2);var yv=h.forwardRef(function(e,t){return h.createElement(Ya,qt({},e,{ref:t,sideCar:l2}))});yv.classNames=Ya.classNames;var c2=[" ","Enter","ArrowUp","ArrowDown"],u2=[" ","Enter"],Ws="Select",[Xa,Ja,d2]=ig(Ws),[Eo,H2]=Z_(Ws,[d2,Jg]),el=Jg(),[f2,or]=Eo(Ws),[p2,m2]=Eo(Ws),xv=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:s,value:i,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:f,disabled:g,required:x,form:w}=e,v=el(t),[_,m]=h.useState(null),[d,y]=h.useState(null),[C,k]=h.useState(!1),T=cd(c),[b=!1,E]=fa({prop:r,defaultProp:o,onChange:s}),[I,j]=fa({prop:i,defaultProp:a,onChange:l}),V=h.useRef(null),M=_?w||!!_.closest("form"):!0,[q,W]=h.useState(new Set),J=Array.from(q).map(F=>F.props.value).join(";");return p.jsx(gk,{...v,children:p.jsxs(f2,{required:x,scope:t,trigger:_,onTriggerChange:m,valueNode:d,onValueNodeChange:y,valueNodeHasChildren:C,onValueNodeHasChildrenChange:k,contentId:Us(),value:I,onValueChange:j,open:b,onOpenChange:E,dir:T,triggerPointerDownPosRef:V,disabled:g,children:[p.jsx(Xa.Provider,{scope:t,children:p.jsx(p2,{scope:e.__scopeSelect,onNativeOptionAdd:h.useCallback(F=>{W(K=>new Set(K).add(F))},[]),onNativeOptionRemove:h.useCallback(F=>{W(K=>{const N=new Set(K);return N.delete(F),N})},[]),children:n})}),M?p.jsxs(Hv,{"aria-hidden":!0,required:x,tabIndex:-1,name:u,autoComplete:f,value:I,onChange:F=>j(F.target.value),disabled:g,form:w,children:[I===void 0?p.jsx("option",{value:""}):null,Array.from(q)]},J):null]})})};xv.displayName=Ws;var wv="SelectTrigger",Sv=h.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,s=el(n),i=or(wv,n),a=i.disabled||r,l=Oe(t,i.onTriggerChange),c=Ja(n),u=h.useRef("touch"),[f,g,x]=Wv(v=>{const _=c().filter(y=>!y.disabled),m=_.find(y=>y.value===i.value),d=Zv(_,v,m);d!==void 0&&i.onValueChange(d.value)}),w=v=>{a||(i.onOpenChange(!0),x()),v&&(i.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return p.jsx(vk,{asChild:!0,...s,children:p.jsx(me.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Uv(i.value)?"":void 0,...o,ref:l,onClick:ue(o.onClick,v=>{v.currentTarget.focus(),u.current!=="mouse"&&w(v)}),onPointerDown:ue(o.onPointerDown,v=>{u.current=v.pointerType;const _=v.target;_.hasPointerCapture(v.pointerId)&&_.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(w(v),v.preventDefault())}),onKeyDown:ue(o.onKeyDown,v=>{const _=f.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&g(v.key),!(_&&v.key===" ")&&c2.includes(v.key)&&(w(),v.preventDefault())})})})});Sv.displayName=wv;var _v="SelectValue",Cv=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:s,placeholder:i="",...a}=e,l=or(_v,n),{onValueNodeHasChildrenChange:c}=l,u=s!==void 0,f=Oe(t,l.onValueNodeChange);return et(()=>{c(u)},[c,u]),p.jsx(me.span,{...a,ref:f,style:{pointerEvents:"none"},children:Uv(l.value)?p.jsx(p.Fragment,{children:i}):s})});Cv.displayName=_v;var h2="SelectIcon",kv=h.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return p.jsx(me.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});kv.displayName=h2;var g2="SelectPortal",Ev=e=>p.jsx(lv,{asChild:!0,...e});Ev.displayName=g2;var Nr="SelectContent",bv=h.forwardRef((e,t)=>{const n=or(Nr,e.__scopeSelect),[r,o]=h.useState();if(et(()=>{o(new DocumentFragment)},[]),!n.open){const s=r;return s?So.createPortal(p.jsx(Nv,{scope:e.__scopeSelect,children:p.jsx(Xa.Slot,{scope:e.__scopeSelect,children:p.jsx("div",{children:e.children})})}),s):null}return p.jsx(Tv,{...e,ref:t})});bv.displayName=Nr;var Rt=10,[Nv,sr]=Eo(Nr),v2="SelectContentImpl",Tv=h.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:i,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:g,collisionPadding:x,sticky:w,hideWhenDetached:v,avoidCollisions:_,...m}=e,d=or(Nr,n),[y,C]=h.useState(null),[k,T]=h.useState(null),b=Oe(t,B=>C(B)),[E,I]=h.useState(null),[j,V]=h.useState(null),M=Ja(n),[q,W]=h.useState(!1),J=h.useRef(!1);h.useEffect(()=>{if(y)return bk(y)},[y]),nC();const F=h.useCallback(B=>{const[ce,...Ae]=M().map(ie=>ie.ref.current),[fe]=Ae.slice(-1),le=document.activeElement;for(const ie of B)if(ie===le||(ie==null||ie.scrollIntoView({block:"nearest"}),ie===ce&&k&&(k.scrollTop=0),ie===fe&&k&&(k.scrollTop=k.scrollHeight),ie==null||ie.focus(),document.activeElement!==le))return},[M,k]),K=h.useCallback(()=>F([E,y]),[F,E,y]);h.useEffect(()=>{q&&K()},[q,K]);const{onOpenChange:N,triggerPointerDownPosRef:O}=d;h.useEffect(()=>{if(y){let B={x:0,y:0};const ce=fe=>{var le,ie;B={x:Math.abs(Math.round(fe.pageX)-(((le=O.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((ie=O.current)==null?void 0:ie.y)??0))}},Ae=fe=>{B.x<=10&&B.y<=10?fe.preventDefault():y.contains(fe.target)||N(!1),document.removeEventListener("pointermove",ce),O.current=null};return O.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",Ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",Ae,{capture:!0})}}},[y,N,O]),h.useEffect(()=>{const B=()=>N(!1);return window.addEventListener("blur",B),window.addEventListener("resize",B),()=>{window.removeEventListener("blur",B),window.removeEventListener("resize",B)}},[N]);const[D,H]=Wv(B=>{const ce=M().filter(le=>!le.disabled),Ae=ce.find(le=>le.ref.current===document.activeElement),fe=Zv(ce,B,Ae);fe&&setTimeout(()=>fe.ref.current.focus())}),ee=h.useCallback((B,ce,Ae)=>{const fe=!J.current&&!Ae;(d.value!==void 0&&d.value===ce||fe)&&(I(B),fe&&(J.current=!0))},[d.value]),he=h.useCallback(()=>y==null?void 0:y.focus(),[y]),ae=h.useCallback((B,ce,Ae)=>{const fe=!J.current&&!Ae;(d.value!==void 0&&d.value===ce||fe)&&V(B)},[d.value]),_e=r==="popper"?Xc:Rv,ve=_e===Xc?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:f,collisionBoundary:g,collisionPadding:x,sticky:w,hideWhenDetached:v,avoidCollisions:_}:{};return p.jsx(Nv,{scope:n,content:y,viewport:k,onViewportChange:T,itemRefCallback:ee,selectedItem:E,onItemLeave:he,itemTextRefCallback:ae,focusSelectedItem:K,selectedItemText:j,position:r,isPositioned:q,searchRef:D,children:p.jsx(yv,{as:go,allowPinchZoom:!0,children:p.jsx(Vg,{asChild:!0,trapped:d.open,onMountAutoFocus:B=>{B.preventDefault()},onUnmountAutoFocus:ue(o,B=>{var ce;(ce=d.trigger)==null||ce.focus({preventScroll:!0}),B.preventDefault()}),children:p.jsx($g,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:B=>B.preventDefault(),onDismiss:()=>d.onOpenChange(!1),children:p.jsx(_e,{role:"listbox",id:d.contentId,"data-state":d.open?"open":"closed",dir:d.dir,onContextMenu:B=>B.preventDefault(),...m,...ve,onPlaced:()=>W(!0),ref:b,style:{display:"flex",flexDirection:"column",outline:"none",...m.style},onKeyDown:ue(m.onKeyDown,B=>{const ce=B.ctrlKey||B.altKey||B.metaKey;if(B.key==="Tab"&&B.preventDefault(),!ce&&B.key.length===1&&H(B.key),["ArrowUp","ArrowDown","Home","End"].includes(B.key)){let fe=M().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(B.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(B.key)){const le=B.target,ie=fe.indexOf(le);fe=fe.slice(ie+1)}setTimeout(()=>F(fe)),B.preventDefault()}})})})})})})});Tv.displayName=v2;var y2="SelectItemAlignedPosition",Rv=h.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,s=or(Nr,n),i=sr(Nr,n),[a,l]=h.useState(null),[c,u]=h.useState(null),f=Oe(t,b=>u(b)),g=Ja(n),x=h.useRef(!1),w=h.useRef(!0),{viewport:v,selectedItem:_,selectedItemText:m,focusSelectedItem:d}=i,y=h.useCallback(()=>{if(s.trigger&&s.valueNode&&a&&c&&v&&_&&m){const b=s.trigger.getBoundingClientRect(),E=c.getBoundingClientRect(),I=s.valueNode.getBoundingClientRect(),j=m.getBoundingClientRect();if(s.dir!=="rtl"){const le=j.left-E.left,ie=I.left-le,Ge=b.left-ie,rt=b.width+Ge,ir=Math.max(rt,E.width),rn=window.innerWidth-Rt,ar=Qf(ie,[Rt,Math.max(Rt,rn-ir)]);a.style.minWidth=rt+"px",a.style.left=ar+"px"}else{const le=E.right-j.right,ie=window.innerWidth-I.right-le,Ge=window.innerWidth-b.right-ie,rt=b.width+Ge,ir=Math.max(rt,E.width),rn=window.innerWidth-Rt,ar=Qf(ie,[Rt,Math.max(Rt,rn-ir)]);a.style.minWidth=rt+"px",a.style.right=ar+"px"}const V=g(),M=window.innerHeight-Rt*2,q=v.scrollHeight,W=window.getComputedStyle(c),J=parseInt(W.borderTopWidth,10),F=parseInt(W.paddingTop,10),K=parseInt(W.borderBottomWidth,10),N=parseInt(W.paddingBottom,10),O=J+F+q+N+K,D=Math.min(_.offsetHeight*5,O),H=window.getComputedStyle(v),ee=parseInt(H.paddingTop,10),he=parseInt(H.paddingBottom,10),ae=b.top+b.height/2-Rt,_e=M-ae,ve=_.offsetHeight/2,B=_.offsetTop+ve,ce=J+F+B,Ae=O-ce;if(ce<=ae){const le=V.length>0&&_===V[V.length-1].ref.current;a.style.bottom="0px";const ie=c.clientHeight-v.offsetTop-v.offsetHeight,Ge=Math.max(_e,ve+(le?he:0)+ie+K),rt=ce+Ge;a.style.height=rt+"px"}else{const le=V.length>0&&_===V[0].ref.current;a.style.top="0px";const Ge=Math.max(ae,J+v.offsetTop+(le?ee:0)+ve)+Ae;a.style.height=Ge+"px",v.scrollTop=ce-ae+v.offsetTop}a.style.margin=`${Rt}px 0`,a.style.minHeight=D+"px",a.style.maxHeight=M+"px",r==null||r(),requestAnimationFrame(()=>x.current=!0)}},[g,s.trigger,s.valueNode,a,c,v,_,m,s.dir,r]);et(()=>y(),[y]);const[C,k]=h.useState();et(()=>{c&&k(window.getComputedStyle(c).zIndex)},[c]);const T=h.useCallback(b=>{b&&w.current===!0&&(y(),d==null||d(),w.current=!1)},[y,d]);return p.jsx(w2,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:x,onScrollButtonChange:T,children:p.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:p.jsx(me.div,{...o,ref:f,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});Rv.displayName=y2;var x2="SelectPopperPosition",Xc=h.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Rt,...s}=e,i=el(n);return p.jsx(yk,{...i,...s,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...s.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Xc.displayName=x2;var[w2,Ed]=Eo(Nr,{}),Jc="SelectViewport",Pv=h.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,s=sr(Jc,n),i=Ed(Jc,n),a=Oe(t,s.onViewportChange),l=h.useRef(0);return p.jsxs(p.Fragment,{children:[p.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),p.jsx(Xa.Slot,{scope:n,children:p.jsx(me.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:ue(o.onScroll,c=>{const u=c.currentTarget,{contentWrapper:f,shouldExpandOnScrollRef:g}=i;if(g!=null&&g.current&&f){const x=Math.abs(l.current-u.scrollTop);if(x>0){const w=window.innerHeight-Rt*2,v=parseFloat(f.style.minHeight),_=parseFloat(f.style.height),m=Math.max(v,_);if(m<w){const d=m+x,y=Math.min(w,d),C=d-y;f.style.height=y+"px",f.style.bottom==="0px"&&(u.scrollTop=C>0?C:0,f.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});Pv.displayName=Jc;var jv="SelectGroup",[S2,_2]=Eo(jv),C2=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=Us();return p.jsx(S2,{scope:n,id:o,children:p.jsx(me.div,{role:"group","aria-labelledby":o,...r,ref:t})})});C2.displayName=jv;var Iv="SelectLabel",Ov=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=_2(Iv,n);return p.jsx(me.div,{id:o.id,...r,ref:t})});Ov.displayName=Iv;var ya="SelectItem",[k2,Mv]=Eo(ya),Av=h.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:s,...i}=e,a=or(ya,n),l=sr(ya,n),c=a.value===r,[u,f]=h.useState(s??""),[g,x]=h.useState(!1),w=Oe(t,d=>{var y;return(y=l.itemRefCallback)==null?void 0:y.call(l,d,r,o)}),v=Us(),_=h.useRef("touch"),m=()=>{o||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return p.jsx(k2,{scope:n,value:r,disabled:o,textId:v,isSelected:c,onItemTextChange:h.useCallback(d=>{f(y=>y||((d==null?void 0:d.textContent)??"").trim())},[]),children:p.jsx(Xa.ItemSlot,{scope:n,value:r,disabled:o,textValue:u,children:p.jsx(me.div,{role:"option","aria-labelledby":v,"data-highlighted":g?"":void 0,"aria-selected":c&&g,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:w,onFocus:ue(i.onFocus,()=>x(!0)),onBlur:ue(i.onBlur,()=>x(!1)),onClick:ue(i.onClick,()=>{_.current!=="mouse"&&m()}),onPointerUp:ue(i.onPointerUp,()=>{_.current==="mouse"&&m()}),onPointerDown:ue(i.onPointerDown,d=>{_.current=d.pointerType}),onPointerMove:ue(i.onPointerMove,d=>{var y;_.current=d.pointerType,o?(y=l.onItemLeave)==null||y.call(l):_.current==="mouse"&&d.currentTarget.focus({preventScroll:!0})}),onPointerLeave:ue(i.onPointerLeave,d=>{var y;d.currentTarget===document.activeElement&&((y=l.onItemLeave)==null||y.call(l))}),onKeyDown:ue(i.onKeyDown,d=>{var C;((C=l.searchRef)==null?void 0:C.current)!==""&&d.key===" "||(u2.includes(d.key)&&m(),d.key===" "&&d.preventDefault())})})})})});Av.displayName=ya;var Uo="SelectItemText",Lv=h.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:o,...s}=e,i=or(Uo,n),a=sr(Uo,n),l=Mv(Uo,n),c=m2(Uo,n),[u,f]=h.useState(null),g=Oe(t,m=>f(m),l.onItemTextChange,m=>{var d;return(d=a.itemTextRefCallback)==null?void 0:d.call(a,m,l.value,l.disabled)}),x=u==null?void 0:u.textContent,w=h.useMemo(()=>p.jsx("option",{value:l.value,disabled:l.disabled,children:x},l.value),[l.disabled,l.value,x]),{onNativeOptionAdd:v,onNativeOptionRemove:_}=c;return et(()=>(v(w),()=>_(w)),[v,_,w]),p.jsxs(p.Fragment,{children:[p.jsx(me.span,{id:l.textId,...s,ref:g}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?So.createPortal(s.children,i.valueNode):null]})});Lv.displayName=Uo;var Dv="SelectItemIndicator",zv=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return Mv(Dv,n).isSelected?p.jsx(me.span,{"aria-hidden":!0,...r,ref:t}):null});zv.displayName=Dv;var eu="SelectScrollUpButton",$v=h.forwardRef((e,t)=>{const n=sr(eu,e.__scopeSelect),r=Ed(eu,e.__scopeSelect),[o,s]=h.useState(!1),i=Oe(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;s(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?p.jsx(Vv,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});$v.displayName=eu;var tu="SelectScrollDownButton",Fv=h.forwardRef((e,t)=>{const n=sr(tu,e.__scopeSelect),r=Ed(tu,e.__scopeSelect),[o,s]=h.useState(!1),i=Oe(t,r.onScrollButtonChange);return et(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;s(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),o?p.jsx(Vv,{...e,ref:i,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});Fv.displayName=tu;var Vv=h.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,s=sr("SelectScrollButton",n),i=h.useRef(null),a=Ja(n),l=h.useCallback(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return h.useEffect(()=>()=>l(),[l]),et(()=>{var u;const c=a().find(f=>f.ref.current===document.activeElement);(u=c==null?void 0:c.ref.current)==null||u.scrollIntoView({block:"nearest"})},[a]),p.jsx(me.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:ue(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:ue(o.onPointerMove,()=>{var c;(c=s.onItemLeave)==null||c.call(s),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:ue(o.onPointerLeave,()=>{l()})})}),E2="SelectSeparator",Bv=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return p.jsx(me.div,{"aria-hidden":!0,...r,ref:t})});Bv.displayName=E2;var nu="SelectArrow",b2=h.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,o=el(n),s=or(nu,n),i=sr(nu,n);return s.open&&i.position==="popper"?p.jsx(xk,{...o,...r,ref:t}):null});b2.displayName=nu;function Uv(e){return e===""||e===void 0}var Hv=h.forwardRef((e,t)=>{const{value:n,...r}=e,o=h.useRef(null),s=Oe(t,o),i=Sk(n);return h.useEffect(()=>{const a=o.current,l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==n&&u){const f=new Event("change",{bubbles:!0});u.call(a,n),a.dispatchEvent(f)}},[i,n]),p.jsx(cv,{asChild:!0,children:p.jsx("select",{...r,ref:s,defaultValue:n})})});Hv.displayName="BubbleSelect";function Wv(e){const t=Jt(e),n=h.useRef(""),r=h.useRef(0),o=h.useCallback(i=>{const a=n.current+i;t(a),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(a)},[t]),s=h.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return h.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,s]}function Zv(e,t,n){const o=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,s=n?e.indexOf(n):-1;let i=N2(e,Math.max(s,0));o.length===1&&(i=i.filter(c=>c!==n));const l=i.find(c=>c.textValue.toLowerCase().startsWith(o.toLowerCase()));return l!==n?l:void 0}function N2(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var T2=xv,qv=Sv,R2=Cv,P2=kv,j2=Ev,Kv=bv,I2=Pv,Gv=Ov,Qv=Av,O2=Lv,M2=zv,Yv=$v,Xv=Fv,Jv=Bv;const A2=T2,L2=R2,ey=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(qv,{ref:r,className:$e("flex h-9 w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,p.jsx(P2,{asChild:!0,children:p.jsx($_,{className:"h-4 w-4 opacity-50"})})]}));ey.displayName=qv.displayName;const ty=h.forwardRef(({className:e,...t},n)=>p.jsx(Yv,{ref:n,className:$e("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(W_,{})}));ty.displayName=Yv.displayName;const ny=h.forwardRef(({className:e,...t},n)=>p.jsx(Xv,{ref:n,className:$e("flex cursor-default items-center justify-center py-1",e),...t,children:p.jsx(U_,{})}));ny.displayName=Xv.displayName;const ry=h.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>p.jsx(j2,{children:p.jsxs(Kv,{ref:o,className:$e("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[p.jsx(ty,{}),p.jsx(I2,{className:$e("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),p.jsx(ny,{})]})}));ry.displayName=Kv.displayName;const D2=h.forwardRef(({className:e,...t},n)=>p.jsx(Gv,{ref:n,className:$e("px-2 py-1.5 text-sm font-semibold",e),...t}));D2.displayName=Gv.displayName;const ru=h.forwardRef(({className:e,children:t,...n},r)=>p.jsxs(Qv,{ref:r,className:$e("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[p.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:p.jsx(M2,{children:p.jsx(V_,{className:"h-4 w-4"})})}),p.jsx(O2,{children:t})]}));ru.displayName=Qv.displayName;const z2=h.forwardRef(({className:e,...t},n)=>p.jsx(Jv,{ref:n,className:$e("-mx-1 my-1 h-px bg-muted",e),...t}));z2.displayName=Jv.displayName;const $2=({connectionStatus:e,transportType:t,setTransportType:n,command:r,setCommand:o,args:s,setArgs:i,url:a,setUrl:l,env:c,setEnv:u,onConnect:f})=>{const[g,x]=h.useState(!1);return p.jsxs("div",{className:"w-80 bg-card border-r border-border flex flex-col h-full",children:[p.jsxs("div",{className:"flex items-center p-4 border-b border-gray-200",children:[p.jsx(k_,{className:"w-6 h-6 text-gray-500"}),p.jsx("h1",{className:"ml-2 text-lg font-semibold",children:"MCP Inspector"})]}),p.jsx("div",{className:"p-4 flex-1 overflow-auto",children:p.jsxs("div",{className:"space-y-4",children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"Transport Type"}),p.jsxs(A2,{value:t,onValueChange:w=>n(w),children:[p.jsx(ey,{children:p.jsx(L2,{placeholder:"Select transport type"})}),p.jsxs(ry,{children:[p.jsx(ru,{value:"stdio",children:"STDIO"}),p.jsx(ru,{value:"sse",children:"SSE"})]})]})]}),t==="stdio"?p.jsxs(p.Fragment,{children:[p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"Command"}),p.jsx(Zt,{placeholder:"Command",value:r,onChange:w=>o(w.target.value)})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"Arguments"}),p.jsx(Zt,{placeholder:"Arguments (space-separated)",value:s,onChange:w=>i(w.target.value)})]})]}):p.jsxs("div",{className:"space-y-2",children:[p.jsx("label",{className:"text-sm font-medium",children:"URL"}),p.jsx(Zt,{placeholder:"URL",value:a,onChange:w=>l(w.target.value)})]}),t==="stdio"&&p.jsxs("div",{className:"space-y-2",children:[p.jsxs(Ze,{variant:"outline",onClick:()=>x(!g),className:"flex items-center w-full",children:[g?p.jsx(p_,{className:"w-4 h-4 mr-2"}):p.jsx(Wc,{className:"w-4 h-4 mr-2"}),"Environment Variables"]}),g&&p.jsxs("div",{className:"space-y-2",children:[Object.entries(c).map(([w,v],_)=>p.jsxs("div",{className:"grid grid-cols-[1fr,auto] gap-2",children:[p.jsxs("div",{className:"space-y-1",children:[p.jsx(Zt,{placeholder:"Key",value:w,onChange:m=>{const d={...c};delete d[w],d[m.target.value]=v,u(d)}}),p.jsx(Zt,{placeholder:"Value",value:v,onChange:m=>{const d={...c};d[w]=m.target.value,u(d)}})]}),p.jsx(Ze,{variant:"destructive",onClick:()=>{const{[w]:m,...d}=c;u(d)},children:"Remove"})]},_)),p.jsx(Ze,{variant:"outline",onClick:()=>{const w={...c};w[""]="",u(w)},children:"Add Environment Variable"})]})]}),p.jsxs("div",{className:"space-y-2",children:[p.jsxs(Ze,{className:"w-full",onClick:f,children:[p.jsx(w_,{className:"w-4 h-4 mr-2"}),"Connect"]}),p.jsxs("div",{className:"flex items-center justify-center space-x-2 mb-4",children:[p.jsx("div",{className:`w-2 h-2 rounded-full ${e==="connected"?"bg-green-500":e==="error"?"bg-red-500":"bg-gray-500"}`}),p.jsx("span",{className:"text-sm text-gray-600",children:e==="connected"?"Connected":e==="error"?"Connection Error":"Disconnected"})]})]})]})})]})},F2=({tools:e,listTools:t,callTool:n,selectedTool:r,setSelectedTool:o,toolResult:s,nextCursor:i,error:a})=>{const[l,c]=h.useState({}),u=()=>{if(!s)return null;if("content"in s){const f=s,g=f.isError??!1;return p.jsxs(p.Fragment,{children:[p.jsxs("h4",{className:"font-semibold mb-2",children:["Tool Result: ",g?"Error":"Success"]}),f.content.map((x,w)=>p.jsxs("div",{className:"mb-2",children:[x.type==="text"&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded text-sm overflow-auto max-h-64",children:x.text}),x.type==="image"&&p.jsx("img",{src:`data:${x.mimeType};base64,${x.data}`,alt:"Tool result image",className:"max-w-full h-auto"}),x.type==="resource"&&p.jsx("pre",{className:"bg-gray-50 p-4 rounded text-sm overflow-auto max-h-64",children:JSON.stringify(x.resource,null,2)})]},w))]})}else if("toolResult"in s)return p.jsxs(p.Fragment,{children:[p.jsx("h4",{className:"font-semibold mb-2",children:"Tool Result (Legacy):"}),p.jsx("pre",{className:"bg-gray-50 p-4 rounded text-sm overflow-auto max-h-64",children:JSON.stringify(s.toolResult,null,2)})]})};return p.jsxs(rr,{value:"tools",className:"grid grid-cols-2 gap-4",children:[p.jsx(pa,{items:e,listItems:t,setSelectedItem:o,renderItem:f=>p.jsxs(p.Fragment,{children:[p.jsx("span",{className:"flex-1",children:f.name}),p.jsx("span",{className:"text-sm text-gray-500 text-right",children:f.description})]}),title:"Tools",buttonText:i?"List More Tools":"List Tools",isButtonDisabled:!i&&e.length>0}),p.jsxs("div",{className:"bg-card rounded-lg shadow",children:[p.jsx("div",{className:"p-4 border-b border-gray-200",children:p.jsx("h3",{className:"font-semibold",children:r?r.name:"Select a tool"})}),p.jsx("div",{className:"p-4",children:a?p.jsxs(xn,{variant:"destructive",children:[p.jsx(pd,{className:"h-4 w-4"}),p.jsx(Za,{children:"Error"}),p.jsx(wn,{children:a})]}):r?p.jsxs("div",{className:"space-y-4",children:[p.jsx("p",{className:"text-sm text-gray-600",children:r.description}),Object.entries(r.inputSchema.properties??[]).map(([f,g])=>p.jsxs("div",{children:[p.jsx(hd,{htmlFor:f,className:"block text-sm font-medium text-gray-700",children:f}),g.type==="string"?p.jsx(gd,{id:f,name:f,placeholder:g.description,onChange:x=>c({...l,[f]:x.target.value}),className:"mt-1"}):p.jsx(Zt,{type:g.type==="number"?"number":"text",id:f,name:f,placeholder:g.description,onChange:x=>c({...l,[f]:g.type==="number"?Number(x.target.value):x.target.value}),className:"mt-1"})]},f)),p.jsxs(Ze,{onClick:()=>n(r.name,l),children:[p.jsx(Mg,{className:"w-4 h-4 mr-2"}),"Run Tool"]}),s&&u()]}):p.jsx(xn,{children:p.jsx(wn,{children:"Select a tool from the list to view its details and run it"})})})]})]})};window.matchMedia("(prefers-color-scheme: dark)").matches&&document.documentElement.classList.add("dark");const V2=1e4,B2=()=>{const[e,t]=h.useState("disconnected"),[n,r]=h.useState([]),[o,s]=h.useState([]),[i,a]=h.useState(""),[l,c]=h.useState([]),[u,f]=h.useState(""),[g,x]=h.useState([]),[w,v]=h.useState(null),[_,m]=h.useState({resources:null,prompts:null,tools:null}),[d,y]=h.useState(()=>localStorage.getItem("lastCommand")||"mcp-server-everything"),[C,k]=h.useState(()=>localStorage.getItem("lastArgs")||""),[T,b]=h.useState("http://localhost:3001/sse"),[E,I]=h.useState("stdio"),[j,V]=h.useState([]),[M,q]=h.useState(null),[W,J]=h.useState([]),[F,K]=h.useState([]),[N,O]=h.useState({}),[D,H]=h.useState([]),ee=h.useRef(0),he=h.useRef([]),ae=($,re)=>{H(Te=>{const Le=Te.find(wt=>wt.id===$);return Le==null||Le.resolve(re),Te.filter(wt=>wt.id!==$)})},_e=$=>{H(re=>{const Te=re.find(Le=>Le.id===$);return Te==null||Te.reject(new Error("Sampling request rejected")),re.filter(Le=>Le.id!==$)})},[ve,B]=h.useState(null),[ce,Ae]=h.useState(null),[fe,le]=h.useState(null),[ie,Ge]=h.useState(),[rt,ir]=h.useState(),[rn,ar]=h.useState(),[bo,Pr]=h.useState(),oy=h.useRef(0),[tl,sy]=h.useState(300),[Zs,bd]=h.useState(!1),Nd=h.useRef(0),Td=h.useRef(0),iy=h.useCallback($=>{bd(!0),Nd.current=$.clientY,Td.current=tl,document.body.style.userSelect="none"},[tl]),nl=h.useCallback($=>{if(!Zs)return;const re=Nd.current-$.clientY,Te=Math.max(100,Math.min(800,Td.current+re));sy(Te)},[Zs]),rl=h.useCallback(()=>{bd(!1),document.body.style.userSelect=""},[]);h.useEffect(()=>{if(Zs)return window.addEventListener("mousemove",nl),window.addEventListener("mouseup",rl),()=>{window.removeEventListener("mousemove",nl),window.removeEventListener("mouseup",rl)}},[Zs,nl,rl]),h.useEffect(()=>{localStorage.setItem("lastCommand",d)},[d]),h.useEffect(()=>{localStorage.setItem("lastArgs",C)},[C]),h.useEffect(()=>{fetch("http://localhost:3000/config").then($=>$.json()).then($=>{O($.defaultEnvironment),y($.defaultCommand),k($.defaultArgs)}).catch($=>console.error("Error fetching default environment:",$))},[]),h.useEffect(()=>{he.current=F},[F]);const Rd=($,re)=>{V(Te=>[...Te,{request:JSON.stringify($),response:re!==void 0?JSON.stringify(re):void 0}])},Nt=$=>{m(re=>({...re,[$]:null}))},kn=async($,re,Te)=>{if(!M)throw new Error("MCP client not connected");try{const Le=new AbortController,wt=setTimeout(()=>{Le.abort("Request timed out")},V2);let lr;try{lr=await M.request($,re,{signal:Le.signal})}finally{clearTimeout(wt)}return Rd($,lr),Te!==void 0&&Nt(Te),lr}catch(Le){const wt=Le.message??String(Le);throw Te===void 0?pe.error(wt):m(lr=>({...lr,[Te]:wt})),Le}},ay=async $=>{if(!M)throw new Error("MCP client not connected");try{await M.notification($),Rd($)}catch(re){throw pe.error(re.message??String(re)),re}},ly=async()=>{const $=await kn({method:"resources/list",params:ie?{cursor:ie}:{}},td,"resources");r(n.concat($.resources??[])),Ge($.nextCursor)},cy=async()=>{const $=await kn({method:"resources/templates/list",params:rt?{cursor:rt}:{}},nd,"resources");s(o.concat($.resourceTemplates??[])),ir($.nextCursor)},uy=async $=>{const re=await kn({method:"resources/read",params:{uri:$}},rd,"resources");a(JSON.stringify(re,null,2))},dy=async()=>{const $=await kn({method:"prompts/list",params:rn?{cursor:rn}:{}},od,"prompts");c($.prompts),ar($.nextCursor)},fy=async($,re={})=>{const Te=await kn({method:"prompts/get",params:{name:$,arguments:re}},sd,"prompts");f(JSON.stringify(Te,null,2))},py=async()=>{const $=await kn({method:"tools/list",params:bo?{cursor:bo}:{}},id,"tools");x($.tools),Pr($.nextCursor)},my=async($,re)=>{const Te=await kn({method:"tools/call",params:{name:$,arguments:re,_meta:{progressToken:oy.current++}}},Mw,"tools");v(Te)},hy=async()=>{await ay({method:"notifications/roots/list_changed"})},gy=async()=>{try{const $=new Qw({name:"mcp-inspector",version:"0.0.1"},{capabilities:{sampling:{},roots:{listChanged:!0}}}),re=new URL("http://localhost:3000/sse");re.searchParams.append("transportType",E),E==="stdio"?(re.searchParams.append("command",d),re.searchParams.append("args",C),re.searchParams.append("env",JSON.stringify(N))):re.searchParams.append("url",T);const Te=new Yw(re);await $.connect(Te),$.setNotificationHandler(Fa,Le=>{J(wt=>[...wt,Le])}),$.setRequestHandler(ng,Le=>new Promise((wt,lr)=>{H(vy=>[...vy,{id:ee.current++,request:Le,resolve:wt,reject:lr}])})),$.setRequestHandler(og,async()=>({roots:he.current})),q($),t("connected")}catch($){console.error($),t("error")}};return p.jsxs("div",{className:"flex h-screen bg-background",children:[p.jsx($2,{connectionStatus:e,transportType:E,setTransportType:I,command:d,setCommand:y,args:C,setArgs:k,url:T,setUrl:b,env:N,setEnv:O,onConnect:gy}),p.jsxs("div",{className:"flex-1 flex flex-col overflow-hidden",children:[p.jsx("div",{className:"flex-1 overflow-auto",children:M?p.jsxs(l_,{defaultValue:"resources",className:"w-full p-4",children:[p.jsxs(Ig,{className:"mb-4 p-0",children:[p.jsxs(an,{value:"resources",children:[p.jsx(m_,{className:"w-4 h-4 mr-2"}),"Resources"]}),p.jsxs(an,{value:"prompts",children:[p.jsx(y_,{className:"w-4 h-4 mr-2"}),"Prompts"]}),p.jsxs(an,{value:"requests",disabled:!0,children:[p.jsx(Mg,{className:"w-4 h-4 mr-2"}),"Requests"]}),p.jsxs(an,{value:"tools",children:[p.jsx(g_,{className:"w-4 h-4 mr-2"}),"Tools"]}),p.jsxs(an,{value:"console",disabled:!0,children:[p.jsx(E_,{className:"w-4 h-4 mr-2"}),"Console"]}),p.jsxs(an,{value:"ping",children:[p.jsx(f_,{className:"w-4 h-4 mr-2"}),"Ping"]}),p.jsxs(an,{value:"sampling",className:"relative",children:[p.jsx(v_,{className:"w-4 h-4 mr-2"}),"Sampling",D.length>0&&p.jsx("span",{className:"absolute -top-1 -right-1 bg-red-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:D.length})]}),p.jsxs(an,{value:"roots",children:[p.jsx(h_,{className:"w-4 h-4 mr-2"}),"Roots"]})]}),p.jsxs("div",{className:"w-full",children:[p.jsx(A_,{resources:n,resourceTemplates:o,listResources:()=>{Nt("resources"),ly()},listResourceTemplates:()=>{Nt("resources"),cy()},readResource:$=>{Nt("resources"),uy($)},selectedResource:ve,setSelectedResource:$=>{Nt("resources"),B($)},resourceContent:i,nextCursor:ie,nextTemplateCursor:rt,error:_.resources}),p.jsx(M_,{prompts:l,listPrompts:()=>{Nt("prompts"),dy()},getPrompt:($,re)=>{Nt("prompts"),fy($,re)},selectedPrompt:ce,setSelectedPrompt:$=>{Nt("prompts"),Ae($)},promptContent:u,nextCursor:rn,error:_.prompts}),p.jsx(F2,{tools:g,listTools:()=>{Nt("tools"),py()},callTool:($,re)=>{Nt("tools"),my($,re)},selectedTool:fe,setSelectedTool:$=>{Nt("tools"),le($),v(null)},toolResult:w,nextCursor:bo,error:_.tools}),p.jsx(b_,{}),p.jsx(P_,{onPingClick:()=>{kn({method:"ping"},mr)}}),p.jsx(D_,{pendingRequests:D,onApprove:ae,onReject:_e}),p.jsx(L_,{roots:F,setRoots:K,onRootsChange:hy})]})]}):p.jsx("div",{className:"flex items-center justify-center h-full",children:p.jsx("p",{className:"text-lg text-gray-500",children:"Connect to an MCP server to start inspecting"})})}),p.jsxs("div",{className:"relative border-t border-border",style:{height:`${tl}px`},children:[p.jsx("div",{className:"absolute w-full h-4 -top-2 cursor-row-resize flex items-center justify-center hover:bg-accent/50",onMouseDown:iy,children:p.jsx("div",{className:"w-8 h-1 rounded-full bg-border"})}),p.jsx("div",{className:"h-full overflow-auto",children:p.jsx(N_,{requestHistory:j,serverNotifications:W})})]})]})]})};Ph(document.getElementById("root")).render(p.jsxs(h.StrictMode,{children:[p.jsx(B2,{}),p.jsx(rx,{})]}));
|
package/client/dist/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>MCP Inspector</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-D-ByN_8f.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-DJlejpJa.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/package.json
CHANGED
package/server/build/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { parseArgs } from "node:util";
|
|
2
3
|
import cors from "cors";
|
|
3
4
|
import EventSource from "eventsource";
|
|
4
5
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
@@ -9,6 +10,13 @@ import mcpProxy from "./mcpProxy.js";
|
|
|
9
10
|
// Polyfill EventSource for an SSE client in Node.js
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
global.EventSource = EventSource;
|
|
13
|
+
const { values } = parseArgs({
|
|
14
|
+
args: process.argv.slice(2),
|
|
15
|
+
options: {
|
|
16
|
+
env: { type: "string", default: "" },
|
|
17
|
+
args: { type: "string", default: "" },
|
|
18
|
+
},
|
|
19
|
+
});
|
|
12
20
|
const app = express();
|
|
13
21
|
app.use(cors());
|
|
14
22
|
let webAppTransports = [];
|
|
@@ -78,12 +86,17 @@ app.post("/message", async (req, res) => {
|
|
|
78
86
|
res.status(500).json(error);
|
|
79
87
|
}
|
|
80
88
|
});
|
|
81
|
-
app.get("/
|
|
89
|
+
app.get("/config", (req, res) => {
|
|
82
90
|
try {
|
|
83
|
-
|
|
91
|
+
const defaultEnvironment = getDefaultEnvironment();
|
|
92
|
+
res.json({
|
|
93
|
+
defaultEnvironment,
|
|
94
|
+
defaultCommand: values.env,
|
|
95
|
+
defaultArgs: values.args,
|
|
96
|
+
});
|
|
84
97
|
}
|
|
85
98
|
catch (error) {
|
|
86
|
-
console.error("Error in /
|
|
99
|
+
console.error("Error in /config route:", error);
|
|
87
100
|
res.status(500).json(error);
|
|
88
101
|
}
|
|
89
102
|
});
|