Repository navigation
Conversation
Tools already forwarded per-user OAuth context into MCP client construction. Prompt and resource paths omitted it, so protected prompts/list and resources/list returned 401 after tools/list succeeded. Co-authored-by: Cursor <cursoragent@cursor.com>
|
|
Greptile SummaryThis PR consistently propagates request-scoped authentication into MCP prompt and resource client construction, aligning those operations with existing tool handling.
Confidence Score: 5/5The PR appears safe to merge because every reachable prompt and resource path now consistently forwards the request-scoped authentication context. The changed call chain preserves the caller identity from the aggregate MCP handlers through all prompt and resource manager operations into client construction, with focused coverage for each affected operation and no accepted regression.
|
| Filename | Overview |
|---|---|
| litellm/proxy/_experimental/mcp_server/mcp_server_manager.py | Adds optional request authentication to every prompt/resource manager operation and forwards it consistently into MCP client construction. |
| litellm/proxy/_experimental/mcp_server/server.py | Threads the authenticated request context through all aggregate prompt and resource list/get/read call sites. |
| tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py | Adds focused regression coverage for all five manager paths and updates direct handler tests for the new argument. |
Reviews (1): Last reviewed commit: "fix(mcp): pass user auth into prompt and..." | Re-trigger Greptile
There was a problem hiding this comment.
Pull request overview
This PR fixes MCP OAuth auth-context propagation so prompt and resource operations reuse the same per-user credential path already used for tools
Changes:
- Plumb
user_api_key_auththrough MCP prompt and resource manager methods into_create_mcp_client - Forward
user_api_key_authfrom server prompt/resource endpoints to the manager - Add regression tests ensuring all prompt/resource manager entrypoints pass the auth context
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
litellm/proxy/_experimental/mcp_server/mcp_server_manager.py |
Adds user_api_key_auth to prompt/resource manager APIs and forwards it to _create_mcp_client |
litellm/proxy/_experimental/mcp_server/server.py |
Passes user_api_key_auth into prompt/resource manager calls from server routes |
tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server.py |
Extends endpoint tests and adds a regression test for auth propagation across manager paths |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
TLDR
Problem this solves:
How it solves it:
The current main branch already passes auth through the prompt and resource clients. This PR expands the existing stored-OAuth regression to cover prompt listing, resource listing, template listing, prompt retrieval, and resource reading. It checks the user identities sent to the injected token store and the bearer credentials transmitted by the real MCP client through an in-memory HTTP transport
Relevant issues
Refs #37497
Validation
1536 tests pass across the manager and endpoint test files. The repository pre-commit check, Ruff, the type-discipline budget, and the test-quality budget pass. Replacing credential propagation with
Nonemakes all five regression cases failPre-Submission checklist
Type
Test
Caveats
Low
High
The dependency manifests match main. The scanner reports no fixed version for GHSA-vfj7-8cjw-p6xm. OSV is outside main's required status checks, and #44347 tracks the repository-wide exception