@samanhappy/mcphub 1.1.10 → 1.1.11
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/clients/legacyMcpClient.js +10 -2
- package/dist/clients/legacyMcpClient.js.map +1 -1
- package/dist/controllers/groupController.js +19 -0
- package/dist/controllers/groupController.js.map +1 -1
- package/dist/controllers/serverController.js +2 -0
- package/dist/controllers/serverController.js.map +1 -1
- package/dist/dao/CapabilitySnapshotDao.js +38 -0
- package/dist/dao/CapabilitySnapshotDao.js.map +1 -0
- package/dist/dao/CapabilitySnapshotDaoDbImpl.js +18 -0
- package/dist/dao/CapabilitySnapshotDaoDbImpl.js.map +1 -0
- package/dist/dao/DaoFactory.js +7 -0
- package/dist/dao/DaoFactory.js.map +1 -1
- package/dist/dao/DatabaseDaoFactory.js +4 -0
- package/dist/dao/DatabaseDaoFactory.js.map +1 -1
- package/dist/dao/ServerDaoDbImpl.js +3 -0
- package/dist/dao/ServerDaoDbImpl.js.map +1 -1
- package/dist/db/entities/CapabilitySnapshot.js +37 -0
- package/dist/db/entities/CapabilitySnapshot.js.map +1 -0
- package/dist/db/entities/Group.js.map +1 -1
- package/dist/db/entities/Server.js +4 -0
- package/dist/db/entities/Server.js.map +1 -1
- package/dist/db/entities/index.js +3 -1
- package/dist/db/entities/index.js.map +1 -1
- package/dist/services/capabilitySnapshotService.js +106 -0
- package/dist/services/capabilitySnapshotService.js.map +1 -0
- package/dist/services/groupService.js +1 -0
- package/dist/services/groupService.js.map +1 -1
- package/dist/services/keepAliveService.js +52 -36
- package/dist/services/keepAliveService.js.map +1 -1
- package/dist/services/mcpOAuthProvider.js +19 -2
- package/dist/services/mcpOAuthProvider.js.map +1 -1
- package/dist/services/mcpService.js +405 -103
- package/dist/services/mcpService.js.map +1 -1
- package/dist/services/oauthClientRegistration.js +2 -1
- package/dist/services/oauthClientRegistration.js.map +1 -1
- package/dist/services/principalRuntimeService.js +27 -3
- package/dist/services/principalRuntimeService.js.map +1 -1
- package/dist/services/smartRoutingService.js +19 -5
- package/dist/services/smartRoutingService.js.map +1 -1
- package/dist/services/templateService.js +5 -0
- package/dist/services/templateService.js.map +1 -1
- package/dist/services/upstreamListRefresh.js +37 -0
- package/dist/services/upstreamListRefresh.js.map +1 -0
- package/dist/utils/groupToolNames.js +21 -0
- package/dist/utils/groupToolNames.js.map +1 -0
- package/dist/utils/mcpProtocol.js +14 -1
- package/dist/utils/mcpProtocol.js.map +1 -1
- package/dist/utils/migration.js +1 -0
- package/dist/utils/migration.js.map +1 -1
- package/dist/utils/oauthServerMetadata.js +23 -0
- package/dist/utils/oauthServerMetadata.js.map +1 -0
- package/dist/utils/parameterConversion.js +9 -2
- package/dist/utils/parameterConversion.js.map +1 -1
- package/dist/utils/serverConfigPersistence.js +11 -0
- package/dist/utils/serverConfigPersistence.js.map +1 -1
- package/dist/utils/settingsSync.js +2 -0
- package/dist/utils/settingsSync.js.map +1 -1
- package/frontend/dist/assets/{ActivityPage-DDa3yAck.js → ActivityPage-D8nsR_f_.js} +2 -2
- package/frontend/dist/assets/{ActivityPage-DDa3yAck.js.map → ActivityPage-D8nsR_f_.js.map} +1 -1
- package/frontend/dist/assets/{CopyClientConfigDialog-DPQOggV-.js → CopyClientConfigDialog-DgHrZUv_.js} +2 -2
- package/frontend/dist/assets/{CopyClientConfigDialog-DPQOggV-.js.map → CopyClientConfigDialog-DgHrZUv_.js.map} +1 -1
- package/frontend/dist/assets/{CredentialsPage-DmxY-iXb.js → CredentialsPage-B_-H2SKV.js} +2 -2
- package/frontend/dist/assets/{CredentialsPage-DmxY-iXb.js.map → CredentialsPage-B_-H2SKV.js.map} +1 -1
- package/frontend/dist/assets/{Dashboard-DCvveQBj.js → Dashboard-Bhl6u2n-.js} +2 -2
- package/frontend/dist/assets/{Dashboard-DCvveQBj.js.map → Dashboard-Bhl6u2n-.js.map} +1 -1
- package/frontend/dist/assets/{EndpointCopy-DRWz8guH.js → EndpointCopy-Cbm48MAT.js} +2 -2
- package/frontend/dist/assets/{EndpointCopy-DRWz8guH.js.map → EndpointCopy-Cbm48MAT.js.map} +1 -1
- package/frontend/dist/assets/GroupsPage-DhBTIL-O.js +33 -0
- package/frontend/dist/assets/GroupsPage-DhBTIL-O.js.map +1 -0
- package/frontend/dist/assets/{LoginPage-BVBf8nr6.js → LoginPage-DuyaaEX3.js} +2 -2
- package/frontend/dist/assets/{LoginPage-BVBf8nr6.js.map → LoginPage-DuyaaEX3.js.map} +1 -1
- package/frontend/dist/assets/{LogsPage-DbsmNJcA.js → LogsPage-BtYlQ3Fg.js} +2 -2
- package/frontend/dist/assets/{LogsPage-DbsmNJcA.js.map → LogsPage-BtYlQ3Fg.js.map} +1 -1
- package/frontend/dist/assets/{MarketPage-BOggDLJb.js → MarketPage-QNT3w149.js} +2 -2
- package/frontend/dist/assets/{MarketPage-BOggDLJb.js.map → MarketPage-QNT3w149.js.map} +1 -1
- package/frontend/dist/assets/{OAuthConsentPage-VON__2op.js → OAuthConsentPage-fjVkCE13.js} +2 -2
- package/frontend/dist/assets/{OAuthConsentPage-VON__2op.js.map → OAuthConsentPage-fjVkCE13.js.map} +1 -1
- package/frontend/dist/assets/{PromptsPage-BNkvIDZU.js → PromptsPage-CWQEgxAH.js} +2 -2
- package/frontend/dist/assets/{PromptsPage-BNkvIDZU.js.map → PromptsPage-CWQEgxAH.js.map} +1 -1
- package/frontend/dist/assets/{ResourcesPage-4WBvamN_.js → ResourcesPage-Dw3p1r3S.js} +2 -2
- package/frontend/dist/assets/{ResourcesPage-4WBvamN_.js.map → ResourcesPage-Dw3p1r3S.js.map} +1 -1
- package/frontend/dist/assets/{ServersPage-C7000Szj.js → ServersPage-C9F8T1eo.js} +9 -9
- package/frontend/dist/assets/ServersPage-C9F8T1eo.js.map +1 -0
- package/frontend/dist/assets/{SettingsPage-YX6dJjrM.js → SettingsPage-DGLThCbs.js} +2 -2
- package/frontend/dist/assets/{SettingsPage-YX6dJjrM.js.map → SettingsPage-DGLThCbs.js.map} +1 -1
- package/frontend/dist/assets/{StatusDot-mgJveZ2h.js → StatusDot-L_s7TahY.js} +2 -2
- package/frontend/dist/assets/{StatusDot-mgJveZ2h.js.map → StatusDot-L_s7TahY.js.map} +1 -1
- package/frontend/dist/assets/{ToggleGroup-DXyuwPy7.js → ToggleGroup-BYsHpk5D.js} +2 -2
- package/frontend/dist/assets/{ToggleGroup-DXyuwPy7.js.map → ToggleGroup-BYsHpk5D.js.map} +1 -1
- package/frontend/dist/assets/{UsersPage-BiUn8c0z.js → UsersPage-uH8VPdD5.js} +2 -2
- package/frontend/dist/assets/{UsersPage-BiUn8c0z.js.map → UsersPage-uH8VPdD5.js.map} +1 -1
- package/frontend/dist/assets/{clipboard-7MOQ-4Cg.js → clipboard-7o0A3Yh4.js} +2 -2
- package/frontend/dist/assets/{clipboard-7MOQ-4Cg.js.map → clipboard-7o0A3Yh4.js.map} +1 -1
- package/frontend/dist/assets/index-Bflb_BXR.js +3 -0
- package/frontend/dist/assets/{index-BKFFbupY.js.map → index-Bflb_BXR.js.map} +1 -1
- package/frontend/dist/assets/{index-B3hkLjCv.css → index-JDk4RjZI.css} +1 -1
- package/frontend/dist/assets/{resourceService-BOn21QbP.js → resourceService-0jFnNuzj.js} +2 -2
- package/frontend/dist/assets/{resourceService-BOn21QbP.js.map → resourceService-0jFnNuzj.js.map} +1 -1
- package/frontend/dist/assets/{useCostData-3iIVsNH6.js → useCostData-BrYWvkNn.js} +2 -2
- package/frontend/dist/assets/{useCostData-3iIVsNH6.js.map → useCostData-BrYWvkNn.js.map} +1 -1
- package/frontend/dist/assets/variableDetection-D0qCtrcY.js +18 -0
- package/frontend/dist/assets/variableDetection-D0qCtrcY.js.map +1 -0
- package/frontend/dist/index.html +2 -2
- package/package.json +1 -1
- package/frontend/dist/assets/GroupsPage-DtoTWqWU.js +0 -33
- package/frontend/dist/assets/GroupsPage-DtoTWqWU.js.map +0 -1
- package/frontend/dist/assets/ServersPage-C7000Szj.js.map +0 -1
- package/frontend/dist/assets/index-BKFFbupY.js +0 -3
- package/frontend/dist/assets/variableDetection-Cpa0rIrf.js +0 -18
- package/frontend/dist/assets/variableDetection-Cpa0rIrf.js.map +0 -1
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import{r as g,j as e}from"./framework-vendor-CQFm9vKd.js";import{u as Dr,f as et,k as st}from"./index-BKFFbupY.js";import{f as rt,a as tt,O as nt}from"./contextCost-CilWqGWT.js";import{u as at}from"./i18n-vendor-DVmjrzgW.js";import{X as me}from"./icons-vendor-CkcU1LMA.js";const Ct=(a,o)=>o?o.isAdmin?!0:!!(a.owner&&a.owner===o.username):!1,lt=(a,o)=>{var r,u,h;return o===!0?null:((r=a.oauth)==null?void 0:r.allowInsecureTokenEndpoint)===!0?"server.httpOAuthRequiresAdmin":a.type==="stdio"||a.command||Array.isArray(a.args)&&a.args.length>0||!a.url&&!((u=a.openapi)!=null&&u.url)&&!((h=a.openapi)!=null&&h.schema)?"server.localExecutionRequiresAdmin":null},Or=a=>{const o={};return a.forEach(({key:r,value:u})=>{const h=r.trim();h&&(o[h]=u)}),o},Mr=a=>a?a.split(",").map(o=>o.trim()).filter(o=>o.length>0):[],ot=a=>Array.from(new Set((a||[]).map(o=>o.trim()).filter(o=>o.length>0))),it=a=>{const o={};if(typeof(a==null?void 0:a.timeout)=="number"&&!Number.isNaN(a.timeout)&&(o.timeout=a.timeout),typeof(a==null?void 0:a.resetTimeoutOnProgress)=="boolean"&&(o.resetTimeoutOnProgress=a.resetTimeoutOnProgress),a!=null&&a.maxTotalTimeout&&(o.maxTotalTimeout=a.maxTotalTimeout),(a==null?void 0:a.maxBufferSize)!==void 0){if(!Number.isSafeInteger(a.maxBufferSize)||a.maxBufferSize<=0)throw new Error("options.maxBufferSize must be a positive safe integer in bytes");o.maxBufferSize=a.maxBufferSize}return o},ct=a=>{var k,S,C,p,f,i,c,K;if(!a)return{};const o={};a.identityMode&&(o.identityMode=a.identityMode),a.allowInsecureTokenEndpoint!==void 0&&(o.allowInsecureTokenEndpoint=a.allowInsecureTokenEndpoint);const r=(k=a.clientId)==null?void 0:k.trim(),u=(S=a.clientSecret)==null?void 0:S.trim(),h=(C=a.scopes)==null?void 0:C.trim(),x=(p=a.accessToken)==null?void 0:p.trim(),b=(f=a.refreshToken)==null?void 0:f.trim(),t=(i=a.authorizationEndpoint)==null?void 0:i.trim(),m=(c=a.tokenEndpoint)==null?void 0:c.trim(),j=(K=a.resource)==null?void 0:K.trim();if(r&&(o.clientId=r),u&&(o.clientSecret=u),h){const E=h.split(/[\s,]+/).map(T=>T.trim()).filter(T=>T.length>0);E.length>0&&(o.scopes=E)}return x&&a.identityMode!=="personal"&&(o.accessToken=x),b&&a.identityMode!=="personal"&&(o.refreshToken=b),t&&(o.authorizationEndpoint=t),m&&(o.tokenEndpoint=m),j&&(o.resource=j),a.dynamicRegistration&&(o.dynamicRegistration=a.dynamicRegistration),a.revocationEndpoint&&(o.revocationEndpoint=a.revocationEndpoint),a.redirectUri&&(o.redirectUri=a.redirectUri),o.identityMode==="shared"&&Object.keys(o).length===1&&delete o.identityMode,o},pt=a=>{var t,m,j,k,S,C,p,f,i,c,K,E,T,R,P,O,z,q,U,H,N,M,W;const o={version:((t=a.openapi)==null?void 0:t.version)||"3.1.0",passthroughHeaders:Mr((m=a.openapi)==null?void 0:m.passthroughHeaders),cookieSession:((j=a.openapi)==null?void 0:j.cookieSession)===!0?!0:void 0},r=(S=(k=a.openapi)==null?void 0:k.oauth2TokenUrl)==null?void 0:S.trim(),u=(p=(C=a.openapi)==null?void 0:C.oauth2ClientId)==null?void 0:p.trim(),h=(i=(f=a.openapi)==null?void 0:f.oauth2ClientSecret)==null?void 0:i.trim(),x=(K=(c=a.openapi)==null?void 0:c.oauth2Token)==null?void 0:K.trim();if(((E=a.openapi)==null?void 0:E.inputMode)==="url")o.url=((T=a.openapi)==null?void 0:T.url)||"";else if(((R=a.openapi)==null?void 0:R.inputMode)==="schema"&&((P=a.openapi)!=null&&P.schema))try{o.schema=JSON.parse(a.openapi.schema)}catch{throw new Error("Invalid JSON schema format")}(O=a.openapi)!=null&&O.securityType&&a.openapi.securityType!=="none"&&(o.security={type:a.openapi.securityType,...a.openapi.securityType==="apiKey"&&{apiKey:{name:a.openapi.apiKeyName||"",in:a.openapi.apiKeyIn||"header",value:a.openapi.apiKeyValue||""}},...a.openapi.securityType==="http"&&{http:{scheme:a.openapi.httpScheme||"bearer",credentials:a.openapi.httpCredentials||""}},...a.openapi.securityType==="oauth2"&&{oauth2:{...r&&{tokenUrl:r},...u&&{clientId:u},...h&&{clientSecret:h},...x&&{token:x}}},...a.openapi.securityType==="openIdConnect"&&{openIdConnect:{url:a.openapi.openIdConnectUrl||"",token:a.openapi.openIdConnectToken||""}}});const b=(z=a.openapi)==null?void 0:z.specSecurityType;return b&&b!=="none"&&(o.specSecurity={type:b,...b==="apiKey"&&{apiKey:{name:((q=a.openapi)==null?void 0:q.specApiKeyName)||"",in:((U=a.openapi)==null?void 0:U.specApiKeyIn)||"header",value:((H=a.openapi)==null?void 0:H.specApiKeyValue)||""}},...b==="http"&&{http:{scheme:((N=a.openapi)==null?void 0:N.specHttpScheme)||"basic",credentials:((M=a.openapi)==null?void 0:M.specHttpCredentials)||""}},...b==="oauth2"&&{oauth2:{token:((W=a.openapi)==null?void 0:W.specOauth2Token)||""}}}),o},he=({formData:a,serverType:o,envVars:r,headerVars:u})=>{var j,k,S,C,p;const h=Or(r),x=Or(u),b=it(a.options),t=((j=a.description)==null?void 0:j.trim())||"",m={type:o,description:t,options:b,visibility:a.visibility??"private",sharedWithUsers:a.visibility==="group"?ot(a.sharedWithUsers):void 0,credentialTemplate:(k=a.credentialTemplate)==null?void 0:k.map(f=>({...f,target:o==="stdio"?f.target==="args"?"args":"env":f.target==="url"?"url":"headers"})),perSessionClient:a.perSessionClient===!0?!0:void 0,startOnDemand:a.startOnDemand===!0?!0:void 0,idleTimeoutMs:a.startOnDemand===!0||(S=a.credentialTemplate)!=null&&S.length?a.idleTimeoutMs??3e5:void 0,proxy:a.proxy};if(o==="openapi")m.headers=x,m.openapi=pt(a);else if(o==="sse"||o==="streamable-http"){const f=((C=a.keepAlive)==null?void 0:C.enabled)===!0;m.url=a.url.trim(),m.env=h,m.headers=x,m.passthroughHeaders=Mr(a.passthroughHeaders),m.oauth=ct(a.oauth),m.enableKeepAlive=f,m.keepAliveInterval=f?((p=a.keepAlive)==null?void 0:p.interval)||6e4:void 0}else m.command=a.command.trim(),m.args=a.args,m.env=h;return{name:a.name.trim(),config:m}},dt=(a=[],o=[])=>Array.from(new Set([...a,...o])).sort((r,u)=>r.localeCompare(u)),ut=(a,o)=>{const r=o.trim().toLowerCase();return r?a.filter(u=>u.toLowerCase().includes(r)):[...a]},mt=(a,o)=>Array.from(new Set([...a,...o])),ht=(a,o)=>{const r=new Set(o);return a.filter(u=>!r.has(u))};function Fr(a,o=!1){if(o)return!1;const r=a.openapi;return r&&r.securityType&&r.securityType!=="none"?!1:!(r!=null&&r.apiKeyValue)&&!(r!=null&&r.httpCredentials)&&!(r!=null&&r.oauth2TokenUrl)&&!(r!=null&&r.oauth2ClientId)&&!(r!=null&&r.oauth2ClientSecret)&&!(r!=null&&r.oauth2Token)&&!(r!=null&&r.openIdConnectUrl)&&!(r!=null&&r.openIdConnectToken)}function xt(a,o,r=!1){var h,x,b,t,m;if(!o.declared||!o.supported||!o.prefill||!Fr(a,r))return a;const u=o.prefill;return{...a,openapi:{...a.openapi,securityType:u.type,apiKeyName:((h=u.apiKey)==null?void 0:h.name)||"",apiKeyIn:((x=u.apiKey)==null?void 0:x.in)||"header",apiKeyValue:"",httpScheme:((b=u.http)==null?void 0:b.scheme)||"bearer",httpCredentials:"",oauth2TokenUrl:((t=u.oauth2)==null?void 0:t.tokenUrl)||"",oauth2ClientId:"",oauth2ClientSecret:"",oauth2Token:"",openIdConnectUrl:((m=u.openIdConnect)==null?void 0:m.url)||"",openIdConnectToken:""}}}function yt(a,o){var u,h,x;if(!o.prefill)return!1;const r=a.openapi;if((r==null?void 0:r.securityType)!==o.prefill.type)return!0;switch(r==null?void 0:r.securityType){case"apiKey":return r.apiKeyName!==((u=o.prefill.apiKey)==null?void 0:u.name)||r.apiKeyIn!==((h=o.prefill.apiKey)==null?void 0:h.in);case"http":return r.httpScheme!==((x=o.prefill.http)==null?void 0:x.scheme);default:return!1}}function gt(a){const o=a.openapi,r=o==null?void 0:o.securityType;if(!r||r==="none")return null;switch(r){case"apiKey":return`API key in ${(o==null?void 0:o.apiKeyIn)||"header"} '${(o==null?void 0:o.apiKeyName)||""}'`;case"http":return`HTTP ${(o==null?void 0:o.httpScheme)||"bearer"}`;case"oauth2":return"OAuth2";case"openIdConnect":return"OpenID Connect";default:return null}}function bt(a,o,r={}){return o!=null&&o.declared?!Fr(a,r.securityTouched)&&yt(a,o)?{kind:"warning",messageKey:"securityMismatchWarning",values:{summary:o.summary,configured:gt(a)||"none"}}:o.supported?{kind:"info",messageKey:"securityPrefillNotice",values:{summary:o.summary}}:{kind:"warning",messageKey:"securityUnsupportedNotice",values:{summary:o.summary,reason:o.unsupportedReason||""}}:r.includeNotDeclared?{kind:"info",messageKey:"securityNotDeclared",values:{}}:null}function Ur(a){var u,h,x,b;const o=((u=a.openapi)==null?void 0:u.inputMode)==="schema"?"schema":"url",r=((b=o==="schema"?(h=a.openapi)==null?void 0:h.schema:(x=a.openapi)==null?void 0:x.url)==null?void 0:b.trim())||"";return{mode:o,value:r,key:r?`${o}:${r}`:""}}function Rr(a){if(!a.value)return!1;if(a.mode==="schema")try{const o=JSON.parse(a.value);return o!==null&&typeof o=="object"&&!Array.isArray(o)}catch{return!1}try{const o=new URL(a.value);return o.protocol==="http:"||o.protocol==="https:"}catch{return!1}}function vt(a){return!a.isEdit&&a.serverType==="openapi"&&Rr(a.source)&&a.source.key!==a.analyzedSourceKey}const Pr=/^[A-Za-z0-9._-]+$/,xe=128,Hr=a=>{const o=a.trim();return o.length>0&&o.length<=xe&&Pr.test(o)&&!o.includes("..")},Tt=a=>a.replace(/[^A-Za-z0-9._-]+/g,"-").replace(/\.{2,}/g,".").replace(/^-+|-+$/g,"").slice(0,xe)||"server",wt=({onSubmit:a,onCancel:o,initialData:r=null,modalTitle:u,formError:h=null,mode:x,shareCandidatesFrom:b=null})=>{var Ke,Ee,Oe,Ue,He,Me,Fe,Re,Pe,ze,Ve,Be,Le,qe,We,$e,_e,Xe,Je,Ge,Qe,Ze,Ye,De,es,ss,rs,ts,ns,as,ls,os,is,cs,ps,ds,us,ms,hs,xs,ys,gs,bs,vs,fs,js,ks,Ns,Ss,Cs,Ts,ws,As,Is,Ks,Es,Os,Us,Hs,Ms,Fs,Rs,Ps,zs,Vs,Bs,Ls,qs,Ws,$s,_s,Xs,Js,Gs,Qs,Zs,Ys,Ds,er,sr,rr,tr,nr,ar,lr,or,ir,cr,pr,dr,ur,mr,hr,xr,yr,gr,br,vr,fr,jr,kr,Nr,Sr,Cr,Tr,wr,Ar,Ir,Kr,Er;const{t}=at(),{auth:m}=Dr(),j=!(r!=null&&r.name)||Hr(r.name),k=()=>!r||!r.config?"stdio":r.config.type?r.config.type:r.config.url?"sse":"stdio",S=n=>!n||!n.config||!n.config.env?[]:Object.entries(n.config.env).map(([s,l])=>({key:s,value:l,description:""})),C=n=>{var l;const s=(l=n==null?void 0:n.config)==null?void 0:l.oauth;return{identityMode:(s==null?void 0:s.identityMode)||"shared",clientId:(s==null?void 0:s.clientId)||"",...(s==null?void 0:s.allowInsecureTokenEndpoint)!==void 0&&{allowInsecureTokenEndpoint:s.allowInsecureTokenEndpoint},clientSecret:(s==null?void 0:s.clientSecret)||"",scopes:s!=null&&s.scopes?s.scopes.join(" "):"",accessToken:(s==null?void 0:s.accessToken)||"",refreshToken:(s==null?void 0:s.refreshToken)||"",authorizationEndpoint:(s==null?void 0:s.authorizationEndpoint)||"",tokenEndpoint:(s==null?void 0:s.tokenEndpoint)||"",resource:(s==null?void 0:s.resource)||"",...(s==null?void 0:s.dynamicRegistration)&&{dynamicRegistration:s.dynamicRegistration},...(s==null?void 0:s.revocationEndpoint)&&{revocationEndpoint:s.revocationEndpoint},...(s==null?void 0:s.redirectUri)&&{redirectUri:s.redirectUri}}},[p,f]=g.useState(k()),[i,c]=g.useState({name:r&&r.name||"",description:r&&r.config&&r.config.description||"",url:r&&r.config&&r.config.url||"",command:r&&r.config&&r.config.command||"",arguments:"",args:r&&r.config&&r.config.args||[],type:k(),env:S(r),headers:[],passthroughHeaders:((Ee=(Ke=r==null?void 0:r.config)==null?void 0:Ke.passthroughHeaders)==null?void 0:Ee.join(", "))||"",visibility:((Oe=r==null?void 0:r.config)==null?void 0:Oe.visibility)??"private",sharedWithUsers:((Ue=r==null?void 0:r.config)==null?void 0:Ue.sharedWithUsers)||[],options:{maxBufferSize:(Me=(He=r==null?void 0:r.config)==null?void 0:He.options)==null?void 0:Me.maxBufferSize,timeout:r&&r.config&&r.config.options&&r.config.options.timeout||6e4,resetTimeoutOnProgress:((Re=(Fe=r==null?void 0:r.config)==null?void 0:Fe.options)==null?void 0:Re.resetTimeoutOnProgress)??!0,maxTotalTimeout:r&&r.config&&r.config.options&&r.config.options.maxTotalTimeout||void 0},oauth:C(r),keepAlive:{enabled:((Pe=r==null?void 0:r.config)==null?void 0:Pe.enableKeepAlive)===!0,interval:((ze=r==null?void 0:r.config)==null?void 0:ze.keepAliveInterval)||6e4},perSessionClient:((Ve=r==null?void 0:r.config)==null?void 0:Ve.perSessionClient)===!0,credentialTemplate:((Be=r==null?void 0:r.config)==null?void 0:Be.credentialTemplate)||[],proxy:(Le=r==null?void 0:r.config)==null?void 0:Le.proxy,startOnDemand:((qe=r==null?void 0:r.config)==null?void 0:qe.startOnDemand)===!0,idleTimeoutMs:((We=r==null?void 0:r.config)==null?void 0:We.idleTimeoutMs)??3e5,openapi:r&&r.config&&r.config.openapi?{url:r.config.openapi.url||"",schema:r.config.openapi.schema?JSON.stringify(r.config.openapi.schema,null,2):"",inputMode:r.config.openapi.url?"url":r.config.openapi.schema?"schema":"url",version:r.config.openapi.version||"3.1.0",securityType:(($e=r.config.openapi.security)==null?void 0:$e.type)||"none",apiKeyName:((Xe=(_e=r.config.openapi.security)==null?void 0:_e.apiKey)==null?void 0:Xe.name)||"",apiKeyIn:((Ge=(Je=r.config.openapi.security)==null?void 0:Je.apiKey)==null?void 0:Ge.in)||"header",apiKeyValue:((Ze=(Qe=r.config.openapi.security)==null?void 0:Qe.apiKey)==null?void 0:Ze.value)||"",httpScheme:((De=(Ye=r.config.openapi.security)==null?void 0:Ye.http)==null?void 0:De.scheme)||"bearer",httpCredentials:((ss=(es=r.config.openapi.security)==null?void 0:es.http)==null?void 0:ss.credentials)||"",oauth2TokenUrl:((ts=(rs=r.config.openapi.security)==null?void 0:rs.oauth2)==null?void 0:ts.tokenUrl)||"",oauth2ClientId:((as=(ns=r.config.openapi.security)==null?void 0:ns.oauth2)==null?void 0:as.clientId)||"",oauth2ClientSecret:((os=(ls=r.config.openapi.security)==null?void 0:ls.oauth2)==null?void 0:os.clientSecret)||"",oauth2Token:((cs=(is=r.config.openapi.security)==null?void 0:is.oauth2)==null?void 0:cs.token)||"",openIdConnectUrl:((ds=(ps=r.config.openapi.security)==null?void 0:ps.openIdConnect)==null?void 0:ds.url)||"",openIdConnectToken:((ms=(us=r.config.openapi.security)==null?void 0:us.openIdConnect)==null?void 0:ms.token)||"",specSecurityType:["apiKey","http","oauth2"].includes((hs=r.config.openapi.specSecurity)==null?void 0:hs.type)?r.config.openapi.specSecurity.type:"none",specApiKeyName:((ys=(xs=r.config.openapi.specSecurity)==null?void 0:xs.apiKey)==null?void 0:ys.name)||"",specApiKeyIn:((bs=(gs=r.config.openapi.specSecurity)==null?void 0:gs.apiKey)==null?void 0:bs.in)||"header",specApiKeyValue:((fs=(vs=r.config.openapi.specSecurity)==null?void 0:vs.apiKey)==null?void 0:fs.value)||"",specHttpScheme:((ks=(js=r.config.openapi.specSecurity)==null?void 0:js.http)==null?void 0:ks.scheme)==="bearer"?"bearer":"basic",specHttpCredentials:((Ss=(Ns=r.config.openapi.specSecurity)==null?void 0:Ns.http)==null?void 0:Ss.credentials)||"",specOauth2Token:((Ts=(Cs=r.config.openapi.specSecurity)==null?void 0:Cs.oauth2)==null?void 0:Ts.token)||"",passthroughHeaders:r.config.openapi.passthroughHeaders?r.config.openapi.passthroughHeaders.join(", "):"",cookieSession:r.config.openapi.cookieSession===!0}:{inputMode:"url",url:"",schema:"",version:"3.1.0",securityType:"none",specSecurityType:"none",passthroughHeaders:"",cookieSession:!1}}),[K,E]=g.useState([]),[T,R]=g.useState(!1),[P,O]=g.useState(!1),[z,q]=g.useState(""),U=b||(r==null?void 0:r.name);g.useEffect(()=>{if(i.visibility!=="group"||!U)return;let n=!1;return R(!0),O(!1),et(`/servers/${encodeURIComponent(U)}/share-candidates`).then(s=>{n||(s.success&&Array.isArray(s.data)?E(s.data):O(!0))}).catch(()=>{n||O(!0)}).finally(()=>{n||R(!1)}),()=>{n=!0}},[i.visibility,U]);const H=dt(i.sharedWithUsers||[],K),N=ut(H,z),M=new Set(i.sharedWithUsers||[]),W=N.length>0&&N.every(n=>M.has(n)),zr=N.length===0||N.every(n=>!M.has(n)),Vr=n=>{c(s=>{const l=new Set(s.sharedWithUsers||[]);return l.has(n)?l.delete(n):l.add(n),{...s,sharedWithUsers:Array.from(l)}})},Br=()=>{c(n=>({...n,sharedWithUsers:mt(n.sharedWithUsers||[],N)}))},Lr=()=>{c(n=>({...n,sharedWithUsers:ht(n.sharedWithUsers||[],N)}))},[w,re]=g.useState(r&&r.config&&r.config.env?Object.entries(r.config.env).map(([n,s])=>({key:n,value:s})):[]),[A,te]=g.useState(r&&r.config&&r.config.headers?Object.entries(r.config.headers).map(([n,s])=>({key:n,value:s})):[]),[V,ye]=g.useState(null),[ne,B]=g.useState(!1),[qr,ae]=g.useState(!1),le=g.useRef(0),ge=g.useRef(null),be=g.useRef(!1),oe=g.useRef(!!r),$=g.useRef(i);$.current=i;const ve=g.useRef(w);ve.current=w;const fe=g.useRef(A);fe.current=A;const[_,X]=g.useState(null),[je,ke]=g.useState(!1),[ie,Wr]=g.useState(!1),[ce,$r]=g.useState(!1),[pe,_r]=g.useState(!1),[de,Xr]=g.useState(!1),[Ne,J]=g.useState(null),F=x?x==="edit":!!r,Jr=()=>{oe.current=!0,X(null)},G=n=>{const{name:s,value:l}=n.target;c({...i,[s]:l})},Q=n=>{f(n),c(s=>({...s,type:n}))},Z=(n,s,l)=>{const d=[...w];d[n][s]=l,re(d)},Se=()=>{re([...w,{key:"",value:""}])},Ce=n=>{const s=[...w];s.splice(n,1),re(s)},Y=(n,s,l)=>{const d=[...A];d[n][s]=l,te(d)},Te=()=>{te([...A,{key:"",value:""}])},we=n=>{const s=[...A];s.splice(n,1),te(s)},D=(n,s)=>{c(l=>({...l,oauth:{...l.oauth||{},[n]:s}}))},ee=(n,s)=>{c(l=>({...l,options:{...l.options,[n]:s}}))},Gr=async n=>{try{const s=await st("/servers/openapi/tool-stats",{config:n.config},{signal:AbortSignal.timeout(6e4)});return s.success&&s.data?s.data:null}catch{return null}},Ae=async(n,s,l)=>{const d=++le.current;B(!0),ae(!1);const y=await Gr(n);if(le.current!==d)return;if(!y){ae(!0),B(!1);return}ge.current=s,ye(y);const v=$.current,L=oe.current,I=y.declaredSecurity,Yr=l.allowSecurityPrefill&&!L&&!F&&!be.current;l.consumeAutomaticAnalysis&&(be.current=!0);const ue=I!=null&&I.declared&&I.supported&&Yr?xt(v,I,L):v;ue!==v&&($.current=ue,c(ue)),X(bt(v,I,{includeNotDeclared:!0,securityTouched:L})),B(!1)},Qr=async()=>{ke(!0);try{const n=he({formData:i,serverType:p,envVars:w,headerVars:A});await Ae(n,Ur(i).key,{allowSecurityPrefill:!F&&!oe.current,consumeAutomaticAnalysis:!1})}catch{}finally{ke(!1)}},se=Ur(i),Ie=p==="openapi"&&Rr(se);g.useEffect(()=>{if(le.current+=1,ye(null),ae(!1),B(!1),X(null),!vt({isEdit:F,serverType:p,source:se,analyzedSourceKey:ge.current}))return;B(!0);const n=window.setTimeout(()=>{const s=he({formData:$.current,serverType:p,envVars:ve.current,headerVars:fe.current});Ae(s,se.key,{allowSecurityPrefill:!0,consumeAutomaticAnalysis:!0})},600);return()=>{window.clearTimeout(n)}},[F,se.key,p]);const Zr=async n=>{var l;if(n.preventDefault(),J(null),(!(r!=null&&r.name)||i.name!==r.name)&&!Hr(i.name)){J(t("server.nameInvalid"));return}try{const d=he({formData:i,serverType:p,envVars:w,headerVars:A}),y=lt(d.config,(l=m.user)==null?void 0:l.isAdmin);if(y){J(t(y));return}a(d)}catch(d){J(`Error: ${d instanceof Error?d.message:String(d)}`)}};return e.jsxs("div",{className:"hub-card p-6 w-full max-w-3xl max-h-screen overflow-y-auto",children:[e.jsxs("div",{className:"flex justify-between items-center mb-5",children:[e.jsx("h2",{className:"text-lg font-semibold text-[var(--hub-ink)]",children:u}),e.jsx("button",{onClick:o,className:"hub-icon-btn","aria-label":"Close",children:e.jsx(me,{size:16})})]}),(Ne||h)&&e.jsx("div",{className:"bg-red-50 text-red-700 p-3 rounded mb-4",children:h||Ne}),e.jsxs("form",{onSubmit:Zr,children:[e.jsxs("div",{className:"mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--hub-ink)] mb-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:t("server.sectionBasicInfo","Basic Info")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-4",children:[e.jsxs("div",{className:"md:col-span-1",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"name",children:t("server.name")}),e.jsx("input",{type:"text",name:"name",id:"name",value:i.name,onChange:G,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: time-mcp",pattern:j?Pr.source:void 0,maxLength:j?xe:void 0,title:t("server.nameInvalid"),required:!0}),e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.nameInvalid")})]}),e.jsxs("div",{className:"md:col-span-2",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"description",children:t("server.description")}),e.jsx("input",{type:"text",name:"description",id:"description",value:i.description||"",onChange:G,className:"w-full py-2 px-3 form-input",placeholder:t("server.descriptionPlaceholder")})]})]})]}),e.jsxs("div",{className:"mb-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--hub-ink)] mb-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:t("server.sectionConnection","Connection")}),((ws=m.user)==null?void 0:ws.isAdmin)!==!0&&e.jsx("p",{id:"local-execution-permission",className:"text-sm text-amber-700 dark:text-amber-300 mb-3",children:t("server.localExecutionRequiresAdmin")}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.type")}),e.jsxs("div",{className:"flex flex-wrap gap-x-4 gap-y-2",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"command",name:"serverType",value:"command",disabled:((As=m.user)==null?void 0:As.isAdmin)!==!0,"aria-describedby":(Is=m.user)!=null&&Is.isAdmin?void 0:"local-execution-permission",checked:p==="stdio",onChange:()=>Q("stdio"),className:"mr-1"}),e.jsx("label",{htmlFor:"command",className:"text-[var(--hub-ink)]",children:t("server.typeStdio")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"url",name:"serverType",value:"url",checked:p==="sse",onChange:()=>Q("sse"),className:"mr-1"}),e.jsx("label",{htmlFor:"url",className:"text-[var(--hub-ink)]",children:t("server.typeSse")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"streamable-http",name:"serverType",value:"streamable-http",checked:p==="streamable-http",onChange:()=>Q("streamable-http"),className:"mr-1"}),e.jsx("label",{htmlFor:"streamable-http",className:"text-[var(--hub-ink)]",children:t("server.typeStreamableHttp")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"openapi",name:"serverType",value:"openapi",checked:p==="openapi",onChange:()=>Q("openapi"),className:"mr-1"}),e.jsx("label",{htmlFor:"openapi",className:"text-[var(--hub-ink)]",children:t("server.typeOpenapi")})]})]})]}),e.jsx("div",{className:"pl-4 border-l-2 border-gray-200 dark:border-gray-700 ml-2",children:p==="openapi"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.inputMode")}),e.jsxs("div",{className:"flex space-x-4",children:[e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-url",name:"inputMode",value:"url",checked:((Ks=i.openapi)==null?void 0:Ks.inputMode)==="url",onChange:()=>c(n=>({...n,openapi:{...n.openapi,inputMode:"url"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-url",children:t("server.openapi.inputModeUrl")})]}),e.jsxs("div",{children:[e.jsx("input",{type:"radio",id:"input-mode-schema",name:"inputMode",value:"schema",checked:((Es=i.openapi)==null?void 0:Es.inputMode)==="schema",onChange:()=>c(n=>({...n,openapi:{...n.openapi,inputMode:"schema"}})),className:"mr-1"}),e.jsx("label",{htmlFor:"input-mode-schema",children:t("server.openapi.inputModeSchema")})]})]})]}),((Os=i.openapi)==null?void 0:Os.inputMode)==="url"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-url",children:t("server.openapi.specUrl")}),e.jsx("input",{type:"url",name:"openapi-url",id:"openapi-url",value:((Us=i.openapi)==null?void 0:Us.url)||"",onChange:n=>c(s=>({...s,openapi:{...s.openapi,url:n.target.value}})),className:"w-full py-2 px-3 form-input",placeholder:"e.g.: https://api.example.com/openapi.json",required:p==="openapi"&&((Hs=i.openapi)==null?void 0:Hs.inputMode)==="url"})]}),((Ms=i.openapi)==null?void 0:Ms.inputMode)==="schema"&&e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"openapi-schema",children:t("server.openapi.schema")}),e.jsx("textarea",{name:"openapi-schema",id:"openapi-schema",rows:10,value:((Fs=i.openapi)==null?void 0:Fs.schema)||"",onChange:n=>c(s=>({...s,openapi:{...s.openapi,schema:n.target.value}})),className:"w-full py-2 px-3 form-input font-mono text-sm",placeholder:`{
|
|
2
|
-
"openapi": "3.1.0",
|
|
3
|
-
"info": {
|
|
4
|
-
"title": "API",
|
|
5
|
-
"version": "1.0.0"
|
|
6
|
-
},
|
|
7
|
-
"servers": [
|
|
8
|
-
{
|
|
9
|
-
"url": "https://api.example.com"
|
|
10
|
-
}
|
|
11
|
-
],
|
|
12
|
-
"paths": {
|
|
13
|
-
...
|
|
14
|
-
}
|
|
15
|
-
}`,required:p==="openapi"&&((Rs=i.openapi)==null?void 0:Rs.inputMode)==="schema"}),e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.openapi.schemaHelp")})]}),!F&&Ie&&e.jsx("div",{className:"mb-4 rounded border border-blue-200 bg-blue-50 p-3 text-sm dark:border-blue-900 dark:bg-blue-950/30","aria-live":"polite",children:ne?e.jsx("p",{className:"text-blue-700 dark:text-blue-300",children:t("server.openapi.statsMeasuring")}):V?e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"font-medium text-blue-900 dark:text-blue-100",children:t("server.openapi.statsSummary",{toolCount:V.toolCount,bytes:tt(V.definitionsBytes),tokens:rt(V.estimatedTokens)})}),V.estimatedTokens>=nt&&e.jsx("p",{className:"mt-1 text-yellow-700 dark:text-yellow-300",children:t("server.openapi.statsWarning")})]}):qr?e.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:t("server.openapi.statsUnavailable")}):null}),e.jsxs("div",{className:"mb-4",onChange:Jr,children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("label",{className:"block text-sm font-medium text-[var(--hub-ink-2)]",children:t("server.openapi.security")}),e.jsx("button",{type:"button",onClick:()=>void Qr(),disabled:je||ne||!Ie,className:"hub-btn text-xs !h-7 !px-2",children:t(je||ne?"server.openapi.securityDetecting":"server.openapi.securityDetect")})]}),e.jsxs("select",{value:((Ps=i.openapi)==null?void 0:Ps.securityType)||"none",onChange:n=>c(s=>{var l;return X(null),{...s,openapi:{...s.openapi,securityType:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"none",children:t("server.openapi.securityNone")}),e.jsx("option",{value:"apiKey",children:t("server.openapi.securityApiKey")}),e.jsx("option",{value:"http",children:t("server.openapi.securityHttp")}),e.jsx("option",{value:"oauth2",children:t("server.openapi.securityOAuth2")}),e.jsx("option",{value:"openIdConnect",children:t("server.openapi.securityOpenIdConnect")})]}),_&&e.jsx("p",{className:`mt-2 text-xs ${_.kind==="warning"?"text-yellow-700 dark:text-yellow-300":"text-blue-700 dark:text-blue-300"}`,children:t(`server.openapi.${_.messageKey}`,_.values)})]}),((zs=i.openapi)==null?void 0:zs.securityType)==="apiKey"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-[var(--hub-ink-2)]",children:t("server.openapi.apiKeyConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((Vs=i.openapi)==null?void 0:Vs.apiKeyName)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,apiKeyName:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm form-input focus:outline-none",placeholder:"Authorization"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-[var(--hub-ink-2)] mb-1",children:t("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((Bs=i.openapi)==null?void 0:Bs.apiKeyIn)||"header",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,apiKeyIn:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"header",children:t("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:t("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:t("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((Ls=i.openapi)==null?void 0:Ls.apiKeyValue)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,apiKeyValue:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"your-api-key"})]})]})]}),((qs=i.openapi)==null?void 0:qs.securityType)==="http"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.httpAuthConfig")}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpScheme")}),e.jsxs("select",{value:((Ws=i.openapi)==null?void 0:Ws.httpScheme)||"bearer",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,httpScheme:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"basic",children:t("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:t("server.openapi.httpSchemeBearer")}),e.jsx("option",{value:"digest",children:t("server.openapi.httpSchemeDigest")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:(($s=i.openapi)==null?void 0:$s.httpCredentials)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,httpCredentials:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((_s=i.openapi)==null?void 0:_s.httpScheme)==="basic"?"user:password or base64":"bearer-token"}),((Xs=i.openapi)==null?void 0:Xs.httpScheme)==="basic"&&e.jsx("p",{className:"text-xs text-[var(--hub-ink-3)] mt-1",children:t("server.openapi.httpCredentialsBasicHint")})]})]})]}),((Js=i.openapi)==null?void 0:Js.securityType)==="openIdConnect"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.openIdConnectConfig")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectUrl")}),e.jsx("input",{type:"url",value:((Gs=i.openapi)==null?void 0:Gs.openIdConnectUrl)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,openIdConnectUrl:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/.well-known/openid_configuration"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.openIdConnectToken")}),e.jsx("input",{type:"password",value:((Qs=i.openapi)==null?void 0:Qs.openIdConnectToken)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,openIdConnectToken:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"id-token"})]})]})]}),((Zs=i.openapi)==null?void 0:Zs.securityType)==="oauth2"&&e.jsxs("div",{className:"mb-4 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsx("h4",{className:"text-sm font-medium mb-3 text-gray-700 dark:text-gray-300",children:t("server.openapi.oauth2Config")}),e.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.tokenEndpoint")}),e.jsx("input",{type:"url",value:((Ys=i.openapi)==null?void 0:Ys.oauth2TokenUrl)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,oauth2TokenUrl:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"https://example.com/oauth/token"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Ds=i.openapi)==null?void 0:Ds.oauth2ClientId)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,oauth2ClientId:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-id"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((er=i.openapi)==null?void 0:er.oauth2ClientSecret)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,oauth2ClientSecret:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"client-secret"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((sr=i.openapi)==null?void 0:sr.oauth2Token)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,oauth2Token:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"access-token"})]})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"openapiSpecSecurity",checked:(((rr=i.openapi)==null?void 0:rr.specSecurityType)||"none")!=="none",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specSecurityType:n.target.checked?"http":"none"}}}),className:"mr-2"}),e.jsx("label",{htmlFor:"openapiSpecSecurity",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.openapi.specSecurityToggle")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.openapi.specSecurityHelp")}),(((tr=i.openapi)==null?void 0:tr.specSecurityType)||"none")!=="none"&&e.jsxs("div",{className:"mt-2 ml-6 p-4 border border-gray-200 dark:border-gray-700 rounded bg-gray-50 dark:bg-gray-800",children:[e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.security")}),e.jsxs("select",{value:((nr=i.openapi)==null?void 0:nr.specSecurityType)||"http",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specSecurityType:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"http",children:t("server.openapi.securityHttp")}),e.jsx("option",{value:"apiKey",children:t("server.openapi.securityApiKey")}),e.jsx("option",{value:"oauth2",children:t("server.openapi.securityOAuth2")})]})]}),((ar=i.openapi)==null?void 0:ar.specSecurityType)==="http"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpScheme")}),e.jsxs("select",{value:((lr=i.openapi)==null?void 0:lr.specHttpScheme)||"basic",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specHttpScheme:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"basic",children:t("server.openapi.httpSchemeBasic")}),e.jsx("option",{value:"bearer",children:t("server.openapi.httpSchemeBearer")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.httpCredentials")}),e.jsx("input",{type:"password",value:((or=i.openapi)==null?void 0:or.specHttpCredentials)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specHttpCredentials:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:((ir=i.openapi)==null?void 0:ir.specHttpScheme)==="basic"?"user:password or base64":"bearer-token"})]})]}),((cr=i.openapi)==null?void 0:cr.specSecurityType)==="apiKey"&&e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyName")}),e.jsx("input",{type:"text",value:((pr=i.openapi)==null?void 0:pr.specApiKeyName)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specApiKeyName:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"X-API-Key"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyIn")}),e.jsxs("select",{value:((dr=i.openapi)==null?void 0:dr.specApiKeyIn)||"header",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specApiKeyIn:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",children:[e.jsx("option",{value:"header",children:t("server.openapi.apiKeyInHeader")}),e.jsx("option",{value:"query",children:t("server.openapi.apiKeyInQuery")}),e.jsx("option",{value:"cookie",children:t("server.openapi.apiKeyInCookie")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.apiKeyValue")}),e.jsx("input",{type:"password",value:((ur=i.openapi)==null?void 0:ur.specApiKeyValue)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specApiKeyValue:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input"})]})]}),((mr=i.openapi)==null?void 0:mr.specSecurityType)==="oauth2"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.openapi.oauth2Token")}),e.jsx("input",{type:"password",value:((hr=i.openapi)==null?void 0:hr.specOauth2Token)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,url:((l=s.openapi)==null?void 0:l.url)||"",specOauth2Token:n.target.value}}}),className:"w-full border rounded px-2 py-1 text-sm focus:outline-none form-input",placeholder:"access-token"})]})]})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"openapiCookieSession",checked:((xr=i.openapi)==null?void 0:xr.cookieSession)||!1,onChange:n=>c(s=>{var l,d;return{...s,openapi:{...s.openapi,passthroughHeaders:((l=s.openapi)==null?void 0:l.passthroughHeaders)||"",url:((d=s.openapi)==null?void 0:d.url)||"",cookieSession:n.target.checked}}}),className:"mr-2"}),e.jsx("label",{htmlFor:"openapiCookieSession",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.openapi.cookieSession","Cookie Session Handling")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.openapi.cookieSessionHelp","Capture Set-Cookie from upstream login responses and replay them on later calls within the same downstream session. Isolated per MCP session; not persisted.")})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:Te,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),A.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:l=>Y(s,"key",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Authorization"}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:l=>Y(s,"value",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>we(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]}):p==="sse"||p==="streamable-http"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"url",children:t("server.url")}),e.jsx("input",{type:"url",name:"url",id:"url",value:i.url,onChange:G,className:"w-full py-2 px-3 form-input",placeholder:p==="streamable-http"?"e.g.: http://localhost:3000/mcp":"e.g.: http://localhost:3000/sse",required:p==="sse"||p==="streamable-http"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.headers")}),e.jsx("button",{type:"button",onClick:Te,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),A.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:l=>Y(s,"key",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Authorization"}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:l=>Y(s,"value",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:"Bearer token..."})]}),e.jsx("button",{type:"button",onClick:()=>we(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:Se,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),w.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:l=>Z(s,"key",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:l=>Z(s,"value",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>Ce(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-gray-700 dark:text-gray-300",htmlFor:"command",children:t("server.command")}),e.jsx("input",{type:"text",name:"command",id:"command",value:i.command,onChange:G,className:"w-full py-2 px-3 form-input",placeholder:"e.g.: npx",required:p==="stdio"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.arguments")}),e.jsx("button",{type:"button",className:"text-sm text-blue-600 dark:text-blue-400",onClick:()=>c(n=>({...n,args:[...n.args||[],""]})),children:t("server.addArgument")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-2",children:t("server.argumentsHint")}),(i.args||[]).map((n,s)=>e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("input",{type:"text","aria-label":t("server.argumentLabel",{index:s+1}),value:n,onChange:l=>{const d=l.target.value;c(y=>{var v;return{...y,args:(v=y.args)==null?void 0:v.map((L,I)=>I===s?d:L)}})},className:"w-full py-2 px-3 form-input"}),e.jsx("button",{type:"button","aria-label":t("server.removeArgument",{index:s+1}),onClick:()=>c(l=>{var d;return{...l,args:(d=l.args)==null?void 0:d.filter((y,v)=>v!==s)}}),className:"text-gray-500 hover:text-red-600",children:e.jsx(me,{size:16})})]},s))]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex justify-between items-center mb-2",children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.envVars")}),e.jsx("button",{type:"button",onClick:Se,className:"hub-btn primary !w-[30px] !h-[30px] !p-0 justify-center text-base font-bold",children:"+"})]}),w.map((n,s)=>e.jsxs("div",{className:"flex items-center mb-2",children:[e.jsxs("div",{className:"flex items-center space-x-2 flex-grow",children:[e.jsx("input",{type:"text",value:n.key,onChange:l=>Z(s,"key",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.key")}),e.jsx("span",{className:"flex items-center",children:":"}),e.jsx("input",{type:"text",value:n.value,onChange:l=>Z(s,"value",l.target.value),className:"w-1/2 py-2 px-3 form-input",placeholder:t("server.value")})]}),e.jsx("button",{type:"button",onClick:()=>Ce(s),className:"bg-gray-200 hover:bg-gray-300 text-gray-700 font-medium py-1 px-2 rounded text-sm flex items-center justify-center min-w-[30px] min-h-[30px] ml-2 btn-danger",children:"-"})]},s))]})]})})]}),e.jsxs("div",{className:"mb-4",children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Xr(!de),children:[e.jsx("h3",{className:"text-sm font-semibold text-[var(--hub-ink)]",children:t("server.sectionAdvanced","Advanced Options")}),e.jsx("span",{className:"text-gray-500 text-sm",children:de?"▼":"▶"})]}),de&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-white dark:bg-gray-900 border-t-0 space-y-4",children:[e.jsxs("fieldset",{className:"space-y-3 rounded-lg border border-gray-200 dark:border-gray-700 p-4",children:[e.jsx("legend",{className:"px-1 font-medium",children:t("credentials.slots")}),e.jsx("p",{className:"text-sm text-gray-500",children:t("credentials.slotsHint")}),p==="stdio"&&e.jsx("p",{className:"text-sm text-gray-500",children:t("credentials.argsHint",{placeholder:"{{args.API_KEY}}"})}),(p==="sse"||p==="streamable-http")&&e.jsx("p",{className:"text-sm text-gray-500",children:t("credentials.urlHint",{placeholder:"{{url.region}}"})}),(i.credentialTemplate||[]).map((n,s)=>e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[p==="stdio"?e.jsxs("select",{"aria-label":t("credentials.target"),value:n.target==="args"?"args":"env",className:"py-2 px-3 form-input",onChange:l=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,target:l.target.value}:y)})},children:[e.jsx("option",{value:"env",children:t("server.envVars")}),e.jsx("option",{value:"args",children:t("server.arguments")})]}):e.jsxs("select",{"aria-label":t("credentials.target"),value:n.target==="url"?"url":"headers",className:"py-2 px-3 form-input",onChange:l=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,target:l.target.value,allowed:l.target.value==="url"?[]:void 0}:y)})},children:[e.jsx("option",{value:"headers",children:t("server.headers")}),(p==="sse"||p==="streamable-http")&&e.jsx("option",{value:"url",children:"URL"})]}),e.jsx("input",{required:!0,maxLength:128,"aria-label":t("credentials.fieldName"),placeholder:t("credentials.fieldName"),value:n.name,className:"min-w-0 flex-1 py-2 px-3 form-input",onChange:l=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,name:l.target.value}:y)})}}),e.jsx("input",{maxLength:200,"aria-label":t("credentials.label"),placeholder:t("credentials.label"),value:n.label||"",className:"min-w-0 flex-1 py-2 px-3 form-input",onChange:l=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,label:l.target.value}:y)})}}),n.target==="url"&&e.jsx("textarea",{required:!0,"aria-label":t("credentials.allowed"),placeholder:t("credentials.allowed"),value:(n.allowed||[]).join(`
|
|
16
|
-
`),className:"w-full py-2 px-3 form-input",onChange:l=>{var d;return c({...i,credentialTemplate:(d=i.credentialTemplate)==null?void 0:d.map((y,v)=>v===s?{...y,allowed:l.target.value.split(`
|
|
17
|
-
`)}:y)})}}),e.jsx("button",{type:"button","aria-label":t("credentials.removeSlot"),onClick:()=>{var l;return c({...i,credentialTemplate:(l=i.credentialTemplate)==null?void 0:l.filter((d,y)=>y!==s)})},children:e.jsx(me,{size:18})})]},s)),e.jsx("button",{type:"button",className:"text-sm text-blue-600",disabled:(((yr=i.credentialTemplate)==null?void 0:yr.length)||0)>=32,onClick:()=>c({...i,credentialTemplate:[...i.credentialTemplate||[],{target:p==="stdio"?"env":"headers",name:""}]}),children:t("credentials.addSlot")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",htmlFor:"visibility",children:t("server.visibility","Visibility")}),e.jsxs("select",{id:"visibility",name:"visibility",value:i.visibility||"private",onChange:n=>c(s=>({...s,visibility:n.target.value})),className:"w-full py-2 px-3 form-input",children:[e.jsx("option",{value:"private",children:t("server.visibilityPrivate","Private — only the owner and admins")}),e.jsx("option",{value:"group",children:t("server.visibilityGroup","Shared — selected users only")}),e.jsx("option",{value:"public",children:t("server.visibilityPublic","Public — every authenticated user")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.visibilityDescription","Controls which non-admin users can discover and call this server. Admins always have access.")}),i.visibility==="group"&&e.jsxs("div",{className:"mt-4 rounded border border-gray-200 dark:border-gray-700 p-3",children:[e.jsx("div",{className:"text-sm font-medium text-[var(--hub-ink-2)]",children:t("server.shareWithUsers","Share with users")}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 mb-3",children:t("server.shareWithUsersDescription","Selected users can discover and call this server, but cannot manage its configuration.")}),r!=null&&r.name?e.jsxs(e.Fragment,{children:[T&&e.jsx("p",{className:"text-sm text-gray-500",children:t("server.shareCandidatesLoading","Loading users...")}),P&&e.jsx("p",{className:"text-sm text-red-600 dark:text-red-400",children:t("server.shareCandidatesError","Failed to load users.")}),!T&&!P&&H.length===0&&e.jsx("p",{className:"text-sm text-gray-500",children:t("server.noShareCandidates","No other users are available.")}),H.length>0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-3 space-y-2",children:[e.jsx("label",{htmlFor:"share-user-search",className:"block text-xs font-medium text-[var(--hub-ink-2)]",children:t("server.shareUserSearchLabel","Search users")}),e.jsx("input",{id:"share-user-search",type:"search",value:z,onChange:n=>q(n.target.value),placeholder:t("server.shareUserSearchPlaceholder","Search usernames..."),className:"w-full py-2 px-3 form-input text-sm"}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:Br,disabled:W,className:"hub-btn text-sm",children:t("server.selectAllShareUsers","Select all")}),e.jsx("button",{type:"button",onClick:Lr,disabled:zr,className:"hub-btn text-sm",children:t("server.deselectAllShareUsers","Deselect all")})]})]}),N.length===0?e.jsx("p",{className:"text-sm text-gray-500",children:t("server.noMatchingShareUsers","No users match your search.")}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:N.map(n=>e.jsxs("label",{className:"flex items-center gap-2 rounded border border-gray-200 dark:border-gray-700 px-3 py-2 text-sm text-[var(--hub-ink-2)]",children:[e.jsx("input",{type:"checkbox",checked:M.has(n),onChange:()=>Vr(n)}),e.jsx("span",{children:n})]},n))})]})]}):e.jsx("p",{className:"text-sm text-gray-500",children:t("server.shareAfterCreate","Save the server before selecting users.")})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5 text-[var(--hub-ink-2)]",children:t("server.openapi.passthroughHeaders")}),p==="openapi"?e.jsx(e.Fragment,{children:e.jsx("input",{type:"text",value:((gr=i.openapi)==null?void 0:gr.passthroughHeaders)||"",onChange:n=>c(s=>{var l;return{...s,openapi:{...s.openapi,passthroughHeaders:n.target.value,url:((l=s.openapi)==null?void 0:l.url)||""}}}),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-API-Key, X-Custom-Header"})}):e.jsx("input",{type:"text",value:i.passthroughHeaders||"",onChange:n=>c(s=>({...s,passthroughHeaders:n.target.value})),className:"w-full py-2 px-3 form-input",placeholder:"Authorization, X-Custom-User-Id"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.openapi.passthroughHeadersHelp")})]}),p!=="openapi"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>$r(!ce),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.oauth.sectionTitle")}),e.jsx("span",{className:"text-gray-500 text-sm",children:ce?"▼":"▶"})]}),ce&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.oauth.sectionDescription")}),(p==="sse"||p==="streamable-http")&&e.jsxs("div",{className:"mb-3",children:[e.jsx("label",{htmlFor:"oauthIdentityMode",className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.identityMode")}),e.jsxs("select",{id:"oauthIdentityMode",className:"w-full py-2 px-3 form-input",value:((br=i.oauth)==null?void 0:br.identityMode)||"shared",onChange:n=>D("identityMode",n.target.value),children:[e.jsx("option",{value:"shared",children:t("server.oauth.sharedIdentity")}),e.jsx("option",{value:"personal",children:t("server.oauth.personalIdentity")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.oauth.personalIdentityHelp")})]}),(p==="sse"||p==="streamable-http")&&(((vr=m.user)==null?void 0:vr.isAdmin)||((fr=i.oauth)==null?void 0:fr.allowInsecureTokenEndpoint))&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:((jr=i.oauth)==null?void 0:jr.allowInsecureTokenEndpoint)===!0,disabled:!((kr=m.user)!=null&&kr.isAdmin),onChange:n=>D("allowInsecureTokenEndpoint",n.target.checked)}),t("server.oauth.allowInsecureTokenEndpoint")]}),e.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-400 mt-1",children:t("server.oauth.allowInsecureTokenEndpointHelp")})]}),e.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientId")}),e.jsx("input",{type:"text",value:((Nr=i.oauth)==null?void 0:Nr.clientId)||"",onChange:n=>D("clientId",n.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client id",autoComplete:"off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs text-gray-600 mb-1",children:t("server.oauth.clientSecret")}),e.jsx("input",{type:"password",value:((Sr=i.oauth)==null?void 0:Sr.clientSecret)||"",onChange:n=>D("clientSecret",n.target.value),className:"w-full py-2 px-3 form-input",placeholder:"client secret",autoComplete:"off"})]})]})]})]}),p!=="openapi"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>Wr(!ie),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.requestOptions")}),e.jsx("span",{className:"text-gray-500 text-sm",children:ie?"▼":"▶"})]}),ie&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[p==="stdio"&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxBufferSize",children:t("server.maxBufferSize")}),e.jsx("input",{type:"number",id:"maxBufferSize",value:((Cr=i.options)==null?void 0:Cr.maxBufferSize)??"",onChange:n=>ee("maxBufferSize",n.target.value===""?void 0:Number(n.target.value)),className:"w-full py-2 px-3 form-input",placeholder:"10485760",min:"1",step:"1"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.maxBufferSizeDescription")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"timeout",children:t("server.timeout")}),e.jsx("input",{type:"number",id:"timeout",value:((Tr=i.options)==null?void 0:Tr.timeout)||6e4,onChange:n=>ee("timeout",parseInt(n.target.value)||6e4),className:"w-full py-2 px-3 form-input",placeholder:"30000",min:"1000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.timeoutDescription")})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"maxTotalTimeout",children:t("server.maxTotalTimeout")}),e.jsx("input",{type:"number",id:"maxTotalTimeout",value:((wr=i.options)==null?void 0:wr.maxTotalTimeout)||"",onChange:n=>ee("maxTotalTimeout",n.target.value?parseInt(n.target.value):void 0),className:"w-full py-2 px-3 form-input",placeholder:"Optional",min:"1000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.maxTotalTimeoutDescription")})]})]}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("label",{className:"flex items-center",children:[e.jsx("input",{type:"checkbox",checked:((Ar=i.options)==null?void 0:Ar.resetTimeoutOnProgress)??!0,onChange:n=>ee("resetTimeoutOnProgress",n.target.checked),className:"mr-2"}),e.jsx("span",{className:"text-gray-600 text-sm",children:t("server.resetTimeoutOnProgress")})]}),e.jsx("p",{className:"text-xs text-gray-500 mt-1 ml-6",children:t("server.resetTimeoutOnProgressDescription")})]})]})]}),(p==="sse"||p==="streamable-http")&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between cursor-pointer bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 p-3 rounded border border-gray-200 dark:border-gray-700",onClick:()=>_r(!pe),children:[e.jsx("label",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:t("server.keepAlive","Connection Health")}),e.jsx("span",{className:"text-gray-500 text-sm",children:pe?"▼":"▶"})]}),pe&&e.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-b p-4 bg-gray-50 dark:bg-gray-800 border-t-0",children:[e.jsxs("div",{className:"flex items-center mb-3",children:[e.jsx("input",{type:"checkbox",id:"enableKeepAlive",checked:((Ir=i.keepAlive)==null?void 0:Ir.enabled)||!1,onChange:n=>c(s=>({...s,keepAlive:{...s.keepAlive,enabled:n.target.checked}})),className:"mr-2"}),e.jsx("label",{htmlFor:"enableKeepAlive",className:"text-gray-600 text-sm",children:t("server.enableKeepAlive","Enable Health Checks and Auto Reconnect")})]}),e.jsx("p",{className:"text-xs text-gray-500 mb-3",children:t("server.keepAliveDescription","Run periodic health checks and automatically reconnect this remote server when it becomes disconnected.")}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-gray-600 text-sm font-medium mb-1",htmlFor:"keepAliveInterval",children:t("server.keepAliveInterval","Check interval (ms)")}),e.jsx("input",{type:"number",id:"keepAliveInterval",value:((Kr=i.keepAlive)==null?void 0:Kr.interval)||6e4,onChange:n=>c(s=>({...s,keepAlive:{...s.keepAlive,interval:parseInt(n.target.value)||6e4}})),className:"w-full py-2 px-3 form-input",placeholder:"60000",min:"5000",max:"300000"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.keepAliveIntervalDescription","Time between health checks and automatic reconnect attempts in milliseconds (default: 60000ms = 1 minute)")})]})]})]}),p!=="openapi"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"perSessionClient",checked:i.perSessionClient||!1,onChange:n=>c(s=>({...s,perSessionClient:n.target.checked})),className:"mr-2"}),e.jsx("label",{htmlFor:"perSessionClient",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.perSessionClient","Per-Session Client Isolation")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.perSessionClientDescription","Create a dedicated upstream connection per session instead of sharing one across all sessions. Enable for stateful servers like Playwright. Increases upstream connections with concurrent sessions.")})]}),p==="stdio"&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center mb-1",children:[e.jsx("input",{type:"checkbox",id:"startOnDemand",checked:i.startOnDemand||!1,onChange:n=>c(s=>({...s,startOnDemand:n.target.checked})),className:"mr-2"}),e.jsx("label",{htmlFor:"startOnDemand",className:"text-gray-700 dark:text-gray-300 text-sm font-medium",children:t("server.startOnDemand","Start On Demand")})]}),e.jsx("p",{className:"text-xs text-gray-500 ml-6",children:t("server.startOnDemandDescription","Skip startup connect and spawn this server only when a tool call arrives. The process is shut down automatically after the idle timeout, then restarted on the next call. Reduces persistent memory usage for rarely-used servers.")}),(i.startOnDemand||!!((Er=i.credentialTemplate)!=null&&Er.length))&&e.jsxs("div",{className:"ml-6 mt-2",children:[e.jsx("label",{htmlFor:"idleTimeoutMs",className:"block text-xs text-gray-600 dark:text-gray-400 mb-1",children:t("server.idleTimeoutMs","Idle shutdown timeout (ms)")}),e.jsx("input",{type:"number",id:"idleTimeoutMs",min:1e4,step:1e3,value:i.idleTimeoutMs??3e5,onChange:n=>c(s=>({...s,idleTimeoutMs:Number(n.target.value)})),className:"hub-input w-40 text-sm"}),e.jsx("p",{className:"text-xs text-gray-500 mt-1",children:t("server.idleTimeoutMsDescription","Shut down the process after this many milliseconds with no tool calls. Default: 300000 (5 minutes).")})]})]})]})]}),e.jsxs("div",{className:"flex justify-end mt-6",children:[e.jsx("button",{type:"button",onClick:o,className:"hub-btn mr-2",children:t("server.cancel")}),e.jsx("button",{type:"submit",className:"hub-btn primary",children:t(F?"server.save":"server.add")})]})]})]})},At=a=>{const o=new Set,r=/\$\{([^}]+)\}/g,u=x=>{let b;for(;(b=r.exec(x))!==null;)o.add(b[1])},h=(x,b="")=>{typeof x=="string"?u(x):Array.isArray(x)?x.forEach((t,m)=>h(t,`${b}[${m}]`)):x&&typeof x=="object"&&Object.entries(x).forEach(([t,m])=>{h(m,b?`${b}.${t}`:t)})};return h(a),Array.from(o)};export{xe as S,wt as a,Ct as c,At as d,lt as g,Tt as s};
|
|
18
|
-
//# sourceMappingURL=variableDetection-Cpa0rIrf.js.map
|