SQLBot runs a dedicated Model Context Protocol (MCP) server on portDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dataease/SQLBot/llms.txt
Use this file to discover all available pages before exploring further.
8001, separate from the main application. Any MCP-compatible agent or workflow tool can connect to it and ask questions in plain language — SQLBot handles the SQL generation, query execution, and result formatting automatically.
How it works
The MCP server exposes six operations, each mapped to a tool that agents can invoke:mcp_start
Authenticate with username and password. Returns an
access_token and a chat_id for the session.mcp_question
Submit a natural-language question. Returns structured data, SQL, and optionally a chart image.
mcp_ws_list
List the workspaces the authenticated user has access to.
mcp_datasource_list
List the datasources available within a workspace.
mcp_assistant
Ask a question through a specific SQLBot assistant configuration, for use in DataEase and CRM integrations.
get_model_list
Retrieve the list of configured LLM models available in the deployment.
Port
8001 must be reachable from your agent or workflow host. If SQLBot is behind a reverse proxy, make sure you forward this port or expose the MCP path separately.Authentication flow
All MCP operations exceptmcp_start require a valid access_token. Tokens are short-lived JWTs issued by the same mechanism as the main application.
Call mcp_start to obtain a token
POST to
/mcp/mcp_start with your SQLBot username and password. The response includes both a token and a fresh chat_id bound to that session.Discover available workspaces (optional)
If your user belongs to multiple workspaces, call
mcp_ws_list to find the oid (workspace ID) you want to query against.Discover datasources (optional)
Call The response omits sensitive fields (
mcp_datasource_list to get the IDs of datasources available in your workspace. Pass oid to target a specific workspace.embedding, table_relation, configuration) and returns a clean list of datasource metadata.mcp_question parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
token | string | Yes | Access token from mcp_start. |
chat_id | integer | Yes | Chat session ID from mcp_start. |
question | string | Yes | Natural-language question to answer. |
datasource_id | integer or string | No | Pin the query to a specific datasource. If omitted and the session has no datasource set, SQLBot selects automatically. |
lang | string | No | Response language: zh-CN, zh-TW, en, or ko-KR. Defaults to zh-CN. |
oid | string | No | Workspace ID. Effective only when datasource_id is not provided. Defaults to the user’s last-used workspace. |
stream | boolean | No | Stream the response as server-sent events. Defaults to true. Set to false to receive a single JSON object. |
return_img | boolean | No | Include a base64 chart image in the response. Defaults to true. Set to false to return data only. |
Connecting external agents
- Claude Desktop
- n8n
- Dify
- MaxKB
Claude Desktop supports MCP servers through its configuration file. Add SQLBot as a custom MCP server so Claude can call After restarting Claude Desktop, you will see the SQLBot tools listed in the tool picker. Authenticate by asking Claude to call
mcp_start and mcp_question as tools during conversations.Open your Claude Desktop configuration file and add a server entry pointing to the SQLBot MCP endpoint:mcp_start with your credentials, then ask data questions normally.MCP server internals
Frombackend/main.py, the MCP server is a separate FastAPI application mounted via fastapi-mcp:
images static mount means chart images generated by mcp_question (when return_img: true) are stored on disk and served at http://<your-host>:8001/images/<filename>.