POC: deploy a streamable HTTP server on Databricks apps and connect to it from the client#1
Open
smurching wants to merge 2 commits intomainsmurching/python-sdk:mainfrom
smurching/databricks-apps-pocsmurching/python-sdk:smurching/databricks-apps-pocCopy head branch name to clipboard
Open
POC: deploy a streamable HTTP server on Databricks apps and connect to it from the client#1smurching wants to merge 2 commits intomainsmurching/python-sdk:mainfrom smurching/databricks-apps-pocsmurching/python-sdk:smurching/databricks-apps-pocCopy head branch name to clipboard
smurching wants to merge 2 commits intomainsmurching/python-sdk:mainfrom
smurching/databricks-apps-pocsmurching/python-sdk:smurching/databricks-apps-pocCopy head branch name to clipboard
Conversation
…o it from the client Signed-off-by: Sid Murching <sid.murching@databricks.com>
smurching
commented
May 7, 2025
| async def initialized_client_session(basic_server, basic_server_url): | ||
| """Create initialized StreamableHTTP client session.""" | ||
| async with streamablehttp_client(f"{basic_server_url}/mcp") as ( | ||
| token = "TODO add token here" |
Owner
Author
There was a problem hiding this comment.
I used code like this to get an oauth token, after doing databricks auth login --profile fieldeng-oauth:
from databricks import sdk
w = sdk.WorkspaceClient(profile="fieldeng-oauth")
headers = w.config.authenticate()
print(headers)
Using a PAT to talk to apps doesn't work
Signed-off-by: Sid Murching <sid.murching@databricks.com>
smurching
commented
May 7, 2025
| "run", | ||
| "mcp-simple-streamablehttp", | ||
| "--port", | ||
| "8000", |
Owner
Author
There was a problem hiding this comment.
Using port 8000 since that's what apps exposes by default, though this is configurable via environment variable
smurching
commented
May 8, 2025
| """Create initialized StreamableHTTP client session.""" | ||
| async with streamablehttp_client(f"{basic_server_url}/mcp") as ( | ||
| token = "TODO add token here" | ||
| async with streamablehttp_client(url=f"{basic_server_url}/mcp/", headers={'Authorization': f'Bearer {token}'}) as ( |
Owner
Author
There was a problem hiding this comment.
Note: when running against the example server in the MCP repo, the client has to connect to /mcp/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In this POC, I'm trying out deploying the example MCP server from the MCP Python SDK repo as a Databricks app, and then connecting to it using the Python client. To run the POC:
examples/servers/simple-streamablehttpfollowing the steps here (create app, sync code to workspace, deploy app)uv run pytest tests/shared/test_streamable_http.pyto test connecting to the app etcIt's also possible now to write your own custom client code that resembles the code in
uv run pytest tests/shared/test_streamable_http.py- just make sure you have mcp>=1.8.2 installed