UI

MCP

Model Context Protocol server manager with a segmented context budget meter, cross-highlighted server rows, per-tool switches with live rolling token totals, a focus-trapped Add server sheet with OAuth authorization and streaming tool discovery, and six-second undoable removal.

import { MCPServers } from '@uthereal/ui/mcp-servers'

Mcpservers playground

MCP servers

18tools6.4ktokens of context

Budget 8k

GitHub, 2.2k tokens
Linear, 1k tokens
Slack, 1k tokens
Stripe, 610 tokens
PostgreSQL, 730 tokens
Figma, 850 tokens

Loading interactive preview…

Overview

MCPServers manages the Model Context Protocol servers that supply tools to an AI agent. The header displays live enabled tool and token counts over a segmented role="meter" budget bar with one proportional segment per connected server. Hovering or focusing any server row highlights its matching segment on the bar while dimming the others. When total enabled tool definitions exceed budget, the bar rescales, renders a warning-colored overflow segment, and states how many tokens exceed the budget.

Expanding any server row reveals its tools with read/write badges, per-tool token costs, and individual switches that roll the row and header totals live, along with a Tool calls permission selector (Ask every time or Always allow reads), endpoint path, and Remove control backed by a six-second Undo bar (pausable on hover/focus and restorable via Mod+Z). Selecting Add server raises a focus-trapped sheet with a searchable directory, custom URL input, simulated OAuth authorize step, and streaming tool discovery.

Use MCPServers in agent workspaces, IDE settings, and developer consoles that configure MCP tool servers and context budgets. For lightweight OAuth workspace connections without tool-level token budgets, use Connectors. For persistent user facts across chats, use Memory.

Usage

'use client'
import { MCPServers, type McpServer } from '@uthereal/ui/mcp-servers'

export function AgentToolsSettings({ servers }: { servers: McpServer[] }) {
  return (
    <MCPServers
      clientName="Northwind Agent"
      budget={8000}
      servers={servers}
      onToggleTool={(serverId, toolId, enabled) => {
        void fetch(`/api/mcp/${serverId}/tools/${toolId}`, {
          method: 'PATCH',
          body: JSON.stringify({ enabled }),
        })
      }}
      onConnect={async (request, signal) => {
        const res = await fetch('/api/mcp/connect', {
          method: 'POST',
          body: JSON.stringify(request),
          signal,
        })
        if (!res.ok) throw new Error('Could not reach the server')
        return (await res.json()) as McpServer
      }}
      onRemove={(serverId) => {
        void fetch(`/api/mcp/${serverId}`, { method: 'DELETE' })
      }}
      onPermissionChange={(serverId, permission) => {
        void fetch(`/api/mcp/${serverId}/permission`, {
          method: 'PATCH',
          body: JSON.stringify({ permission }),
        })
      }}
    />
  )
}

Omit servers and onConnect to render the default sample servers and eleven-entry directory with simulated local OAuth authorization and streaming tool discovery (nothing leaves the browser).

Examples

Over-budget context warning

Lower budget (or enable enough tool definitions to exceed it) to trigger the rescaled meter, amber overflow segment, and over-budget readout. Toggle any tool switch off to watch the totals roll back within budget.

Agent tool budget

11tools4.3ktokens of context

800 over

GitHub, 1.5k tokens
Linear, 1k tokens
PostgreSQL, 1k tokens
Slack, 720 tokens

Auth and error recovery

Include servers in needs-auth and error states alongside connected servers to surface inline Sign in and Retry actions, expanded status notices, and account context for OAuth prompts.

MCP servers

3tools1ktokens of context

Budget 6k

GitHub, 710 tokens
Linear, 310 tokens

Context budget and discovery flow

Server status lifecycle

StatusRow badgeRow actionContext meter contribution
connectedcircle-check (Connected)ExpandSum of tokens for every enabled tool.
needs-authlock (Needs sign in)Sign in0 tokens until re-authenticated.
errorcircle-alert (Error)Retry0 tokens; panel shows server.error message.

Add server sheet steps

StepTriggerBehavior
DirectoryAdd server buttonFilters directory entries (Added entries are disabled) or accepts a pasted http(s) server URL.
AuthorizeDirectory entry with oauthShows clientName, optional account pill, and plain-language scopes before starting discovery.
DiscoverLocal/URL entry or AuthorizeStreams discovered tools (reads default on, writes default off) with live token and budget preview.

