mysql-mcp
Provides readonly access to MySQL databases, allowing listing tables, describing table structures, executing SELECT queries, showing databases, and switching databases.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mysql-mcplist tables on the production server"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MySQL MCP Server
A Model Context Protocol (MCP) server that provides readonly MySQL database operations for AI agents with support for multiple database servers.
Features
list_servers: Show all configured MySQL servers
list_tables: List all tables in the database
describe_table: Show table structure and column information
query: Execute SELECT queries (readonly only)
show_databases: List available databases
use_database: Switch to a different database on a server
Related MCP server: MCP MySQL Server
Installation
For detailed installation instructions, see INSTALLATION.md
From npm (once published)
npm install -g @your-username/mysql-mcpFrom source
git clone <repository-url>
cd mysql-mcp
npm installConfiguration
Option 1: Multiple Servers (Recommended)
Configure multiple MySQL servers using a JSON environment variable MYSQL_SERVERS:
{
"production": {
"host": "prod.example.com",
"port": 3306,
"user": "prod_user",
"password": "prod_password",
"database": "prod_db"
},
"staging": {
"host": "staging.example.com",
"port": 3306,
"user": "staging_user",
"password": "staging_password",
"database": "staging_db"
},
"local": {
"host": "localhost",
"port": 3306,
"user": "root",
"password": "local_password",
"database": "test_db"
}
}Option 2: Single Server (Backward Compatible)
Copy .env.example to .env and configure your MySQL connection:
cp .env.example .envSet the following environment variables:
MYSQL_HOST: MySQL server host (default: localhost)MYSQL_PORT: MySQL server port (default: 3306)MYSQL_USER: MySQL username (default: root)MYSQL_PASSWORD: MySQL passwordMYSQL_DATABASE: Database name to connect to
Usage with Claude Desktop
Multiple Servers Configuration
If installed from npm:
{
"mcpServers": {
"mysql": {
"command": "mysql-mcp",
"env": {
"MYSQL_SERVERS": "{\"production\":{\"host\":\"prod.example.com\",\"port\":3306,\"user\":\"prod_user\",\"password\":\"prod_password\",\"database\":\"prod_db\"},\"staging\":{\"host\":\"staging.example.com\",\"port\":3306,\"user\":\"staging_user\",\"password\":\"staging_password\",\"database\":\"staging_db\"}}"
}
}
}
}If running from source:
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["path/to/mysql-mcp/server.js"],
"env": {
"MYSQL_SERVERS": "{\"production\":{\"host\":\"prod.example.com\",\"port\":3306,\"user\":\"prod_user\",\"password\":\"prod_password\",\"database\":\"prod_db\"},\"staging\":{\"host\":\"staging.example.com\",\"port\":3306,\"user\":\"staging_user\",\"password\":\"staging_password\",\"database\":\"staging_db\"}}"
}
}
}
}Single Server Configuration
{
"mcpServers": {
"mysql": {
"command": "node",
"args": ["path/to/mysql-mcp/server.js"],
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_username",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}Using Multiple Servers
When multiple servers are configured, all tools accept an optional server parameter:
// List tables from production server
await list_tables({ server: "production" })
// Query staging server
await query({
sql: "SELECT * FROM users LIMIT 10",
server: "staging"
})
// Describe table on local server
await describe_table({
table_name: "products",
server: "local"
})
// If no server is specified, "default" is used
await list_tables() // Uses "default" serverSecurity
This server only allows readonly operations (SELECT, SHOW, DESCRIBE) for safety. All other SQL operations are blocked.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenanceProvides read-only access to MySQL databases with automatic schema discovery and secure query execution. Enables users to explore database structure and execute SELECT queries through natural language interactions.Last updatedMIT
- Alicense-qualityDmaintenanceEnables AI assistants to safely query MySQL databases with read-only access by default, supporting table listing, structure inspection, and SQL queries with optional write operation control.Last updated33MIT
- Alicense-qualityDmaintenanceProvides AI assistants with secure read-only access to MySQL databases through validated SELECT queries. Supports SSL/TLS connections and implements multiple security layers to prevent data modification.Last updated5953MIT
- AlicenseAqualityBmaintenanceEnables AI assistants to inspect and query a MySQL database through safe, structured tools, including schema discovery and read-only queries.Last updated9104MIT
Related MCP Connectors
Read-only MCP server for Muovi, Argentina's trust-first local services marketplace (6 tools).
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/saturnino-adrales/mysql-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server