Labsco
XGenerationLab logo

XiYan MCP Server

β˜… 237

from XGenerationLab

A server that enables natural language queries to databases using XiyanSQL.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeQuick setup
<h1 align="center">XiYan MCP Server</h1> <p align="center"> <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> </p> <p align="center"> <b>A Model Context Protocol (MCP) server that enables natural language queries to databases</b><br/> <sub>powered by <a href="https://github.com/XGenerationLab/XiYan-SQL" >XiYan-SQL</a>, SOTA of text-to-sql on open benchmarks</sub> </p> <p align="center"> πŸ’» <a href="https://github.com/XGenerationLab/xiyan_mcp_server" >XiYan-mcp-server</a> | 🌐 <a href="https://github.com/XGenerationLab/XiYan-SQL" >XiYan-SQL</a> | πŸ“– <a href="https://arxiv.org/abs/2507.04701"> Arxiv</a> | πŸ† <a href="https://github.com/XGenerationLab/XiYanSQL-QwenCoder" >XiYanSQL Model</a> | πŸ“„ <a href="https://paperswithcode.com/paper/xiyan-sql-a-multi-generator-ensemble" >PapersWithCode</a> πŸ€— <a href="https://huggingface.co/collections/XGenerationLab/xiyansql-models-67c9844307b49f87436808fc">HuggingFace</a> | πŸ€– <a href="https://modelscope.cn/collections/XiYanSQL-Models-4483337b614241" >ModelScope</a> | πŸŒ• <a href="https://bailian.console.aliyun.com/xiyan">ζžθ¨€GBI</a> <br /> <img src="https://badge.mcpx.dev/?type=server%20%27MCP%20Server%27" alt="MCP Server" /> <a href="https://arxiv.org/abs/2411.08599"><img src="imgs/Paper-Arxiv-orange.svg" ></a> <a href="https://opensource.org/licenses/Apache-2.0"> <img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License: Apache 2.0" /> </a> <a href="https://pepy.tech/projects/xiyan-mcp-server"><img src="https://static.pepy.tech/badge/xiyan-mcp-server" alt="PyPI Downloads"></a>

Trust Score <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> <a href="https://github.com/XGenerationLab/xiyan_mcp_server" target="_blank"> <img src="https://img.shields.io/github/stars/XGenerationLab/xiyan_mcp_server?style=social" alt="GitHub stars" /> </a> <br /> <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 /> <a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png">Ding Groupι’‰ι’‰ηΎ€</a>| <a href="https://weibo.com/u/2540915670" target="_blank">Follow me on Weibo</a>

</p>

Table of Contents

Features

  • 🌐 Fetch data by natural language through XiYanSQL
  • πŸ€– Support general LLMs (GPT,qwenmax), Text-to-SQL SOTA model
  • πŸ’» Support pure local mode (high security!)
  • πŸ“ Support MySQL and PostgreSQL.
  • πŸ–±οΈ List available tables as resources
  • πŸ”§ Read table contents

Preview

Architecture

There are two ways to integrate this server in your project, as shown below: The left is remote mode, which is the default mode. It requires an API key to access the xiyanSQL-qwencoder-32B model from service provider (see Configuration). Another mode is local mode, which is more secure. It does not require the API key.

architecture.png

Best practice and reports

"Build a local data assistant using MCP + Modelscope API-Inference without writing a single line of code"

"Xiyan MCP on Modelscope"

Evaluation on MCPBench

The following figure illustrates the performance of the XiYan MCP server as measured by the MCPBench benchmark. The XiYan MCP server demonstrates superior performance compared to both the MySQL MCP server and the PostgreSQL MCP server, achieving a lead of 2-22 percentage points. The detailed experiment results can be found at MCPBench and the report "Evaluation Report on MCP Servers".

exp_mcpbench.png

Tools Preview

  • The tool get_data provides a natural language interface for retrieving data from a database. This server will convert the input natural language into SQL using a built-in model and call the database to return the query results.

  • The {dialect}://{table_name} resource allows obtaining a portion of sample data from the database for model reference when a specific table_name is specified.

  • The {dialect}:// resource will list the names of the current databases

Launch

Server Launch

If you want to launch server with sse, you have to run the following command in a terminal:

Copy & paste β€” that's it
YML=path/to/yml python -m xiyan_mcp_server

Then you should see the information on http://localhost:8000/sse in your browser. (Defaultly, change if your mcp server runs on other host/port)

Otherwise, if you use stdio transport protocol, you usually declare the mcp server command in specific mcp application instead of launching it in a terminal. However, you can still debug with this command if needed.

Client Setting

Claude Desktop

Add this in your Claude Desktop config file, ref <a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/claude_desktop.jpg">Claude Desktop config example</a>

Copy & paste β€” that's it
{
    "mcpServers": {
        "xiyan-mcp-server": {
            "command": "/xxx/python",
            "args": [
                "-m",
                "xiyan_mcp_server"
            ],
            "env": {
                "YML": "PATH/TO/YML"
            }
        }
    }
}

Please note that the Python command here requires the complete path to the Python executable (/xxx/python); otherwise, the Python interpreter cannot be found. You can determine this path by using the command which python. The same applies to other applications as well.

Claude Desktop currently does not support the SSE transport protocol.

Cline

Prepare the config like Claude Desktop

Goose

If you use stdio, add following command in the config, ref <a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/goose.jpg">Goose config example</a>

Copy & paste β€” that's it
env YML=path/to/yml /xxx/python -m xiyan_mcp_server

Otherwise, if you use sse, change Type to SSE and set the endpoint to http://127.0.0.1:8000/sse

Cursor

Use the similar command as follows.

For stdio:

Copy & paste β€” that's it
{
  "mcpServers": {
    "xiyan-mcp-server": {
      "command": "/xxx/python",
      "args": [
        "-m",
        "xiyan_mcp_server"
      ],
      "env": {
        "YML": "path/to/yml"
      }
    }
  }
}

For sse:

Copy & paste β€” that's it
{
  "mcpServers": {
    "xiyan_mcp_server_1": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Witsy

Add following in command:

Copy & paste β€” that's it
/xxx/python -m xiyan_mcp_server

Add an env: key is YML and value is the path to your yml file. Ref <a href="https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/witsy.jpg">Witsy config example</a>

Contact us:

If you are interested in our research or products, please feel free to contact us.

Contact Information:

Yifu Liu, zhencang.lyf@alibaba-inc.com

Join Our DingTalk Group

<a href="https://github.com/XGenerationLab/XiYan-SQL/blob/main/xiyansql_dingding.png">Ding Groupι’‰ι’‰ηΎ€</a>

Other Related Links

MseeP.ai Security Assessment Badge

Citation

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

Copy & paste β€” that's it
@article{XiYanSQL,
      title={XiYan-SQL: A Novel Multi-Generator Framework For Text-to-SQL}, 
      author={Yifu Liu and Yin Zhu and Yingqi Gao and Zhiling Luo and Xiaoxia Li and Xiaorong Shi and Yuntao Hong and Jinyang Gao and Yu Li and Bolin Ding and Jingren Zhou},
      year={2025},
      eprint={2507.04701},
      archivePrefix={arXiv},
      primaryClass={cs.CL},
      url={https://arxiv.org/abs/2507.04701}, 
}