Repository navigation
fix(mcp): explain missing public client dependencies - #42148
Conversation
|
bugbot run. Please review this focused MCP import-error fix, including exception preservation, optional-dependency regression coverage, and the documented HTTPX2 compatibility boundaries. |
|
@veria-ai Please review this focused MCP import-error fix, including exception preservation, optional-dependency regression coverage, and the documented HTTPX2 compatibility boundaries. |
|
@greptileai Please review this focused MCP import-error fix, including exception preservation, optional-dependency regression coverage, and the documented HTTPX2 compatibility boundaries. |
|
|
@greptileai Please reassess both findings using the supplied execution evidence and your README exemption. Neither finding requires a production change. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@greptileai Please review d93cc8d: public-client regressions now run in the existing MCP shard, avoiding zero collection from migrated misc directories. |
|
bugbot run. Please review d93cc8d: public-client regressions now run in the existing MCP shard; the previously reviewed production code is unchanged. |
|
@veria-ai Please review d93cc8d: public-client regressions now run in the existing MCP shard; the previously reviewed production code is unchanged. |
|
@greptileai Please review 671b51c after merging main to align the OAuth workflow and test checkout; local validation passes |
|
bugbot run. Please review 671b51c after merging main to align the OAuth workflow and test checkout; local validation passes |
|
@veria-ai Please review 671b51c after merging main to align the OAuth workflow and test checkout; local validation passes |
There was a problem hiding this comment.
✅ 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 671b51c. Configure here.
TLDR
Problem this solves:
How it solves it:
pip install 'litellm[mcp]'for missing MCP/HTTPX2User Flow
Before: a core-only LiteLLM installation cannot explain how to enable MCP
python -c "from litellm.experimental_mcp_client.client import MCPClient"ModuleNotFoundError: No module named 'mcp'After: the same attempted import explains which extra to install
python -c "from litellm.experimental_mcp_client.client import MCPClient"ImportErrorrecommendingpip install 'litellm[mcp]', with the original missing-module causeRelevant issues
Narrow follow-up to #41718, which already ported SDK2 transports, sessions, handlers, callbacks and results
Affected release
Linear ticket
Resolves LIT-7740
Pre-Submission checklist
Validation
The public-client test directory now runs once in the existing MCP shard. The misc shard references directories removed by the concurrent test migration and was collecting zero tests. Moving this directory restores actual regression execution and hosted coverage without changing the shared runner
The workflow ownership guard and its 34 tests pass. Pinned zizmor 1.24.1 reports no findings. Final source-built local core checks pass (8/8); the Python implementation is unchanged from the independent verification
The mapped regressions first failed on missing-MCP and missing-HTTPX2 guidance, while unrelated missing modules and incompatible SDK imports retained their original errors. All 216 affected client/helper tests pass at
671b51c9599bc84e679add55a3a6eb1775fa6b9c. Existing logging/result/alias/auth-header checks pass (60 tests), as do seven callback/error-handler checks. One pre-existing local-only external-service test remains skipped and is not counted as a passLocal full production/test-tree Ruff, formatting, strict-rule, type-discipline, test-quality and canonical basedpyright budget gates pass, as do circular-import and import-safety checks. Changed production executable-line coverage is 6/6 (100%); the touched initializer's branches are 2/2 (100%). Hosted coverage is pending for the refreshed tip; the previous tip had complete uploads and 100% changed-line coverage
Independent Devin execution at
4fda0092d3confirmed the source-built import fix, all eight core-wheel smoke checks, and all 216 mapped tests. Controlled HTTP/SSE/stdio calls returned42withis_error=Falseon both revisions. A supplemental controlled peer verified bearer authentication over HTTP and SSE on both revisions: missing/wrong credentials returned 401 without tool execution, while valid credentials returned 42. Legacy negotiation and modern-header rejection remain unchangedScreenshots / Proof of Fix
Both revisions were built locally on macOS with
uv build --wheel, then installed in turn usinguv pip install --no-deps --reinstall --python local-core/bin/python <wheel>. The isolated environment already contained core dependencies. Each command ran outside the source checkout, importing the installed wheel; MCP and HTTPX2 were absent on both revisionsBefore:
0f7d4dc13b493dd6bfe1d03346e309a6494b1711local-core/bin/python -c 'import litellm': exit 0local-core/bin/python -c 'from litellm.experimental_mcp_client.client import MCPClient': exit 1,ModuleNotFoundError: No module named 'mcp', without installation guidanceAfter:
671b51c9599bc84e679add55a3a6eb1775fa6b9clocal-core/bin/python -c 'import litellm': exit 0local-core/bin/python -c 'from litellm.experimental_mcp_client.client import MCPClient': exit 1,ImportError: MCP client dependencies are missing. Install them with: pip install 'litellm[mcp]', with the original missing-module exception as its direct causeReview status
At
671b51c9599bc84e679add55a3a6eb1775fa6b9c, local validation passes; hosted checks, Codecov and fresh bot reviews are pending. The previous OAuth run exited before executing tests because its workflow targeted a test file absent from the old PR checkout. Merging current main aligns the workflow and checkout, and all four OAuth cases now collect locally. Actual OAuth execution remains pending in CIContributor agreement status is not exposed by the PR checks and has not been independently confirmed
Type
Bug Fix
Documentation
Test
Caveats (if any)
Low
Final Attestation
Note
Low Risk
Changes are limited to import error messaging, documentation, CI test sharding, and tests; no runtime MCP client behavior changes in the diff.
Overview
Improves optional MCP client installs by turning missing
mcporhttpx2onlitellm.experimental_mcp_clientinto anImportErrorthat recommendspip install 'litellm[mcp]', while leaving other missing modules and incompatible SDK import failures unchanged.The MCP client readme now documents the public import path, the
[mcp]extra, and that custom HTTP auth and client hooks must use httpx2 (no HTTPX1 shim). Base-wheel smoke checks assert that guidance on a core-only install, and unit tests cover the import edge cases.CI runs
tests/test_litellm/experimental_mcp_clientin the mcp-integration shard instead of misc, so those regressions run with the MCP test environment.Reviewed by Cursor Bugbot for commit 671b51c. Bugbot is set up for automated code reviews on this repo. Configure here.