Doris-MCP-Lite
Enables LLMs to explore database schemas, execute read-only SQL queries, and perform data analysis on Apache Doris or MySQL-compatible databases through a standardized MCP interface with built-in analytical prompts.
README
📖 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.
[!WARNING] 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 an issue. 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:
chmod +x setup.sh
- Run the script:
./setup.sh
The script will automatically install the server and help you walk through database configuration.
Option 2: Install via pip
Recommended for production usage
pip install doris-mcp-lite
✅ 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:
git clone https://github.com/YOUR_USERNAME/doris-mcp-lite.git
cd doris-mcp-lite
- Set up a local Python environment using uv:
uv venv # Create a virtual environment
uv sync # Install dependencies
# Activate the virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install
- Add this server to your LLM client or Run the server:
uv run server doris://user:pass@localhost:9030/mydb
Option 4: Install using uv directly
For local editable installations
uv pip install 'git+https://github.com/NomotoK/doris-mcp-lite.git'
uv sync
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv pip install -e .
uv run server doris://user:pass@localhost:9030/mydb
⚙️ Post-Installation Setup
Step 1: Configure .env file (optional)
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 .env
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:
pip show doris-mcp-lite
You will find a .env.example file:
- Copy
.env.exampleto.env:
cp .env.example .env
- Edit .env to set your Doris database connection information:
DB_HOST=your-doris-host
DB_PORT=9030
DB_USER=your-username
DB_PASSWORD=your-password
DB_NAME=your-database
MCP_SERVER_NAME=DorisAnalytics
DEBUG=false
[!NOTE] If
.envis missing, the server will attempt to auto-create it from.env.examplebut 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:
--directory
/Users/hailin/dev/Doris-MCP-Lite
run
server
doris://user:pass@localhost:9030/mydb
Example if you are installing with pip (mcp_setting.json):
{
"mcpServers": {
"DorisAnalytics": {
"command": "server",
"args": ["doris://user:pass@localhost:9030/mydb"],
"transportType": "stdio"
}
}
}
If you are installing with source code/uv or using setup.sh:
{
"mcpServers": {
"DorisAnalytics": {
"disabled": false,
"timeout": 60,
"command": "absolute/path/to/uv",
"args": [
"--directory",
"absolute/path/to/mcp/server",
"run",
"server"
"doris://user:pass@localhost:9030/mydb"
],
"transportType": "stdio"
}
}
}
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:
python test.py --server server.py --test resources
or test all the tools provided by the server:
python test.py --server server.py --test tools
or test database connection:
python test.py --server "doris://user:pass@localhost:9030/mydb" --test dbconfig
or test all functions of resources, tools, and prompt words at one time:
python test.py --server server.py --test all
Testing Database connection and run server
Launch the MCP server by running the command:
server doris://user:pass@localhost:9030/mydb
Or manually:
python -m doris_mcp_lite.server doris://user:pass@localhost:9030/mydb
The server immediately attempts to connect to the database. If the connection is successful, after startup, you should see:
🚀 Doris MCP Server is starting...
[DorisConnector] Connected to 127.0.0.1:9030
✅ Database connection successful.
[DorisConnector] Connection closed.
You can now use the tools and prompts inside your MCP client.
📚 Project Structure Overview
src/
└── doris_mcp_lite/
├── config/ # Configuration files
│ ├── __init__.py
│ ├── config.py # Loads environment variables
│ ├── .env.example # Environment variables template
│ └── .env # Stores your database credentials
│
├── db/ # Database interaction logic
│ ├── __init__.py
│ ├── db.py # Doris database connection class
│ └── tools.py # SQL query execution tools
│
├── res/ # Resource definitions (e.g., schemas)
│ ├── __init__.py
│ └── resources.py
│
├── prompts/ # Prebuilt prompt templates
│ ├── __init__.py
│ ├── general_prompts.py
│ └── customize_prompts.py
│
├── __init__.py # Main entry point to start the MCP server
├── server.py # Server launcher
├── mcp_app.py # MCP server instance
└── test.py # Unit test script
README.md # Documentation
INSTALL.md # Installation guide
LISENCE # Lisence
setup.sh # Auto setup wizard
pyproject.toml # Project build configuration
.gitignore # Git ignore settings
📜 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。