XiYan

v1.0.0โ€ขDatabasesโ€ขstable

๐Ÿ“‡ โ˜๏ธ โ€” An MCP server that supports fetching data from a database using natural language queries, powered by XiyanSQL as the text-to-SQL LLM.

databasemcptext-to-sql
Share:
236
Stars
0
Downloads
0
Weekly
0/5

What is XiYan?

XiYan is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐Ÿ“‡ โ˜๏ธ โ€” an mcp server that supports fetching data from a database using natural language queries, powered by xiyansql as the text-to-sql llm.

๐Ÿ“‡ โ˜๏ธ โ€” An MCP server that supports fetching data from a database using natural language queries, powered by XiyanSQL as the text-to-SQL LLM.

This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • ๐Ÿ“‡ โ˜๏ธ โ€” An MCP server that supports fetching data from a data

Use Cases

Convert natural language to SQL queries
Query databases with text-to-SQL
Enable database access without SQL knowledge
XGenerationLab

Maintainer

LicenseApache 2.0
Languagepython
Versionv1.0.0
UpdatedMay 18, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx xiyan-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use XiYan

XiYan MCP Server lets AI assistants query MySQL and PostgreSQL databases using plain natural language, powered by XiYanSQL, the state-of-the-art text-to-SQL model that ranks at the top of the BIRD benchmark. The server converts a natural language question into a SQL query, executes it against your configured database, and returns the results โ€” without requiring the user to know SQL. Data analysts, business users, and developers who want conversational database access without exposing query syntax use this server in Claude Desktop, Cursor, Cline, or Goose.

Prerequisites

  • Python 3.11 or higher
  • pip or uv package manager
  • A running MySQL or PostgreSQL database accessible from your machine
  • An API key for a supported LLM (Modelscope, Alibaba DashScope, or OpenAI-compatible endpoint) or a locally running XiYanSQL model
  • An MCP-capable client such as Claude Desktop, Cursor, Cline, or Goose
1

Install the package from PyPI

Install xiyan-mcp-server into your Python environment. Python 3.11+ is required.

pip install xiyan-mcp-server
2

Create the YAML configuration file

Copy the demo config and fill in your LLM credentials and database connection details. The model name, key, and url select which text-to-SQL backend to use.

cat config_demo.yml
3

Configure the YAML with your credentials

Edit the config file with your actual values. Using the Modelscope-hosted XiYanSQL-QwenCoder-32B model gives the best accuracy. Set database.host, port, user, password, and database to match your setup.

mcp:
  transport: "stdio"
model:
  name: "XGenerationLab/XiYanSQL-QwenCoder-32B-2412"
  key: "YOUR_MODELSCOPE_API_KEY"
  url: "https://api-inference.modelscope.cn/v1/"
database:
  host: "localhost"
  port: 3306
  user: "root"
  password: "your_password"
  database: "your_database_name"
4

Add to Claude Desktop configuration

Open ~/Library/Application Support/Claude/claude_desktop_config.json and add a mcpServers entry that launches the server with your config file.

{
  "mcpServers": {
    "xiyan-mcp": {
      "command": "python",
      "args": ["-m", "xiyan_mcp_server", "--config", "/path/to/your/config.yml"]
    }
  }
}
5

Verify table resources are visible

The server exposes your database tables as MCP resources using the pattern mysql://table_name or postgresql://table_name. Ask your AI assistant to list available tables to confirm the connection is working.

6

Query data with natural language

Use the get_data tool by asking questions in plain language. The server translates your question to SQL using XiYanSQL, executes it, and returns results.

XiYan Examples

Claude Desktop configuration

MCP config block using the installed xiyan_mcp_server module with a local YAML config file.

{
  "mcpServers": {
    "xiyan-mcp": {
      "command": "python",
      "args": ["-m", "xiyan_mcp_server", "--config", "/Users/you/xiyan/config.yml"]
    }
  }
}

Prompts to try

Example natural language queries that the server converts to SQL and executes against your database.

- "Show me the top 10 customers by total order value this year"
- "How many new users signed up each month in 2025?"
- "Which products have inventory below 50 units?"
- "List all orders that haven't shipped yet, sorted by order date"
- "What is the average session duration by country last week?"

Troubleshooting XiYan

Connection refused when the server tries to reach the database

Verify that host, port, user, password, and database in your YAML config match your actual database. For MySQL the default port is 3306; for PostgreSQL it is 5432. Ensure the database user has SELECT privileges.

Model API key error or 401 Unauthorized from the LLM endpoint

Check that the 'key' field in config.yml is a valid API key for the chosen provider. For Modelscope, generate a key at modelscope.cn. For OpenAI-compatible endpoints, ensure the 'url' matches the provider's base URL exactly.

Generated SQL returns wrong results or fails to execute

The XiYanSQL model performs best when table and column names are descriptive. If results are inaccurate, try rephrasing with column names that match your schema, or switch from a general LLM (gpt-3.5-turbo) to the specialist XiYanSQL-QwenCoder-32B model.

Frequently Asked Questions about XiYan

What is XiYan?

XiYan is a Model Context Protocol (MCP) server that ๐Ÿ“‡ โ˜๏ธ โ€” an mcp server that supports fetching data from a database using natural language queries, powered by xiyansql as the text-to-sql llm. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install XiYan?

Follow the installation instructions on the XiYan GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with XiYan?

XiYan works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is XiYan free to use?

Yes, XiYan is open source and available under the Apache 2.0 license. You can use it freely in both personal and commercial projects.

Browse More Databases MCP Servers

Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "xiyan-mcp-server": { "command": "npx", "args": ["-y", "xiyan-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

Ready to use XiYan?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides