Skip to content

Fix MCP server mounted path #11231

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

Merged
merged 5 commits into from
May 21, 2025
Merged

Fix MCP server mounted path #11231

merged 5 commits into from
May 21, 2025

Conversation

abidlabs
Copy link
Member

@abidlabs abidlabs commented May 20, 2025

mcp==1.9.0 introduced a breaking change in how paths are mounted (the new approach is actually the correct one, see modelcontextprotocol/python-sdk#659)

This PR makes the corresponding change in Gradio's MCP server to account for this change and adds a test.

Closes: #11225
Closes: #11219

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented May 20, 2025

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-pypi-previews.s3.amazonaws.com/a78ef0fbfaaced256c955afe546962765f724cc5/gradio-5.30.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@a78ef0fbfaaced256c955afe546962765f724cc5#subdirectory=client/python"

Install Gradio JS Client from this PR

npm install https://gradio-npm-previews.s3.amazonaws.com/a78ef0fbfaaced256c955afe546962765f724cc5/gradio-client-1.15.0.tgz

Use Lite from this PR

<script type="module" src="https://gradio-lite-previews.s3.amazonaws.com/a78ef0fbfaaced256c955afe546962765f724cc5/dist/lite.js""></script>

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented May 20, 2025

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Fix MCP server mounted path

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@abidlabs abidlabs changed the title Fix MCP server Fix MCP server mounted path May 21, 2025
Copy link
Collaborator

@freddyaboulton freddyaboulton left a comment

Choose a reason for hiding this comment

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

Changes look good to me @abidlabs !

@@ -157,6 +157,7 @@ async def handle_sse(request):
streams[1],
self.mcp_server.create_initialization_options(),
)
return Response()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need this? Is it possible to even reach this part of the code? The with block seems like it would block forever

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah so I added it because I would see an exception being raised (None type is not callable or something like that) when a client would disconnect from the mcp server. So while it doesn't functionally change anything, it prevents this exception from being raised during disconnect

@abidlabs abidlabs merged commit 78a3854 into main May 21, 2025
22 checks passed
@abidlabs abidlabs deleted the mcp-path-fix branch May 21, 2025 16:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Erro while Connectin MCP server Incorrect Messages path generation
3 participants