API reference

These serializable arguments and defaults come directly from the component schema.

ArgumentType / defaultDescription
titlestringDefault: "MCP servers"Heading of the card and accessible section name.
clientNamestringDefault: "Workspace agent"Your agent's name on the authorize screen.
accountMcpAccount—The signed in person shown on the authorize screen: name, email, and an optional avatar URL.
budgetintegerDefault: 8000Tokens of context you are willing to spend on tool definitions. The bar spans the budget; past it the bar rescales, the overflow turns warning, and the label says how far over it is.
defaultServersMcpServer[]Default: [{"id":"github","name":"GitHub","brand":"github","transport":"remote","endpoint":"https://api.githubcopilot.com/mcp/","status":"connected","permission":"allow-reads","tools":[{"id":"search_code","name":"search_code","access":"read","tokens":420,"enabled":true},{"id":"get_pull_request","name":"get_pull_request","access":"read","tokens":290,"enabled":true},{"id":"list_issues","name":"list_issues","access":"read","tokens":400,"enabled":true},{"id":"create_issue","name":"create_issue","access":"write","tokens":420,"enabled":true},{"id":"create_pull_request","name":"create_pull_request","access":"write","tokens":640,"enabled":true},{"id":"merge_pull_request","name":"merge_pull_request","access":"write","tokens":360,"enabled":false}]},{"id":"linear","name":"Linear","brand":"linear","transport":"remote","endpoint":"https://mcp.linear.app/mcp","status":"connected","permission":"allow-reads","tools":[{"id":"list_issues","name":"list_issues","access":"read","tokens":310,"enabled":true},{"id":"get_issue","name":"get_issue","access":"read","tokens":260,"enabled":true},{"id":"create_issue","name":"create_issue","access":"write","tokens":450,"enabled":true},{"id":"update_issue","name":"update_issue","access":"write","tokens":480,"enabled":false},{"id":"list_projects","name":"list_projects","access":"read","tokens":260,"enabled":false}]},{"id":"notion","name":"Notion","brand":"notion","transport":"remote","endpoint":"https://mcp.notion.com/mcp","status":"needs-auth","permission":"ask","scopes":["Search and read pages you share with it","Create pages and add comments"],"tools":[{"id":"search","name":"search","access":"read","tokens":380,"enabled":true},{"id":"fetch","name":"fetch","access":"read","tokens":300,"enabled":true},{"id":"create_pages","name":"create_pages","access":"write","tokens":520,"enabled":false},{"id":"update_page","name":"update_page","access":"write","tokens":460,"enabled":false}]},{"id":"slack","name":"Slack","brand":"slack","transport":"remote","endpoint":"https://mcp.slack.com/mcp","status":"connected","permission":"ask","tools":[{"id":"search_messages","name":"search_messages","access":"read","tokens":360,"enabled":true},{"id":"get_thread","name":"get_thread","access":"read","tokens":280,"enabled":false},{"id":"list_channels","name":"list_channels","access":"read","tokens":240,"enabled":true},{"id":"post_message","name":"post_message","access":"write","tokens":420,"enabled":true}]},{"id":"sentry","name":"Sentry","brand":"sentry","transport":"remote","endpoint":"https://mcp.sentry.dev/mcp","status":"error","error":"tools/list timed out after 30 seconds","permission":"allow-reads","tools":[{"id":"search_issues","name":"search_issues","access":"read","tokens":330,"enabled":true},{"id":"get_issue_details","name":"get_issue_details","access":"read","tokens":410,"enabled":true},{"id":"update_issue_status","name":"update_issue_status","access":"write","tokens":300,"enabled":false}]},{"id":"stripe","name":"Stripe","brand":"stripe","transport":"remote","endpoint":"https://mcp.stripe.com","status":"connected","permission":"ask","tools":[{"id":"list_customers","name":"list_customers","access":"read","tokens":320,"enabled":true},{"id":"list_invoices","name":"list_invoices","access":"read","tokens":290,"enabled":true},{"id":"create_refund","name":"create_refund","access":"write","tokens":350,"enabled":false},{"id":"create_payment_link","name":"create_payment_link","access":"write","tokens":420,"enabled":false}]},{"id":"postgresql","name":"PostgreSQL","brand":"postgresql","transport":"local","endpoint":"npx @northwind/mcp-postgres postgres://localhost/analytics","status":"connected","permission":"allow-reads","tools":[{"id":"query","name":"query","access":"read","tokens":290,"enabled":true},{"id":"list_tables","name":"list_tables","access":"read","tokens":180,"enabled":true},{"id":"describe_table","name":"describe_table","access":"read","tokens":260,"enabled":true}]},{"id":"figma","name":"Figma","brand":"figma","transport":"local","endpoint":"http://127.0.0.1:3845/mcp","status":"connected","permission":"allow-reads","tools":[{"id":"get_design_context","name":"get_design_context","access":"read","tokens":610,"enabled":true},{"id":"get_screenshot","name":"get_screenshot","access":"read","tokens":240,"enabled":true},{"id":"get_variable_defs","name":"get_variable_defs","access":"read","tokens":300,"enabled":false}]}]Servers the agent starts with. Defaults to an eight-server sample (GitHub, Linear, Notion, Slack, Sentry, Stripe, PostgreSQL, Figma). Only enabled tools of connected servers count toward context. Edits do not reset a mounted instance.
directoryMcpDirectoryEntry[]Default: [{"id":"vercel","name":"Vercel","brand":"vercel","description":"Deployments, build logs and project settings","transport":"remote","endpoint":"https://mcp.vercel.com","auth":"oauth","scopes":["Read projects, deployments and build logs","Create preview deployments"],"tools":[{"id":"list_projects","name":"list_projects","access":"read","tokens":240},{"id":"list_deployments","name":"list_deployments","access":"read","tokens":310},{"id":"get_build_logs","name":"get_build_logs","access":"read","tokens":380},{"id":"create_deployment","name":"create_deployment","access":"write","tokens":460},{"id":"promote_deployment","name":"promote_deployment","access":"write","tokens":330}]},{"id":"supabase","name":"Supabase","brand":"supabase","description":"Tables, SQL and edge functions","transport":"remote","endpoint":"https://mcp.supabase.com/mcp","auth":"oauth","scopes":["Read tables and run read only SQL","Apply migrations and deploy functions"],"tools":[{"id":"list_tables","name":"list_tables","access":"read","tokens":220},{"id":"execute_sql","name":"execute_sql","access":"read","tokens":360},{"id":"apply_migration","name":"apply_migration","access":"write","tokens":420},{"id":"deploy_edge_function","name":"deploy_edge_function","access":"write","tokens":480}]},{"id":"datadog","name":"Datadog","brand":"datadog","description":"Metrics, monitors and logs","transport":"remote","endpoint":"https://mcp.datadoghq.com/mcp","auth":"oauth","scopes":["Read metrics, monitors and logs","Mute and unmute monitors"],"tools":[{"id":"query_metrics","name":"query_metrics","access":"read","tokens":420},{"id":"search_logs","name":"search_logs","access":"read","tokens":390},{"id":"list_monitors","name":"list_monitors","access":"read","tokens":260},{"id":"mute_monitor","name":"mute_monitor","access":"write","tokens":280}]},{"id":"cloudflare","name":"Cloudflare","brand":"cloudflare","description":"Workers, KV namespaces and DNS records","transport":"remote","endpoint":"https://bindings.mcp.cloudflare.com/mcp","auth":"oauth","scopes":["Read Workers, KV and DNS","Edit DNS records"],"tools":[{"id":"workers_list","name":"workers_list","access":"read","tokens":230},{"id":"kv_get","name":"kv_get","access":"read","tokens":210},{"id":"dns_records_list","name":"dns_records_list","access":"read","tokens":280},{"id":"dns_record_update","name":"dns_record_update","access":"write","tokens":390}]},{"id":"google-drive","name":"Google Drive","brand":"google-drive","description":"Search and read files in shared drives","transport":"remote","endpoint":"https://drivemcp.googleapis.com/mcp","auth":"oauth","scopes":["See and download files in your Drive"],"tools":[{"id":"search_files","name":"search_files","access":"read","tokens":340},{"id":"read_file","name":"read_file","access":"read","tokens":260}]},{"id":"atlassian","name":"Atlassian","brand":"atlassian","description":"Jira issues and Confluence pages","transport":"remote","endpoint":"https://mcp.atlassian.com/v1/sse","auth":"oauth","scopes":["Read Jira issues and Confluence pages","Create and edit issues"],"tools":[{"id":"search_jira","name":"search_jira","access":"read","tokens":380},{"id":"get_confluence_page","name":"get_confluence_page","access":"read","tokens":290},{"id":"create_jira_issue","name":"create_jira_issue","access":"write","tokens":470},{"id":"add_comment","name":"add_comment","access":"write","tokens":260}]},{"id":"hubspot","name":"HubSpot","brand":"hubspot","description":"Contacts, companies and deals","transport":"remote","endpoint":"https://mcp.hubspot.com","auth":"oauth","scopes":["Read contacts, companies and deals","Add notes to records"],"tools":[{"id":"search_contacts","name":"search_contacts","access":"read","tokens":330},{"id":"get_deal","name":"get_deal","access":"read","tokens":270},{"id":"create_note","name":"create_note","access":"write","tokens":300}]},{"id":"posthog","name":"PostHog","brand":"posthog","description":"Product analytics, insights and feature flags","transport":"remote","endpoint":"https://mcp.posthog.com/mcp","auth":"oauth","scopes":["Read insights and feature flags","Update feature flag rollouts"],"tools":[{"id":"query_insight","name":"query_insight","access":"read","tokens":410},{"id":"list_feature_flags","name":"list_feature_flags","access":"read","tokens":230},{"id":"update_feature_flag","name":"update_feature_flag","access":"write","tokens":360}]},{"id":"asana","name":"Asana","brand":"asana","description":"Tasks, projects and comments","transport":"remote","endpoint":"https://mcp.asana.com/sse","auth":"oauth","scopes":["Read tasks and projects","Create tasks and comments"],"tools":[{"id":"search_tasks","name":"search_tasks","access":"read","tokens":300},{"id":"get_project","name":"get_project","access":"read","tokens":240},{"id":"create_task","name":"create_task","access":"write","tokens":380}]},{"id":"airtable","name":"Airtable","brand":"airtable","description":"Bases, tables and records","transport":"remote","endpoint":"https://mcp.airtable.com/mcp","auth":"oauth","scopes":["Read bases and records","Create and update records"],"tools":[{"id":"list_bases","name":"list_bases","access":"read","tokens":200},{"id":"search_records","name":"search_records","access":"read","tokens":310},{"id":"update_records","name":"update_records","access":"write","tokens":400}]},{"id":"docker","name":"Docker","brand":"docker","description":"Containers and images on this machine","transport":"local","endpoint":"docker mcp gateway run","auth":"none","tools":[{"id":"list_containers","name":"list_containers","access":"read","tokens":210},{"id":"container_logs","name":"container_logs","access":"read","tokens":260},{"id":"restart_container","name":"restart_container","access":"write","tokens":240}]}]What Add server offers. Defaults to an eleven-entry sample directory; OAuth entries show the authorize step first and entries already in the list read Added.
toggleToolActionstring—Registered host action requested when a tool is switched on or off in a server list.
connectActionstring—Registered host action requested when a server connects: from the directory or a URL, on sign in, and on retry.
removeActionstring—Registered host action requested once a removals undo window closes.
permissionActionstring—Registered host action requested when a server default for tool calls changes.
localestring—BCP 47 locale for number formatting; inherited when omitted.
recipestudio | softDefault: "studio"Visual treatment. Both recipes preserve interaction behavior.
themeMcpServersThemeDefault: {}Color mode, accent, and typed semantic token overrides.
motionnone | subtle | expressiveDefault: "subtle"Animation preset. System reduced-motion preferences take precedence.
motionOptionsMcpServersMotionOptionsDefault: {}Row expansion, label swap, and tool reveal timing overrides in milliseconds.
dirltr | rtl—Reading direction; inherited from the page when omitted.
  • McpServer accepts { id, name, brand?, transport: 'remote' | 'local', endpoint?, status: 'connected' | 'needs-auth' | 'error', error?, permission: 'ask' | 'allow-reads', tools: McpTool[] }.
  • McpTool accepts { id, name, access: 'read' | 'write', tokens, enabled }.
  • McpDirectoryEntry accepts { id, name, brand?, description, transport, endpoint?, auth: 'oauth' | 'none', scopes?, tools }.
  • Built-in ServerMark and McpMark components are exported from @uthereal/ui/mcp-servers supporting 23 built-in brand identifiers with automatic monogram fallbacks.

