XiYan MCP Server

Official

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Enables natural language queries to MySQL databases, allowing users to fetch data, list available tables, and read table contents using natural language commands, powered by XiYanSQL text-to-SQL technology.

  • Supports use of OpenAI models like GPT-3.5-turbo for processing natural language queries to SQL databases, configurable through the server settings.

XiYan MCP Server

A Model Context Protocol (MCP) server that enables natural language queries to MySQL databases, power by XiYanSQL(https://github.com/XGenerationLab/XiYan-SQL) as text-to-sql technique.

Features

Installation

Python 3.11+ is required. you can install the server by a pre-release verion

pip install xiyan_mcp_server-0.1.0-py3-none-any.whl

After that you can directly run the server by:

python -m xiyan_mcp_server

But it does not provide any functions until you complete following config. You will get a yml file. After that you can run the server by:

env YML=path/to/yml python -m xiyan_mcp_server

Configuration

You need a yml config file to configure the server. a default config file is provided in config_demo.yml which looks like this:

model: name: "pre-xiyan_multi_dialect_v3" key: "" url: "https://poc-dashscope.aliyuncs.com/compatible-mode/v1" database: host: "localhost" port: 3306 user: "root" password: "" database: ""

About LLM

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.

Using general LLMs

if you want to use the general LLMs, e.g. gpt3.5, you can directly config like this:

model: name: "gpt-3.5-turbo" key: "YOUR KEY " url: "https://api.openai.com/v1/chat/completions" database:

if you want to use Qwen from alibaba, e.g. Qwen-max,

model: name: "qwen-max" key: "YOUR KEY " url: "https://dashscope.aliyuncs.com/compatible-mode/v1" database:

Using Text-to-SQL SOTA model

Last, we recommend the XiYanSQL-qwencoder-32B (https://github.com/XGenerationLab/XiYanSQL-QwenCoder), which is the SOTA model in text-to-sql. We deployed the model on DashScope, so you need to set the following environment variables: Contact us to get the key.

model: name: "pre-xiyan_multi_dialect_v3" key: "KEY" url: "https://poc-dashscope.aliyuncs.com/compatible-mode/v1" database:

Local LLMs

To support in the future.

About the database

host, port, user, password, database are the connection information of the MySQL database.

You can use local or any remote databases. Currently we support MySQL (more dialects soon)

database: host: "localhost" port: 3306 user: "root" password: "" database: ""

Citation

If you find our work helpful, feel free to give us a cite.

@article{xiyansql, title={A Preview of XiYan-SQL: A Multi-Generator Ensemble Framework for Text-to-SQL}, 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}, year={2024}, journal={arXiv preprint arXiv:2411.08599}, url={https://arxiv.org/abs/2411.08599}, primaryClass={cs.AI} }
-
security - not tested
F
license - not found
-
quality - not tested

A Model Context Protocol server that enables natural language queries to MySQL databases, powered by XiYanSQL text-to-SQL technology.

  1. Features
    1. Installation
      1. Configuration
        1. About LLM
          1. Using general LLMs
            1. Using Text-to-SQL SOTA model
              1. Local LLMs
              2. About the database
              3. Citation