Provides AI agents with direct access to query, search, and analyze MySQL databases.
A Model Context Protocol (MCP) server that provides AI agents with direct access to MySQL databases. This server enables AI models to query, search, and analyze MySQL database content through a set of well-defined tools.
The easiest way to run the MySQL MCP server is using Docker:
# Pull the latest image (stdio mode by default)
docker pull ghcr.io/sagenkoder/go-mysql-mcp-server:latest
# Or pull a specific mode
docker pull ghcr.io/sagenkoder/go-mysql-mcp-server:stdio
docker pull ghcr.io/sagenkoder/go-mysql-mcp-server:http
docker pull ghcr.io/sagenkoder/go-mysql-mcp-server:interactive
# Connect to MySQL on host machine
docker run -i --rm \
--network host \
-e MYSQL_HOST=localhost \
-e MYSQL_USER=your_user \
-e MYSQL_PASSWORD=your_password \
-e MYSQL_DATABASE=your_database \
ghcr.io/sagenkoder/go-mysql-mcp-server:stdio
# Run HTTP server on port 8080
docker run -d \
--name mysql-mcp-http \
--network host \
-p 8080:8080 \
-e MYSQL_HOST=localhost \
-e MYSQL_USER=your_user \
-e MYSQL_PASSWORD=your_password \
ghcr.io/sagenkoder/go-mysql-mcp-server:http
# Run in interactive mode
docker run -it --rm \
--network host \
-e MYSQL_HOST=localhost \
-e MYSQL_USER=your_user \
-e MYSQL_PASSWORD=your_password \
ghcr.io/sagenkoder/go-mysql-mcp-server:interactive
If your MySQL is also running in Docker, use Docker networking:
# Create a network
docker network create myapp
# Run MySQL (example)
docker run -d \
--name mysql \
--network myapp \
-e MYSQL_ROOT_PASSWORD=rootpass \
-e MYSQL_DATABASE=mydb \
mysql:8
# Run MCP server
docker run -i --rm \
--network myapp \
-e MYSQL_HOST=mysql \
-e MYSQL_USER=root \
-e MYSQL_PASSWORD=rootpass \
-e MYSQL_DATABASE=mydb \
ghcr.io/sagenkoder/go-mysql-mcp-server:stdio
Add this to your Claude Desktop configuration file:
{
"mcpServers": {
"mysql": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"--network", "host",
"-e", "MYSQL_HOST=localhost",
"-e", "MYSQL_USER=your_user",
"-e", "MYSQL_PASSWORD=your_password",
"-e", "MYSQL_DATABASE=your_database",
"ghcr.io/sagenkoder/go-mysql-mcp-server:stdio"
]
}
}
}
If you prefer to use the binary directly:
{
"mcpServers": {
"mysql": {
"command": "/path/to/mysql-mcp-stdio",
"env": {
"MYSQL_HOST": "localhost",
"MYSQL_PORT": "3306",
"MYSQL_USER": "your_user",
"MYSQL_PASSWORD": "your_password",
"MYSQL_DATABASE": "your_database"
}
}
}
}
# Clone the repository
git clone https://github.com/sagenkoder/go-mysql-mcp-server.git
cd go-mysql-mcp-server
# Build all binaries
./build.sh
# Build Docker images
./build.sh docker
This will create:
mysql-mcp-stdio
- For stdio-based MCP communicationmysql-mcp-http
- HTTP server modemysql-mcp-interactive
- Interactive CLI mode for testingghcr.io/sagenkoder/go-mysql-mcp-server:stdio
(also tagged as mysql-mcp:latest
)ghcr.io/sagenkoder/go-mysql-mcp-server:http
ghcr.io/sagenkoder/go-mysql-mcp-server:interactive
The server connects to MySQL using these environment variables:
MYSQL_HOST
- MySQL server hostname (default: localhost)MYSQL_PORT
- MySQL server port (default: 3306)MYSQL_USER
- MySQL username (default: root)MYSQL_PASSWORD
- MySQL password (required)MYSQL_DATABASE
- Default database (optional)List all schemas/databases available in the MySQL server.
Parameters:
page
(optional): Page number for pagination (default: 1)page_size
(optional): Number of items per page (default: 20, max: 100)List all tables in a specific schema with metadata.
Parameters:
schema
(required): The schema/database namepage
(optional): Page number for paginationpage_size
(optional): Number of items per pageGet detailed column and index information for a table.
Parameters:
schema
(required): The schema/database nametable
(required): The table nameGet the CREATE TABLE statement for a specific table.
Parameters:
schema
(required): The schema/database nametable
(required): The table nameExecute a SQL query (SELECT, SHOW, DESCRIBE, EXPLAIN only).
Parameters:
query
(required): The SQL query to executelimit
(optional): Maximum rows to return (default: 100)Search for a value across all text columns in a table.
Parameters:
schema
(required): The schema/database nametable
(required): The table namesearch_term
(required): The term to search forlimit
(optional): Maximum rows to return (default: 100)Use the interactive mode to test your connection:
# With Docker
docker run -it --rm \
--network host \
-e MYSQL_HOST=localhost \
-e MYSQL_USER=test \
-e MYSQL_PASSWORD=test \
ghcr.io/sagenkoder/go-mysql-mcp-server:interactive
# With binary
MYSQL_USER=test MYSQL_PASSWORD=test ./mysql-mcp-interactive
--network host
for local MySQL)mysql -h localhost -u user -p
--network host
to connect to MySQL on the host machineMIT License - see LICENSE file for details.
Access the OSV (Open Source Vulnerabilities) database for vulnerability information. Query vulnerabilities by package version or commit, batch query multiple packages, and get detailed vulnerability information by ID.
Provides natural language access to relational databases using advanced language models, supporting multiple database types.
A Model Context Protocol (MCP) server that enables LLMs to interact directly with MongoDB databases
Interact with the Solana blockchain to check balances, send SOL, and airdrop SOL.
A comprehensive movie database server supporting advanced search, CRUD operations, and image management via a PostgreSQL database.
Interact with Microsoft SQL Server (MSSQL) databases. List tables, read data, and execute SQL queries with controlled access.
An MCP server for NocoDB, the open-source Airtable alternative. It allows interaction with your NocoDB instance via API.
Perform database actions on Amazon Redshift via its Data API.
Build robust data workflows, integrations, and analytics on a single intuitive platform.
A server that enables LLMs to connect and interact with databases via JDBC, built using the Spring AI MCP framework.