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_SAFE_MODE |
true |
Enable sandbox validation. Set to false to allow all SQL permitted by the Databend user. |
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
Metadata
Release files for mcp-databend 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_databend-0.3.2.tar.gz | 24.0 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_databend-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.1 kB
Release files / mcp_databend-0.3.2.tar.gz
| Download URL | mcp_databend-0.3.2.tar.gz |
|---|---|
| Size | 24.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
725efbff5d8fbb124edc5ee36fa235ebedd2c56adb13188aa15b13c4e8223a16
|
|
BLAKE2b-256 checksum How to use checksums |
4cdbf04f8fe434888506d727bd9c9dac7dcbd1d952592fd0d78dbbe02c884924
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2026.
Transparency logRelease files / mcp_databend-0.3.2-py3-none-any.whl
| Download URL | mcp_databend-0.3.2-py3-none-any.whl |
|---|---|
| Size | 19.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db2d8a24c879f0e4795ff2f65512bac97707f0e3e8b7ee6625538e772ce38c40
|
|
BLAKE2b-256 checksum How to use checksums |
e83638b48972197566d62fba3495092963ad3bdbd1ebb7fd0107227311e4a306
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2026.
Transparency logSecurity for mcp-databend 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for mcp_databend-0.3.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.