Enables connection to Apache Doris databases for executing read-only SQL queries, exploring database schemas, retrieving table structures, and performing data analysis operations like yearly, monthly, and daily usage data retrieval.
Provides compatibility for connecting to MySQL-compatible database schemas, allowing exploration of database structures, execution of read-only queries, and access to metadata such as table definitions and resource usage.
π Doris-MCP-Lite
A lightweight MCP server designed for connecting to Apache Doris or other MySQL compatible database schemas, providing tools and prompts for LLM applications.
This server enables LLMs and MCP clients to explore database schemas, run read-only SQL queries, and leverage pre-built analytical prompts β all through a standardized, secure MCP interface.
This is an early developer version of doris-mcp-lite. Some functions may not operate properly and minor bugs may exist. If you have any quesions, please open anissue. The official Apache Doris MCP server is available at apache/doris-mcp-server
π Features
π οΈ Tools
Execute read-only SQL queries against your Doris database.
Perform data analysis operations such as retrieving yearly, monthly, and daily usage data.
Query metadata such as database schemas, table structures, and resource usage.
Connection Pooling: Efficient connection management with pooling to optimize performance.
Asynchronous Execution: Support for asynchronous query execution to improve responsiveness.
π§ Prompts
Built-in prompt templates to assist LLMs in asking analytics questions.
Support for multi-role prompting to enhance the interaction between LLMs and the Doris database.
Support for user-defined and general-purpose SQL analysis prompts.
ποΈ Resources
Expose your Doris database schema as structured resources.
Allow LLMs to contextually access table and field definitions to improve query understanding.
π¦ Installation Options
We recommend using uv to manage your Python environment.
Option 1: Install viaΒ shell script
Recommended for personal and server deployment
This is the easiest way to install. Please copy the setup.sh file in project and run it locally. For more information please refer: Doris MCP install guide
Copy the
setup.shto local.Make the script executable:
Run the script:
The script will automatically install the server and help you walk through database configuration.
Option 2: Install viaΒ
Recommended for production usage
β After installation, the command-line tool server will be available to launch the MCP server.
Option 3: Clone the source and install manually
Recommended if you want to modify the server
Fork and clone the repository:
Set up a local Python environment using uv:
Add this server to your LLM client or Run the server:
Option 4: Install using uv directly
For local editable installations
βοΈ Post-Installation Setup
Step 1: Configure
Use the .env file to permanently save your database connection information in the MCP server, so you do not need to enter the database connection every time you run the MCP server with CLI. Of course, this step is not necessary, if you are using a MCP-capatible LLM client, you can also set up a database connection in the configuration file of the MCP client later (See step2). Please follow these steps to finish configuration:
Configure through shell script
This is the most recommended and easiest way to setup. Please refer to Doris MCP install guide.
Configure manually in
After installing, navigate to the doris_mcp_lite/config/ directory inside your project directory. If you are using pip, your package will be installed in Python site-packages:
Mac/Linux:
/Users/YOUR_USERNAME/.local/lib/python3.x/site-packages/doris_mcp_lite/config/Windows:
C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python3x\Lib\site-packages\doris_mcp_lite\config\
You can run the following command to locate pip install location:
You will find a .env.example file:
Copy
.env.exampleto.env:
Edit .env to set your Doris database connection information:
If.env is missing, the server will attempt to auto-create it from .env.example but you must manually fill in correct credentials.
Step 2: Configure MCP Client
To connect this server to an MCP-compatible client (e.g., Claude Desktop, CherryStudio, Cline), you need to modify your MCP client configuration JSON.
Example if you are using CherryStudio:
name: doris-mcp-lite
type: stdio
command: absolute/path/to/your/uv
arguments:
Example if you are installing with pip (mcp_setting.json):
If you are installing with source code/uv or using setup.sh:
Note that you can use uv and server instead of passing absolute path in config file, but you need to make sure that uv is in your PATH.
Connection URL
Remember to replace doris://user:pass@localhost:9030/mydb with your actual database connection string.
For more information on how to configure your client, please refer to :
For Server Developers - Model Context Protocol - Claude
Config and Using MCP | CherryStudio
β Now your LLM client will discover Doris Analytics tools, prompts, and resources through the MCP server.
π₯οΈ Usage
Testing MCP server (optional)
Before you start, you can run the test.py in the project src/doris-mcp-lite directory to directly call the MCP Server functional interface to test database connection, resources, tools, etc. without using LLM (such as Claude, GPT, etc. models). You can control what functions to test by passing arguments through the command line.
Test all resources exposed by the server:
or test all the tools provided by the server:
or test database connection:
or test all functions of resources, tools, and prompt words at one time:
Testing Database connection and run server
Launch the MCP server by running the command:
Or manually:
The server immediately attempts to connect to the database. If the connection is successful, after startup, you should see:
You can now use the tools and prompts inside your MCP client.
π Project Structure Overview
π License
This project is licensed under the MIT License.
πAcknowledgements
Built using the MCP Python SDK.
Based on: MCP: The Model Context Protocol, a standard for LLMs to interact with external data sources.
Apache Doris: An open-source, high-performance, real-time analytical database.
Apache Doris Official MCP Server: The official MCP server for Apache Doris.
PyMySQL: A Python MySQL client library for database interaction.
Inspired by MCP official examples and best practices.
π€ Contributions
Contributions are welcome! Feel free to open issues or submit pull requests.