MCPcopy Index your code
hub / github.com/codeaashu/claude-code / prepareServers

Function prepareServers

src/components/mcp/MCPSettings.tsx:70–126  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 t5 = () => {
69 let cancelled = false;
70 const prepareServers = async function prepareServers() {
71 const serverInfos = await Promise.all(filteredClients.map(async client_0 => {
72 const scope = client_0.config.scope;
73 const isSSE = client_0.config.type === "sse";
74 const isHTTP = client_0.config.type === "http";
75 const isClaudeAIProxy = client_0.config.type === "claudeai-proxy";
76 let isAuthenticated = undefined;
77 if (isSSE || isHTTP) {
78 const authProvider = new ClaudeAuthProvider(client_0.name, client_0.config as McpSSEServerConfig | McpHTTPServerConfig);
79 const tokens = await authProvider.tokens();
80 const hasSessionAuth = getSessionIngressAuthToken() !== null && client_0.type === "connected";
81 const hasToolsAndConnected = client_0.type === "connected" && filterToolsByServer(mcp.tools, client_0.name).length > 0;
82 isAuthenticated = Boolean(tokens) || hasSessionAuth || hasToolsAndConnected;
83 }
84 const baseInfo = {
85 name: client_0.name,
86 client: client_0,
87 scope
88 };
89 if (isClaudeAIProxy) {
90 return {
91 ...baseInfo,
92 transport: "claudeai-proxy" as const,
93 isAuthenticated: false,
94 config: client_0.config as McpClaudeAIProxyServerConfig
95 };
96 } else {
97 if (isSSE) {
98 return {
99 ...baseInfo,
100 transport: "sse" as const,
101 isAuthenticated,
102 config: client_0.config as McpSSEServerConfig
103 };
104 } else {
105 if (isHTTP) {
106 return {
107 ...baseInfo,
108 transport: "http" as const,
109 isAuthenticated,
110 config: client_0.config as McpHTTPServerConfig
111 };
112 } else {
113 return {
114 ...baseInfo,
115 transport: "stdio" as const,
116 config: client_0.config as McpStdioServerConfig
117 };
118 }
119 }
120 }
121 }));
122 if (cancelled) {
123 return;
124 }
125 setServers(serverInfos);
126 };
127 prepareServers();

Callers 1

MCPSettingsFunction · 0.85

Calls 3

tokensMethod · 0.95
filterToolsByServerFunction · 0.85

Tested by

no test coverage detected