import{r as v}from"./index-DJrCN3i2.js";import"./constants-CSeHBPkf.js";import{g as A}from"./github-icon-Dp3wHhYE.js";import{g as D}from"./registry-utils-DE2gmofn.js";import{g as H}from"./generate-id-Dyweu44Y.js";const z=({size:e=24,color:r="currentColor",...c})=>v.createElement("svg",{viewBox:"0 0 24 24",width:e,height:e,stroke:r,strokeWidth:"2",fill:"none",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",...c},v.createElement("path",{d:"m7.5 12 3 3 6-6m5.5 3c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10Z"}));z.displayName="CheckCircle";const L="mcp.mesh";function O(e){if(!e?.url)return"Unknown";try{return new URL(e.url).hostname}catch{return e.url}}function R(e){const r=e?.identifier||e?.name;return r?r.replace(/^@[^/]+\//,"").replace(/[-_]/g," ").replace(/\b\w/g,i=>i.toUpperCase()):"Unknown"}function K(e,r,c,i){const n=e.server,t=e._meta?.[L],m=new Date().toISOString(),b=t?.friendlyName||t?.friendly_name||e.title||n?.title||n?.name||"Unnamed MCP Server",x=n?.description||null,C=n?.icons?.[0]?.src||A(n?.repository)||null,o=t?.oauth_config,N=o&&typeof o.authorizationEndpoint=="string"&&typeof o.tokenEndpoint=="string"&&typeof o.clientId=="string"&&Array.isArray(o.scopes)&&(o.grantType==="authorization_code"||o.grantType==="client_credentials")?o:null,w=t?.configuration_state,I=t?.configuration_scopes,P=n?.repository?{url:n.repository.url,source:n.repository.source,subfolder:n.repository.subfolder}:null,p=n?.packages??[],f=n?.remotes??[],S=i?.packageIndex??0,T=i?.remoteIndex??0,h=p.length>0&&i?.packageIndex!==void 0,a=h?p[S]:null,s=h?null:f[T];let l,u,y=null;if(a){const _=a.identifier||a.name;l="STDIO",u="";const g={};if(a.environmentVariables)for(const k of a.environmentVariables)k.name&&(g[k.name]="");y={command:"npx",args:_?["-y",_]:[],...Object.keys(g).length>0&&{envVars:g}}}else s?(l=D(s.type)||"HTTP",u=s.url||""):(l="HTTP",u="");const E=f.length>1,M=p.length>1;let d="";a&&M?d=` (${R(a)})`:s&&E&&(d=` (${O(s)})`);const U=b+d;return{id:H("conn"),title:U,description:x,icon:C,app_name:t?.appName||n?.name||null,app_id:t?.id||e.id||null,connection_type:l,connection_url:u,connection_token:null,connection_headers:y,oauth_config:N,configuration_state:w??null,configuration_scopes:I??null,metadata:{source:"store",registry_item_id:e.id,verified:t?.verified??!1,scopeName:t?.scopeName??null,toolsCount:t?.tools?.length??0,publishedAt:t?.publishedAt??null,repository:P},created_at:m,updated_at:m,created_by:c,organization_id:r,tools:null,bindings:null,status:"inactive"}}export{L as M,K as e,z as i};