React integration

PropPurpose
serversReplaces the displayed server list whenever the array reference changes; omit to manage defaultServers locally.
onToggleTool(serverId, toolId, enabled)Called when a per-tool switch toggles.
onConnect(request, signal)Async handler for directory picks, URL pastes, Sign in, and Retry; resolves with the connected McpServer.
onRemove(serverId)Called only after the six-second undo bar expires without being undone.
onPermissionChange(serverId, permission)Called when Tool calls changes between 'ask' and 'allow-reads'.
onAction(action, itemId?)Called with toggleToolAction, connectAction, removeAction, or permissionAction and the affected ID.
renderServerMark(defaultMark)Customizes the 20px brand mark beside each server name.
presetApplication defaults overridden by explicit instance arguments.
tokensCSS variables applied after the typed theme, forwarded to root and all composed controls.
ref, className, styleApplied to the root <section> element.
Native attributesid, aria-*, data-*, and remaining <section> props forwarded to the root element.

Keyboard & accessibility

KeyAction
ArrowUp / ArrowDownMoves focus between server row headers (ArrowDown from sheet search jumps to first entry).
Home / EndJumps to the first or last server row header.
Enter / SpaceExpands or collapses the focused server row, toggles tool switches, or activates buttons.
EscapeCloses the open Add server sheet and restores focus to the originating trigger button.
Tab / Shift+TabCycles focus cleanly inside the modal Add server sheet (role="dialog", aria-modal).
Mod+ZRestores a recently removed server during the six-second undo window (ignored in text inputs).
  • The context budget gauge exposes role="meter" with aria-valuemin={0}, aria-valuemax={budget}, aria-valuenow, and aria-valuetext ("6.4k of 8k budgeted tokens"), and each segment carries visually hidden server-name and token text.
  • Visual CountingNumber readouts are marked aria-hidden="true" and paired with visually hidden plain text so screen readers announce exact totals instead of intermediate animation frames.
  • A pre-mounted polite role="status" live region announces connections, tool discovery counts, removals with their six-second undo window, restorations, and errors.
  • Container queries adapt below 520px (collapsing panel indent and shortening row counts) and below 400px (hiding secondary tool counts and showing read/write icons with visually hidden labels). Logical CSS mirrors cleanly in RTL (dir="rtl"), and @media (forced-colors: active) maps segments, overflow, and borders to system colors.

