mysql-mcp-server
Provides read-only access to MySQL database schema and sample data, including listing tables, retrieving table schemas, and fetching up to 5 sample rows from any table.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
MySQL MCP Server
A Model Context Protocol (MCP) server for MySQL databases that provides read-only access to database schema information and sample data.
Background
While existing MySQL MCP servers (such as designcomputer/mysql_mcp_server) allow LLMs to generate and execute arbitrary SQL queries—including INSERT, UPDATE, and DELETE operations—this approach poses risks when working on backend implementations.
This MCP server takes a different, safer approach:
✅ Read-only operations: Retrieves table lists, schema information, and sample data
❌ No write operations: Cannot modify, add, or delete data
🎯 Backend development focused: Provides exactly what's needed for backend implementation without the risk of data corruption
When developing backend applications, you typically only need to understand the database structure. This server provides:
Table List: Get all tables in the database
Schema Information: Retrieve detailed schema for specific tables
Sample Data: Fetch the first 5 rows from any table for validation
Related MCP server: MySQL MCP Server
Features
🔒 Safe by design: Read-only operations prevent accidental data modification
🚀 Simple setup: Easy configuration via CLI arguments
📊 Three essential tools:
list_tables: Get a list of all tables in the databaseget_table_schema: Retrieve schema information for a specific tableget_table_data: Fetch up to 5 sample rows from a table
Installation
npm install @yukihito/mysql-mcp-serveror
pnpm add @yukihito/mysql-mcp-serverUsage
As an MCP Server
Configure your MCP client (e.g., Claude Desktop, Cline) to use this server:
{
"mcpServers": {
"mysql-mcp-server": {
"command": "npx",
"args": [
"-y",
"@yukihito/mysql-mcp-server@latest",
"--host", "localhost",
"--port", "3306",
"--name", "your_username",
"--password", "your_password",
"--database", "your_database"
]
}
}
}CLI Options
Option | Description | Default |
| MySQL host |
|
| MySQL port |
|
| Database username |
|
| Database password |
|
| Database name |
|
Example Configuration for Claude Desktop
Edit your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"mysql-mcp-server": {
"command": "npx",
"args": [
"-y",
"@yukihito/mysql-mcp-server@latest",
"--host", "localhost",
"--port", "3306",
"--name", "myuser",
"--password", "mypassword",
"--database", "mydb"
]
}
}
}Available Tools
1. list_tables
Retrieves a list of all tables in the connected database.
Input: None
Output: JSON array of table names
Example:
["users", "products", "orders", "categories"]2. get_table_schema
Gets detailed schema information for a specific table.
Input:
tableName(string): Name of the table
Output: JSON array containing column information (name, type, nullable, key, default, extra)
Example:
[
{
"Field": "id",
"Type": "int",
"Null": "NO",
"Key": "PRI",
"Default": null,
"Extra": "auto_increment"
},
{
"Field": "name",
"Type": "varchar(255)",
"Null": "NO",
"Key": "",
"Default": null,
"Extra": ""
}
]3. get_table_data
Retrieves up to 5 rows from a specific table for validation purposes.
Input:
tableName(string): Name of the table
Output: JSON array of row objects (limited to 5 rows)
Example:
[
{"id": 1, "name": "John Doe", "email": "john@example.com"},
{"id": 2, "name": "Jane Smith", "email": "jane@example.com"}
]Development
For development environment setup and contribution guidelines, see DEVELOPMENT.md.
License
MIT
Author
Yukihito
Related Projects
designcomputer/mysql_mcp_server - Alternative MySQL MCP server with full query execution capabilities
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
Work with your database from AI tools: ask, export, approved changes, and scheduled jobs.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides secure, read-only access to MariaDB/MySQL databases, allowing users to list databases, explore table schemas, and execute SQL queries with built-in security measures.460 npm4MIT
- FlicenseNot gradedqualityDmaintenanceEnables safe interaction with MySQL databases through SELECT queries, table structure inspection, and database schema exploration. Provides read-only access to query data and examine database metadata.1-
- AlicenseNot gradedqualityDmaintenanceEnables schema introspection and safe read-only queries on MySQL databases, supporting table/column discovery, relationship exploration, and controlled SELECT queries.17 npmMIT
- FlicenseAqualityDmaintenanceProvides read-only access to a local MySQL database, enabling SQL queries, database and table listings, and table schema descriptions.4-