doris-mcp-server 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. doris_mcp_server-0.0.1/LICENSE +21 -0
  2. doris_mcp_server-0.0.1/PKG-INFO +336 -0
  3. doris_mcp_server-0.0.1/README.md +320 -0
  4. doris_mcp_server-0.0.1/pyproject.toml +27 -0
  5. doris_mcp_server-0.0.1/setup.cfg +4 -0
  6. doris_mcp_server-0.0.1/src/doris_mcp_server/config/__init__.py +3 -0
  7. doris_mcp_server-0.0.1/src/doris_mcp_server/config/config.py +37 -0
  8. doris_mcp_server-0.0.1/src/doris_mcp_server/db/__init__.py +4 -0
  9. doris_mcp_server-0.0.1/src/doris_mcp_server/db/db.py +57 -0
  10. doris_mcp_server-0.0.1/src/doris_mcp_server/db/tools.py +94 -0
  11. doris_mcp_server-0.0.1/src/doris_mcp_server/mcp_app.py +7 -0
  12. doris_mcp_server-0.0.1/src/doris_mcp_server/prompts/__init__.py +3 -0
  13. doris_mcp_server-0.0.1/src/doris_mcp_server/prompts/customize_prompts.py +9 -0
  14. doris_mcp_server-0.0.1/src/doris_mcp_server/prompts/general_prompts.py +68 -0
  15. doris_mcp_server-0.0.1/src/doris_mcp_server/res/__init__.py +4 -0
  16. doris_mcp_server-0.0.1/src/doris_mcp_server/res/resources.py +116 -0
  17. doris_mcp_server-0.0.1/src/doris_mcp_server/server.py +50 -0
  18. doris_mcp_server-0.0.1/src/doris_mcp_server/test.py +81 -0
  19. doris_mcp_server-0.0.1/src/doris_mcp_server.egg-info/PKG-INFO +336 -0
  20. doris_mcp_server-0.0.1/src/doris_mcp_server.egg-info/SOURCES.txt +22 -0
  21. doris_mcp_server-0.0.1/src/doris_mcp_server.egg-info/dependency_links.txt +1 -0
  22. doris_mcp_server-0.0.1/src/doris_mcp_server.egg-info/entry_points.txt +2 -0
  23. doris_mcp_server-0.0.1/src/doris_mcp_server.egg-info/requires.txt +5 -0
  24. doris_mcp_server-0.0.1/src/doris_mcp_server.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Hailin Xie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,336 @@
