{"id":26570845,"url":"https://github.com/XGenerationLab/xiyan_mcp_server","last_synced_at":"2025-03-22T22:19:29.240Z","repository":{"id":282184808,"uuid":"947753431","full_name":"XGenerationLab/xiyan_mcp_server","owner":"XGenerationLab","description":"A Model Context Protocol (MCP) server that enables natural language queries to databases","archived":false,"fork":false,"pushed_at":"2025-03-20T08:41:16.000Z","size":229,"stargazers_count":17,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T08:47:05.732Z","etag":null,"topics":["database","mcp","text-to-sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/XGenerationLab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T07:39:00.000Z","updated_at":"2025-03-20T08:39:31.000Z","dependencies_parsed_at":"2025-03-13T08:42:30.781Z","dependency_job_id":null,"html_url":"https://github.com/XGenerationLab/xiyan_mcp_server","commit_stats":null,"previous_names":["xgenerationlab/xiyan_mcp_server"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XGenerationLab%2Fxiyan_mcp_server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XGenerationLab%2Fxiyan_mcp_server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XGenerationLab%2Fxiyan_mcp_server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XGenerationLab%2Fxiyan_mcp_server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XGenerationLab","download_url":"https://codeload.github.com/XGenerationLab/xiyan_mcp_server/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245026599,"owners_count":20549170,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","mcp","text-to-sql"],"created_at":"2025-03-22T22:19:18.298Z","updated_at":"2025-03-22T22:19:29.222Z","avatar_url":"https://github.com/XGenerationLab.png","language":"Python","readme":"\u003ch1 align=\"center\"\u003eXiYan MCP Server\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/XGenerationLab/XiYan-SQL\"\u003e\u003cimg alt=\"MCP Playwright\" src=\"https://raw.githubusercontent.com/XGenerationLab/XiYan-SQL/main/xiyanGBI.png\" height=\"60\"/\u003e\u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cb\u003eA Model Context Protocol (MCP) server that enables natural language queries to databases\u003c/b\u003e\u003cbr/\u003e\n  \u003csub\u003epowered by \u003ca href=\"https://github.com/XGenerationLab/XiYan-SQL\" \u003eXiYan-SQL\u003c/a\u003e, SOTA of text-to-sql on open benchmarks\u003c/sub\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n💻 \u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server\" \u003eXiYan-mcp-server\u003c/a\u003e | \n🌐 \u003ca href=\"https://github.com/XGenerationLab/https://github.com/XGenerationLab/XiYan-SQL\" \u003eXiYan-SQL\u003c/a\u003e |\n📖 \u003ca href=\"https://arxiv.org/abs/2411.08599\"\u003e Arxiv\u003c/a\u003e | \n📄 \u003ca href=\"https://paperswithcode.com/paper/xiyan-sql-a-multi-generator-ensemble\" \u003ePapersWithCode\u003c/a\u003e\n💻 \u003ca href=\"https://huggingface.co/collections/XGenerationLab/xiyansql-models-67c9844307b49f87436808fc\"\u003eHuggingFace\u003c/a\u003e |\n🤖 \u003ca href=\"https://modelscope.cn/collections/XiYanSQL-Models-4483337b614241\" \u003eModelScope\u003c/a\u003e |\n🌕 \u003ca href=\"https://bailian.console.aliyun.com/xiyan\"\u003e析言GBI\u003c/a\u003e \n\u003cbr /\u003e\n\u003ca href=\"https://opensource.org/licenses/Apache-2.0\"\u003e\n  \u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License: Apache 2.0\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://pepy.tech/projects/xiyan-mcp-server\"\u003e\u003cimg src=\"https://static.pepy.tech/badge/xiyan-mcp-server\" alt=\"PyPI Downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://smithery.ai/server/@XGenerationLab/xiyan_mcp_server\"\u003e\u003cimg alt=\"Smithery Installs\" src=\"https://smithery.ai/badge/@XGenerationLab/xiyan_mcp_server\" height=\"20\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/stars/XGenerationLab/xiyan_mcp_server?style=social\" alt=\"GitHub stars\" /\u003e\n\u003c/a\u003e\n\u003cbr /\u003e\n\u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server\" \u003eEnglish\u003c/a\u003e | \u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/README_zh.md\"\u003e 中文 \u003c/a\u003e\u003cbr /\u003e\n\u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png\"\u003eDing Group钉钉群\u003c/a\u003e｜ \n\u003ca href=\"https://weibo.com/u/2540915670\" target=\"_blank\"\u003eFollow me on Weibo\u003c/a\u003e\n\u003c/p\u003e\n\n\n## Table of Contents\n\n- [Features](#features)\n- [Tool Preview](#tool-preview)\n- [Installation](#installation)\n  - [Installing from pip](#installing-from-pip)\n  - [Installing from Smithery.ai](#installing-from-smitheryai)\n- [Configuration](#configuration)\n  - [LLM Configuration](#llm-configuration)\n    - [General LLMs](#general-llms)\n    - [Text-to-SQL SOTA model](#text-to-sql-sota-model)\n    - [Local Model](#local-model)\n  - [Database Configuration](#database-configuration)\n- [Launch](#launch)\n  - [Claude Desktop](#claude-desktop)\n  - [Cline](#cline)\n  - [Goose](#goose)\n  - [Cursor](#cursor)\n- [It Does Not Work](#it-does-not-work)\n- [Citation](#citation)\n\n\n## Features\n- 🌐 Fetch data by natural language through [XiYanSQL](https://github.com/XGenerationLab/XiYan-SQL)\n- 🤖 Support general LLMs (GPT,qwenmax), Text-to-SQL SOTA model\n- 💻 Support pure local mode (high security!)\n- 🖱️ List available MySQL tables as resources\n- 🔧 Read table contents\n\n## Tool Preview\n - 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.\n\n - The ``mysql://{table_name}`` resource allows obtaining a portion of sample data from the database for model reference when a specific table_name is specified.\n- The ``mysql://`` resource will list the names of the current databases\n\n## Installation\n### Installing from pip\n\nPython 3.11+ is required. \nyou can install the server through pip, and it will install the latest verion\n\n```bash\npip install xiyan-mcp-server\n```\n\nAfter that you can directly run the server by:\n```bash\npython -m xiyan_mcp_server\n```\nBut it does not provide any functions until you complete following config.\nYou will get a yml file. After that you can run the server by:\n```yaml\nenv YML=path/to/yml python -m xiyan_mcp_server\n```\n\n### Installing from Smithery.ai\nSee [@XGenerationLab/xiyan_mcp_server](https://smithery.ai/server/@XGenerationLab/xiyan_mcp_server)\n\nNot fully tested.\n\n## Configuration\n\nYou need a yml config file to configure the server.\na default config file is provided in config_demo.yml which looks like this:\n\n```yaml\nmodel:\n  name: \"XGenerationLab/XiYanSQL-QwenCoder-32B-2412\"\n  key: \"\"\n  url: \"https://api-inference.modelscope.cn/v1/\"\n\ndatabase:\n  host: \"localhost\"\n  port: 3306\n  user: \"root\"\n  password: \"\"\n  database: \"\"\n```\n\n### LLM Configuration\n``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.\n\n| versions | general LLMs(GPT,qwenmax)                                             | SOTA model by Modelscope                   | SOTA model by Dashscope                                   | Local LLMs            |\n|----------|-------------------------------|--------------------------------------------|-----------------------------------------------------------|-----------------------|\n| description| basic, easy to use | best performance, stable, recommand        | best performance, for trial                               | slow, high-security   |\n| name     | the official model name (e.g. gpt-3.5-turbo,qwen-max)                 | XGenerationLab/XiYanSQL-QwenCoder-32B-2412 | xiyansql-qwencoder-32b                                    | xiyansql-qwencoder-3b |\n| key      | the API key of the service provider (e.g. OpenAI, Alibaba Cloud)      | the API key of modelscope                  | the API key via email                                     | \"\"                    |\n| 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 |\n\n#### General LLMs\nif you want to use the general LLMs, e.g. gpt3.5, you can directly config like this:\n```yaml\nmodel:\n  name: \"gpt-3.5-turbo\"\n  key: \"YOUR KEY \"\n  url: \"https://api.openai.com/v1\"\ndatabase:\n```\n\nif you want to use Qwen from alibaba, e.g. Qwen-max, you can use following config.\n```yaml\nmodel:\n  name: \"qwen-max\"\n  key: \"YOUR KEY \"\n  url: \"https://dashscope.aliyuncs.com/compatible-mode/v1\"\ndatabase:\n```\n#### Text-to-SQL SOTA model\nWe recommend the XiYanSQL-qwencoder-32B (https://github.com/XGenerationLab/XiYanSQL-QwenCoder), which is the SOTA model in text-to-sql, see [Bird benchmark](https://bird-bench.github.io/).\nThere are two ways to use the model. You can use either of them.\n(1) [Modelscope](https://www.modelscope.cn/models/XGenerationLab/XiYanSQL-QwenCoder-32B-2412),  (2) Alibaba Cloud DashScope.\n\n\n##### (1) Modelscope version\nYou need to apply a ``key`` of API-inference from Modelscope, https://www.modelscope.cn/docs/model-service/API-Inference/intro\nThen you can use the following config:\n```yaml\nmodel:\n  name: \"XGenerationLab/XiYanSQL-QwenCoder-32B-2412\"\n  key: \"\"\n  url: \"https://api-inference.modelscope.cn/v1/\"\n```\n\nRead our [model description](https://www.modelscope.cn/models/XGenerationLab/XiYanSQL-QwenCoder-32B-2412) for more details. \n\n##### (2) Dashscope version\n\nWe deployed the model on Alibaba Cloud DashScope, so you need to set the following environment variables:\nSend me your email to get the ``key``. ( godot.lzl@alibaba-inc.com )\nIn the email, please attach the following information:\n```yaml\nname: \"YOUR NAME\",\nemail: \"YOUR EMAIL\",\norganization: \"your college or Company or Organization\"\n```\nWe will send you a ``key`` according to your email. And you can fill the ``key`` in the yml file.\nThe ``key`` will be expired by  1 month or 200 queries or other legal restrictions.\n\n\n```yaml\nmodel:\n  name: \"xiyansql-qwencoder-32b\"\n  key: \"KEY\"\n  url: \"https://xiyan-stream.biz.aliyun.com/service/api/xiyan-sql\"\ndatabase:\n```\n\nNote: this model service is just for trial, if you need to use it in production, please contact us.\n\nAlternatively, you can also deploy the model [XiYanSQL-qwencoder-32B](https://github.com/XGenerationLab/XiYanSQL-QwenCoder) on your own server.\n\n#### Local Model\nNote: local model is slow (about 12 seconds per query on my macbook).\nIf your need stable and fast service, we still recommend to use the modelscope version.\n\nTo run xiyan_mcp_server on local mode, you need \n1) a PC/Mac with at least 16GB RAM\n2) 6GB disk space\n\nstep1: Install additional python packages\n```bash\npip install flask modelscope torch==2.2.2 accelerate\u003e=0.26.0 numpy=2.2.3\n```\n\nstep2: (optional) manully download the model\nWe recommand [xiyansql-qwencoder-3b](https://www.modelscope.cn/models/XGenerationLab/XiYanSQL-QwenCoder-3B-2502/).\nYou can manully download the model by\n```bash\nmodelscope download --model XGenerationLab/XiYanSQL-QwenCoder-3B-2502\n```\nIt will take you 6GB disk space.\n\nstep4: download the script and run server. src/xiyan_mcp_server/local_xiyan_server.py\n\n\n\n```bash\npython local_xiyan_server.py\n```\nThe server will be running on http://localhost:5090/\n\nstep4: prepare config and run xiyan_mcp_server\nthe config.yml should be like:\n```yml\nmodel:\n  name: \"xiyansql-qwencoder-3b\"\n  key: \"KEY\"\n  url: \"http://127.0.0.1:5090\"\n```\n\nTil now the local mode is ready.\n\n### Database Configuration\n``host``, ``port``, ``user``, ``password``, ``database`` are the connection information of the MySQL database.\n\nYou can use local or any remote databases. Now we support MySQL (more dialects soon).\n\n\n```yaml\ndatabase:\n  host: \"localhost\"\n  port: 3306\n  user: \"root\"\n  password: \"\"\n  database: \"\"\n```\n\n## Launch\n### Claude desktop\nAdd this in your claude desktop config file, ref \u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/claude_desktop.jpg\"\u003eclaude desktop config example\u003c/a\u003e\n```json\n{\n    \"mcpServers\": {\n        \"xiyan-mcp-server\": {\n            \"command\": \"python\",\n            \"args\": [\n                \"-m\",\n                \"xiyan_mcp_server\"\n            ],\n            \"env\": {\n                \"YML\": \"PATH/TO/YML\"\n            }\n        }\n    }\n}\n```\n### Cline\nprepare the config like [Claude desktop](#claude-desktop)\n\n### Goose\nAdd following command in the config, ref \u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/goose.jpg\"\u003egoose config example\u003c/a\u003e\n\n```yaml\nenv YML=path/to/yml python -m xiyan_mcp_server\n```\n### Cursor\nUse the same command like [Goose](#goose) .\n\n\n### Witsy\nAdd following in command.\n```yaml\npython -m xiyan_mcp_server\n```\nAdd an env: key is YML and value is the path to your yml file.\nRef \u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/witsy.jpg\"\u003ewitsy config example\u003c/a\u003e\n## It does not work!\ncontact us:\n\u003ca href=\"https://github.com/XGenerationLab/xiyan_mcp_server/blob/main/imgs/dinggroup_out.png\"\u003eDing Group钉钉群\u003c/a\u003e｜ \n\u003ca href=\"https://weibo.com/u/2540915670\" target=\"_blank\"\u003eFollow me on Weibo\u003c/a\u003e\n\n\n## Citation\nIf you find our work helpful, feel free to give us a cite.\n```bib\n@article{xiyansql,\n      title={A Preview of XiYan-SQL: A Multi-Generator Ensemble Framework for Text-to-SQL}, \n      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},\n      year={2024},\n      journal={arXiv preprint arXiv:2411.08599},\n      url={https://arxiv.org/abs/2411.08599},\n      primaryClass={cs.AI}\n}\n```\n\n\n","funding_links":[],"categories":["Databases","Uncategorized","Database \u0026 Messaging MCP Servers","📚 Projects (1974 total)","Community Servers","MCP 服务器精选列表","Legend","پیاده‌سازی‌های سرور","🗄️ Database","Python","APIs and HTTP Requests","Table of Contents","🗂️ Extensions by Category"],"sub_categories":["Multi-Database Tools","Uncategorized","MCP Servers","🗄️ 数据库交互","🗄️ \u003ca name=\"databases\"\u003e\u003c/a\u003eDatabases","🗄️ \u003ca name=\"databases\"\u003e\u003c/a\u003eپایگاه‌های داده","Databases","🗄️ Databases"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXGenerationLab%2Fxiyan_mcp_server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FXGenerationLab%2Fxiyan_mcp_server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXGenerationLab%2Fxiyan_mcp_server/lists"}