improve mcp CLI + ability to debug MCP oauth (#5980)

This commit is contained in:
Matt Silverlock
2025-12-22 23:27:38 -05:00
committed by GitHub
parent 161e9287a8
commit 1a2b656c4d
4 changed files with 333 additions and 23 deletions

View File

@@ -29,6 +29,16 @@ export function Sidebar(props: { sessionID: string }) {
// Sort MCP servers alphabetically for consistent display order
const mcpEntries = createMemo(() => Object.entries(sync.data.mcp).sort(([a], [b]) => a.localeCompare(b)))
// Count connected and error MCP servers for collapsed header display
const connectedMcpCount = createMemo(() => mcpEntries().filter(([_, item]) => item.status === "connected").length)
const errorMcpCount = createMemo(
() =>
mcpEntries().filter(
([_, item]) =>
item.status === "failed" || item.status === "needs_auth" || item.status === "needs_client_registration",
).length,
)
const cost = createMemo(() => {
const total = messages().reduce((sum, x) => sum + (x.role === "assistant" ? x.cost : 0), 0)
return new Intl.NumberFormat("en-US", {
@@ -98,6 +108,13 @@ export function Sidebar(props: { sessionID: string }) {
</Show>
<text fg={theme.text}>
<b>MCP</b>
<Show when={!expanded.mcp}>
<span style={{ fg: theme.textMuted }}>
{" "}
({connectedMcpCount()} active
{errorMcpCount() > 0 ? `, ${errorMcpCount()} error${errorMcpCount() > 1 ? "s" : ""}` : ""})
</span>
</Show>
</text>
</box>
<Show when={mcpEntries().length <= 2 || expanded.mcp}>