1
+ Metadata-Version: 2.4
2
+ Name: doris-mcp-server
3
+ Version: 0.0.1
4
+ Summary: An MCP server for analytics on Apache Doris database.
5
+ Project-URL: Homepage, https://github.com/NomotoK/doris-mcp-server
6
+ Project-URL: Repository, https://github.com/NomotoK/doris-mcp-server
7
+ Requires-Python: >=3.12
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: httpx>=0.28.1
11
+ Requires-Dist: mcp[cli]>=1.6.0
12
+ Requires-Dist: pandas>=2.2.3
13
+ Requires-Dist: pyarrow>=19.0.1
14
+ Requires-Dist: pymysql>=1.1.1
15
+ Dynamic: license-file
16
+
17
+ # **๐Ÿ“– Doris-MCP-Server**
18
+
19
+ A lightweight **MCP server** designed for connecting to **Apache Doris** or other **MySQL compatible** database schemas, providing tools and prompts for LLM applications.
20
+
21
+ 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.
22
+
23
+ > [!WARNING]
24
+ > This is an early developer version of doris-mcp-server. Some functions may not operate properly and minor bugs may exist. If you have any quesions, please open an [issue](https://github.com/NomotoK/Doris-MCP-Server/issues).
25
+
26
+ ## **๐Ÿš€ Features**
27
+
28
+ ### **๐Ÿ› ๏ธ Tools**
29
+
30
+ - Execute **read-only SQL queries** against your Doris database.
31
+ - Perform **data analysis operations** such as retrieving yearly, monthly, and daily usage data.
32
+ - Query metadata such as **database schemas**, **table structures**, and **resource usage**.
33
+
34
+ ### **๐Ÿง  Prompts**
35
+
36
+ - Built-in prompt templates to assist LLMs in asking **analytics questions**.
37
+ - Support for **user-defined** and **general-purpose** SQL analysis prompts.
38
+
39
+ ### **๐Ÿ—‚๏ธ Resources**
40
+
41
+ - Expose your Doris **database schema** as **structured resources**.
42
+ - Allow LLMs to **contextually access** table and field definitions to improve query understanding.
43
+
44
+ ## **๐Ÿ“ฆ Installation Options**
45
+
46
+ We recommend using [uv](https://docs.astral.sh/uv/) to manage your Python environment.
47
+
48
+ ### **Option 1: Install viaย shell script**
49
+
50
+ > **Recommended for server deployment**
51
+
52
+ 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](INSTALL.md)
53
+
54
+ 1. Copy the `setup.sh` to local.
55
+ 2. Make the script executable:
56
+
57
+ ```bash
58
+ chmod +x setup.sh
59
+ ```
60
+
61
+ 3. Run the script:
62
+
63
+ ```bash
64
+ ./setup.sh
65
+ ```
66
+
67
+ The script will automatically install the server and help you walk through database configuration.
68
+ ### **Option 2: Install viaย `pip`**
69
+
70
+ > **Recommended for production usage**
71
+
72
+ ```bash
73
+ pip install doris-mcp-server
74
+ ```
75
+
76
+ โœ… After installation, the command-line tool server will be available to launch the MCP server.
77
+
78
+ ### **Option 3: Clone the source and install manually**
79
+
80
+ > **Recommended if you want to modify the server**
81
+
82
+ 1. Fork and clone the repository:
83
+
84
+ ```bash
85
+ git clone https://github.com/YOUR_USERNAME/doris-mcp-server.git
86
+ cd doris-mcp-server
87
+ ```
88
+
89
+ 1. Set up a local Python environment using [uv](https://github.com/astral-sh/uv):
90
+
91
+ ```bash
92
+ uv venv
93
+ uv pip install -e .
94
+ ```
95
+
96
+ 1. Add this server to your LLM client or Run the server:
97
+
98
+ ```bash
99
+ uv run server
100
+ ```
101
+
102
+ ### **Option 4: Install using uv directly**
103
+
104
+ > **For local editable installations**
105
+
106
+ ```bash
107
+ uv pip install 'git+https://github.com/YOUR_USERNAME/doris-mcp-server.git'
108
+ ```
109
+
110
+ ## **โš™๏ธ Post-Installation Setup**
111
+
112
+ ### **Step 1: Configure `.env` file**
113
+
114
+ Doris-MCP-Server uses .env file to configure database connection info. Please follow these steps to finish configuration:
115
+
116
+ #### **Configure through shell script**
117
+
118
+ This is the most recommended and easiest way to setup. Please refer to [Doris MCP install guide](INSTALL.md).
119
+
120
+ #### **Configure manually**
121
+
122
+ After installing, navigate to the `doris_mcp_server/config/` directory inside your project directory. If you are using pip, your package will be installed in Python site-packages:
123
+
124
+ - **Mac/Linux:** `/Users/YOUR_USERNAME/.local/lib/python3.x/site-packages/doris_mcp_server/config/`
125
+
126
+ - **Windows:** `C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python3x\Lib\site-packages\doris_mcp_server\config\`
127
+
128
+ You can run the following command to locate pip install location:
129
+
130
+ ```bash
131
+ pip show doris-mcp-server
132
+ ```
133
+
134
+ You will find a `.env.example` file:
135
+
136
+ 1. Copy `.env.example` to `.env`:
137
+
138
+ ```bash
139
+ cp .env.example .env
140
+ ```
141
+
142
+ 2. Edit .env to set your **Doris** database connection information:
143
+
144
+ ```bash
145
+ DB_HOST=your-doris-host
146
+ DB_PORT=9030
147
+ DB_USER=your-username
148
+ DB_PASSWORD=your-password
149
+ DB_NAME=your-database
150
+
151
+ MCP_SERVER_NAME=DorisAnalytics
152
+ DEBUG=false
153
+ ```
154
+
155
+ > [!NOTE]
156
+ > If `.env `is missing, the server will attempt to auto-create it from `.env.example` but you must manually fill in correct credentials.
157
+
158
+ ### **Step 2: Configure MCP Client**
159
+
160
+ To connect this server to an MCP-compatible client (e.g., Claude Desktop, CherryStudio, Cline), you need to modify your MCP client configuration JSON.
161
+
162
+ Example if you are using CherryStudio:
163
+
164
+ - name: doris-mcp-server
165
+ - type: stdio
166
+ - command: absolute/path/to/your/uv
167
+ - arguments:
168
+
169
+ ```bash
170
+ --directory
171
+ /Users/hailin/dev/Doris-MCP-Server
172
+ run
173
+ server
174
+ ```
175
+
176
+
177
+ Example if you are installing with pip (`mcp_setting.json`):
178
+
179
+ ```json
180
+ {
181
+ "mcpServers": {
182
+ "DorisAnalytics": {
183
+ "command": "server",
184
+ "args": [],
185
+ "transportType": "stdio"
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ Alternatively, if you prefer a more robust form:
192
+
193
+ ```json
194
+ {
195
+ "mcpServers": {
196
+ "DorisAnalytics": {
197
+ "command": "python",
198
+ "args": ["-m", "doris_mcp_server.server"],
199
+ "transportType": "stdio"
200
+ }
201
+ }
202
+ }
203
+ ```
204
+
205
+ If you are installing with source code or using `setup.sh`:
206
+
207
+ ```json
208
+ {
209
+ "mcpServers": {
210
+ "DorisAnalytics": {
211
+ "disabled": false,
212
+ "timeout": 60,
213
+ "command": "absolute/path/to/uv",
214
+ "args": [
215
+ "--directory",
216
+ "absolute/path/to/mcp/server",
217
+ "run",
218
+ "server"
219
+ ],
220
+ "transportType": "stdio"
221
+ }
222
+ }
223
+
224
+ }
225
+ ```
226
+
227
+ For more information on how to configure your client, please refer to :
228
+
229
+ [For Server Developers - Model Context Protocol - Claude](https://modelcontextprotocol.io/quickstart/server)
230
+
231
+
232
+ [้…็ฝฎๅ’Œไฝฟ็”จ MCP | CherryStudio](https://docs.cherry-ai.com/advanced-basic/mcp/config)
233
+
234
+ โœ… Now your LLM client will discover Doris Analytics tools, prompts, and resources through the MCP server.
235
+
236
+ ---
237
+
238
+ ## **๐Ÿ–ฅ๏ธ Usage**
239
+
240
+ ### **Testing MCP server**
241
+
242
+ Before you start, you can run the `test.py` in the project `src/doris-mcp-server` directory to directly call the MCP Server functional interface to test 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.
243
+
244
+ Test all resources exposed by the server:
245
+
246
+ ```bash
247
+ python test.py --server server.py --test resources
248
+ ```
249
+
250
+ or test all the tools provided by the server:
251
+
252
+ ```bash
253
+ python test.py --server server.py --test tools
254
+ ```
255
+
256
+ or test all functions of resources, tools, and prompt words at one time:
257
+
258
+ ```bash
259
+ python test.py --server server.py --test all
260
+ ```
261
+
262
+ ### **Testing Database connection and run server**
263
+
264
+ Launch the MCP server by running the command:
265
+
266
+ ```bash
267
+ server
268
+ ```
269
+
270
+ Or manually:
271
+
272
+ ```bash
273
+ python -m doris_mcp_server.server
274
+ ```
275
+
276
+ The server immediately attempts to connect to the database. If the connection is successful, after startup, you should see:
277
+
278
+ ```bash
279
+ ๐Ÿš€ Doris MCP Server is starting...
280
+ [DorisConnector] Connected to 127.0.0.1:9030
281
+ โœ… Database connection successful.
282
+ [DorisConnector] Connection closed.
283
+ ```
284
+
285
+ You can now use the tools and prompts inside your MCP client.
286
+
287
+ ## **๐Ÿ“š Project Structure Overview**
288
+
289
+ ```bash
290
+ src/
291
+ โ””โ”€โ”€ doris_mcp_server/
292
+ โ”œโ”€โ”€ config/ # Configuration files
293
+ โ”‚ โ”œโ”€โ”€ __init__.py
294
+ โ”‚ โ”œโ”€โ”€ config.py # Loads environment variables
295
+ โ”‚ โ”œโ”€โ”€ .env.example # Environment variables template
296
+ โ”‚ โ””โ”€โ”€ .env # Stores your database credentials
297
+ โ”‚
298
+ โ”œโ”€โ”€ db/ # Database interaction logic
299
+ โ”‚ โ”œโ”€โ”€ __init__.py
300
+ โ”‚ โ”œโ”€โ”€ db.py # Doris database connection class
301
+ โ”‚ โ””โ”€โ”€ tools.py # SQL query execution tools
302
+ โ”‚
303
+ โ”œโ”€โ”€ res/ # Resource definitions (e.g., schemas)
304
+ โ”‚ โ”œโ”€โ”€ __init__.py
305
+ โ”‚ โ””โ”€โ”€ resources.py
306
+ โ”‚
307
+ โ”œโ”€โ”€ prompts/ # Prebuilt prompt templates
308
+ โ”‚ โ”œโ”€โ”€ __init__.py
309
+ โ”‚ โ”œโ”€โ”€ general_prompts.py
310
+ โ”‚ โ””โ”€โ”€ customize_prompts.py
311
+ โ”‚
312
+ โ”œโ”€โ”€ server.py # Main entry point to start the MCP server
313
+ โ”œโ”€โ”€ mcp_app.py # MCP object
314
+ โ””โ”€โ”€ test.py # Unit test script
315
+ README.md # Documentation
316
+ INSTALL.md # Installation guide
317
+ LISENCE # Lisence
318
+ setup.sh # Auto setup wizard
319
+ pyproject.toml # Project build configuration
320
+ .gitignore # Git ignore settings
321
+ ```
322
+
323
+ ## **๐Ÿ“œ License**
324
+
325
+ This project is licensed under the [MIT License](LICENSE).
326
+
327
+ ## **๐ŸŒŸAcknowledgements**
328
+
329
+ - Built using the [MCP Python SDK](https://pypi.org/project/mcp/).
330
+ - Inspired by MCP official examples and best practices.
331
+
332
+ ---
333
+
334
+ ## **๐Ÿค Contributions**
335
+
336
+ Contributions are welcome! Feel free to open issues or submit pull requests.
@@ -0,0 +1,320 @@
1
+ # **๐Ÿ“– Doris-MCP-Server**
2
+
3
+ A lightweight **MCP server** designed for connecting to **Apache Doris** or other **MySQL compatible** database schemas, providing tools and prompts for LLM applications.
4
+
5
+ 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.
6
+
7
+ > [!WARNING]
8
+ > This is an early developer version of doris-mcp-server. Some functions may not operate properly and minor bugs may exist. If you have any quesions, please open an [issue](https://github.com/NomotoK/Doris-MCP-Server/issues).
9
+
10
+ ## **๐Ÿš€ Features**
11
+
12
+ ### **๐Ÿ› ๏ธ Tools**
13
+
14
+ - Execute **read-only SQL queries** against your Doris database.
15
+ - Perform **data analysis operations** such as retrieving yearly, monthly, and daily usage data.
16
+ - Query metadata such as **database schemas**, **table structures**, and **resource usage**.
17
+
18
+ ### **๐Ÿง  Prompts**
19
+
20
+ - Built-in prompt templates to assist LLMs in asking **analytics questions**.
21
+ - Support for **user-defined** and **general-purpose** SQL analysis prompts.
22
+
23
+ ### **๐Ÿ—‚๏ธ Resources**
24
+
25
+ - Expose your Doris **database schema** as **structured resources**.
26
+ - Allow LLMs to **contextually access** table and field definitions to improve query understanding.
27
+
28
+ ## **๐Ÿ“ฆ Installation Options**
29
+
30
+ We recommend using [uv](https://docs.astral.sh/uv/) to manage your Python environment.
31
+
32
+ ### **Option 1: Install viaย shell script**
33
+
34
+ > **Recommended for server deployment**
35
+
36
+ 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](INSTALL.md)
37
+
38
+ 1. Copy the `setup.sh` to local.
39
+ 2. Make the script executable:
40
+
41
+ ```bash
42
+ chmod +x setup.sh
43
+ ```
44
+
45
+ 3. Run the script:
46
+
47
+ ```bash
48
+ ./setup.sh
49
+ ```
50
+
51
+ The script will automatically install the server and help you walk through database configuration.
52
+ ### **Option 2: Install viaย `pip`**
53
+
54
+ > **Recommended for production usage**
55
+
56
+ ```bash
57
+ pip install doris-mcp-server
58
+ ```
59
+
60
+ โœ… After installation, the command-line tool server will be available to launch the MCP server.
61
+
62
+ ### **Option 3: Clone the source and install manually**
63
+
64
+ > **Recommended if you want to modify the server**
65
+
66
+ 1. Fork and clone the repository:
67
+
68
+ ```bash
69
+ git clone https://github.com/YOUR_USERNAME/doris-mcp-server.git
70
+ cd doris-mcp-server
71
+ ```
72
+
73
+ 1. Set up a local Python environment using [uv](https://github.com/astral-sh/uv):
74
+
75
+ ```bash
76
+ uv venv
77
+ uv pip install -e .
78
+ ```
79
+
80
+ 1. Add this server to your LLM client or Run the server:
81
+
82
+ ```bash
83
+ uv run server
84
+ ```
85
+
86
+ ### **Option 4: Install using uv directly**
87
+
88
+ > **For local editable installations**
89
+
90
+ ```bash
91
+ uv pip install 'git+https://github.com/YOUR_USERNAME/doris-mcp-server.git'
92
+ ```
93
+
94
+ ## **โš™๏ธ Post-Installation Setup**
95
+
96
+ ### **Step 1: Configure `.env` file**
97
+
98
+ Doris-MCP-Server uses .env file to configure database connection info. Please follow these steps to finish configuration:
99
+
100
+ #### **Configure through shell script**
101
+
102
+ This is the most recommended and easiest way to setup. Please refer to [Doris MCP install guide](INSTALL.md).
103
+
104
+ #### **Configure manually**
105
+
106
+ After installing, navigate to the `doris_mcp_server/config/` directory inside your project directory. If you are using pip, your package will be installed in Python site-packages:
107
+
108
+ - **Mac/Linux:** `/Users/YOUR_USERNAME/.local/lib/python3.x/site-packages/doris_mcp_server/config/`
109
+
110
+ - **Windows:** `C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python3x\Lib\site-packages\doris_mcp_server\config\`
111
+
112
+ You can run the following command to locate pip install location:
113
+
114
+ ```bash
115
+ pip show doris-mcp-server
116
+ ```
117
+
118
+ You will find a `.env.example` file:
119
+
120
+ 1. Copy `.env.example` to `.env`:
121
+
122
+ ```bash
123
+ cp .env.example .env
124
+ ```
125
+
126
+ 2. Edit .env to set your **Doris** database connection information:
127
+
128
+ ```bash
129
+ DB_HOST=your-doris-host
130
+ DB_PORT=9030
131
+ DB_USER=your-username
132
+ DB_PASSWORD=your-password
133
+ DB_NAME=your-database
134
+
135
+ MCP_SERVER_NAME=DorisAnalytics
136
+ DEBUG=false
137
+ ```
138
+
139
+ > [!NOTE]
140
+ > If `.env `is missing, the server will attempt to auto-create it from `.env.example` but you must manually fill in correct credentials.
141
+
142
+ ### **Step 2: Configure MCP Client**
143
+
144
+ To connect this server to an MCP-compatible client (e.g., Claude Desktop, CherryStudio, Cline), you need to modify your MCP client configuration JSON.
145
+
146
+ Example if you are using CherryStudio:
147
+
148
+ - name: doris-mcp-server
149
+ - type: stdio
150
+ - command: absolute/path/to/your/uv
151
+ - arguments:
152
+
153
+ ```bash
154
+ --directory
155
+ /Users/hailin/dev/Doris-MCP-Server
156
+ run
157
+ server
158
+ ```
159
+
160
+
161
+ Example if you are installing with pip (`mcp_setting.json`):
162
+
163
+ ```json
164
+ {
165
+ "mcpServers": {
166
+ "DorisAnalytics": {
167
+ "command": "server",
168
+ "args": [],
169
+ "transportType": "stdio"
170
+ }
171
+ }
172
+ }
173
+ ```
174
+
175
+ Alternatively, if you prefer a more robust form:
176
+
177
+ ```json
178
+ {
179
+ "mcpServers": {
180
+ "DorisAnalytics": {
181
+ "command": "python",
182
+ "args": ["-m", "doris_mcp_server.server"],
183
+ "transportType": "stdio"
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ If you are installing with source code or using `setup.sh`:
190
+
191
+ ```json
192
+ {
193
+ "mcpServers": {
194
+ "DorisAnalytics": {
195
+ "disabled": false,
196
+ "timeout": 60,
197
+ "command": "absolute/path/to/uv",
198
+ "args": [
199
+ "--directory",
200
+ "absolute/path/to/mcp/server",
201
+ "run",
202
+ "server"
203
+ ],
204
+ "transportType": "stdio"
205
+ }
206
+ }
207
+
208
+ }
209
+ ```
210
+
211
+ For more information on how to configure your client, please refer to :
212
+
213
+ [For Server Developers - Model Context Protocol - Claude](https://modelcontextprotocol.io/quickstart/server)
214
+
215
+
216
+ [้…็ฝฎๅ’Œไฝฟ็”จ MCP | CherryStudio](https://docs.cherry-ai.com/advanced-basic/mcp/config)
217
+
218
+ โœ… Now your LLM client will discover Doris Analytics tools, prompts, and resources through the MCP server.
219
+
220
+ ---
221
+
222
+ ## **๐Ÿ–ฅ๏ธ Usage**
223
+
224
+ ### **Testing MCP server**
225
+
226
+ Before you start, you can run the `test.py` in the project `src/doris-mcp-server` directory to directly call the MCP Server functional interface to test 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.
227
+
228
+ Test all resources exposed by the server:
229
+
230
+ ```bash
231
+ python test.py --server server.py --test resources
232
+ ```
233
+
234
+ or test all the tools provided by the server:
235
+
236
+ ```bash
237
+ python test.py --server server.py --test tools
238
+ ```
239
+
240
+ or test all functions of resources, tools, and prompt words at one time:
241
+
242
+ ```bash
243
+ python test.py --server server.py --test all
244
+ ```
245
+
246
+ ### **Testing Database connection and run server**
247
+
248
+ Launch the MCP server by running the command:
249
+
250
+ ```bash
251
+ server
252
+ ```
253
+
254
+ Or manually:
255
+
256
+ ```bash
257
+ python -m doris_mcp_server.server
258
+ ```
259
+
260
+ The server immediately attempts to connect to the database. If the connection is successful, after startup, you should see:
261
+
262
+ ```bash
263
+ ๐Ÿš€ Doris MCP Server is starting...
264
+ [DorisConnector] Connected to 127.0.0.1:9030
265
+ โœ… Database connection successful.
266
+ [DorisConnector] Connection closed.
267
+ ```
268
+
269
+ You can now use the tools and prompts inside your MCP client.
270
+
271
+ ## **๐Ÿ“š Project Structure Overview**
272
+
273
+ ```bash
274
+ src/
275
+ โ””โ”€โ”€ doris_mcp_server/
276
+ โ”œโ”€โ”€ config/ # Configuration files
277
+ โ”‚ โ”œโ”€โ”€ __init__.py
278
+ โ”‚ โ”œโ”€โ”€ config.py # Loads environment variables
279
+ โ”‚ โ”œโ”€โ”€ .env.example # Environment variables template
280
+ โ”‚ โ””โ”€โ”€ .env # Stores your database credentials
281
+ โ”‚
282
+ โ”œโ”€โ”€ db/ # Database interaction logic
283
+ โ”‚ โ”œโ”€โ”€ __init__.py
284
+ โ”‚ โ”œโ”€โ”€ db.py # Doris database connection class
285
+ โ”‚ โ””โ”€โ”€ tools.py # SQL query execution tools
286
+ โ”‚
287
+ โ”œโ”€โ”€ res/ # Resource definitions (e.g., schemas)
288
+ โ”‚ โ”œโ”€โ”€ __init__.py
289
+ โ”‚ โ””โ”€โ”€ resources.py
290
+ โ”‚
291
+ โ”œโ”€โ”€ prompts/ # Prebuilt prompt templates
292
+ โ”‚ โ”œโ”€โ”€ __init__.py
293
+ โ”‚ โ”œโ”€โ”€ general_prompts.py
294
+ โ”‚ โ””โ”€โ”€ customize_prompts.py
295
+ โ”‚
296
+ โ”œโ”€โ”€ server.py # Main entry point to start the MCP server
297
+ โ”œโ”€โ”€ mcp_app.py # MCP object
298
+ โ””โ”€โ”€ test.py # Unit test script
299
+ README.md # Documentation
300
+ INSTALL.md # Installation guide
301
+ LISENCE # Lisence
302
+ setup.sh # Auto setup wizard
303
+ pyproject.toml # Project build configuration
304
+ .gitignore # Git ignore settings
305
+ ```
306
+
307
+ ## **๐Ÿ“œ License**
308
+
309
+ This project is licensed under the [MIT License](LICENSE).
310
+
311
+ ## **๐ŸŒŸAcknowledgements**
312
+
313
+ - Built using the [MCP Python SDK](https://pypi.org/project/mcp/).
314
+ - Inspired by MCP official examples and best practices.
315
+
316
+ ---
317
+
318
+ ## **๐Ÿค Contributions**
319
+
320
+ Contributions are welcome! Feel free to open issues or submit pull requests.
@@ -0,0 +1,27 @@
1
+ [build-system]
2
+ requires = ["setuptools>=67", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "doris-mcp-server"
7
+ version = "0.0.1"
8
+ description = "An MCP server for analytics on Apache Doris database."
9
+ readme = "README.md"
10
+ requires-python = ">=3.12"
11
+ dependencies = [
12
+ "httpx>=0.28.1",
13
+ "mcp[cli]>=1.6.0",
14
+ "pandas>=2.2.3",
15
+ "pyarrow>=19.0.1",
16
+ "pymysql>=1.1.1",
17
+ ]
18
+
19
+ [project.urls]
20
+ Homepage = "https://github.com/NomotoK/doris-mcp-server"
21
+ Repository = "https://github.com/NomotoK/doris-mcp-server"
22
+
23
+ [project.scripts]
24
+ server = "doris_mcp_server.server:main"
25
+
26
+ [tool.setuptools.packages.find]
27
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from .config import DB_CONFIG, MCP_SERVER_NAME, DEBUG
2
+
3
+ __all__ = ["DB_CONFIG", "MCP_SERVER_NAME", "DEBUG"]