An MCP server for TiDB Cloud Lake.
Project description
MCP Server for TiDB Cloud Lake
Connect AI agents to your TiDB Cloud Lake database safely. Session sandbox keeps production read-only while agents experiment. Works with Codex, Cursor, Claude Code, Gemini CLI, and any MCP-compatible client.
Usage
- Get your TiDB Cloud Lake DSN.
Format:
lake://user:password@host:port/database?warehouse=your_warehouseGet it from TiDB Cloud Lake or your project connection settings. - 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": {
"lake-mcp": {
"command": "uv",
"args": ["tool", "run", "--from", "tidbcloudlake-mcp@latest", "lake-mcp"],
"env": {
"LAKE_DSN": "lake://user:password@host:port/database?warehouse=your_warehouse"
}
}
}
}
Codex
codex mcp add lake-mcp \
--env LAKE_DSN='lake://user:password@host:port/database?warehouse=your_warehouse' \
-- uv tool run --from tidbcloudlake-mcp@latest lake-mcp
Claude Code
claude mcp add lake-mcp \
--env LAKE_DSN='lake://user:password@host:port/database?warehouse=your_warehouse' \
-- uv tool run --from tidbcloudlake-mcp@latest lake-mcp
Cursor
Add a new MCP server with command uv tool run --from tidbcloudlake-mcp@latest lake-mcp, then set LAKE_DSN in the env section.
{
"mcpServers": {
"lake-mcp": {
"command": "uv tool run --from tidbcloudlake-mcp@latest lake-mcp",
"env": {
"LAKE_DSN": "lake://user:password@host:port/database?warehouse=your_warehouse"
},
"args": []
}
}
}
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 |
|---|---|---|
LAKE_DSN |
- | Connection string |
LOCAL_MODE |
false |
Use the embedded local engine |
LAKE_QUERY_TIMEOUT |
300 |
Query timeout (seconds) |
LAKE_MCP_SAFE_MODE |
true |
Enable sandbox validation. Set to false to allow all SQL permitted by the configured user. |
LAKE_MCP_SERVER_TRANSPORT |
stdio |
Transport: stdio, http, sse |
LAKE_MCP_BIND_HOST |
127.0.0.1 |
Bind host for HTTP/SSE |
LAKE_MCP_BIND_PORT |
8001 |
Bind port for HTTP/SSE |
Local mode stores data in .databend/.
Development
git clone https://github.com/tidbcloud/lake-mcp
cd lake-mcp
uv sync
# Run locally
uv run python -m lake_mcp.main
# Debug
npx @modelcontextprotocol/inspector uv run python -m lake_mcp.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 tidbcloudlake_mcp-0.3.2.tar.gz.
File metadata
- Download URL: tidbcloudlake_mcp-0.3.2.tar.gz
- Upload date:
- Size: 23.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c056deaa02307582b152aba8e60c4f98d025a748620356348e8f070f8aed3b4e
|
|
| MD5 |
23d39c9f5045ad194834225680a4c31b
|
|
| BLAKE2b-256 |
f0b99d5ecf99ae126f157991be1ef1bd5f2b32baaf3be628323f83fd53d5aa98
|
Provenance
The following attestation bundles were made for tidbcloudlake_mcp-0.3.2.tar.gz:
Publisher:
release.yml on tidbcloud/lake-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tidbcloudlake_mcp-0.3.2.tar.gz -
Subject digest:
c056deaa02307582b152aba8e60c4f98d025a748620356348e8f070f8aed3b4e - Sigstore transparency entry: 2210595871
- Sigstore integration time:
-
Permalink:
tidbcloud/lake-mcp@97086d7fd03e4fa37dbcb8c725ba8450ac94b8b0 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/tidbcloud
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@97086d7fd03e4fa37dbcb8c725ba8450ac94b8b0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tidbcloudlake_mcp-0.3.2-py3-none-any.whl.
File metadata
- Download URL: tidbcloudlake_mcp-0.3.2-py3-none-any.whl
- Upload date:
- Size: 18.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1872ab9ee0980d627d87d8d9581236d37d4622873f90e65cb671334bac604c7
|
|
| MD5 |
1ccf58b79b3bad21a07cf01f16ffb480
|
|
| BLAKE2b-256 |
4fbc14a9f016611629ea9c9fed57d738443adf9d13e3fe84d8f3a7efdc7f1e95
|
Provenance
The following attestation bundles were made for tidbcloudlake_mcp-0.3.2-py3-none-any.whl:
Publisher:
release.yml on tidbcloud/lake-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tidbcloudlake_mcp-0.3.2-py3-none-any.whl -
Subject digest:
c1872ab9ee0980d627d87d8d9581236d37d4622873f90e65cb671334bac604c7 - Sigstore transparency entry: 2210595894
- Sigstore integration time:
-
Permalink:
tidbcloud/lake-mcp@97086d7fd03e4fa37dbcb8c725ba8450ac94b8b0 -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/tidbcloud
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@97086d7fd03e4fa37dbcb8c725ba8450ac94b8b0 -
Trigger Event:
release
-
Statement type: