()
| 32 | await Instance.provide({ |
| 33 | directory: process.cwd(), |
| 34 | async fn() { |
| 35 | UI.empty() |
| 36 | prompts.intro("MCP Servers") |
| 37 | |
| 38 | const config = await Config.get() |
| 39 | const mcpServers = config.mcp ?? {} |
| 40 | const statuses = await MCP.status() |
| 41 | |
| 42 | if (Object.keys(mcpServers).length === 0) { |
| 43 | prompts.log.warn("No MCP servers configured") |
| 44 | prompts.outro("Add servers with: arctic mcp add") |
| 45 | return |
| 46 | } |
| 47 | |
| 48 | for (const [name, serverConfig] of Object.entries(mcpServers)) { |
| 49 | const status = statuses[name] |
| 50 | const hasOAuth = serverConfig.type === "remote" && !!serverConfig.oauth |
| 51 | const hasStoredTokens = await MCP.hasStoredTokens(name) |
| 52 | |
| 53 | let statusIcon: string |
| 54 | let statusText: string |
| 55 | let hint = "" |
| 56 | |
| 57 | if (!status) { |
| 58 | statusIcon = "○" |
| 59 | statusText = "not initialized" |
| 60 | } else if (status.status === "connected") { |
| 61 | statusIcon = "✓" |
| 62 | statusText = "connected" |
| 63 | if (hasOAuth && hasStoredTokens) { |
| 64 | hint = " (OAuth)" |
| 65 | } |
| 66 | } else if (status.status === "disabled") { |
| 67 | statusIcon = "○" |
| 68 | statusText = "disabled" |
| 69 | } else if (status.status === "needs_auth") { |
| 70 | statusIcon = "⚠" |
| 71 | statusText = "needs authentication" |
| 72 | } else if (status.status === "needs_client_registration") { |
| 73 | statusIcon = "✗" |
| 74 | statusText = "needs client registration" |
| 75 | hint = "\n " + status.error |
| 76 | } else { |
| 77 | statusIcon = "✗" |
| 78 | statusText = "failed" |
| 79 | hint = "\n " + status.error |
| 80 | } |
| 81 | |
| 82 | const typeHint = serverConfig.type === "remote" ? serverConfig.url : serverConfig.command.join(" ") |
| 83 | prompts.log.info( |
| 84 | `${statusIcon} ${name} ${UI.Style.TEXT_DIM}${statusText}${hint}\n ${UI.Style.TEXT_DIM}${typeHint}`, |
| 85 | ) |
| 86 | } |
| 87 | |
| 88 | prompts.outro(`${Object.keys(mcpServers).length} server(s)`) |
| 89 | }, |
| 90 | }) |
| 91 | }, |
nothing calls this directly
no test coverage detected