An MCP server for Databend.
Project description
MCP Server for Databend
Connect AI agents to your Databend database safely. Session sandbox keeps production read-only while agents experiment. Works with Codex, Cursor, Claude Code, Gemini CLI, and any MCP-compatible client. Learn more at databend.com/mcp.
Usage
- Get your Databend DSN.
Format:
databend://user:password@host:port/database?warehouse=your_warehouseGet it from Databend Cloud or the docs. - Session sandbox safety: writes only to
mcp_sandbox_{session_id}_*; production stays read-only. Useget_session_sandbox_prefixto retrieve the live prefix. - Configure your MCP client.
Standard config works in most tools:
{
"mcpServers": {
"databend": {
"command": "uv",
"args": ["tool", "run", "--from", "mcp-databend@latest", "mcp-databend"],
"env": {
"DATABEND_DSN": "databend://user:password@host:port/database?warehouse=your_warehouse"
}
}
}
}
Codex
Use the Codex CLI to add the Databend MCP server:
codex mcp add databend \
--env DATABEND_DSN='databend://user:password@host:port/database?warehouse=your_warehouse' \
-- uv tool run --from mcp-databend@latest mcp-databend
Claude Code
Use the Claude Code CLI to add the Databend MCP server:
claude mcp add databend \
--env DATABEND_DSN='databend://user:password@host:port/database?warehouse=your_warehouse' \
-- uv tool run --from mcp-databend@latest mcp-databend
Cursor
Click the button to install:
Then open Cursor Settings -> MCP, select Databend, click Edit, and add DATABEND_DSN to the env section. Cursor keeps the command as a single string:
{
"mcpServers": {
"Databend": {
"command": "uv tool run --from mcp-databend@latest mcp-databend",
"env": {
"DATABEND_DSN": "databend://user:password@host:port/database?warehouse=your_warehouse"
},
"args": []
}
}
}
Or install manually:
Go to Cursor Settings -> MCP -> Add new MCP Server. Paste command uv tool run --from mcp-databend@latest mcp-databend, then click Edit and add DATABEND_DSN in env.
Gemini CLI
Add the standard config above to your Gemini CLI settings.json.
Safety Guarantees
| Scope | Rules |
|---|---|
| Read access | SELECT/SHOW/DESCRIBE/EXPLAIN/LIST on any object. |
| Write access | Only objects prefixed with mcp_sandbox_{session_id}_*. |
| Sandbox objects | CATALOG, DATABASE, TABLE, VIEW, STAGE, FUNCTION, USER, ROLE, TASK, PIPE, STREAM, CONNECTION, WAREHOUSE, SEQUENCE, PROCEDURE, DICTIONARY, TAG, FILE FORMAT, NETWORK POLICY, PASSWORD POLICY, MASKING POLICY, ROW ACCESS POLICY, NOTIFICATION INTEGRATION, WORKLOAD GROUP, DYNAMIC TABLE, INDEX (AGGREGATING/INVERTED/NGRAM/VECTOR). |
| Write rules | CREATE/CREATE OR REPLACE/DROP/ALTER on sandbox objects; DML only on sandbox tables (INSERT/UPDATE/DELETE/TRUNCATE/COPY/MERGE/REPLACE); GRANT/REVOKE only on sandbox objects/principals; `ALTER ... SET |
Available Tools
| Tool | Description |
|---|---|
execute_sql |
Execute SQL with sandbox validation |
execute_multi_sql |
Execute multiple SQL statements |
show_databases |
List all databases |
show_tables |
List tables in database |
describe_table |
Get table schema |
get_session_sandbox_prefix |
Get current session prefix |
list_session_sandbox_databases |
List sandbox databases |
create_session_sandbox_database |
Create sandbox database |
show_stages / list_stage_files / create_stage |
Stage management |
show_connections |
List connections |
Configuration
| Variable | Default | Description |
|---|---|---|
DATABEND_DSN |
- | Connection string |
LOCAL_MODE |
false |
Use embedded Databend |
DATABEND_QUERY_TIMEOUT |
300 |
Query timeout (seconds) |
DATABEND_MCP_SERVER_TRANSPORT |
stdio |
Transport: stdio, http, sse |
DATABEND_MCP_BIND_HOST |
127.0.0.1 |
Bind host for HTTP/SSE |
DATABEND_MCP_BIND_PORT |
8001 |
Bind port for HTTP/SSE |
Local mode stores data in .databend/.
Development
git clone https://github.com/databendlabs/mcp-databend
cd mcp-databend
uv sync
# Run locally
uv run python -m mcp_databend.main
# Debug
npx @modelcontextprotocol/inspector uv run python -m mcp_databend.main
# Test
uv run pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_databend-0.3.1.tar.gz.
File metadata
- Download URL: mcp_databend-0.3.1.tar.gz
- Upload date:
- Size: 23.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11b76b5221d8d768b127fe4a8a06c704483ce56ca66c37834699350c898f14c7
|
|
| MD5 |
5c8fe9432cd9b9a5a9e1942db2c550f8
|
|
| BLAKE2b-256 |
1b6d9f2dd974a3283c30f30067e14ab43889e3a2747b9a935494ba67191406e8
|
Provenance
The following attestation bundles were made for mcp_databend-0.3.1.tar.gz:
Publisher:
python-publish.yml on databendlabs/mcp-databend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_databend-0.3.1.tar.gz -
Subject digest:
11b76b5221d8d768b127fe4a8a06c704483ce56ca66c37834699350c898f14c7 - Sigstore transparency entry: 850266357
- Sigstore integration time:
-
Permalink:
databendlabs/mcp-databend@ce623d81c7c5af5902cf11d5f9343911dad5033f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/databendlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ce623d81c7c5af5902cf11d5f9343911dad5033f -
Trigger Event:
release
-
Statement type:
File details
Details for the file mcp_databend-0.3.1-py3-none-any.whl.
File metadata
- Download URL: mcp_databend-0.3.1-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2078b24643a27de9f33b23950c9263f42cbaee1662be3957f82ae03caffdcbef
|
|
| MD5 |
af5a5e58681135793ec76c1cfd99e9dc
|
|
| BLAKE2b-256 |
3d67053a3beb7ed2b58a1e35062514123868671c1d2f04364cf0f1800d3769f4
|
Provenance
The following attestation bundles were made for mcp_databend-0.3.1-py3-none-any.whl:
Publisher:
python-publish.yml on databendlabs/mcp-databend
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcp_databend-0.3.1-py3-none-any.whl -
Subject digest:
2078b24643a27de9f33b23950c9263f42cbaee1662be3957f82ae03caffdcbef - Sigstore transparency entry: 850266360
- Sigstore integration time:
-
Permalink:
databendlabs/mcp-databend@ce623d81c7c5af5902cf11d5f9343911dad5033f -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/databendlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@ce623d81c7c5af5902cf11d5f9343911dad5033f -
Trigger Event:
release
-
Statement type: