XiYan

XiYan

MCP server enabling natural language queries to databases using XiYanSQL.

218
Stars
44
Forks
6
Releases

Overview

XiYan MCP Server is an MCP server that enables natural language queries to databases, powered by XiYanSQL, a state-of-the-art text-to-SQL model. It supports fetching data from databases by translating natural language into SQL queries via a built-in NL-to-SQL engine and returning results. The server offers two integration modes: remote mode (default) which requires an API key to access the xiyanSQL-qwencoder-32B-2412 model (Modelscope) or equivalent services, and local mode which runs entirely on your own infrastructure for higher security. It supports multiple LLM options, including general LLMs (GPT, qwenmax), and a SOTA text-to-SQL model XiYanSQL-QwenCoder-32B-2412 accessible via Modelscope, or Alibaba Cloud DashScope; local models are also supported. Database support currently includes MySQL and PostgreSQL, with configuration for host, port, user, password, and database, and dialect handling (PostgreSQL uses dialect: "postgresql"). The YAML config can specify mcp transport (stdio or SSE), model details (name, key, url), and database connection info. Launching via SSE is demonstrated with a command like: YML=path/to/yml python -m xiyan_mcp_server, and stdio-based usage is supported for MCP-integrations. The server exposes tooling and resources such as get_data to NL-query a database and functions like dialect://{table_name} to preview data or list databases.

Details

Owner
XGenerationLab
Language
Python
License
Apache License 2.0
Updated
2025-12-07

Features

NL-based data retrieval via XiYanSQL

Fetch data from databases using natural language queries with XiYanSQL as the text-to-SQL engine.

Supports multiple LLMs and SOTA text-to-SQL model

Supports general LLMs (GPT, qwenmax) and XiYanSQL-QwenCoder-32B-2412 via Modelscope or Dashscope, including local options.

Local mode for high security

Pure local mode that does not require API keys for operation.

Database dialect support (MySQL & PostgreSQL)

Configures connections for MySQL and PostgreSQL and uses dialect-specific settings (postgresql for PostgreSQL).

Resource discovery and data preview

List available tables as resources and preview data via dialect://{table_name} and similar resources.

Two integration modes: Remote and Local

Architecture supports remote mode with API-backed NL-to-SQL and local mode for secure, self-contained use.

Configurable via YAML with transport options

Configure mcp transport (stdio or SSE), model, and database in YAML; includes example defaults and launch commands.

Data tooling for NL queries

Includes a get_data tool to translate NL to SQL and execute queries, returning results.

Tags

natural language queriesdatabaseMCP Servertext-to-SQLXiYanSQLMySQLPostgreSQLlocal modeSSEstdioModelScopeDashScope