XiYan MCP Server is an MCP server that enables natural language database querying using the XiYan-SQL model and general large language models. It connects client applications such as Claude Desktop, Cline, Goose, and Cursor directly to relational databases, specifically MySQL and PostgreSQL. Developers, data analysts, and software engineers use this server to inspect database schemas, retrieve table records, and fetch data using plain natural language questions without manually drafting SQL syntax. The server translates conversational input into SQL queries via local or remote model endpoints, executes the statements against the connected database, and returns the query outputs directly to the MCP client. XiYan MCP Server supports both stdio and SSE transport protocols, and it can operate using hosted inference APIs like ModelScope and DashScope, general LLMs like GPT or Qwen, or completely local models for enhanced data isolation and privacy.
Category: Data & Analytics
Tags: database-query, natural-language-query, SQL, xiyansql
shell pip install xiyan-mcp-server Or install from source: shell pip install git+https://github.com/XGenerationLab/xiyan_mcp_server.git 3. Create a YAML configuration file (e.g., config.yml) defining the transport, model, and database parameters: yaml mcp: transport: "stdio" model: name: "XGenerationLab/XiYanSQL-QwenCoder-32B-2412" key: "YOUR_KEY" url: "https://api-inference.modelscope.cn/v1/" database: host: "localhost" port: 3306 user: "root" password: "" database: "" 4. Configure your MCP client (such as Claude Desktop or Cursor) to launch the server pointing to your configuration file, as instructed in the repository documentation at https://github.com/XGenerationLab/xiyan_mcp_server.get_data tool to automatically translate questions into SQL and fetch database records. - Inspecting relational schemas by browsing database names and listing available tables as MCP resources. - Sampling table records using custom URI schemes to provide schema and context references for AI models. - Running offline Text-to-SQL tasks by configuring local model weights to maintain database privacy without external API calls. - Connecting MySQL or PostgreSQL instances to development assistants like Claude Desktop, Cline, and Cursor.Part of MCP Servers
XiYan MCP Server requires Python 3.11 or higher. You can install it directly from PyPI by running pip install xiyan-mcp-server in your terminal. Alternatively, you can install the latest development build from the source repository using pip install git+https://github.com/XGenerationLab/xiyan_mcp_server.git. It can also be added through Smithery.
The server provides tools to convert plain text prompts into structured database queries using XiYanSQL. It executes these queries against connected MySQL or PostgreSQL databases, inspects available tables, retrieves sample records, and returns the resulting data back to your AI client environment.
XiYan MCP Server works with any standard Model Context Protocol client. Supported and documented clients include Claude Desktop, Cline, Goose, and Cursor, communicating through either standard input and output (stdio) or Server-Sent Events (SSE).
The server supports MySQL and PostgreSQL databases. You can configure the database target by providing the host, port, username, password, and database name inside the server's YAML configuration file.
Yes, XiYan MCP Server is open source and licensed under the Apache 2.0 License. Its source code and release information are publicly accessible on GitHub.