PageSourceSearch

https://hiiian-lizpaw1.hf.space/assets/index-BmidOtem.js

js hiiian-lizpaw1.hf.space collected 2026-10-03 16:56:47 UTC 8,793 bytes, 22 lines download raw bytes

1import{r as j,j as e}from"./react-vendor-DbzdS4FP.js";import{M as Y}from"./index-SvwHl0E2.js";import"./index-kSfDswZP.js";import{s as a}from"./index.module-Cl1f8c8i.js";import{useMCP as J}from"./useMCP-Br23EKE8.js";import{P as B}from"./index-BSocZh1V.js";import{u as L}from"./i18n-vendor-BrUIoOSg.js";import{cX as g,df as G,d6 as $,dg as V,dh as W,cV as X,di as Q,cF as d,cv as Z}from"./ui-vendor-DCtmHMLE.js";import"./MCPAccessModal-Dtrt8tw5.js";import"./accessPolicy-D5yKlKW-.js";import"./MCPAccessClientPanel-BbipD0DW.js";import"./MCPAccessPolicySegmented-BJjO0LlT.js";import"./markdown-vendor-DonjKQI4.js";import"./MCPAccessRuleRows-CMvVLGsw.js";import"./MCPAccessToolPanel-BBSNAQFW.js";import"./dnd-vendor-DdAwup11.js";import"./MCPOAuthSection-BAobGauy.js";import"./harness-B4JVY2Eg.js";function D(r){if(typeof r!="string")return;switch(r.trim().toLowerCase()){case"stdio":return"stdio";case"sse":return"sse";case"streamablehttp":case"streamable_http":case"streamable-http":case"http":return"streamable_http";default:return}}function b(r,n){const p=D(n.transport??n.type)??(n.url||n.baseUrl||!n.command?"streamable_http":"stdio"),f=p==="stdio"?n.command??"":"";return{name:n.name||r,description:n.description||"",enabled:n.enabled??n.isActive??!0,transport:p,url:n.url||n.baseUrl||"",headers:n.headers||{},command:f,args:Array.isArray(n.args)?n.args:[],env:n.env||{},cwd:n.cwd||""}}const _={key:"",name:"",description:"",transport:"streamable_http",url:"",command:"",args:"",env:"",cwd:""};function ge(){const{t:r}=L(),{clients:n,providerServers:p,loading:f,toggleEnabled:R,deleteClient:F,createClient:C,updateClient:H,updatePolicy:A,refreshClients:O}=J(),[z,u]=j.useState(!1),[S,N]=j.useState("json"),[k,P]=j.useState(`{
2  "mcpServers": {
3    "example-client": {
4      "command": "npx",
5      "args": ["-y", "@example/mcp-server"],
6      "env": {
7        "API_KEY": "<YOUR_API_KEY>"
8      }
9    }
10  }
11}`),[t,E]=j.useState({..._}),o=j.useCallback((s,l)=>{E(h=>({...h,[s]:l}))},[]),v=j.useCallback(()=>{P(`{
12  "mcpServers": {
13    "example-client": {
14      "command": "npx",
15      "args": ["-y", "@example/mcp-server"],
16      "env": {
17        "API_KEY": "<YOUR_API_KEY>"
18      }
19    }
20  }
21}`),E({..._}),N("json")},[]),I=async(s,l)=>{l==null||l.stopPropagation(),await R(s)},U=async(s,l)=>{l==null||l.stopPropagation(),await F(s)},w=async()=>{try{const s=JSON.parse(k),l=[];if(s.mcpServers)Object.entries(s.mcpServers).forEach(([i,c])=>{l.push({key:i,data:b(i,c)})});else if(s.key&&(s.command||s.url||s.baseUrl)){const{key:i,...c}=s;l.push({key:i,data:b(i,c)})}else Object.entries(s).forEach(([i,c])=>{typeof c=="object"&&c!==null&&(c.command||c.url||c.baseUrl)&&l.push({key:i,data:b(i,c)})});let h=!0;for(const{key:i,data:c}of l)await C(i,c)||(h=!1);h&&(u(!1),v())}catch{alert("Invalid JSON format")}},q=async()=>{const s=t.key.trim(),l=t.name.trim();if(!s){alert(r("mcp.form.keyRequired"));return}if(!l){alert(r("mcp.form.nameRequired"));return}const h=t.transport==="streamable_http"||t.transport==="sse";if(h&&!t.url.trim()){alert(r("mcp.form.urlRequired"));return}if(t.transport==="stdio"&&!t.command.trim()){alert(r("mcp.form.commandRequired"));return}const i=t.args.split(/[\n, ]+/).map(x=>x.trim()).filter(Boolean),c={};t.env.split(`
22`).map(x=>x.trim()).filter(Boolean).forEach(x=>{const y=x.indexOf("=");y>0&&(c[x.slice(0,y).trim()]=x.slice(y+1).trim())});const T={name:l,description:t.description,transport:t.transport,url:h?t.url.trim():"",command:t.transport==="stdio"?t.command.trim():"",args:i,env:c,cwd:t.cwd.trim()};await C(s,T)&&(u(!1),v())},K=t.transport==="streamable_http"||t.transport==="sse";return e.jsxs("div",{className:a.mcpPage,children:[e.jsx(B,{items:[{title:r("nav.agent")},{title:r("mcp.title")}],extra:e.jsx(g,{type:"primary",icon:e.jsx(G,{size:14}),onClick:()=>u(!0),children:r("mcp.create")})}),f?e.jsx("div",{className:a.loading,children:e.jsx("p",{children:r("common.loading")})}):n.length===0&&p.length===0?e.jsx("div",{className:a.emptyState,children:e.jsx($,{description:r("mcp.emptyState")})}):e.jsxs("div",{className:a.mcpSections,children:[e.jsxs("section",{className:a.mcpSection,children:[e.jsxs("div",{className:a.sectionHeader,children:[e.jsx("div",{className:a.sectionIcon,children:e.jsx(V,{size:17})}),e.jsxs("div",{children:[e.jsx("h2",{children:r("mcp.qwenpawManaged")}),e.jsx("p",{children:r("mcp.qwenpawManagedHint")})]})]}),n.length===0?e.jsx("div",{className:a.sectionEmpty,children:r("mcp.emptyState")}):e.jsx("div",{className:a.mcpGrid,children:n.map(s=>e.jsx(Y,{client:s,onToggle:I,onDelete:U,onUpdate:H,onUpdatePolicy:A,onRefresh:O},s.key))})]}),p.length>0&&e.jsxs("section",{className:a.mcpSection,children:[e.jsxs("div",{className:a.sectionHeader,children:[e.jsx("div",{className:a.sectionIcon,children:e.jsx(W,{size:17})}),e.jsxs("div",{children:[e.jsx("h2",{children:r("mcp.providerManaged",{provider:p[0].provider_id})}),e.jsx("p",{children:r("mcp.providerManagedHint")})]})]}),e.jsx("div",{className:a.providerGrid,children:p.map(s=>e.jsxs("article",{className:a.providerCard,children:[e.jsxs("div",{className:a.providerCardHeader,children:[e.jsx("strong",{children:s.name}),e.jsx("span",{className:s.enabled?a.providerEnabled:a.providerDisabled,children:s.enabled?r("common.enabled"):r("common.disabled")})]}),e.jsxs("div",{className:a.providerMeta,children:[e.jsx("span",{children:s.transport}),e.jsx("span",{children:r("mcp.providerOnly")}),e.jsx("span",{children:r("mcp.readOnly")})]})]},`${s.provider_id}:${s.name}`))})]})]}),e.jsx(X,{title:r("mcp.create"),open:z,onCancel:()=>{u(!1),v()},footer:e.jsxs("div",{className:a.modalFooter,children:[e.jsx(g,{onClick:()=>{u(!1),v()},style:{marginRight:8},children:r("common.cancel")}),e.jsx(g,{type:"primary",onClick:S==="json"?w:q,children:r("common.create")})]}),width:800,children:e.jsx(Q,{activeKey:S,onChange:s=>N(s),items:[{key:"json",label:r("mcp.tab.json"),children:e.jsxs("div",{children:[e.jsxs("div",{className:a.importHint,children:[e.jsxs("p",{className:a.importHintTitle,children:[r("mcp.formatSupport"),":"]}),e.jsxs("ul",{className:a.importHintList,children:[e.jsxs("li",{children:[r("mcp.standardFormat"),":"," ",e.jsx("code",{children:'{ "mcpServers": { "ke
22y": {...} } }'})]}),e.jsxs("li",{children:[r("mcp.directFormat"),":"," ",e.jsx("code",{children:'{ "key": {...} }'})]}),e.jsxs("li",{children:[r("mcp.singleFormat"),":"," ",e.jsx("code",{children:'{ "key": "...", "name": "...", "command": "..." }'})]})]})]}),e.jsx(d.TextArea,{value:k,onChange:s=>P(s.target.value),autoSize:{minRows:15,maxRows:25},className:a.jsonTextArea})]})},{key:"form",label:r("mcp.tab.form"),children:e.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[e.jsxs("div",{style:ee,children:[e.jsxs("div",{style:M,children:[e.jsxs("label",{style:m,children:[r("mcp.form.key"),e.jsx("span",{style:{color:"#c0392b"},children:" *"})]}),e.jsx(d,{placeholder:r("mcp.form.keyPlaceholder"),value:t.key,onChange:s=>o("key",s.target.value)})]}),e.jsxs("div",{style:M,children:[e.jsxs("label",{style:m,children:[r("mcp.form.name"),e.jsx("span",{style:{color:"#c0392b"},children:" *"})]}),e.jsx(d,{placeholder:r("mcp.form.namePlaceholder"),value:t.name,onChange:s=>o("name",s.target.value)})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:m,children:r("mcp.form.transport")}),e.jsx(Z,{value:t.transport,onChange:s=>o("transport",s),style:{width:"100%"},options:[{label:"Streamable HTTP",value:"streamable_http"},{label:"SSE",value:"sse"},{label:"Stdio",value:"stdio"}]})]}),K?e.jsxs("div",{children:[e.jsxs("label",{style:m,children:[r("mcp.form.url"),e.jsx("span",{style:{color:"#c0392b"},children:" *"})]}),e.jsx(d,{placeholder:"https://mcp.example.com/mcp",value:t.url,onChange:s=>o("url",s.target.value)})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsxs("label",{style:m,children:[r("mcp.form.command"),e.jsx("span",{style:{color:"#c0392b"},children:" *"})]}),e.jsx(d,{placeholder:"npx",value:t.command,onChange:s=>o("command",s.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{style:m,children:r("mcp.form.args")}),e.jsx(d,{placeholder:"-y @example/mcp-server",value:t.args,onChange:s=>o("args",s.target.value)})]})]}),e.jsxs("div",{children:[e.jsx("label",{style:m,children:r("mcp.form.description")}),e.jsx(d,{placeholder:r("mcp.form.descriptionPlaceholder"),value:t.description,onChange:s=>o("description",s.target.value)})]}),t.transport==="stdio"&&e.jsxs("div",{children:[e.jsx("label",{style:m,children:r("mcp.form.env")}),e.jsx(d.TextArea,{placeholder:r("mcp.form.envPlaceholder"),value:t.env,onChange:s=>o("env",s.target.value),autoSize:{minRows:2,maxRows:5}})]})]})}]})})]})}const ee={display:"flex",gap:12},M={flex:1,display:"flex",flexDirection:"column",gap:4},m={fontSize:12,color:"#555",fontWeight:500};export{ge as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.