diff --git a/ui/src/components/mcp/MCPProjectView.tsx b/ui/src/components/mcp/MCPProjectView.tsx index 8554077d3..720f0146a 100644 --- a/ui/src/components/mcp/MCPProjectView.tsx +++ b/ui/src/components/mcp/MCPProjectView.tsx @@ -192,7 +192,7 @@ export default function MCPProjectView({ data, root, offered, onChanged, onRemov {ownRows.length > 0 - ? + ? :

{t('mcp.projects.noOnlyHere')}

} diff --git a/ui/src/components/mcp/MCPServerList.test.tsx b/ui/src/components/mcp/MCPServerList.test.tsx index 04b7d87a0..1a35cd5e7 100644 --- a/ui/src/components/mcp/MCPServerList.test.tsx +++ b/ui/src/components/mcp/MCPServerList.test.tsx @@ -1,28 +1,15 @@ import { render, screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; import { describe, expect, it, vi } from 'vitest'; import { I18nProvider } from '../../i18n'; import MCPServerList from './MCPServerList'; describe('MCP server list', () => { - it('shows which Pi adapter settings a server has on focus, without their contents', async () => { - const user = userEvent.setup(); - const server = { command: 'npx', targets: ['pi'], piExtension: 'pi-mcp-adapter', directTools: true, piOptions: { excludeTools: ['secret_*'] } }; + it('shows which Pi adapter settings a server has on its row, without their contents', () => { + const server = { command: 'npx', targets: ['pi'], piExtension: 'pi-mcp-adapter', directTools: ['take_screenshot', 'list_pages'], piOptions: { excludeTools: ['secret_*'] } }; render( ['pi']} onToggle={vi.fn()} onMenu={vi.fn()} />); - await user.tab(); - expect(screen.getByRole('button', { name: 'Pi adapter settings for docs' })).toHaveFocus(); - const tip = await screen.findByRole('tooltip'); - expect(tip).toHaveTextContent('Direct tools: All tools'); - expect(tip).toHaveTextContent('Other adapter settings: Set'); - expect(tip).not.toHaveTextContent('secret_'); - }); - - it('opens the server editor from the Pi settings button', async () => { - const user = userEvent.setup(); - const onEdit = vi.fn(); - const server = { command: 'npx', targets: ['pi'], piExtension: 'pi-mcp-adapter', directTools: true }; - render( ['pi']} onToggle={vi.fn()} onMenu={vi.fn()} onEdit={onEdit} />); - await user.click(screen.getByRole('button', { name: 'Pi adapter settings for docs' })); - expect(onEdit).toHaveBeenCalledWith('docs'); + const line = screen.getByText('take_screenshot, list_pages').parentElement!; + expect(line).toHaveTextContent('Direct tools'); + expect(line).toHaveTextContent('Other adapter settings'); + expect(line).not.toHaveTextContent('secret_'); }); }); diff --git a/ui/src/components/mcp/MCPServerList.tsx b/ui/src/components/mcp/MCPServerList.tsx index e9d256a98..e3a799581 100644 --- a/ui/src/components/mcp/MCPServerList.tsx +++ b/ui/src/components/mcp/MCPServerList.tsx @@ -1,7 +1,7 @@ import { Fragment, useState } from 'react'; -import { Ellipsis, Plug, SlidersHorizontal } from 'lucide-react'; +import { Ellipsis, Plug } from 'lucide-react'; import { useT } from '../../i18n'; -import Tooltip from '../Tooltip'; +import AgentIcon from '../AgentIcon'; import { mcpOffTargets } from '../../api/mcp'; import { describeEndpoint, type MatrixRow } from './mcpView'; import { TargetPill, TargetToggles } from './TargetPicker'; @@ -13,8 +13,6 @@ interface Props { targetsOf: (name: string) => string[]; onToggle: (name: string, target: string, on: boolean) => void; onMenu: (e: React.MouseEvent, name: string) => void; - /** Opens the server's edit dialog, where the Pi settings live. */ - onEdit?: (name: string) => void; /** Agents a switch-only entry can go to. mcp.projects cannot reach Claude's off list. */ offTargets?: readonly string[]; } @@ -23,7 +21,7 @@ interface Props { * One row per server. The agents it writes to are chips inside the row, not columns: * the list grows downwards as more CLIs gain MCP support, so it never scrolls sideways. */ -export default function MCPServerList({ rows, targets, targetsOf, onToggle, onMenu, onEdit, offTargets = mcpOffTargets }: Props) { +export default function MCPServerList({ rows, targets, targetsOf, onToggle, onMenu, offTargets = mcpOffTargets }: Props) { const t = useT(); const [open, setOpen] = useState([]); const directToolsLabel = useDirectToolsLabel(); @@ -52,26 +50,18 @@ export default function MCPServerList({ rows, targets, targetsOf, onToggle, onMe {/* Transport and endpoint on one quiet line, the same shape as a plugin row. */} {!row.server ? t('mcp.removedHint') : row.server.disabled ? t('mcp.offHere') : <>{http ? 'http' : 'stdio'} · {describeEndpoint(row.server)}} + {/* Only whether other Pi settings exist, never their contents: piOptions may hold anything. */} + {piSettings && ( + + + {direct !== undefined && <>{t('mcp.directTools')}{directToolsLabel(direct)}} + {direct !== undefined && piOptions && ·} + {piOptions && {t('mcp.piOptions')}} + + )} {row.server && ( <> - {/* Only which Pi settings exist, never their contents: piOptions may hold anything. */} - {piSettings && ( - - Pi · pi-mcp-adapter - {direct !== undefined && {t('mcp.directTools')}: {directToolsLabel(direct)}} - {piOptions && {t('mcp.piOptions')}: {t('mcp.piOptionsSet')}} - - } - > - - - )} setOpen((prev) => (expanded ? prev.filter((x) => x !== row.name) : [...prev, row.name]))} />