Skip to content

test(e2e-ui): check the MCP Tools tab against the upstream's own tools/list - #42397

Merged
mateo-berri merged 2 commits into
mainfrom
litellm_e2e_ui_mcp_tools_from_upstream_list
Sep 22, 2026
Merged

mateo-berri merged 2 commits into
mainfrom
litellm_e2e_ui_mcp_tools_from_upstream_list

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

TLDR

Problem this solves:

  • e2e_ui_testing has been red on main since 2026-09-22 00:09Z
  • DeepWiki renamed its ask_question tool to ask_wiki_question
  • mcpTools.spec.ts hardcoded the old name, so every PR fails that job

How it solves it:

  • The spec asks DeepWiki for its tool list with the official MCP TypeScript SDK
  • It expects the MCP Tools tab to show exactly those cards, whatever they are named
  • A future vendor rename can no longer turn the job red

User Flow

Before: an engineer opens a PR that touches nothing near MCP and the required e2e_ui_testing check fails on DeepWiki's tool rename

  1. They push a litellm_ branch and open a PR against main
  2. CircleCI runs e2e_ui_testing: it boots a proxy, adds an MCP server pointing at https://mcp.deepwiki.com/mcp through http://localhost:4000/ui/?page=mcp-servers, and opens its MCP Tools tab
  3. The tab shows three cards, ask_wiki_question, read_wiki_contents, and read_wiki_structure, which is what DeepWiki advertises today
  4. The spec still looks for a card named ask_question, so the job reports 1 failed, 153 passed with expect(locator).toBeVisible() failed ... /^ask_question$/ at mcpTools.spec.ts:45
  5. The PR's checks stay red, and so do every other PR's, until someone edits the spec by hand

After: the same job learns DeepWiki's current tool names first, so it stays green through a rename

  1. They push a litellm_ branch and open a PR against main
  2. CircleCI runs e2e_ui_testing: it boots a proxy, adds an MCP server pointing at https://mcp.deepwiki.com/mcp through http://localhost:4000/ui/?page=mcp-servers, and opens its MCP Tools tab
  3. The tab shows three cards, ask_wiki_question, read_wiki_contents, and read_wiki_structure, which is what DeepWiki advertises today
  4. Before reading the tab, the spec sends an MCP tools/list request to https://mcp.deepwiki.com/mcp and gets those same three names back
  5. It checks that the tab has one card per advertised name and no extra cards, then that searching read_wiki_structure narrows the list to that one card
  6. The job reports 154 passed and the PR's checks are green; the next DeepWiki rename changes what the spec expects instead of failing it

Relevant issues

Affected release

Linear ticket

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review (Greptile reviews automatically once the PR is opened; only comment @greptileai to re-request a review after pushing changes)

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

Both legs run the spec the way tests/e2e/ui/run_e2e.sh and the e2e_ui_testing job do: a proxy on tests/e2e/ui/fixtures/config.yml with a fresh Postgres database, LITELLM_MASTER_KEY=sk-1234, LITELLM_DANGEROUSLY_PERMIT_WEAK_OR_UNSET_MASTER_KEY=true, DISABLE_SCHEMA_UPDATE=true, SERVER_ROOT_PATH="", and PROXY_LOGOUT_URL=https://www.example.com, the mock LLM and mock Presidio servers, seed.sql applied, then npx playwright test --config playwright.config.ts --reporter=list from tests/e2e/ui against that proxy. The spec talks to the real DeepWiki server at https://mcp.deepwiki.com/mcp, no mocks

What DeepWiki advertises at the time of both runs:

$ curl -sS -X POST https://mcp.deepwiki.com/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
event: message
data: {"result":{"tools":[{"name":"read_wiki_structure",...},{"name":"read_wiki_contents",...},{"name":"ask_wiki_question",...}]},"jsonrpc":"2.0","id":1}

Before (b833e1f)

  1. npx playwright test --config playwright.config.ts --reporter=list tests/mcp/mcpTools.spec.ts
  2. Output:
