Add Databricks SQL MCP token exchange with per-workspace token isolation#23
Merged
Add Databricks SQL MCP token exchange with per-workspace token isolation#23
Conversation
Signed-off-by: yosrixp <yosrixp@yahoo.com>
MartinTrojans
approved these changes
Apr 11, 2026
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.
Summary
id_token(JWT) at each workspace'sPOST /oidc/v1/tokenendpoint, returning a workspace-scoped Databricks access token.databricks-sql-<workspace-hostname>.databricks-sql(not genericdatabricks) so future Databricks MCP variants (e.g. vector search) can coexist with separate config, scopes, and storage prefixes.Multi-workspace token flow
sequenceDiagram participant Client participant MoP as MoP (TokenEndpoint) participant DynamoDB as DynamoDB participant DBX_A as Databricks Workspace A<br/>(dbc-aaa.cloud.databricks.com) participant DBX_B as Databricks Workspace B<br/>(dbc-bbb.cloud.databricks.com) Note over Client,DBX_B: User authorizes for Workspace A Client->>MoP: POST /token (resource=.../databricks-sql/dbc-aaa/mcp) MoP->>DynamoDB: getUserToken(alice, okta) DynamoDB-->>MoP: Okta id_token + access_token + refresh_token MoP->>MoP: Validate segment "dbc-aaa" against regex MoP->>DBX_A: POST /oidc/v1/token<br/>grant_type=token-exchange<br/>subject_token=<Okta id_token><br/>subject_token_type=jwt<br/>scope=sql DBX_A-->>MoP: { access_token: "ws-a-token", expires_in: 3600, scope: "sql" } MoP->>DynamoDB: storeUserToken(alice, "databricks-sql-dbc-aaa.cloud.databricks.com", ws-a-token) MoP-->>Client: { access_token: "ws-a-token", scope: "sql" } Note over Client,DBX_B: Same user authorizes for Workspace B Client->>MoP: POST /token (resource=.../databricks-sql/dbc-bbb/mcp) MoP->>DynamoDB: getUserToken(alice, okta) DynamoDB-->>MoP: Okta id_token (same session) MoP->>MoP: Validate segment "dbc-bbb" against regex MoP->>DBX_B: POST /oidc/v1/token<br/>(same grant, different workspace) DBX_B-->>MoP: { access_token: "ws-b-token", expires_in: 3600, scope: "sql" } MoP->>DynamoDB: storeUserToken(alice, "databricks-sql-dbc-bbb.cloud.databricks.com", ws-b-token) MoP-->>Client: { access_token: "ws-b-token", scope: "sql" }