The Doris MCP Server is a backend service built with Python and FastAPI that implements the Model Control Protocol (MCP). It allows clients to interact with Apache Doris databases through defined tools, providing capabilities for SQL execution, metadata management, and database interactions.
git clone https://github.com/apache/doris-mcp-server.git
cd doris-mcp-server
pip install -r requirements.txt
Copy the example environment file to create your configuration:
cp env.example .env
Edit the .env
file with your specific settings:
Database Connection:
DB_HOST
: Database hostnameDB_PORT
: Database port (default 9030)DB_USER
: Database usernameDB_PASSWORD
: Database passwordDB_DATABASE
: Default database nameServer Configuration:
SERVER_HOST
: Host address the server listens on (default 0.0.0.0)SERVER_PORT
: Port the server listens on (default 3000)ALLOWED_ORIGINS
: CORS allowed origins (comma-separated, * allows all)MCP_ALLOW_CREDENTIALS
: Whether to allow CORS credentials (default false)Logging Configuration:
LOG_DIR
: Directory for log files (default ./logs)LOG_LEVEL
: Log level (e.g., INFO, DEBUG, WARNING, ERROR, default INFO)CONSOLE_LOGGING
: Whether to output logs to the console (default false)To run the server in SSE mode:
./start_server.sh
This starts the FastAPI application providing both SSE and Streamable HTTP MCP services.
The server provides various tools for database interaction:
Tool Name | Description | Key Parameters |
---|---|---|
mcp_doris_get_db_list | Get a list of all database names | random_string (Required) |
mcp_doris_get_db_table_list | Get a list of all table names in a database | random_string (Required), db_name (Optional) |
mcp_doris_get_table_schema | Get detailed table structure | random_string (Required), table_name (Required), db_name (Optional) |
mcp_doris_get_table_comment | Get table comment | random_string (Required), table_name (Required), db_name (Optional) |
mcp_doris_get_table_column_comments | Get comments for all columns | random_string (Required), table_name (Required), db_name (Optional) |
mcp_doris_get_table_indexes | Get table index information | random_string (Required), table_name (Required), db_name (Optional) |
mcp_doris_exec_query | Execute SQL query | random_string (Required), sql (Required), db_name (Optional), max_rows (Optional), timeout (Optional) |
mcp_doris_get_recent_audit_logs | Get recent audit logs | random_string (Required), days (Optional), limit (Optional) |
Note: All tools require a random_string
parameter as a call identifier, typically handled automatically by the MCP client.
Interaction with the server requires an MCP client following this general flow:
/sse
(SSE) or send an initialize method call to /mcp
(Streamable)mcp/listTools
or mcp/listOfferings
to get supported toolstool_call
message/request with the tool name and argumentsYou can connect Cursor to this MCP server using either Stdio or SSE mode.
For Stdio mode (where Cursor manages the server):
uv --project /your/path/doris-mcp-server run doris-mcp
{
"mcpServers": {
"doris-stdio": {
"command": "uv",
"args": ["--project", "/path/to/your/doris-mcp-server", "run", "doris-mcp"],
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "9030",
"DB_USER": "root",
"DB_PASSWORD": "your_db_password",
"DB_DATABASE": "your_default_db"
}
}
}
}
For SSE mode (where you run the server independently):
.env
file with database credentials and server settings./start_server.sh
{
"mcpServers": {
"doris-sse": {
"url": "http://127.0.0.1:3000/sse"
}
}
}
After configuration, you can select the server in Cursor and use its tools to interact with your Doris database.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "doris-stdio" '{"command":"uv","args":["--project","/path/to/your/doris-mcp-server","run","doris-mcp"],"env":{"DB_HOST":"127.0.0.1","DB_PORT":"9030","DB_USER":"root","DB_PASSWORD":"your_db_password","DB_DATABASE":"your_default_db"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"doris-stdio": {
"command": "uv",
"args": [
"--project",
"/path/to/your/doris-mcp-server",
"run",
"doris-mcp"
],
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "9030",
"DB_USER": "root",
"DB_PASSWORD": "your_db_password",
"DB_DATABASE": "your_default_db"
}
},
"doris-sse": {
"url": "http://127.0.0.1:3000/sse"
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"doris-stdio": {
"command": "uv",
"args": [
"--project",
"/path/to/your/doris-mcp-server",
"run",
"doris-mcp"
],
"env": {
"DB_HOST": "127.0.0.1",
"DB_PORT": "9030",
"DB_USER": "root",
"DB_PASSWORD": "your_db_password",
"DB_DATABASE": "your_default_db"
}
},
"doris-sse": {
"url": "http://127.0.0.1:3000/sse"
}
}
}
3. Restart Claude Desktop for the changes to take effect