-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Feat/mcp tools list debug improvement #15180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@uc4w6c is attempting to deploy a commit to the CLERKIEAI Team on Vercel. A member of the Team first needs to authorize it. |
verbose_logger.warning( | ||
f"Client operation cancelled for {server_name}: {str(e)}" | ||
) | ||
raise asyncio.CancelledError( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we raise the raw error instead? @uc4w6c
this will make it easier to debug on the UI why the call is failing. instead of requiring the user to get access to server logs to see what's going on. e.g. a malformed header to the mcp server.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krrishdholakia
When connecting to the MCP server, a CancelledError is raised inside the aenter call, which overwrites the original exception.
As a result, the error message becomes meaningless (as shown in this capture), so I handled it this way instead.
If you know a way to fix this, I’d appreciate your advice.

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack - let me see how i can raise this
allows user to debug why mcp server is not working as expected Related to #15180
so i setup a fake mcp server, and raised an error on list - i can see in a lot of places we were swallowing the error. This seems like it was initially done to ensure list calls always seemed like they worked, but after some trial-and-error, i think this has led to more support tickets from users confused why their mcp servers aren't connecting to litellm. so the change is to just re-raise the exception to the client, for easier debugging ![]() PR: #15214 |
@krrishdholakia ![]() ![]() |
Title
Feat/mcp tools list debug improvement
Relevant issues
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/litellm/
directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit
Type
🆕 New Feature
✅ Test
Changes
Previously, errors in the mcp /tools/list call were ignored.
With this change, errors are now raised and returned as error messages, making it easier to identify the root cause of MCP connection errors.
https://www.loom.com/share/e582249d61714eacb2443572a1543d74?sid=3a5578c8-6e9f-497d-92ed-b5baeb2909d2
Not included in this PR
This change does not modify the behavior when calling
/mcp/{mcp_server_name}/tools/list
directly as an MCP endpoint.In that case, error messages are still not returned.