Local MySQL MCP Server
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| LOG_LEVEL | No | Logging level (debug, info, warn, error). | info |
| MYSQL_HOST | No | The MySQL host. The server refuses to start against non-loopback hosts unless ALLOW_REMOTE_MYSQL=1. | 127.0.0.1 |
| MYSQL_PORT | No | The MySQL port. | 3306 |
| MYSQL_USER | Yes | The MySQL user account. To follow least privilege, use the dedicated read-only 'mcp_readonly' user created by scripts/setup-mysql-user.sql. | |
| MCP_MAX_ROWS | No | Maximum number of rows returned by get_rows. | 1000 |
| MCP_AUDIT_LOG | No | Path to a JSONL audit log file. If empty, audit events go to stderr. | |
| MYSQL_DATABASE | Yes | The name of the database to connect to. This must match an entry in MCP_ALLOWED_SCHEMAS. | |
| MYSQL_PASSWORD | Yes | The password for MYSQL_USER. For the read-only user, set it in the SQL script and then in .env. | |
| ALLOW_REMOTE_MYSQL | No | Set to '1' to allow connecting to a non-loopback MySQL host. The server still requires a non-empty MYSQL_PASSWORD. | 0 |
| MCP_ALLOWED_TABLES | No | Optional comma-separated allowlist of tables. If empty, all tables in the allowed schemas are visible. | |
| MCP_ALLOWED_SCHEMAS | Yes | Comma-separated list of schemas the server is allowed to access. Wildcards are only allowed if ALLOW_WILDCARD_SCHEMAS=1. | |
| ALLOW_WILDCARD_SCHEMAS | No | Set to '1' to allow wildcard entries in MCP_ALLOWED_SCHEMAS. Off by default for safety. | 0 |
| MYSQL_CONNECTION_LIMIT | No | Maximum number of simultaneous MySQL connections in the pool. | 5 |
| MYSQL_QUERY_TIMEOUT_MS | No | Query timeout in milliseconds. Queries exceeding this are aborted. | 3000 |
| MYSQL_CONNECT_TIMEOUT_MS | No | MySQL connection timeout in milliseconds. | 5000 |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {
"listChanged": true
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_tablesA | List tables in allowlisted MySQL schemas. Returns table metadata (schema, name, type). Always read-only. No raw SQL. |
| describe_tableA | Describe a single allowlisted MySQL table: columns, types, nullability, and key metadata. Sensitive columns may be redacted. Read-only. |
| get_rowsA | Read rows from a single allowlisted MySQL table. Requires an explicit column list, supports equality/IN/range filters and pagination. Read-only. Sensitive columns are masked. Cap is MCP_MAX_ROWS. |
| health_checkA | Report server/database reachability. Returns ok=true and a latencyMs value when the configured MySQL is reachable. Does NOT expose host, user, password, or version. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
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/kamrul-dev/local-mysql-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server