1
- <h1 align =" center " >XiYan MCP服务器 </h1 >
1
+ <h1 align =" center " >XiYan MCP Server </h1 >
2
2
<p align =" center " >
3
3
<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 >
4
4
</p >
5
5
<p align =" center " >
6
- <b >一个模型上下文协议( MCP) 服务器,能够通过自然语言查询数据库 </b ></br >
7
- <sub >由 <a href =" https://github.com/XGenerationLab/XiYan-SQL " >XiYan-SQL</a > 提供支持,这是开放基准上的文本到SQL的最新技术 </sub >
6
+ <b >一个模型上下文协议 ( MCP) 服务器,支持自然语言查询数据库 </b ></br >
7
+ <sub >由 <a href =" https://github.com/XGenerationLab/XiYan-SQL " >XiYan-SQL</a > 提供支持,Test-to-SQL公开基准上的SOTA </sub >
8
8
</p >
9
9
10
10
<p align =" center " >
11
11
💻 <a href =" https://github.com/XGenerationLab/xiyan_mcp_server " >XiYan-mcp-server</a > |
12
12
🌐 <a href =" https://github.com/XGenerationLab/XiYan-SQL " >XiYan-SQL</a > |
13
13
📖 <a href =" https://arxiv.org/abs/2411.08599 " > Arxiv</a > |
14
- 📄 <a href =" https://paperswithcode.com/paper/xiyan-sql-a-multi-generator-ensemble " >PapersWithCode</a > <br />
15
- <a href =" https://smithery.ai/server/@XGenerationLab/xiyan_mcp_server " ><img alt =" Smithery Installs " src =" https://smithery.ai/badge/@XGenerationLab/xiyan_mcp_server " height =" 20 " /></a ><br />
16
- <a href =" https://github.com/XGenerationLab/xiyan_mcp_server " >英文</a > | <a href =" https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/README_zh.md " > 中文 </a >
14
+ 📄 <a href =" https://paperswithcode.com/paper/xiyan-sql-a-multi-generator-ensemble " >PapersWithCode</a > |
15
+ 💻 <a href =" https://huggingface.co/collections/XGenerationLab/xiyansql-models-67c9844307b49f87436808fc " >HuggingFace</a > |
16
+ 🤖 <a href =" https://modelscope.cn/collections/XiYanSQL-Models-4483337b614241 " >ModelScope</a > |
17
+ 🌕 <a href =" https://bailian.console.aliyun.com/xiyan " >析言GBI</a >
18
+ <br />
19
+ <a href =" https://pepy.tech/projects/xiyan-mcp-server " ><img src =" https://static.pepy.tech/badge/xiyan-mcp-server " alt =" PyPI 下载量 " ></a >
20
+ <a href =" https://smithery.ai/server/@XGenerationLab/xiyan_mcp_server " ><img alt =" Smithery 安装量 " src =" https://smithery.ai/badge/@XGenerationLab/xiyan_mcp_server " height =" 20 " /></a >
21
+ <a href =" https://github.com/XGenerationLab/xiyan_mcp_server " target =" _blank " >
22
+ <img src="https://img.shields.io/github/stars/XGenerationLab/xiyan_mcp_server?style=social" alt="GitHub stars" />
23
+ </a >
24
+ <br />
25
+ <a href =" https://github.com/XGenerationLab/xiyan_mcp_server " >English</a > | <a href =" https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/README_zh.md " > 中文 </a ><br />
26
+ <a href =" https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png " >钉钉群</a >|
27
+ <a href =" https://weibo.com/u/2540915670 " target =" _blank " >在微博上关注我</a >
17
28
</p >
18
29
19
-
20
30
## 目录
21
31
22
32
- [ 功能] ( #features )
23
33
- [ 工具预览] ( #tool-preview )
24
34
- [ 安装] ( #installation )
25
- - [ 通过pip安装 ] ( #installing-from-pip )
26
- - [ 通过Smithery.ai安装 ] ( #installing-from-smitheryai )
35
+ - [ 通过 pip 安装 ] ( #installing-from-pip )
36
+ - [ 通过 Smithery.ai 安装 ] ( #installing-from-smitheryai )
27
37
- [ 配置] ( #configuration )
28
- - [ LLM配置 ] ( #llm-configuration )
29
- - [ 通用LLMs ] ( #general-llms )
30
- - [ 文本到SQL的最新技术模型 ] ( #text-to-sql-sota-model )
31
- - [ 本地LLMs ] ( #local-llms )
38
+ - [ LLM 配置 ] ( #llm-configuration )
39
+ - [ 通用 LLM ] ( #general-llms )
40
+ - [ 文本到 SQL SOTA 模型 ] ( #text-to-sql-sota-model )
41
+ - [ 本地 LLM ] ( #local-llms )
32
42
- [ 数据库配置] ( #database-configuration )
33
43
- [ 启动] ( #launch )
34
- - [ Claude桌面] ( #claude-desktop )
44
+ - [ Claude 桌面] ( #claude-desktop )
45
+ - [ Goose] ( #goose )
35
46
- [ 引用] ( #citation )
36
47
37
-
38
48
## 功能
39
- - 🌐 通过 [ XiYanSQL] ( https://github.com/XGenerationLab/XiYan-SQL ) 使用自然语言获取数据
40
- - 🖱️ 列出可用的MySQL表作为资源
41
- - 🔧 阅读表内容
49
+ - 🌐 通过 [ XiYanSQL] ( https://github.com/XGenerationLab/XiYan-SQL ) 以自然语言提取数据
50
+ - 🖱️ 列出可用的 MySQL 表作为资源
51
+ - 🔧 读取表内容
42
52
43
53
## 工具预览
44
- - 工具 `` get_data_via_natural_language `` 提供了一个自然语言接口,用于从数据库中检索数据。该服务器将输入的自然语言转换为SQL ,并调用数据库返回查询结果。
54
+ - 工具 `` get_data_via_natural_language `` 提供从数据库检索数据的自然语言接口。该服务器将输入的自然语言转换为 SQL ,并调用数据库返回查询结果。
45
55
46
- - 资源 `` mysql://{table_name} `` 允许在指定特定表名时从数据库获取一部分示例数据以供模型参考 。
47
- - 资源 `` mysql:// `` 将列出当前数据库的名称
56
+ - `` mysql://{table_name} `` 资源允许在指定特定的表名时,从数据库获取一部分样本数据以供模型参考 。
57
+ - `` mysql:// `` 资源将列出当前数据库的名称
48
58
49
59
## 安装
50
- ### 通过pip安装
60
+ ### 通过 pip 安装
51
61
52
- 需要Python 3.11或更高版本 。
53
- 您可以通过pip安装服务器 ,它将安装最新版本。
62
+ 需要 Python 3.11 及以上版本 。
63
+ 您可以通过 pip 安装服务器 ,它将安装最新版本。
54
64
55
65
``` bash
56
66
pip install xiyan-mcp-server
57
67
```
58
68
59
- 之后您可以通过以下命令直接运行服务器 :
69
+ 之后您可以直接运行服务器 :
60
70
``` bash
61
71
python -m xiyan_mcp_server
62
72
```
63
- 但在您完成以下配置之前 ,它不会提供任何功能。
64
- 您将获得一个yml文件 。之后您可以通过以下命令运行服务器:
73
+ 但是在您完成后续配置之前 ,它不会提供任何功能。
74
+ 您将获得一个 yml 文件 。之后您可以通过以下命令运行服务器:
65
75
``` yaml
66
76
env YML=path/to/yml python -m xiyan_mcp_server
67
77
```
68
78
69
- ### 通过Smithery.ai安装
70
- 请参阅 [ @XGenerationLab /xiyan_mcp_server] ( https://smithery.ai/server/@XGenerationLab/xiyan_mcp_server )
79
+ ### 通过 Smithery.ai 安装
80
+ 请参见 [ @XGenerationLab /xiyan_mcp_server] ( https://smithery.ai/server/@XGenerationLab/xiyan_mcp_server )
71
81
72
- 未完全测试 。
82
+ 尚未全面测试 。
73
83
74
84
## 配置
75
85
76
- 您需要一个yml配置文件来配置服务器 。
77
- 在config_demo.yml中提供了默认配置文件 ,内容如下:
86
+ 您需要一个 yml 配置文件来配置服务器 。
87
+ 在 config_demo.yml 中提供了一个默认配置文件 ,内容如下:
78
88
79
89
``` yaml
80
90
model :
81
- name : " pre-xiyan_multi_dialect_v3 "
91
+ name : " pre-xiyansql-qwencoder-32b "
82
92
key : " "
83
- url : " https://poc-dashscope.aliyuncs. com/compatible-mode/v1 "
93
+ url : " https://pre-xiyan-stream.biz.aliyun. com/service/api/xiyan-sql "
84
94
85
95
database :
86
96
host : " localhost"
@@ -90,48 +100,58 @@ database:
90
100
database : " "
91
101
` ` `
92
102
93
- ### LLM配置
94
- ` ` Name` ` 是要使用的模型名称 ,` ` key` ` 是模型的API密钥 ,` ` url` ` 是模型的API网址 。我们支持以下模型。
95
- #### 通用LLMs
96
- 如果您想使用通用LLMs,例如gpt3 .5,您可以直接配置如下:
103
+ ### LLM 配置
104
+ ` ` Name` ` 是要使用的模型的名称 ,` ` key` ` 是模型的 API 密钥 ,` ` url` ` 是模型的 API 地址 。我们支持以下模型。
105
+ #### 通用 LLM
106
+ 如果您想使用通用 LLM,比如 gpt3 .5,您可以直接配置如下:
97
107
` ` ` yaml
98
108
model :
99
109
name : " gpt-3.5-turbo"
100
- key : " YOUR KEY "
101
- url : " https://api.openai.com/v1/chat/completions "
110
+ key : " 您的密钥 "
111
+ url : " https://api.openai.com/v1"
102
112
database :
103
113
` ` `
104
114
105
- 如果您想使用阿里巴巴的Qwen,例如Qwen -max,
115
+ 如果您想使用阿里巴巴的 Qwen,例如 Qwen -max,您可以使用以下配置。
106
116
` ` ` yaml
107
117
model :
108
118
name : " qwen-max"
109
- key : " YOUR KEY "
119
+ key : " 您的密钥 "
110
120
url : " https://dashscope.aliyuncs.com/compatible-mode/v1"
111
121
database :
112
122
` ` `
123
+ #### 文本到 SQL SOTA 模型
124
+ 最后,我们推荐使用 XiYanSQL-qwencoder-32B (https://github.com/XGenerationLab/XiYanSQL-QwenCoder),这是文本到 SQL 的 SOTA 模型,见 [Bird benchmark](https://bird-bench.github.io/)。
125
+ 我们在阿里云 DashScope 上部署了该模型,因此您需要设置以下环境变量:
126
+ 请发送您的电子邮件以获取 ` ` key` ` 。 ( godot.lzl@alibaba-inc.com )
127
+ 在电子邮件中,请附上以下信息:
128
+ ` ` ` yaml
129
+ name : " 您的姓名" ,
130
+ email : " 您的电子邮件" ,
131
+ organization : " 您所在的学校或公司或组织"
132
+ ` ` `
133
+ 我们将根据您的电子邮件发送给您一个 ` ` key` ` 。您可以将该 ` ` key` ` 填写在 yml 文件中。
134
+ 该 ` ` key` ` 将在一个月或 200 查询或其他法律限制下过期。
113
135
114
- #### 文本到SQL的最新技术模型
115
- 最后,我们推荐XiYanSQL-qwencoder-32B (https://github.com/XGenerationLab/XiYanSQL-QwenCoder),这是文本到SQL的最新模型。
116
- 我们在阿里巴巴云DashScope上部署了该模型,因此您需要设置以下环境变量:
117
- 请与我们联系以获取 ` ` key` ` 。 ( godot.lzl@alibaba-inc.com )
118
136
` ` ` yaml
119
137
model :
120
- name : " pre-xiyan_multi_dialect_v3 "
121
- key : " KEY "
122
- url : " https://poc-dashscope.aliyuncs. com/compatible-mode/v1 "
138
+ name : " pre-xiyansql-qwencoder-32b "
139
+ key : " 密钥 "
140
+ url : " https://pre-xiyan-stream.biz.aliyun. com/service/api/xiyan-sql "
123
141
database :
124
142
` ` `
125
143
126
- 或者,您也可以在自己的服务器上部署模型(XiYanSQL-qwencoder-32B)。
144
+ 注意:该模型服务仅供试用,如果您需要在生产环境中使用,请与我们联系。
145
+
146
+ 或者,您也可以在自己的服务器上部署模型 [XiYanSQL-qwencoder-32B](https://github.com/XGenerationLab/XiYanSQL-QwenCoder)。
127
147
128
- #### 本地LLMs
129
- 未来将提供支持 。
148
+ #### 本地 LLM
149
+ 未来将支持 。
130
150
131
151
### 数据库配置
132
- ` ` host` ` , ` ` port` ` , ` ` user` ` , ` ` password` ` , ` ` database` ` 是MySQL数据库的连接信息 。
152
+ ` ` host` ` , ` ` port` ` , ` ` user` ` , ` ` password` ` , ` ` database` ` 是 MySQL 数据库的连接信息 。
133
153
134
- 您可以使用本地或任何远程数据库。现在我们支持MySQL(更多方言即将推出 )。
154
+ 您可以使用本地或任何远程数据库。现在我们支持 MySQL(更多方言将在不久的将来支持 )。
135
155
136
156
` ` ` yaml
137
157
database :
@@ -143,8 +163,8 @@ database:
143
163
` ` `
144
164
145
165
## 启动
146
- ### Claude desktop
147
- 在您的claude桌面配置文件中添加以下内容 :
166
+ ### Claude 桌面
167
+ 在您的 Claude 桌面配置文件中添加以下内容 :
148
168
` ` ` json
149
169
{
150
170
" mcpServers " : {
@@ -161,9 +181,15 @@ database:
161
181
}
162
182
}
163
183
```
184
+ ### Goose
185
+ 在配置中添加以下命令。
186
+
187
+ ``` yaml
188
+ env YML=path/to/yml python -m xiyan_mcp_server
189
+ ```
164
190
165
191
## 引用
166
- 如果您觉得我们的工作有帮助,欢迎引用我们的文章 。
192
+ 如果您觉得我们的工作对您有帮助,请随时引用我们 。
167
193
``` bib
168
194
@article{xiyansql,
169
195
title={A Preview of XiYan-SQL: A Multi-Generator Ensemble Framework for Text-to-SQL},
0 commit comments