Skip to content

Commit f51aea0

Browse files
Merge pull request #7 from eltociear/add-japanese-readme
docs: add Japanese README file
2 parents 779fca1 + 14ae51d commit f51aea0

File tree

3 files changed

+338
-3
lines changed

3 files changed

+338
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<img src="https://img.shields.io/github/stars/XGenerationLab/xiyan_mcp_server?style=social" alt="GitHub stars" />
2828
</a>
2929
<br />
30-
<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 />
30+
<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> | <a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/README_ja.md"> 日本語 </a><br />
3131
<a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png">Ding Group钉钉群</a>|
3232
<a href="https://weibo.com/u/2540915670" target="_blank">Follow me on Weibo</a>
3333
</p>

README_ja.md

Lines changed: 335 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,335 @@
1+
# XiYan MCP サーバー
2+
3+
<p align="center">
4+
<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>
5+
</p>
6+
<p align="center">
7+
<b>自然言語でデータベースにクエリを実行できるモデルコンテキストプロトコル(MCP)サーバー</b><br/>
8+
<sub>オープンベンチマークでのテキストからSQLへのSOTAを実現する<a href="https://github.com/XGenerationLab/XiYan-SQL">XiYan-SQL</a>によって提供されています</sub>
9+
</p>
10+
11+
<p align="center">
12+
💻 <a href="https://github.com/XGenerationLab/xiyan_mcp_server">XiYan-mcp-server</a> |
13+
🌐 <a href="https://github.com/XGenerationLab/XiYan-SQL">XiYan-SQL</a> |
14+
📖 <a href="https://arxiv.org/abs/2411.08599">Arxiv</a> |
15+
📄 <a href="https://paperswithcode.com/paper/xiyan-sql-a-multi-generator-ensemble">PapersWithCode</a>
16+
💻 <a href="https://huggingface.co/collections/XGenerationLab/xiyansql-models-67c9844307b49f87436808fc">HuggingFace</a> |
17+
🤖 <a href="https://modelscope.cn/collections/XiYanSQL-Models-4483337b614241">ModelScope</a> |
18+
🌕 <a href="https://bailian.console.aliyun.com/xiyan">析言GBI</a>
19+
<br />
20+
<img src="https://badge.mcpx.dev/?type=server%20%27MCP%20Server%27" alt="MCP Server" />
21+
<a href="https://arxiv.org/abs/2411.08599"><img src="imgs/Paper-Arxiv-orange.svg"></a>
22+
<a href="https://opensource.org/licenses/Apache-2.0">
23+
<img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0" />
24+
</a>
25+
<a href="https://pepy.tech/projects/xiyan-mcp-server"><img src="https://static.pepy.tech/badge/xiyan-mcp-server" alt="PyPI Downloads"></a>
26+
<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>
27+
<a href="https://github.com/XGenerationLab/xiyan_mcp_server" target="_blank">
28+
<img src="https://img.shields.io/github/stars/XGenerationLab/xiyan_mcp_server?style=social" alt="GitHub stars" />
29+
</a>
30+
<br />
31+
<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><br />
32+
<a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png">Ding Group</a> |
33+
<a href="https://weibo.com/u/2540915670" target="_blank">Weiboでフォロー</a>
34+
</p>
35+
36+
## 目次
37+
38+
- [特徴](#特徴)
39+
- [プレビュー](#プレビュー)
40+
- [アーキテクチャ](#アーキテクチャ)
41+
- [ベストプラクティス](#ベストプラクティス)
42+
- [ツールプレビュー](#ツールプレビュー)
43+
- [インストール](#インストール)
44+
- [pipからのインストール](#pipからのインストール)
45+
- [Smithery.aiからのインストール](#smitheryaiからのインストール)
46+
- [設定](#設定)
47+
- [LLM設定](#llm設定)
48+
- [一般的なLLM](#一般的なllm)
49+
- [テキストからSQLへのSOTAモデル](#テキストからsqlへのsotaモデル)
50+
- [ローカルモデル](#ローカルモデル)
51+
- [データベース設定](#データベース設定)
52+
- [MySQL](#mysql)
53+
- [PostgreSQL](#postgresql)
54+
- [起動](#起動)
55+
- [Claude Desktop](#claude-desktop)
56+
- [Cline](#cline)
57+
- [Goose](#goose)
58+
- [Cursor](#cursor)
59+
- [動作しない場合](#動作しない場合)
60+
- [引用](#引用)
61+
62+
## 特徴
63+
- 🌐 [XiYanSQL](https://github.com/XGenerationLab/XiYan-SQL)を通じて自然言語でデータを取得
64+
- 🤖 一般的なLLM(GPT, qwenmax)、テキストからSQLへのSOTAモデルをサポート
65+
- 💻 純粋なローカルモードをサポート(高セキュリティ!)
66+
- 📝 MySQLとPostgreSQLをサポート
67+
- 🖱️ 利用可能なテーブルをリソースとしてリスト
68+
- 🔧 テーブル内容を読み取る
69+
70+
## プレビュー
71+
### アーキテクチャ
72+
このサーバーをプロジェクトに統合する方法は2つあります。以下の図に示されています:
73+
左側はリモートモードで、デフォルトモードです。サービスプロバイダーからxiyanSQL-qwencoder-32BモデルにアクセスするためにAPIキーが必要です([設定](#設定)を参照)。
74+
もう一つのモードはローカルモードで、より安全です。APIキーは必要ありません。
75+
76+
![architecture.png](imgs/architecture.png)
77+
78+
### ベストプラクティスとレポート
79+
80+
["MCP + Modelscope API-Inferenceを使用して、コードを一行も書かずにローカルデータアシスタントを構築する"](https://mp.weixin.qq.com/s/tzDelu0W4w6t9C0_yYRbHA)
81+
82+
["Modelscope上のXiyan MCP"](https://modelscope.cn/headlines/article/1142)
83+
84+
### MCPBenchでの評価
85+
以下の図は、MCPBenchベンチマークで測定されたXiYan MCPサーバーのパフォーマンスを示しています。XiYan MCPサーバーは、MySQL MCPサーバーおよびPostgreSQL MCPサーバーと比較して優れたパフォーマンスを示し、2〜22パーセントポイントのリードを達成しています。詳細な実験結果は[MCPBench](https://github.com/modelscope/MCPBench)およびレポート["MCPサーバーの評価レポート"](https://arxiv.org/abs/2504.11094)で確認できます。
86+
87+
![exp_mcpbench.png](imgs/exp_mcpbench.png)
88+
89+
### ツールプレビュー
90+
- ツール``get_data``は、データベースからデータを取得するための自然言語インターフェースを提供します。このサーバーは、入力された自然言語をSQLに変換し、データベースを呼び出してクエリ結果を返します。
91+
92+
- ``{dialect}://{table_name}``リソースは、特定のtable_nameを指定した場合に、データベースからモデル参照用のサンプルデータの一部を取得することを許可します。
93+
- ``{dialect}://``リソースは、現在のデータベースの名前をリストします。
94+
95+
## インストール
96+
### pipからのインストール
97+
98+
Python 3.11以上が必要です。
99+
pipを通じてサーバーをインストールできます。最新バージョンがインストールされます:
100+
101+
```bash
102+
pip install xiyan-mcp-server
103+
```
104+
105+
その後、以下のコマンドでサーバーを直接実行できます:
106+
```bash
107+
python -m xiyan_mcp_server
108+
```
109+
ただし、以下の設定を完了するまで機能は提供されません。
110+
ymlファイルを取得します。その後、以下の方法でサーバーを実行できます:
111+
```yaml
112+
env YML=path/to/yml python -m xiyan_mcp_server
113+
```
114+
115+
### Smithery.aiからのインストール
116+
[@XGenerationLab/xiyan_mcp_server](https://smithery.ai/server/@XGenerationLab/xiyan_mcp_server)を参照
117+
118+
完全にはテストされていません。
119+
120+
## 設定
121+
122+
サーバーを設定するには、YAML設定ファイルが必要です。
123+
デフォルトの設定ファイルconfig_demo.ymlが提供されています。内容は以下の通りです:
124+
125+
```yaml
126+
model:
127+
name: "XGenerationLab/XiYanSQL-QwenCoder-32B-2412"
128+
key: ""
129+
url: "https://api-inference.modelscope.cn/v1/"
130+
131+
database:
132+
host: "localhost"
133+
port: 3306
134+
user: "root"
135+
password: ""
136+
database: ""
137+
```
138+
139+
### LLM設定
140+
``Name``は使用するモデルの名前、``key``はモデルのAPIキー、``url``はモデルのAPIアドレスです。以下のモデルをサポートしています。
141+
142+
| バージョン | 一般的なLLM(GPT, qwenmax) | ModelscopeによるSOTAモデル | DashscopeによるSOTAモデル | ローカルLLM |
143+
|----------|-------------------------------|-----------------------------|----------------------------|----------------|
144+
| 説明 | 基本的で使いやすい | 最高のパフォーマンス、安定、推奨 | 最高のパフォーマンス、試用用 | 遅い、高セキュリティ |
145+
| 名前 | 公式モデル名(例:gpt-3.5-turbo, qwen-max) | XGenerationLab/XiYanSQL-QwenCoder-32B-2412 | xiyansql-qwencoder-32b | xiyansql-qwencoder-3b |
146+
| キー | サービスプロバイダーのAPIキー(例:OpenAI, Alibaba Cloud) | ModelscopeのAPIキー | メールで取得するAPIキー | "" |
147+
| URL | サービスプロバイダーのエンドポイント(例:"https://api.openai.com/v1") | https://api-inference.modelscope.cn/v1/ | https://xiyan-stream.biz.aliyun.com/service/api/xiyan-sql | http://localhost:5090 |
148+
149+
#### 一般的なLLM
150+
一般的なLLMを使用する場合、例:gpt3.5、以下のように設定できます:
151+
```yaml
152+
model:
153+
name: "gpt-3.5-turbo"
154+
key: "YOUR KEY"
155+
url: "https://api.openai.com/v1"
156+
database:
157+
```
158+
159+
AlibabaのQwenを使用する場合、例:Qwen-max、以下の設定を使用できます:
160+
```yaml
161+
model:
162+
name: "qwen-max"
163+
key: "YOUR KEY"
164+
url: "https://dashscope.aliyuncs.com/compatible-mode/v1"
165+
database:
166+
```
167+
#### テキストからSQLへのSOTAモデル
168+
テキストからSQLへのSOTAモデルであるXiYanSQL-qwencoder-32B(https://github.com/XGenerationLab/XiYanSQL-QwenCoder)を推奨します。以下の2つの方法でモデルを使用できます。
169+
(1) [Modelscope](https://www.modelscope.cn/models/XGenerationLab/XiYanSQL-QwenCoder-32B-2412)、(2) Alibaba Cloud DashScope。
170+
171+
##### (1) Modelscopeバージョン
172+
ModelscopeからAPI推論の``key``を申請する必要があります。https://www.modelscope.cn/docs/model-service/API-Inference/intro
173+
その後、以下の設定を使用できます:
174+
```yaml
175+
model:
176+
name: "XGenerationLab/XiYanSQL-QwenCoder-32B-2412"
177+
key: ""
178+
url: "https://api-inference.modelscope.cn/v1/"
179+
```
180+
181+
詳細については、[モデルの説明](https://www.modelscope.cn/models/XGenerationLab/XiYanSQL-QwenCoder-32B-2412)を参照してください。
182+
183+
##### (2) Dashscopeバージョン
184+
185+
Alibaba Cloud DashScopeにモデルをデプロイしましたので、以下の環境変数を設定する必要があります:
186+
``key``を取得するためにメールを送信してください。(godot.lzl@alibaba-inc.com)
187+
メールには以下の情報を添付してください:
188+
```yaml
189+
name: "YOUR NAME",
190+
email: "YOUR EMAIL",
191+
organization: "your college or Company or Organization"
192+
```
193+
メールに基づいて``key``を送信します。ymlファイルに``key``を記入できます。
194+
``key``は1ヶ月または200クエリまたはその他の法的制限で期限切れになります。
195+
196+
```yaml
197+
model:
198+
name: "xiyansql-qwencoder-32b"
199+
key: "KEY"
200+
url: "https://xiyan-stream.biz.aliyun.com/service/api/xiyan-sql"
201+
database:
202+
```
203+
204+
注意:このモデルサービスは試用のみです。生産で使用する場合は、私たちに連絡してください。
205+
206+
または、モデル[XiYanSQL-qwencoder-32B](https://github.com/XGenerationLab/XiYanSQL-QwenCoder)を自分のサーバーにデプロイすることもできます。
207+
208+
#### ローカルモデル
209+
注意:ローカルモデルは遅いです(私のMacBookではクエリごとに約12秒かかります)。
210+
安定して高速なサービスが必要な場合は、Modelscopeバージョンを使用することをお勧めします。
211+
212+
ローカルモードでxiyan_mcp_serverを実行するには、以下が必要です:
213+
1)少なくとも16GBのRAMを持つPC/Mac
214+
2)6GBのディスクスペース
215+
216+
ステップ1:追加のPythonパッケージをインストール
217+
```bash
218+
pip install flask modelscope torch==2.2.2 accelerate>=0.26.0 numpy=2.2.3
219+
```
220+
221+
ステップ2:(オプション)モデルを手動でダウンロード
222+
[xiyansql-qwencoder-3b](https://www.modelscope.cn/models/XGenerationLab/XiYanSQL-QwenCoder-3B-2502/)をお勧めします。
223+
以下のコマンドでモデルを手動でダウンロードできます:
224+
```bash
225+
modelscope download --model XGenerationLab/XiYanSQL-QwenCoder-3B-2502
226+
```
227+
6GBのディスクスペースが必要です。
228+
229+
ステップ3:スクリプトをダウンロードしてサーバーを実行します。ファイルsrc/xiyan_mcp_server/local_xiyan_server.py
230+
231+
```bash
232+
python local_xiyan_server.py
233+
```
234+
サーバーはhttp://localhost:5090/で実行されます。
235+
236+
ステップ4:設定を準備してxiyan_mcp_serverを実行
237+
config.ymlは以下のようになります:
238+
```yaml
239+
model:
240+
name: "xiyansql-qwencoder-3b"
241+
key: "KEY"
242+
url: "http://127.0.0.1:5090"
243+
```
244+
245+
これでローカルモードの準備が整いました。
246+
247+
### データベース設定
248+
``host````port````user````password````database``はデータベースの接続情報です。
249+
250+
ローカルまたは任意のリモートデータベースを使用できます。現在、MySQLとPostgreSQLをサポートしています(他の方言も近日中にサポート予定)。
251+
252+
#### MySQL
253+
254+
```yaml
255+
database:
256+
host: "localhost"
257+
port: 3306
258+
user: "root"
259+
password: ""
260+
database: ""
261+
```
262+
#### PostgreSQL
263+
ステップ1:Pythonパッケージをインストール
264+
```bash
265+
pip install psycopg2
266+
```
267+
ステップ2:config.ymlを以下のように準備します:
268+
```yaml
269+
database:
270+
dialect: "postgresql"
271+
host: "localhost"
272+
port: 5432
273+
user: ""
274+
password: ""
275+
database: ""
276+
```
277+
278+
注意:PostgreSQLの場合、``dialect````postgresql``である必要があります。
279+
280+
## 起動
281+
### Claude Desktop
282+
Claude Desktopの設定ファイルに以下を追加します。<a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/claude_desktop.jpg">Claude Desktop設定例</a>を参照
283+
```json
284+
{
285+
"mcpServers": {
286+
"xiyan-mcp-server": {
287+
"command": "python",
288+
"args": [
289+
"-m",
290+
"xiyan_mcp_server"
291+
],
292+
"env": {
293+
"YML": "PATH/TO/YML"
294+
}
295+
}
296+
}
297+
}
298+
```
299+
### Cline
300+
[Claude Desktop](#claude-desktop)の設定を準備
301+
302+
### Goose
303+
設定に以下のコマンドを追加します。<a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/goose.jpg">Goose設定例</a>を参照
304+
305+
```yaml
306+
env YML=path/to/yml python -m xiyan_mcp_server
307+
```
308+
### Cursor
309+
[Goose](#goose)と同じコマンドを使用
310+
311+
### Witsy
312+
コマンドに以下を追加:
313+
```yaml
314+
python -m xiyan_mcp_server
315+
```
316+
環境変数を追加:キーはYML、値はymlファイルのパス。
317+
<a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/witsy.jpg">Witsy設定例</a>を参照
318+
319+
## 動作しない場合
320+
お問い合わせ:
321+
<a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png">Ding Group</a> |
322+
<a href="https://weibo.com/u/2540915670" target="_blank">Weiboでフォロー</a>
323+
324+
## 引用
325+
私たちの仕事が役立つと思われる場合は、自由に引用してください。
326+
```bib
327+
@article{xiyansql,
328+
title={A Preview of XiYan-SQL: A Multi-Generator Ensemble Framework for Text-to-SQL},
329+
author={Yingqi Gao and Yifu Liu and Xiaoxia Li and Xiaorong Shi and Yin Zhu and Yiming Wang and Shiqi Li and Wei Li and Yuntao Hong and Zhiling Luo and Jinyang Gao and Liyu Mou and Yu Li},
330+
year={2024},
331+
journal={arXiv preprint arXiv:2411.08599},
332+
url={https://arxiv.org/abs/2411.08599},
333+
primaryClass={cs.AI}
334+
}
335+
```

README_zh.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<img src="https://img.shields.io/github/stars/XGenerationLab/xiyan_mcp_server?style=social" alt="GitHub stars" />
2929
</a>
3030
<br />
31-
<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><br />
31+
<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> | <a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/README_ja.md">日本語</a><br />
3232
<a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png">钉钉群</a> |
3333
<a href="https://weibo.com/u/2540915670" target="_blank">关注我</a>
3434
</p>
@@ -333,4 +333,4 @@ python -m xiyan_mcp_server
333333
url={https://arxiv.org/abs/2411.08599},
334334
primaryClass={cs.AI}
335335
}
336-
```
336+
```

0 commit comments

Comments
 (0)