A Model Context Protocol (MCP) server that enables natural language queries to databases
https://github.com/XGenerationLab/xiyan_mcp_serverStop wrestling with ChatGPT's inconsistent SQL generation. XiYan MCP Server brings state-of-the-art text-to-SQL directly into your development workflow, powered by purpose-built models that actually understand your database schema.
You've tried getting LLMs to write SQL. Sometimes it works brilliantly, other times it hallucinates table names or completely misunderstands your intent. Generic models weren't built for the precision that database queries demand—they're great at conversation, terrible at generating reliable, executable SQL.
XiYan solves this with XiYanSQL-QwenCoder-32B, a specialized model that leads text-to-SQL benchmarks. Instead of hoping GPT-4 remembers your schema correctly, you get a model trained specifically for database interactions.
Purpose-Built for Databases: While other MCP servers adapt general LLMs for database work, XiYan uses models designed from the ground up for text-to-SQL conversion. The results speak for themselves—it outperforms standard MySQL and PostgreSQL MCP servers by 2-22 percentage points on MCPBench.
Security-First Architecture: Run everything locally if needed. No API keys, no external calls, no data leaving your infrastructure. Perfect for enterprise environments where database queries touching external services are non-starters.
Multiple Deployment Options:
Instant Schema Understanding: Point XiYan at your database and ask questions like "Show me users who haven't logged in this month" or "What's our revenue breakdown by product category?" It understands your actual table structure, relationships, and data types.
Natural Language Exploration: Instead of memorizing column names and writing JOIN statements, explore your data conversationally. "Which customers have the highest lifetime value?" becomes a simple conversation, not a complex SQL archaeology project.
Reliable Results: Because XiYan uses specialized models, you get consistent, executable SQL. No more debugging hallucinated table names or malformed queries.
XiYan plugs into your existing MCP workflow:
Setup is straightforward—configure your database connection and model preferences in a YAML file, then XiYan handles the text-to-SQL translation automatically.
Currently supports MySQL and PostgreSQL with more dialects coming. Whether you're working with a local development database or production PostgreSQL cluster, XiYan adapts to your existing infrastructure.
Perfect for: Teams that need reliable database querying through natural language, data analysts who want conversational database exploration, developers building AI applications that need consistent SQL generation.
Skip if: You're only doing basic SELECT statements occasionally, or you need databases beyond MySQL/PostgreSQL right now.
pip install xiyan-mcp-serverconfig.ymlThe XiYan team has already done the hard work of training specialized text-to-SQL models and benchmarking them against real-world scenarios. You get to skip the model fine-tuning and prompt engineering—just point it at your database and start querying naturally.
Your databases have stories to tell. XiYan gives you the right language to ask the questions.