The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
feat(mcp): re-read installed servers after a Registry add (#7194)
oxoxDev268f26bbe2dd
diff --git a/app/src/components/channels/mcp/McpServersPage.test.tsx b/app/src/components/channels/mcp/McpServersPage.test.tsxindex 231904225b..b012e1265f 100644--- a/app/src/components/channels/mcp/McpServersPage.test.tsx+++ b/app/src/components/channels/mcp/McpServersPage.test.tsx@@ -1,6 +1,7 @@import { fireEvent, render, screen, waitFor } from '@testing-library/react';import { beforeEach, describe, expect, it, vi } from 'vitest';+import { mcpClientsApi } from '../../../services/api/mcpClientsApi';import McpServersPage from './McpServersPage';const mockInstalledList = vi.fn();@@ -167,6 +168,56 @@ describe('McpServersPage', () => {await screen.findByTestId('mcp-installed-empty');});+ it('re-reads the rows after a server is added from the Registry', async () => {+ const NEW = {+ ...HOSTED,+ server_id: 'srv-new',+ qualified_name: 'com.example/new',+ display_name: 'com.example/new',+ env_keys: [],+ transport: { kind: 'http_remote' as const, url: 'https://new.test/mcp' },+ enabled: true,+ };+ mockRegistrySearch.mockResolvedValue({+ servers: [+ {+ qualified_name: 'com.example/new',+ display_name: 'New Hosted',+ is_deployed: true,+ source: 'mcp_official',+ },+ ],+ page: 1,+ total_pages: 1,+ });+ vi.mocked(mcpClientsApi.registryGet).mockResolvedValueOnce({+ qualified_name: 'com.example/new',+ display_name: 'New Hosted',+ connections: [{ type: 'http', deployment_url: 'https://new.test/mcp' }],+ required_env_keys: [],+ });+ mockConfigSet.mockResolvedValue({+ mcpServers: {},+ added: ['com.example/new'],+ updated: [],+ removed: [],+ });+ render(<McpServersPage initialTab="registry" />);+ fireEvent.click(await screen.findByRole('button', { name: 'Add New Hosted' }));+ const callsBefore = mockInstalledList.mock.calls.length;+ mockInstalledList.mockResolvedValue([LOCAL, HOSTED, NEW]);++ await waitFor(() => expect(screen.getByRole('button', { name: /Added/ })).toBeDisabled());+ expect(mockConfigSet).toHaveBeenCalledWith({+ mcpServers: { 'com.example/new': { url: 'https://new.test/mcp' } },+ });+ expect(mockInstalledList.mock.calls.length).toBeGreaterThan(callsBefore);++ fireEvent.click(screen.getByRole('tab', { name: 'Servers' }));+ await screen.findByTestId('mcp-servers-section');+ expect(screen.getAllByTestId('mcp-installed-row')).toHaveLength(3);+ });+it("opens a row's name into its detail view and comes back", async () => {render(<McpServersPage />);await screen.findByTestId('mcp-servers-section');diff --git a/app/src/components/channels/mcp/McpServersTab.tsx b/app/src/components/channels/mcp/McpServersTab.tsxindex 2a845fc8e0..aaff56c1d2 100644--- a/app/src/components/channels/mcp/McpServersTab.tsx+++ b/app/src/components/channels/mcp/McpServersTab.tsx@@ -4,10 +4,11 @@** **Servers** is the rows (`McpServerRows`) and, once a row is opened, that* server's detail with the credential form and its tools. **mcp.json** is the- * same configuration as one document. **Registry** is the browse-only- * directories. The rows and their statuses are read here rather than in the- * rows component so a save in the document tab can re-read them, and so the- * directory can hide what is already declared.+ * same configuration as one document. **Registry** is the directories, where a+ * hosted server can be added in one step. The rows and their statuses are read+ * here rather than in the rows component so a save in the document tab or an+ * add from the directory can re-read them, and so the directory can mark what+ * is already declared.*/import debug from 'debug';import { useCallback, useEffect, useMemo, useRef, useState } from 'react';@@ -169,7 +170,7 @@ const McpServersTab = ({ tab, onTabChange }: McpServersTabProps) => {}if (tab === 'registry') {- return <McpRegistryBrowser installedNames={installedNames} />;+ return <McpRegistryBrowser installedNames={installedNames} onDeclared={handleDocumentSaved} />;}if (loading) {