- Home
- MCP servers
- MySQL
MySQL
- typescript
0
GitHub Stars
typescript
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can securely connect Claude AI assistants to your MySQL data using the MCP protocol. This server lets Claude Desktop and Claude Code run SQL queries, explore databases, and interact with your MySQL data through a permission-controlled, scalable interface.
How to use
Set up your MCP server and connect Claude to your MySQL instances. Once configured, you can ask Claude to run queries, browse databases, and switch between databases using natural language. Claude will generate SQL, validate permissions, execute queries safely, and return structured results.
How to install
# Prerequisites: ensure you have Node.js and npm installed
node -v
npm -v
# Install the MCP server globally for easy access
npm install -g mysql-mcp-webui
# Or run directly without installation
npx mysql-mcp-webui
Configuration and usage notes
Two primary workflows exist: running the server locally for desktop usage and using HTTP mode for Claude Code or remote access. Start the server in the mode you prefer, then connect your Claude clients with the appropriate configuration. The Web UI is available after the server starts, typically at http://localhost:9274.
# 1) Standard, local development (stdio mode) via Claude Desktop
# This starts the MCP server as a local subprocess
TRANSPORT=stdio AUTH_TOKEN=YOUR_TOKEN HTTP_PORT=9274 npx -y mysql-mcp-webui
# 2) Remote/Code usage (HTTP mode) with direct URL
TRANSPORT=http npx -y mysql-mcp-webui
HTTP and STDIO configurations you can use
Use these examples to configure Claude Code or Claude Desktop. The HTTP mode exposes a MCP endpoint and a REST API on a shared port, while STDIO mode runs as a local process managed by Claude.
# HTTP mode configuration for Claude Code
{
"mcpServers": {
"mysql": {
"type": "http",
"url": "http://localhost:9274/mcp",
"headers": {
"Authorization": "Bearer your-api-key-here"
}
}
}
}
# STDIO mode configuration for Claude Desktop (local)
{
"mcpServers": {
"mysql": {
"command": "npx",
"args": ["-y", "mysql-mcp-webui"],
"env": {
"TRANSPORT": "stdio",
"AUTH_TOKEN": "your-token-here",
"HTTP_PORT": "9274"
}
}
}
}
The four MCP tools to understand
Claude can use four core tools to interact with your MySQL data. Each tool is designed to perform a common data operation while enforcing your permissions.
Security and permissions
Define granular permissions per database to control what Claude can do. Start with SELECT for read-only access in production, then grant additional permissions as needed. All actions are validated against your permission rules and logged for auditing.
Troubleshooting
If the MCP server fails to start or Claude cannot connect, check token generation and placement, validate the JSON configuration, and ensure the server is accessible on the expected port. Restart Claude Desktop or Claude Code after making changes."
Advanced notes
You can run multiple instances with isolated state in HTTP mode, or run several stdio instances on the same host. Use the Web UI to manage connections, databases, and user permissions, and enable HTTPS for remote access in production.
What to do next
Generate an API token, configure Claude to point at your MCP endpoint, then start exploring your databases with natural language queries. You can discover databases, switch between them, and run secure SQL queries through Claude.
Available tools
mysql_query
Execute SQL queries with permission checks and transactional safety. Claude generates SQL, runs it against your active connection, and returns results.
list_databases
List configured databases with their permissions and metadata to help you explore available data sources.
switch_database
Switch the active database within a connected MySQL instance, updating future queries to target the selected database.
add_connection
Create a new MySQL connection programmatically, discover databases, and apply default permissions.