Running 2 tests using 2 workers
  ✓  2 [chromium] › tests/mcp/mcpTools.spec.ts:54:7 › MCP Tools › Calling a tool from the Test Tool panel returns the upstream result (7.0s)
  ✘  1 [chromium] › tests/mcp/mcpTools.spec.ts:38:7 › MCP Tools › MCP Tools tab lists the tools the upstream server advertises (15.1s)
    Error: expect(locator).toBeVisible() failed
    Locator: locator('.mcp-tools-scrollable').locator('h4.font-mono').filter({ hasText: /^ask_question$/ })
    Expected: visible
    Error: element(s) not found
    > 45 |     await expect(toolCard(toolList, "ask_question")).toBeVisible();
  1 failed
  1 passed (48.1s)
  1. Playwright's error-context.md for the failure shows the tab rendered heading "ask_wiki_question" [level=4], heading "read_wiki_contents" [level=4], and heading "read_wiki_structure" [level=4]: the proxy and the UI are right, only the spec's expectation is stale. This is the same failure as CircleCI job 2198876 on main (9fad216030)

After (2942b36)

  1. npx playwright test --config playwright.config.ts --reporter=list tests/mcp/, which covers the changed spec and the two sibling specs that share the edited helper module:
Running 5 tests using 5 workers
  ✓  5 [chromium] › tests/mcp/mcpServers.spec.ts:24:7 › MCP Servers › Add a custom MCP server via the discovery → custom form (5.2s)
  ✓  3 [chromium] › tests/mcp/mcpServerEdit.spec.ts:33:7 › MCP Servers - edit and delete › Renaming a server's alias persists (5.7s)
  ✓  1 [chromium] › tests/mcp/mcpServerEdit.spec.ts:73:7 › MCP Servers - edit and delete › Deleting a server removes it (6.0s)
  ✓  2 [chromium] › tests/mcp/mcpTools.spec.ts:41:7 › MCP Tools › MCP Tools tab lists the tools the upstream server advertises (15.8s)
  ✓  4 [chromium] › tests/mcp/mcpTools.spec.ts:60:7 › MCP Tools › Calling a tool from the Test Tool panel returns the upstream result (16.3s)
  5 passed (25.5s)
  1. The new lockfile installs from scratch the way the job's npm ci does on a cache miss (Node 24.19.0, npm 11.17.0, same as install_node): npm ci --no-audit --no-fund in a clean directory holding only package.json and package-lock.json exits 0 and node_modules/@modelcontextprotocol/sdk is at 1.30.0. npx tsc --noEmit -p tsconfig.json in tests/e2e/ui exits 0 at this tip

Type

✅ Test

Caveats (if any)

  • Low: a DeepWiki outage, or a DeepWiki-side rename of read_wiki_structure, still turns e2e_ui_testing red. Left as is: the call-tool test needs one tool with a known input schema, so one pin is unavoidable; the spec cites where and when that name was read, checks it is still advertised before touching the UI so a stale pin fails with its own message, and its header documents the outage trade-off with the E2E_SKIP_EXTERNAL_MCP=1 opt-out
  • Low: the test runner now makes its own call to DeepWiki on top of the proxy's, so a network split between the two would fail the listing test. Left as is: in CI both run on the same machine, and the alternative of reading the list through the proxy would compare the proxy with itself
  • Low: tests/e2e/ui/package-lock.json gains the MCP SDK's dependency tree (96 packages added, 2 replaced; dev-only, nothing in the shipped litellm package), and the first CI run after merge pays a full npm ci because the cache key includes that lockfile. Left as is: the official SDK does the MCP initialize handshake and session headers correctly, where a hand-rolled fetch would re-implement them
  • Low: the non-required ci/circleci: unit job is red at this tip (job 2199795) on two timing assertions this PR cannot reach, since it touches no Python: test_scan_message_stays_linear_on_adversarial_credential_lines[assignment-flood], red on main in each of the last 6 scheduled runs (2199603, 2198895, 2198768, 2196558, 2196428, 2196379), and test_async_log_success_event_counts_the_prompt_off_the_event_loop, which asserts the event loop stalls under a threshold and lost to runner load once. No main commit after the merge base (b833e1f) touches either test. Left as is: the merge gate is the required GitHub Actions checks, all green, and a rerun would only resample the same fleet-wide red

