databendlabs/mcp-databend
If you are the rightful owner of mcp-databend and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
MCP server of databend is a protocol server designed to facilitate seamless communication and data management with the Databend database.
MCP Server for Databend
An MCP server for Databend database interactions.
What You Can Do
Database Operations
- execute_sql - Execute SQL queries with timeout protection and safe mode security
- show_databases - List all databases
- show_tables - List tables in a database (with optional filter)
- describe_table - Get table schema information
Stage Management
- show_stages - List all available Databend stages
- list_stage_files - List files in a specific stage (supports @stage_name format)
- create_stage - Create a new stage with connection support
Connection Management
- show_connections - List all available Databend connections
Security Features
MCP Safe Mode (Enabled by Default)
This server includes built-in security protection that blocks potentially dangerous SQL operations:
- Blocked Operations:
DROP
,DELETE
,TRUNCATE
,ALTER
,UPDATE
,REVOKE
Safe Mode Configuration:
{
"env": {
"DATABEND_DSN": "your-connection-string-here",
"SAFE_MODE": "true"
}
}
To disable safe mode (not recommended for production):
{
"env": {
"DATABEND_DSN": "your-connection-string-here",
"SAFE_MODE": "false"
}
}
How to Use
Step 1: Get Databend Connection
Recommended: Sign up for Databend Cloud (free tier available)
Get your connection string from Databend documentation.
Deployment | Connection String Example |
---|---|
Databend Cloud | databend://user:pwd@host:443/database?warehouse=wh |
Self-hosted | databend://user:pwd@localhost:8000/database?sslmode=disable |
Or use local Databend by setting LOCAL_MODE=true
, the metadata is stored in .databend
directory:
Step 2: Install
uv tool install mcp-databend
Step 3: Configure Your MCP Client
Option A: Claude Code (CLI)
- For Databend server:
claude mcp add mcp-databend --env DATABEND_DSN='your-connection-string-here' -- uv tool run mcp-databend
- For local Databend:
claude mcp add mcp-databend --env LOCAL_MODE=true -- uv tool run mcp-databend
Option B: MCP Configuration (JSON)
Add to your MCP client configuration (e.g., Claude Desktop, Windsurf):
{
"mcpServers": {
"mcp-databend": {
"command": "uv",
"args": ["tool", "run", "mcp-databend"],
"env": {
"DATABEND_DSN": "your-connection-string-here",
"SAFE_MODE": "true"
}
}
}
}
Supported Clients
- Claude Code (CLI)
- Windsurf / Claude Desktop / Continue.dev / Cursor IDE
Options variables
DATABEND_DSN
: Databend connection stringLOCAL_MODE
: Set totrue
to use local DatabendSAFE_MODE
: Set tofalse
to disable safe modeDATABEND_MCP_SERVER_TRANSPORT
: Default tostdio
, set tohttp
orsse
to enable HTTP/SSE transportDATABEND_MCP_BIND_HOST
: Default to127.0.0.1
, set to bind host for HTTP/SSE transportDATABEND_MCP_BIND_PORT
: Default to8001
, set to bind port for HTTP/SSE transport
Step 4: Start Using
Once configured, you can ask your AI assistant to:
Database Operations:
- "Show me all databases"
- "List tables in the sales database"
- "Describe the users table structure"
- "Run this SQL query: SELECT * FROM products LIMIT 10"
Stage Management:
- "Show me all stages"
- "List files in @my_stage"
- "Create a stage named my_s3_stage with URL s3://my-bucket using connection my_connection"
Connection Management:
- "Show all connections"
Development
# Clone and setup
git clone https://github.com/databendlabs/mcp-databend
cd mcp-databend
uv sync
# Run locally
uv run python -m mcp_databend.main
# Use modelcontextprotocol/inspector to debug
npx @modelcontextprotocol/inspector -e LOCAL_MODE=1 uv run python -m mcp_databend.main