XiYan MCP Server
A Model Context Protocol (MCP) server that enables natural language queries to databases
Overview
XiYan MCP Server is a Model Context Protocol (MCP) server that allows users to perform natural language queries on MySQL databases using the XiYanSQL text-to-SQL technique.
To use the XiYan MCP Server, install it via pip, configure the necessary environment variables, and run the server either as a standalone application or integrated with Claude Desktop.
- Fetch data from MySQL databases using natural language queries through XiYanSQL. - List available MySQL tables as resources. - Read and display table contents.
- Simplifying database queries for non-technical users.
- Enabling natural language interactions with MySQL databases.
- Integrating with AI applications for enhanced data retrieval.
Add to your AI client
Use these steps to connect XiYan MCP Server in Cursor, Claude, VS Code, and other MCP-compatible apps. The same JSON appears in the Use with menu above for one-click copy.
Cursor
Add this to your .cursor/mcp.json file in your project root, then restart Cursor.
.cursor/mcp.json
{
"mcpServers": {
"xiyan-mcp-server-xgenerationlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-xiyan-mcp-server-xgenerationlab"
]
}
}
}Claude Desktop
Add this server entry to the mcpServers object in your Claude Desktop config, then restart the app.
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
{
"mcpServers": {
"xiyan-mcp-server-xgenerationlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-xiyan-mcp-server-xgenerationlab"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"xiyan-mcp-server-xgenerationlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-xiyan-mcp-server-xgenerationlab"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"xiyan-mcp-server-xgenerationlab": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-xiyan-mcp-server-xgenerationlab"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"xiyan-mcp-server-xgenerationlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-xiyan-mcp-server-xgenerationlab"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"xiyan-mcp-server-xgenerationlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-xiyan-mcp-server-xgenerationlab"
]
}
}
}FAQ
What databases does XiYan MCP Server support?
It supports MySQL databases.
How do I install XiYan MCP Server?
You can install it using the command: `pip install xiyan-mcp-server`.
Can I use any LLM with XiYan MCP Server?
Yes, any LLM that supports the `chat` API can be used, but it is recommended to use the xiyansql-qwencoder-32b for optimal performance.