mcp-databend
OfficialClick on "Deploy 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., "@mcp-databend show tables in the analytics database"
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.
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"
}
}
}
}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-databendUse 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-databendClick 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.
Add the standard config above to your Gemini CLI settings.json.
Related MCP server: spotdb
Safety Guarantees
Scope | Rules |
Read access |
|
Write access | Only objects prefixed with |
Sandbox objects |
|
Write rules |
|
Available Tools
Tool | Description |
| Execute SQL with sandbox validation |
| Execute multiple SQL statements |
| List all databases |
| List tables in database |
| Get table schema |
| Get current session prefix |
| List sandbox databases |
| Create sandbox database |
| Stage management |
| List connections |
Configuration
Variable | Default | Description |
| - | Connection string |
|
| Use embedded Databend |
|
| Query timeout (seconds) |
|
| Enable sandbox validation. Set to |
|
| Transport: |
|
| Bind host for HTTP/SSE |
|
| 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 pytestAvailable Tools
13 toolscreate_session_sandbox_databaseA
Create a new sandbox database for current session.
The database name will be automatically prefixed with current session's sandbox prefix.
Args: name: Database name suffix (without prefix)
Example: create_session_sandbox_database('analytics') -> Creates 'mcp_sandbox_a1b2c3d4_analytics'
Returns: Dictionary containing result or error
Inputs: name (required). Returns: object
create_stageC
Create a Databend stage with connection Args: name: The stage name url: The stage URL (e.g., 's3://bucket-name') connection_name: Optional connection name to use
Returns: Dictionary containing either query results or error information
Inputs: url (required), name (required), connection_name. Returns: object
describe_tableA
Describe a Databend table (safe operation, not affected by MCP safe mode) Args: table: The table name database: The database name
Returns: Dictionary containing either query results or error information
Inputs: table (required), database.
execute_multi_sqlA
Execute multiple SQL queries against Databend database with MCP safe mode protection.
Safe mode (enabled by default) restricts write operations to the current session sandbox. Set DATABEND_MCP_SAFE_MODE=false to disable sandbox validation.
Args: sqls: List of SQL query strings to execute
Returns: List of dictionaries containing either query results or error information
Inputs: sqls (required). Returns: result
execute_sqlA
Execute SQL query against Databend database.
SAFETY RULES (when DATABEND_MCP_SAFE_MODE is enabled):
Read operations (SELECT/SHOW/DESCRIBE/EXPLAIN/LIST): allowed on ALL objects
Write operations (CREATE/DROP/INSERT/UPDATE/DELETE/...): ONLY allowed on current session's sandbox
Current session sandbox prefix: use get_session_sandbox_prefix() to get it
Set DATABEND_MCP_SAFE_MODE=false to disable sandbox validation
Args: sql: SQL query string to execute
Returns: Dictionary containing query results or error information
Inputs: sql (required). Returns: object
get_session_sandbox_prefixA
Get current session's sandbox prefix for writable objects.
All write operations (CREATE/DROP/INSERT/UPDATE/DELETE/...) are ONLY allowed on objects with this prefix. This is enforced by code, not just guidelines.
Returns: Dictionary with session_id and prefix
Inputs: no named parameters. Returns: object
list_session_sandbox_databasesA
List sandbox databases owned by current session.
Only these databases can be modified. Other databases are read-only.
Returns: Dictionary containing current session's sandbox database list
Inputs: no named parameters. Returns: object
list_stage_filesA
List files in a Databend stage (safe operation, not affected by MCP safe mode) Args: stage_name: The stage name (with @ prefix) path: Optional path within the stage
Returns: Dictionary containing either query results or error information
Inputs: stage_name (required), path.
show_connectionsA
List available Databend connections (safe operation, not affected by MCP safe mode)
Inputs: no named parameters.
show_databasesA
List available Databend databases (safe operation, not affected by MCP safe mode)
Inputs: no named parameters.
show_functionsA
List available Databend functions (safe operation, not affected by MCP safe mode) Args: filter: The filter string, eg: "name like 'add%'" Returns: Dictionary containing either query results or error information
Inputs: filter.
show_stagesA
List available Databend stages (safe operation, not affected by MCP safe mode)
Inputs: no named parameters.
show_tablesA
List available Databend tables in a database (safe operation, not affected by MCP safe mode) Args: database: The database name filter: The filter string, eg: "name like 'test%'"
Returns: Dictionary containing either query results or error information
Inputs: filter, database.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Each tool has a clearly distinct purpose: listing metadata (databases, stages, tables, functions, connections), describing tables, listing stage files, executing SQL (single or multiple statements), creating stages, and managing sandbox databases. There is no overlap or ambiguity.
All tool names follow a consistent verb_noun pattern with lowercase and underscores, e.g., show_databases, list_stage_files, create_stage, get_session_sandbox_prefix. The naming is predictable and uniform.
With 13 tools, the set is well-scoped for a database interaction server. It covers essential operations without being overwhelming, and each tool contributes meaningfully.
The tool set covers metadata exploration, SQL execution (single and multi), stage creation, and sandbox management. The SQL execution tools effectively act as catch-alls for any other operations, making the surface complete for the domain.
Maintenance
Related MCP Connectors
Run AI agent tasks in isolated sandboxes with a cost cap, saved workflows and scoped connections.
AI agents propose database changes as reviewable requests — no direct write access.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Database guardrails for AI agents: check SQL against your Vericto rules before it runs.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to query SQL databases safely with read-only access, allowing schema discovery and SELECT queries while blocking writes and DDL operations.-
- AlicenseNot gradedqualityDmaintenanceEnables AI agents and workflows to safely explore and query data in ephemeral sandboxed databases via MCP, with guardrails and snapshot capabilities.21MIT
- AlicenseAqualityCmaintenanceEnables AI agents to read and write real databases safely by gating every write behind a mandatory propose/confirm preview and securing AWS RDS connections with short-lived IAM tokens.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to safely explore and query SQL databases through read-only, AST-checked SQL, database-enforced read-only transactions, timeouts, row caps, PII masking, and audit logging.MIT