Tools & Approvals
MCP Servers
Connected MCP servers with status, auth prompts and reconnect — expand one to switch individual tools on or off.
3 variantsMIT
Preview
Installation
Copies the component into components/ui and installs its dependencies and theme tokens.
pnpm dlx shadcn@latest add https://uilab.tmih06.com/r/mcp-servers.jsonUsage
Pass your own data and wire the callbacks to your agent runtime.
import { McpServers } from "@/components/ui/mcp-servers";
export function Connectors({ query }: { query: McpServersQuery }) {
// Pass null before the first response. While refetching, keep the stale
// servers in data and set loading to reuse their cardinality without
// displaying their tool or connection counts as current.
return (
<McpServers
data={query.data ?? null}
loading={query.isRefetching}
skeleton={{ count: 4 }}
onToggleTool={(serverId, tool, enabled) =>
mcp.setToolEnabled(serverId, tool, enabled)
}
onToggleServer={(serverId, enabled) => mcp.setAllTools(serverId, enabled)}
onAuthorize={(server) => mcp.startOAuth(server.id)} // opens the provider's consent page
onReconnect={(server) => mcp.restart(server.id)}
/>
);
}Props
| Prop | Type | Default | Description |
|---|---|---|---|
| data* | McpServer[] | null | — | Servers in display order, each with its status and tools. Pass null while they load; an empty array is valid loaded data. |
| loading | boolean | false | Force the layout-preserving skeleton while refetching, even when stale servers are available. Header counts are placeholders rather than false zeroes. |
| skeleton | { count?: number } | — | Shape hints for the loading state; count is the number of server placeholders in Servers view or tool row placeholders in Tools view. |
| view | "servers" | "tools" | "servers" | Expandable servers with their tools, or one searchable list of every tool grouped by server. |
| onToggleTool | (serverId: string, tool: string, enabled: boolean) => void | — | Called when a tool's switch flips. Tools are disabled unless the server is connected. |
| onToggleServer | (serverId: string, enabled: boolean) => void | — | Called by the All tools switch inside an expanded server. |
| onAuthorize | (server: McpServer) => void | — | Called by the Authorize button on servers that need auth. |
| onReconnect | (server: McpServer) => void | — | Called by the Reconnect button on servers in the error state. |
| defaultExpanded | string | — | Id of the server that starts expanded. |
| labels | Partial<McpServersLabels> | — | Your own UI strings: the labels.loading announcement, status names, counts, buttons, search and screen-reader text, for translating. Right-to-left works under `dir="rtl"`; connection errors stay left to right. |
| className | string | — | Extra classes for the root element. |
type McpServer = {
id: string;
name: string;
transport: "stdio" | "http";
status: "connected" | "connecting" | "needs-auth" | "error";
error?: string; // shown on error rows
tools: { name: string; description?: string; enabled: boolean }[];
};