Motion & theming

Row expansions, undo bar height, and meter segments ease smoothly while tool and token totals count in tabular numerals (CountingNumber). The Add server sheet rises on the smooth spring (0.4s, zero overshoot), crossfades between steps, and staggers discovered tools as they arrive.

Under prefers-reduced-motion: reduce, height springs, sheet travel, fresh-row tint animations, and pending skeletons stop while status swaps retain 120ms opacity crossfades. Setting motion="none" makes every transition immediate (0ms).

theme accepts mode, accent, and typed tokens across these groups:

Token groupCSS custom properties
core--ui-surface, --ui-surface-raised, --ui-text, --ui-text-secondary, --ui-muted, --ui-border, --ui-highlight, --ui-accent, --ui-accent-foreground, --ui-danger, --ui-focus-ring, --ui-radius, --ui-border-width, --ui-shadow, --ui-disabled-opacity, --ui-font, --ui-font-size, --ui-font-weight
extended--ui-surface-sunken, --ui-border-strong, --ui-border-subtle, --ui-track, --ui-info, --ui-success, --ui-warning, --ui-tone-foreground, --ui-overlay, --ui-tint-strength
shape--ui-radius-sm, --ui-popup-radius, --ui-surface-radius
accentTones--ui-accent-strong, --ui-accent-subtle
control--ui-control-height, --ui-control-padding-x, --ui-control-gap, --ui-icon-size
type--ui-font-mono, --ui-font-display
include--ui-series-1, --ui-series-2 (highlighted server segment color)

An application-wide UtherealProvider supplies defaults.

Composition

In an agent composition, MCPServers is a leaf block. Mark every tool honestly as read or write, set realistic token estimates, and wire toggleToolAction, connectAction, removeAction, and permissionAction to registered host actions. See Building with agents.

{
  "type": "MCPServers",
  "props": {
    "title": "MCP servers",
    "clientName": "Workspace agent",
    "budget": 8000,
    "toggleToolAction": "toggle_mcp_tool",
    "connectAction": "connect_mcp_server",
    "removeAction": "remove_mcp_server",
    "permissionAction": "set_mcp_permission"
  },
  "children": []
}

On this page