
How to add XiYan MCP Server to Claude Desktop
Natural-language queries to MySQL/PostgreSQL via XiYanSQL text-to-SQL Paste the config into ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude Desktop.
Last updated June 14, 2026 ยท 236โ ยท stdio ยท apikey ยท official
Claude Desktop config for XiYan MCP Server
pip install xiyan-mcp-server{
"mcpServers": {
"xiyan-mcp-server": {
"command": "/xxx/python",
"args": [
"-m",
"xiyan_mcp_server"
],
"env": {
"YML": "PATH/TO/YML"
}
}
}
}Setup steps
- 1Open Claude Desktop โ Settings โ Developer โ Edit Config (this opens ~/Library/Application Support/Claude/claude_desktop_config.json).
- 2Paste the XiYan MCP Server config below under the top-level "mcpServers" key.
- 3Fill in any placeholder secrets (API keys, paths) in the snippet.
- 4Save the file, then fully quit and reopen Claude Desktop.
- 5Open a chat and confirm XiYan MCP Server's tools appear under the ๐ tools menu.
Before you start
- Python 3.11+
- A YAML config file (referenced via the YML env var) with model and database settings
- A MySQL or PostgreSQL database
- For PostgreSQL: pip install psycopg2
- For remote model mode: an API key from the model service provider (e.g. Modelscope, OpenAI, Alibaba Cloud DashScope)
What XiYan MCP Server can do in Claude Desktop
get_dataProvides a natural language interface for retrieving data from a database. Converts the input natural language into SQL using a built-in/configured model and calls the database to return the query results.
Security
Configuration (including database credentials and the model API key) lives in a YAML file referenced by the YML env var. The default remote mode sends database schema/sample data to the configured model service provider and requires an API key. A pure local model mode is available for higher security and needs no API key. The Claude Desktop / Cursor config requires the full absolute path to the Python executable (e.g. from `which python`).
XiYan MCP Server + Claude Desktop FAQ
Where is the Claude Desktop config file?
Claude Desktop reads MCP servers from ~/Library/Application Support/Claude/claude_desktop_config.json. Paste the XiYan MCP Server config there under the "mcpServers" key and restart the client.
Is XiYan MCP Server safe to use with Claude Desktop?
Configuration (including database credentials and the model API key) lives in a YAML file referenced by the YML env var. The default remote mode sends database schema/sample data to the configured model service provider and requires an API key. A pure local model mode is available for higher security and needs no API key. The Claude Desktop / Cursor config requires the full absolute path to the Python executable (e.g. from `which python`).
Which databases are supported?
MySQL and PostgreSQL. For PostgreSQL you must install psycopg2 and set dialect: "postgresql" in the YAML config. More dialects are planned.
Do I need an API key?
In the default remote mode you need an API key for the model service provider (e.g. Modelscope, OpenAI, or Alibaba Cloud DashScope). In pure local mode you deploy the model on your own server and no API key is required.
Which transports are supported?
stdio (default) and sse. The sse server runs on port 8000 by default (e.g. http://localhost:8000/sse). Note that Claude Desktop does not support the SSE transport.