mysql-mcp-server-all
Provides read-only access to MySQL databases, allowing execution of SELECT/SHOW/DESCRIBE/EXPLAIN/WITH queries, retrieving schema information, and sampling table data.
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-mcp-server-allwhat's the schema of the users table?"
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-all
A read-only MySQL MCP server that speaks stdio, SSE, and Streamable HTTP — one binary, three transports.
Why this project exists
We needed to expose a MySQL database as an MCP server to Dify, whose "MCP (HTTP)" integration form only supports the Streamable HTTP protocol.
We evaluated the existing ecosystem:
Project | Transport | Dify "HTTP" form |
stdio; remote HTTP mode is stateless & incomplete | ❌ | |
stdio only | ❌ | |
stdio + SSE | ❌ | |
mysql-mcp-server-all (this project) | stdio + SSE + Streamable HTTP | ✅ |
This project is a derived / enhanced work of designcomputer/mysql_mcp_server (MIT). It keeps the same familiar toolset and adds the missing transport — so the same server can serve Claude Code / opencode over stdio, Cherry Studio over SSE, and Dify over Streamable HTTP.
Related MCP server: mysql-mcp
Features
Three transports via
MCP_TRANSPORT:stdio(default) /sse/streamable-httpRead-only by design: only
SELECT / SHOW / DESCRIBE / EXPLAIN / WITHSingle & multi database mode: omit
MYSQL_DATABASEto query any schema viadb.tableIdentifier whitelist against SQL injection in schema/sample tools
Optional Bearer-token auth for Streamable HTTP (recommended when binding beyond loopback)
Works from Dify, Cherry Studio, Claude Code, opencode and any MCP client
Install
Requires Python 3.10+.
# via uv (recommended)
uvx --from mysql-mcp-server-all mysql-mcp-server-all
# or pip
pip install mysql-mcp-server-allNote: this repository is GitHub-only for now. The PyPI name
mysql-mcp-server-allis reserved for future publishing.
Quick start
# stdio (Claude Code / opencode / Cherry Studio local)
MYSQL_HOST=127.0.0.1 MYSQL_USER=root MYSQL_PASSWORD=secret \
MYSQL_DATABASE=my_db mysql-mcp-server-all
# Streamable HTTP (Dify) with token auth
MYSQL_HOST=127.0.0.1 MYSQL_USER=root MYSQL_PASSWORD=secret \
MYSQL_DATABASE=my_db MCP_TRANSPORT=streamable-http \
MCP_HTTP_HOST=127.0.0.1 MCP_HTTP_PORT=8000 MCP_HTTP_TOKEN=my-token \
mysql-mcp-server-all
# -> http://127.0.0.1:8000/mcpEnvironment variables
Variable | Default | Description |
| (required) | Database host |
|
| Database port |
| (required) | Database user |
| `` | Database password |
| (none) | Default database. Omit → multi-database mode |
|
| Connection timeout (seconds) |
|
|
|
|
| Listen host for |
|
| Listen port for |
| (none) | Bearer token for |
Transports
Transport | Endpoint | Clients |
| — | Claude Code, opencode, Cursor |
|
| Cherry Studio (SSE), Claude Desktop |
|
| Dify (HTTP), Cherry Studio (HTTP) |
Client configuration
Dify (recommended: Streamable HTTP)
MCP type: HTTP
Endpoint URL: http://127.0.0.1:8000/mcp
Auth header: Authorization: Bearer <MCP_HTTP_TOKEN> (if set)
Dynamic client registration: leave disabledDify self-hosted in Docker: use
http://host.docker.internal:8000/mcp, bindMCP_HTTP_HOST=0.0.0.0, and add the target to Dify's SSRF proxy allowlist (SSRF_PROXY_ALLOW_PRIVATE_IPS/SSRF_PROXY_ALLOW_PRIVATE_DOMAINSin Dify'sdocker/.env) — Dify blocks private networks by default.
Cherry Studio
Type: SSE → URL http://127.0.0.1:8000/sse
or HTTP → URL http://127.0.0.1:8000/mcp (streamable-http)Claude Code / opencode (stdio)
{
"mcpServers": {
"mysql": {
"command": "mysql-mcp-server-all",
"env": {
"MYSQL_HOST": "127.0.0.1",
"MYSQL_USER": "root",
"MYSQL_PASSWORD": "secret",
"MYSQL_DATABASE": "my_db"
}
}
}
}opencode: use
"environment"(not"env") inopencode.json.
Tools
Tool | Arguments | Description |
|
| Run a read-only SQL query (SELECT/SHOW/DESCRIBE/EXPLAIN/WITH). Single statement. Returns JSON rows |
|
| Column metadata (SHOW FULL COLUMNS). Accepts |
|
| Sample rows from a table. Accepts |
Security
Read-only enforced in
execute_sql— write/DDL queries are rejectedIdentifier whitelist — only alphanumeric,
_,$, and one.separatorBind loopback by default (
127.0.0.1)Use a least-privilege MySQL user — never
rootwith full grantsAdd token auth (
MCP_HTTP_TOKEN) whenever you bind0.0.0.0SSE transport has no built-in auth — keep it behind a loopback or a reverse proxy with auth (nginx / Caddy)
Credits & License
Derived from designcomputer/mysql_mcp_server (MIT) — same toolset, extended with unified stdio/SSE/Streamable HTTP transports.
MIT License, see LICENSE.
Available Tools
3 toolsexecute_sqlA
Execute a read-only SQL query (SELECT / SHOW / DESCRIBE / EXPLAIN / WITH).
Returns rows as JSON. Single statements only.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the safety disclosure burden. It clearly states 'read-only', which is a critical behavioral trait, and also discloses the return format (rows as JSON) and the single-statement limitation. This is strong transparency, though it does not cover potential edge cases like query timeouts or result size limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three concise sentences, each adding essential information: what it does, the return format, and a key constraint. No filler or repetition. It is well-structured and front-loaded with the primary purpose.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple tool with one parameter and an output schema present, the description covers the core behavior: allowed query types, read-only nature, return format, and single-statement restriction. It does not explicitly contrast with sibling tools, but the allowed statement list provides sufficient context for an agent to select it appropriately.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, so the description must compensate. The description implies the 'query' parameter contains the SQL text and constrains it to the allowed statement types. However, it does not provide examples or elaborate on parameter syntax, leaving some room for interpretation. The parameter name itself is self-explanatory, but the description adds only partial value beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool executes SQL queries with a specific set of read-only statement types (SELECT / SHOW / DESCRIBE / EXPLAIN / WITH). This distinguishes it from sibling tools like get_schema_info and get_table_sample, which likely provide metadata and sample data rather than arbitrary SQL.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides explicit allowed statement types and the 'single statements only' constraint, which helps the agent decide when to use this tool. While it does not mention alternatives by name, the listing of allowed query types implies when it is appropriate and excludes mutations and multi-statement queries.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_schema_infoB
Return column metadata (name, type, nullability, key, default) for a table.
Accepts database.table notation for cross-database lookups.
| Name | Required | Description | Default |
|---|---|---|---|
| table_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It does state that the tool returns column metadata and accepts database.table notation, which is a useful behavioral detail. However, it does not explicitly confirm the tool is read-only, nor does it explain error behavior for nonexistent tables or other limitations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, with the first sentence delivering the core purpose and the second adding a specific syntax detail. There is no fluff or redundancy; every sentence contributes value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The tool is simple with one parameter and an existing output schema, so the description need not enumerate return values. It covers the basic purpose and a key syntax detail, but lacks explicit usage guidance to distinguish from sibling tools and does not address error handling or assumptions. This is adequate but minimal for a complete picture.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema only defines table_name as a string with no description, and schema coverage is 0%. The description adds meaningful context by specifying that database.table notation is accepted for cross-database lookups, which goes beyond the bare schema parameter. This compensates well for the lack of schema documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states that the tool returns column metadata for a table, listing specific attributes (name, type, nullability, key, default). It uses a specific verb ('Return') and identifies the resource ('column metadata' for a table), but does not explicitly differentiate it from sibling tools like execute_sql or get_table_sample.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a usage tip about database.table notation for cross-database lookups, but it gives no guidance on when to use this tool compared to alternatives. There is no mention of execute_sql or get_table_sample, nor any scenarios that would prefer schema inspection over those siblings.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
get_table_sampleA
Fetch a representative sample of rows (max 20) from a table.
Accepts database.table notation for cross-database lookups.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| table_name | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the burden of behavioral disclosure. It adds the useful constraint of max 20 rows and cross-database notation, but does not state whether the operation is read-only, how the sample is selected (e.g., random vs first rows), or any error behavior. This is adequate for a simple fetch but leaves gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, with the main purpose front-loaded and no filler. Every phrase adds value, and it remains concise while conveying the essential behavior.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity and the presence of an output schema, the description covers the core functionality. It misses key context such as usage guidance vs siblings, the read-only nature, and semantics of the limit parameter. Completeness is adequate but not thorough.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It adds meaning to table_name by noting database.table notation, and implies a limit parameter by stating max 20. However, it does not explicitly explain the limit parameter's role or default, so the compensation is partial.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool fetches a representative sample of rows with a max of 20 from a table, distinguishing it from the sibling tools execute_sql and get_schema_info. The verb 'fetch' and resource 'sample from a table' are specific and unambiguous.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus the siblings. It does not mention that execute_sql is for arbitrary queries or that get_schema_info is for metadata. The only usage hint is the database.table notation, which is a parameter detail, not a when-to-use instruction.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
3 tool updates
v0.1.0- First observed
execute_sql - First observed
get_schema_info - First observed
get_table_sample
TDQS
The tools are largely distinct: execute_sql runs arbitrary read-only queries, get_schema_info returns column metadata, and get_table_sample fetches sample rows. However, execute_sql can also perform SELECT queries that return sample data, creating some overlap with get_table_sample.
All tool names follow a consistent verb_noun pattern in snake_case: execute_sql, get_schema_info, get_table_sample. This makes the toolset predictable and easy to navigate.
Three tools is a reasonable count for a focused read-only MySQL exploration server. While on the smaller side, each tool serves a clear purpose and the set does not feel overly thin.
The domain is well-covered for read-only database exploration: arbitrary SQL queries, schema metadata, and sample rows cover the core needs. Missing functionality like listing all tables can be achieved via execute_sql, so there are no major gaps.
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 Connectors
Read-only MCP server for The Quiet Protocol's engines, benchmarks, proof, and business data.
Read-only MCP server for ClassQuill, a tutoring-business-management platform.
Read-only MCP server for turva.dev, an agent-readiness audit and advisory service.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA production-ready MCP server for MySQL database operations, providing secure HTTP endpoints for read-only queries, performance analysis, and server monitoring.12116MIT
- AlicenseNot gradedqualityBmaintenanceA MySQL MCP server for local stdio clients, enabling database queries and management with read-only/write modes, audit logging, and configurable security.1,081MIT
- AlicenseNot gradedqualityDmaintenanceA secure, read-only MySQL database proxy using MCP protocol, enabling SQL queries and table inspections via HTTP.181MIT
- FlicenseAqualityAmaintenanceSecurity-hardened, read-only MySQL MCP server that enables safe, read-only access to MySQL databases for running SELECT queries, exploring schemas, and sampling data via MCP clients.9-
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/ByteTora/mysql-mcp-server-all'
If you have feedback or need assistance with the MCP directory API, please join our Discord server