Skip to content

Commit 523de16

Browse files
0.1.3 version
1 parent 257098b commit 523de16

File tree

10 files changed

+231
-84
lines changed

10 files changed

+231
-84
lines changed

README.md

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<a href="https://github.com/XGenerationLab/XiYan-SQL"><img alt="MCP Playwright" src="https://raw.githubusercontent.com/XGenerationLab/XiYan-SQL/main/xiyanGBI.png" height="60"/></a>
44
</p>
55
<p align="center">
6-
<b>A Model Context Protocol (MCP) server that enables natural language queries to databases</b></br>
6+
<b>A Model Context Protocol (MCP) server that enables natural language queries to databases</b><br/>
77
<sub>powered by <a href="https://github.com/XGenerationLab/XiYan-SQL" >XiYan-SQL</a>, SOTA of text-to-sql on open benchmarks</sub>
88
</p>
99

@@ -42,7 +42,7 @@
4242
- [LLM Configuration](#llm-configuration)
4343
- [General LLMs](#general-llms)
4444
- [Text-to-SQL SOTA model](#text-to-sql-sota-model)
45-
- [Local LLMs](#local-llms)
45+
- [Local Model](#local-model)
4646
- [Database Configuration](#database-configuration)
4747
- [Launch](#launch)
4848
- [Claude Desktop](#claude-desktop)
@@ -55,6 +55,8 @@
5555

5656
## Features
5757
- 🌐 Fetch data by natural language through [XiYanSQL](https://github.com/XGenerationLab/XiYan-SQL)
58+
- 🤖 Support general LLMs (GPT,qwenmax), Text-to-SQL SOTA model
59+
- 💻 Support pure local mode (high security!)
5860
- 🖱️ List available MySQL tables as resources
5961
- 🔧 Read table contents
6062

@@ -111,14 +113,14 @@ database:
111113
### LLM Configuration
112114
``Name`` is the name of the model to use, ``key`` is the API key of the model, ``url`` is the API url of the model. We support following models.
113115
114-
| versions | general LLMs(GPT,qwenmax) | SOTA model by Modelscope | SOTA model by Dashscope |
115-
|----------|-------------------------------|--------------------------------------------|-----------------------------------------------------------|
116-
| description| basic, easy to use | best performance, stable, recommand | best performance, for trial |
117-
| name | the official model name (e.g. gpt-3.5-turbo,qwen-max) | XGenerationLab/XiYanSQL-QwenCoder-32B-2412 | xiyansql-qwencoder-32b |
118-
| key | the API key of the service provider (e.g. OpenAI, Alibaba Cloud) | the API key of modelscope | the API key via email |
119-
| url | the endpoint of the service provider (e.g."https://api.openai.com/v1") | https://api-inference.modelscope.cn/v1/ | https://xiyan-stream.biz.aliyun.com/service/api/xiyan-sql |
116+
| versions | general LLMs(GPT,qwenmax) | SOTA model by Modelscope | SOTA model by Dashscope | Local LLMs |
117+
|----------|-------------------------------|--------------------------------------------|-----------------------------------------------------------|-----------------------|
118+
| description| basic, easy to use | best performance, stable, recommand | best performance, for trial | slow, high-security |
119+
| name | the official model name (e.g. gpt-3.5-turbo,qwen-max) | XGenerationLab/XiYanSQL-QwenCoder-32B-2412 | xiyansql-qwencoder-32b | xiyansql-qwencoder-3b |
120+
| key | the API key of the service provider (e.g. OpenAI, Alibaba Cloud) | the API key of modelscope | the API key via email | "" |
121+
| url | the endpoint of the service provider (e.g."https://api.openai.com/v1") | https://api-inference.modelscope.cn/v1/ | https://xiyan-stream.biz.aliyun.com/service/api/xiyan-sql | http://localhost:5090 |
120122
121-
#### general LLMs
123+
#### General LLMs
122124
if you want to use the general LLMs, e.g. gpt3.5, you can directly config like this:
123125
```yaml
124126
model:
@@ -180,8 +182,46 @@ Note: this model service is just for trial, if you need to use it in production,
180182
181183
Alternatively, you can also deploy the model [XiYanSQL-qwencoder-32B](https://github.com/XGenerationLab/XiYanSQL-QwenCoder) on your own server.
182184
183-
#### Local LLMs
184-
To support in the future.
185+
#### Local Model
186+
Note: local model is slow (about 12 seconds per query on my macbook).
187+
If your need stable and fast service, we still recommend to use the modelscope version.
188+
189+
To run xiyan_mcp_server on local mode, you need
190+
1) a PC/Mac with at least 16GB RAM
191+
2) 6GB disk space
192+
193+
step1: Install additional python packages
194+
```bash
195+
pip install flask modelscope torch==2.2.2 accelerate>=0.26.0 numpy=2.2.3
196+
```
197+
198+
step2: (optional) manully download the model
199+
We recommand [xiyansql-qwencoder-3b](https://www.modelscope.cn/models/XGenerationLab/XiYanSQL-QwenCoder-3B-2502/).
200+
You can manully download the model by
201+
```bash
202+
modelscope download --model XGenerationLab/XiYanSQL-QwenCoder-3B-2502
203+
```
204+
It will take you 6GB disk space.
205+
206+
step4: download the script and run server. src/xiyan_mcp_server/local_xiyan_server.py
207+
208+
209+
210+
```bash
211+
python local_xiyan_server.py
212+
```
213+
The server will be running on http://localhost:5090/
214+
215+
step4: prepare config and run xiyan_mcp_server
216+
the config.yml should be like:
217+
```yml
218+
model:
219+
name: "xiyansql-qwencoder-3b"
220+
key: "KEY"
221+
url: "http://127.0.0.1:5090"
222+
```
223+
224+
Til now the local mode is ready.
185225
186226
### Database Configuration
187227
``host``, ``port``, ``user``, ``password``, ``database`` are the connection information of the MySQL database.

0 commit comments

Comments
 (0)