mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-11-20 06:51:59 +00:00
fix: Observe MCP Tools in the Visible Agent Builder (#17534)
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Backend Unit Tests / backend (push) Blocked by required conditions
Channel Gateway / gateway (push) Waiting to run
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Frontend Unit Tests / frontend (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
Playwright E2E Tests / Codegraph select (push) Waiting to run
Playwright E2E Tests / Shard timings (push) Waiting to run
Playwright E2E Tests / e2e () (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 1) (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 2) (push) Blocked by required conditions
Playwright E2E Tests / MCP Apps (browser and server) (push) Waiting to run
Playwright E2E Tests / e2e (push) Blocked by required conditions
Playwright Shard Timings / Record shard timings (push) Waiting to run
Repository Safety / Confine repository symlinks (push) Waiting to run
Some checks are pending
Backend Unit Tests / Build packages (push) Waiting to run
Backend Unit Tests / Codegraph select (push) Waiting to run
Backend Unit Tests / TypeScript type checks (push) Blocked by required conditions
Backend Unit Tests / Circular dependency checks (push) Waiting to run
Backend Unit Tests / Tests: api (shard 1/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 2/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: api (shard 3/3) (push) Blocked by required conditions
Backend Unit Tests / Tests: data-provider (push) Blocked by required conditions
Backend Unit Tests / Tests: data-schemas (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 1/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 2/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 3/4) (push) Blocked by required conditions
Backend Unit Tests / Tests: @librechat/api (shard 4/4) (push) Blocked by required conditions
Backend Unit Tests / backend (push) Blocked by required conditions
Channel Gateway / gateway (push) Waiting to run
Codegraph E2E Vote Gate / Gate (push) Waiting to run
Codegraph E2E Votes / vote (shard 1/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 10/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 2/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 3/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 4/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 5/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 6/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 7/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 8/10) (push) Waiting to run
Codegraph E2E Votes / vote (shard 9/10) (push) Waiting to run
Docker Dev Branch Images Build / publish (push) Waiting to run
Frontend Unit Tests / Client build recovery regression (push) Waiting to run
Frontend Unit Tests / Codegraph select (push) Waiting to run
Frontend Unit Tests / Build packages (push) Waiting to run
Frontend Unit Tests / TypeScript type checks (client) (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/chat (push) Blocked by required conditions
Frontend Unit Tests / Tests: @librechat/client (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 1/2) (push) Blocked by required conditions
Frontend Unit Tests / Tests: Ubuntu (shard 2/2) (push) Blocked by required conditions
Frontend Unit Tests / Vite build verification (push) Blocked by required conditions
Frontend Unit Tests / frontend (push) Blocked by required conditions
Sync Locize Translations & Create Translation PR / Sync Translation Keys with Locize (push) Waiting to run
Sync Locize Translations & Create Translation PR / Create Translation PR on Version Published (push) Blocked by required conditions
Playwright E2E Tests / Codegraph select (push) Waiting to run
Playwright E2E Tests / Shard timings (push) Waiting to run
Playwright E2E Tests / e2e () (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 1) (push) Blocked by required conditions
Playwright E2E Tests / MCP list_changed (replica count 2) (push) Blocked by required conditions
Playwright E2E Tests / MCP Apps (browser and server) (push) Waiting to run
Playwright E2E Tests / e2e (push) Blocked by required conditions
Playwright Shard Timings / Record shard timings (push) Waiting to run
Repository Safety / Confine repository symlinks (push) Waiting to run
This commit is contained in:
parent
f4e66b1adb
commit
2d7df69368
4 changed files with 61 additions and 5 deletions
|
|
@ -60,12 +60,13 @@ describe('AgentPanelSwitch authorization observers', () => {
|
|||
expect(mockObserveToolAuthorization).toHaveBeenLastCalledWith(true);
|
||||
});
|
||||
|
||||
it('keeps observers disabled for a hydrated ephemeral agent', () => {
|
||||
it('enables builder observers while chatting with an ephemeral agent', () => {
|
||||
renderWithConversation({
|
||||
conversationId: 'new',
|
||||
endpoint: EModelEndpoint.agents,
|
||||
agent_id: 'ephemeral',
|
||||
} as TConversation);
|
||||
expect(mockObserveToolAuthorization).toHaveBeenLastCalledWith(false);
|
||||
expect(mockObserveToolAuthorization).toHaveBeenLastCalledWith(true);
|
||||
expect(mockSetCurrentAgentId).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -10,9 +10,7 @@ export default function AgentPanelSwitch() {
|
|||
const conversation = useRecoilValue(store.conversationByIndex(0));
|
||||
const agentId = conversation?.agent_id ?? null;
|
||||
return (
|
||||
<AgentPanelProvider
|
||||
observeToolAuthorization={conversation != null && !isEphemeralAgent(agentId)}
|
||||
>
|
||||
<AgentPanelProvider observeToolAuthorization={conversation != null}>
|
||||
<AgentPanelSwitchWithContext agentId={agentId} />
|
||||
</AgentPanelProvider>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -436,6 +436,13 @@ modelSpecs:
|
|||
endpoint: 'Mock Provider B'
|
||||
model: 'mock-model-b'
|
||||
|
||||
- name: 'e2e-builder-mcp'
|
||||
label: 'E2E Builder MCP'
|
||||
hideBadgeRow: true
|
||||
preset:
|
||||
endpoint: 'Mock Provider C'
|
||||
model: 'mock-model-c'
|
||||
|
||||
- name: 'e2e-icon-spec'
|
||||
label: 'E2E Icon Spec'
|
||||
iconURL: '/assets/openai.svg'
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
fetchJson,
|
||||
getAccessToken,
|
||||
mockReply,
|
||||
selectModelSpec,
|
||||
sendMessageAndWaitForCompletion,
|
||||
} from './helpers';
|
||||
|
||||
|
|
@ -85,6 +86,55 @@ async function expectSelectedMCPServerTools(form: Locator) {
|
|||
}
|
||||
|
||||
test.describe('agent builder MCP tools', () => {
|
||||
test('discovers builder tools while the current chat uses an ephemeral agent', async ({
|
||||
page,
|
||||
}) => {
|
||||
await page.goto('/c/new');
|
||||
await selectModelSpec(page, 'E2E Builder MCP');
|
||||
// Start with a cold query cache and a model spec whose composer does not observe tools.
|
||||
await page.reload();
|
||||
await expect(page.getByRole('button', { name: 'Select a model' }).first()).toContainText(
|
||||
'E2E Builder MCP',
|
||||
);
|
||||
|
||||
const toolResponses: string[] = [];
|
||||
page.on('response', (response) => {
|
||||
const pathname = new URL(response.url()).pathname;
|
||||
if (pathname === '/api/mcp/tools' || pathname === '/api/mcp/connection/status') {
|
||||
toolResponses.push(pathname);
|
||||
}
|
||||
});
|
||||
const form = await openAgentBuilder(page, { navigate: false });
|
||||
await form.getByRole('button', { name: 'Add tools' }).click();
|
||||
const dialog = page.getByRole('dialog', { name: 'Tool Library' });
|
||||
await dialog.getByRole('textbox', { name: 'Search tools…' }).fill(MCP_SERVER_NAME);
|
||||
const serverCard = dialog.getByRole('button', { name: new RegExp(MCP_SERVER_TITLE) }).first();
|
||||
await expect(serverCard).toBeVisible();
|
||||
|
||||
await serverCard.locator('..').getByRole('button', { name: 'Configure', exact: true }).click();
|
||||
const details = page.getByRole('dialog', { name: MCP_SERVER_TITLE, exact: true });
|
||||
await expect(details).toBeVisible();
|
||||
await expect.soft(details.getByText('Connected', { exact: true })).toBeVisible();
|
||||
await test.info().attach('builder-status', {
|
||||
body: await page.screenshot({
|
||||
path: test.info().outputPath('builder-status.png'),
|
||||
animations: 'disabled',
|
||||
}),
|
||||
contentType: 'image/png',
|
||||
});
|
||||
|
||||
// This must be populated by the builder itself; prefetching the catalog through the
|
||||
// test API or selecting a persistent chat agent would hide the regression.
|
||||
await expect
|
||||
.poll(() => toolResponses)
|
||||
.toEqual(expect.arrayContaining(['/api/mcp/tools', '/api/mcp/connection/status']));
|
||||
await details.getByRole('button', { name: /^Close( dialog)?$/ }).click();
|
||||
await serverCard.click();
|
||||
await expect(serverCard).toHaveAttribute('aria-pressed', 'true');
|
||||
await dialog.getByRole('button', { name: /^Close( dialog)?$/ }).click();
|
||||
await expect(form.getByText(MCP_SERVER_TITLE, { exact: true })).toBeVisible();
|
||||
});
|
||||
|
||||
test('creates an agent with MCP server tools and persists the selection', async ({ page }) => {
|
||||
test.setTimeout(120000);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue