databricks-readonly-mcp
Provides read-only access to Databricks, enabling browsing of Unity Catalog objects and executing SQL queries with safeguards against writes.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@databricks-readonly-mcpShow me the tables in the sales schema."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
databricks-readonly-mcp
A Model Context Protocol (MCP) server that gives an LLM read-only access to Databricks. It exposes Unity Catalog browsing and SQL execution as tools, with two layers of defence against accidental writes:
In-process AST guard. Every SQL statement is parsed with
sqlglotand rejected unless its root and entire tree are read-only (SELECT/WITH/SHOW/DESCRIBE/EXPLAIN/ set-operations).INSERT,UPDATE,DELETE,MERGE,DROP,CREATE,ALTER,TRUNCATE,USE,SET,GRANT,COPY,REFRESH,OPTIMIZE,VACUUM— all rejected before the HTTP call is made. CTE-wrapped writes (e.g.WITH x AS (DELETE …) SELECT * FROM x) are caught by a deep tree walk.Read-only Databricks principal (recommended). Run the server under a service principal or PAT that has only
USE CATALOG/USE SCHEMA/SELECTgrants. See Read-only principal below.
Transport is stdio only.
Install
pip install -e .
# or once published:
# uvx databricks-readonly-mcpRelated MCP server: sql-explorer-mcp
Configure
Create ~/.databricks-mcp/config.yaml (or point DATABRICKS_MCP_CONFIG at a
custom path). Two auth methods are supported per profile:
databricks_cli (recommended)
Delegates to a profile in ~/.databrickscfg via the Databricks SDK. Host
and credentials (PAT or OAuth U2M) come from there, and the SDK refreshes
OAuth tokens automatically. Set up once with the Databricks CLI:
databricks auth login --host https://your-workspace.cloud.databricks.com \
--profile ciq-betaThen reference it in the MCP config:
default_profile: beta
profiles:
beta:
warehouse_name: esm_etl_wh # or warehouse_id: bd6e1945574f6d03
default_catalog: client_catalog
max_rows: 1000
auth:
method: databricks_cli
cli_profile: ciq-beta # name in ~/.databrickscfgNo tokens in YAML, no env vars. Good for laptops / interactive use.
Warehouse selection is one of (highest precedence first):
Field | Behavior |
| Pin a specific warehouse. No lookup; fastest startup. |
|
|
| Resolved at startup via |
(omit all) | Auto-pick: succeeds only if exactly one warehouse is visible to your principal. |
If you don't know which warehouse to pin, list them with:
databricks-readonly-mcp --profile beta --list-warehousesOr pick one interactively (prompts on TTY, prints a YAML snippet to paste):
databricks-readonly-mcp --profile beta --pick-warehouseBoth modes run as one-shot CLI commands and exit; they don't start the MCP server.
token (for CI, headless servers)
Reads a PAT from the env var named in token_env. host must be set:
profiles:
prod:
host: https://your-prod-workspace.cloud.databricks.com
warehouse_id: prodwarehouseid
auth:
method: token
token_env: DATABRICKS_TOKEN_PROD # name of the env var; NOT the token
default_catalog: client_catalog
max_rows: 1000See examples/config.example.yaml for a
complete template.
Profile selection precedence: --profile flag > DATABRICKS_MCP_PROFILE env
var > default_profile in the config.
Run
databricks-readonly-mcp --profile beta
# or
python -m databricks_mcp --profile betaWire into Claude Code / Claude Desktop
Add to your mcpServers config (e.g. ~/.claude.json):
When using auth.method: databricks_cli (recommended), no env block is
needed — credentials come from ~/.databrickscfg:
{
"mcpServers": {
"databricks": {
"command": "databricks-readonly-mcp",
"args": ["--profile", "beta"]
}
}
}With auth.method: token, supply the env var:
{
"mcpServers": {
"databricks": {
"command": "databricks-readonly-mcp",
"args": ["--profile", "prod"],
"env": { "DATABRICKS_TOKEN_PROD": "dapi…" }
}
}
}Restart Claude Code; the tools appear under the databricks server in /mcp.
Tools
Tool | Args | Returns |
| — |
|
|
|
|
|
|
|
|
|
|
|
|
|
row_limit is always clamped to the profile's max_rows.
Read-only principal (recommended)
The AST guard is robust but software. Put a second wall up at the data plane by giving the server a principal that cannot write, even if asked to:
-- Run as a workspace admin once, per environment.
GRANT USE CATALOG ON CATALOG client_catalog TO `databricks-mcp-readonly`;
GRANT USE SCHEMA ON ALL SCHEMAS IN CATALOG client_catalog TO `databricks-mcp-readonly`;
GRANT SELECT ON ALL TABLES IN CATALOG client_catalog TO `databricks-mcp-readonly`;
GRANT CAN USE ON WAREHOUSE <warehouse_id> TO `databricks-mcp-readonly`;
-- explicitly: no MODIFY, no CREATE, no ALL PRIVILEGES, no warehouse mgmt.Don't point this MCP at a PAT for a user that has broader grants. The guard catches the obvious cases, but a parser bug in any combination AST-allow-listing + over-privileged principal is the weakest configuration.
Development
python -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
pytestLayout
src/databricks_mcp/
server.py stdio entrypoint, CLI parsing, FastMCP setup
tools.py tool functions registered onto FastMCP
client.py DatabricksReadClient — Statement API + Unity Catalog REST
sql_guard.py assert_readonly: sqlglot AST allow-list
config.py YAML loader, profile resolution
errors.py typed exceptions
tests/ pytest suite (sql_guard, config, client, tools)Out of scope (v1)
Job / cluster / warehouse management tools — not exposed.
HTTP / SSE transport — stdio only.
Multi-statement bodies, transactions — refused.
Anything that writes, anywhere — refused.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityDmaintenanceA read-only MCP server that enables users to query Databricks SQL, browse metadata, and monitor Delta Lake tables. It also supports tracking Databricks Jobs, DLT Pipelines, and cluster metrics through natural language interfaces.254MIT
- Alicense-qualityFmaintenanceRead-only MCP server for SQL databases (SQL Server, Postgres, SQLite) with multi-server support and three-layer safety using AST validation and linting.MIT
- Alicense-qualityBmaintenanceMCP server for safely exposing SQL Server database capabilities to LLM clients, with read-only mode, security features, and observability.28MIT
- Alicense-qualityCmaintenanceReadonly PostgreSQL MCP server with SQL guardrails for analytical queries and schema introspection.7MIT
Related MCP Connectors
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Read-only MCP server for wafergraph.com's semiconductor & AI supply-chain data: 30 tools, no auth.
MCP server for managing Prisma Postgres.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rishi-ciq/databricks-local-read-only-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server