Skip to content

Commit 8a9ee5f

Browse files
committed
Add MCP Changes
1 parent 1baca79 commit 8a9ee5f

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

databricks/sdk/__init__.py

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

databricks/sdk/service/mcp.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from mcp.client.auth import OAuthClientProvider, TokenStorage
2+
from mcp.shared.auth import OAuthToken
3+
4+
class DatabricksTokenStorage(TokenStorage):
5+
def __init__(self, config):
6+
self.config = config
7+
8+
async def get_tokens(self) -> OAuthToken| None:
9+
headers = self.config.authenticate()
10+
token = headers["Authorization"].split("Bearer ")[1]
11+
return OAuthToken(access_token=token, expires_in=60)
12+
13+
class MCP:
14+
def __init__(self, config):
15+
self._config = config
16+
self.databricks_token_storage = DatabricksTokenStorage(config)
17+
18+
def oauth_provider(self):
19+
return OAuthClientProvider(
20+
server_url="",
21+
client_metadata=None,
22+
storage=self.databricks_token_storage,
23+
redirect_handler=None,
24+
callback_handler=None,
25+
)

0 commit comments

Comments
 (0)