MCP MySQL 本地数据库服务
Overview
MCP MySQL is a lightweight personal service program designed to connect and operate a local MySQL database. It serves as an MCP service for Cursor, allowing easy execution of various database operations through an API interface.
To use MCP MySQL, clone the repository, install dependencies, configure the .env file with your database credentials, and run the service using Node.js.
- Connects to local MySQL databases - Provides a RESTful API for database operations - Supports parameterized queries to prevent SQL injection - Supports Server-Sent Events (SSE) for real-time updates - Integrates as an MCP service for Cursor
- Managing local MySQL databases for personal projects
- Executing SQL queries through a simple API
- Real-time data updates using SSE
Add to your AI client
Use these steps to connect MCP MySQL 本地数据库服务 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": {
"mcp-server-mysql-windows-tristanlib": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-windows-tristanlib"
]
}
}
}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": {
"mcp-server-mysql-windows-tristanlib": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-windows-tristanlib"
]
}
}
}Claude Code
Add this to your project's .mcp.json file. Claude Code will detect it automatically.
.mcp.json (project root)
{
"mcpServers": {
"mcp-server-mysql-windows-tristanlib": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-windows-tristanlib"
]
}
}
}VS Code (Copilot)
Add this to your .vscode/mcp.json file. Requires the GitHub Copilot extension with MCP support enabled.
.vscode/mcp.json
{
"servers": {
"mcp-server-mysql-windows-tristanlib": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-windows-tristanlib"
]
}
}
}Windsurf
Add this to your Windsurf MCP config file, then restart Windsurf.
~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"mcp-server-mysql-windows-tristanlib": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-windows-tristanlib"
]
}
}
}Cline
Open Cline settings, navigate to MCP Servers, and add this server configuration.
Cline MCP Settings (via UI)
{
"mcpServers": {
"mcp-server-mysql-windows-tristanlib": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-mcp-server-mysql-windows-tristanlib"
]
}
}
}FAQ
Is MCP MySQL suitable for production use?
No, it is designed for local use only and should not be exposed to the public internet.
How do I secure my API?
Use an API key to protect your endpoints and limit access to SELECT queries only.
What are the prerequisites for using MCP MySQL?
You need Node.js (v14+) and a MySQL server installed.