# xiyan_mcp_server

> xiyan_mcp_server is an open-source MCP server for databases. MCP server that turns natural-language questions into SQL queries on MySQL and PostgreSQL. It is available on CLI, API, Self-hosted, macOS, Windows and Linux.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, Self-hosted, macOS, Windows, Linux
- **Repository:** https://github.com/xgenerationlab/xiyan_mcp_server
- **GitHub stars:** 238
- **License:** Apache-2.0
- **Categories:** [databases](https://ai-powered.com/categories/databases)
- **Listing updated:** 2026-12-01

## About

XiYan MCP Server lets AI clients query a relational database by asking in plain language. It exposes a get_data tool that converts a request into SQL, runs it against the configured MySQL or PostgreSQL database, and returns the rows. Table listings and sample rows are available as resources so the model can see the schema before writing a query.

The conversion step can use a dedicated text-to-SQL model hosted on ModelScope or DashScope, a local model deployed on your own server so no API key is needed, or a general LLM such as GPT or Qwen through its API. Configuration lives in a single YAML file, and the server can run over stdio or SSE.

It suits developers and data teams who want an assistant to answer ad hoc questions over an existing database from Claude Desktop, Cursor, Cline or Goose, without writing SQL by hand.

## Features

- **Natural language querying:** The get_data tool translates a plain-language question into SQL and returns the query results.
- **Table and schema resources:** Database names and sample rows from each table are exposed as resources to guide the model.
- **Multiple LLM backends:** Works with a text-to-SQL model on ModelScope or DashScope, a local model, or general LLMs via API.
- **Fully local mode:** A locally deployed model keeps queries and data on your own server without an external API key.
- **MySQL and PostgreSQL support:** Connects to MySQL or PostgreSQL databases configured through a YAML file.
- **stdio and SSE transports:** Can run as a local process for desktop clients or as an SSE server over the network.

## Good for

- Asking a company database questions in plain English from an AI desktop client
- Building a quick reporting assistant over an existing MySQL or PostgreSQL database
- Letting analysts explore table contents without writing SQL
- Keeping database queries on-premises by running the model locally

## Tools

From the tool list in its README, going by the names, all 1 tool only read data. From the server's own tool labels and tool names; not verified by us.

- `get_data` (name suggests: reads): Converts a natural language request into SQL, runs it on the database and returns the results.

## FAQ

### Which databases are supported?

The server currently supports MySQL and PostgreSQL, with other dialects mentioned as planned.

### Does xiyan_mcp_server need an API key?

Not in local mode, where a model is deployed on your own server. The hosted ModelScope and DashScope options and general LLM APIs require a key.

### How do I install xiyan_mcp_server?

Install with pip install xiyan-mcp-server, which requires Python 3.11 or newer.

### Which AI clients can use xiyan_mcp_server?

The README gives setup examples for Claude Desktop, Cline, Goose, Cursor and Witsy, using stdio or SSE.

### Is xiyan_mcp_server free?

Yes. xiyan_mcp_server is open source, so you can use and self-host it for free.

### What are the best alternatives to xiyan_mcp_server?

The closest alternatives to xiyan_mcp_server are pgmcp, mysql_mcp_server, sql-query-mcp, text2sql and nlqueries.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [pgmcp](https://ai-powered.com/mcp/pgmcp-2): pgmcp is an open-source MCP server for databases.
- [mysql_mcp_server](https://ai-powered.com/mcp/mysql-mcp-server-4): mysql_mcp_server is an open-source MCP server for databases.
- [sql-query-mcp](https://ai-powered.com/mcp/sql-query-mcp): sql-query-mcp is an open-source MCP server for databases.
- [text2sql](https://ai-powered.com/mcp/text2sql-2): text2sql is an open-source MCP server for databases.
- [nlqueries](https://ai-powered.com/mcp/nlqueries): nlqueries is an open-source MCP server for databases.
- [florentine-ai](https://ai-powered.com/mcp/florentine-ai): florentine-ai is a freemium MCP server for databases.
- [MCP Database Server](https://ai-powered.com/mcp/mcp-database-server): MCP Database Server is an open-source MCP server for databases.
- [mcp-server-mysql](https://ai-powered.com/mcp/mcp-server-mysql): mcp-server-mysql is an open-source MCP server for databases.

---
Source: https://ai-powered.com/mcp/xiyan-mcp-server