QA runbook

  • tests/e2e/ui/tests/mcp/mcpTools.spec.ts › MCP Tools › MCP Tools tab lists the tools the upstream server advertises - the MCP Tools tab shows one card per tool DeepWiki currently advertises, no more and no fewer, and the search box narrows to a single card
    • Ask DeepWiki what it advertises: curl -sS -X POST https://mcp.deepwiki.com/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' and note the name of every entry under result.tools (today: ask_wiki_question, read_wiki_contents, read_wiki_structure)
    • Open http://localhost:4000/ui/?page=mcp-servers, click Add New MCP Server, choose Custom Server, and fill in any name, transport Streamable HTTP, URL https://mcp.deepwiki.com/mcp, authentication None, then click Add MCP Server and expect the "MCP Server created successfully" toast
    • Click the new server's card and open its MCP Tools tab: expect exactly one card per name from the first step and no other cards
    • Type read_wiki_structure into the "Search tools..." box and expect exactly one card, read_wiki_structure, to remain
    • Sanity check: this test makes sense to add and is not hand-wavey (e.g., assert actual expected spend instead of just spend > 0) or potentially flaky

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
  • 2942b36 passes /live-pr-risk

…s/list

DeepWiki renamed ask_question to ask_wiki_question, and the spec hardcoded the old name, so
e2e_ui_testing went red on main for something that is not a litellm regression. The spec now asks
the upstream server for its tool list with the official MCP TypeScript SDK and expects the tab to
show exactly those cards, so a vendor rename cannot turn the job red again.
@devin-ai-integration

devin-ai-integration Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@greptile-apps

greptile-apps Bot commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR appears safe to merge, with no outstanding actionable findings

Findings

  1. P2 Upstream Name Remains Pinned ▶

Summary

This PR updates the MCP Tools UI test to discover the upstream server’s current tool list through the official MCP SDK instead of hardcoding the complete list

  • Adds a helper that connects to the upstream MCP server, lists its tools, and closes the client
  • Compares all rendered tool cards with the upstream-advertised names and count
  • Retains one cited, dated tool name for the call-tool flow and verifies that the upstream still advertises it
  • Adds the pinned MCP SDK development dependency and lockfile entries

Reviews (3) · Last reviewed commit: "test(e2e-ui): cite the pinned DeepWiki t..."


test("MCP Tools tab lists the tools the upstream server advertises", async ({ page }) => {
const upstreamTools = await listUpstreamToolNames(MCP_SERVER_URL);
expect(upstreamTools).toContain(TOOL_NAME);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Upstream Name Remains Pinned

This assertion pins a third-party tool name, violating the requirement that tests fail only when LiteLLM changes. Remove it before merging

Suggested change
expect(upstreamTools).toContain(TOOL_NAME);

Context Used: AGENTS.md (source)

Knowledge Base Used: Harden E2E tests against cache and network flakiness

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AGENTS.md permits a cited, dated outside fact; the call-tool test needs one known tool, and this guard fails first, naming the stale pin

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That’s a valid exception. Given the cited, dated upstream fact and the call-tool test’s need for a stable schema (repoName), keeping expect(upstreamTools).toContain(TOOL_NAME) is appropriate: a vendor rename fails explicitly before the UI assertions instead of producing a misleading failure from an unavailable pinned tool. I’m withdrawing the suggestion to remove it.

Comment thread tests/e2e/ui/helpers/mcp.ts Resolved
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri mateo-berri added run-ci and removed run-ci labels Sep 22, 2026
@mateo-berri

Copy link
Copy Markdown
Contributor

@greptileai

@mateo-berri

Copy link
Copy Markdown
Contributor

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 2942b36. Configure here.

@mateo-berri mateo-berri left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant