
How to add XiYan MCP Server to Cursor
Natural-language queries to MySQL/PostgreSQL via XiYanSQL text-to-SQL Paste the config into ~/.cursor/mcp.json and restart Cursor.
Last updated June 14, 2026 · 236★ · stdio · apikey · official
Cursor 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 Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
- 2Paste the XiYan MCP Server config below into the "mcpServers" object.
- 3Fill in placeholder secrets, then save.
- 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
- 5Ask Cursor to use one of XiYan MCP Server's tools to confirm it's connected.
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 Cursor
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 + Cursor FAQ
Where is the Cursor config file?
Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the XiYan MCP Server config there under the "mcpServers" key and restart the client.
Is XiYan MCP Server safe to use with Cursor?
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.