🐳 MCP MySQL Server (Dockerized)
This project provides a fully containerized MCP (Model Context Protocol) server using Python, FastMCP, and MySQL.
📦 Features
- Run SQL queries via MCP tools
- Retrieve table schemas
- List all tables in a connected MySQL database
- Containerized using Docker and ready for deployment
🚀 Getting Started
1. Clone the Repository and Navigate
git clone <this-repo-url>
cd mcp_docker
2. Configure Environment
Copy .env.example to .env and fill in your MySQL credentials:
DB_HOST=your-db-host
DB_USER=your-db-user
DB_PASSWORD=your-db-password
DB_NAME=your-db-name
3. Build and Run with Docker
docker build -t mcp-mysql-server .
docker run --env-file .env -p 8000:8000 mcp-mysql-server
4. Using Docker Compose (optional)
Start both MySQL and MCP server with one command:
docker compose up --build
Note: If using Docker Compose, set
DB_HOST=dbin your.envfile.
🧪 Tools Exposed
run_sql_query(query: str) -> listget_table_schema(table_name: str) -> listlist_tables() -> list
You can interact with the server via an MCP-compatible client.
📁 File Structure
mcp_docker/
├── Dockerfile
├── requirements.txt
├── .env.example
├── docker-compose.yml
├── mcp_mysql_server.py
└── README.md
🛠 Requirements
- Python 3.10+
- Docker
- MySQL server or container
- fastmcp
📜 License
MIT — feel free to use and modify!
Happy coding! 🎉
MCP MySQL Server
Project Details
- chalfacre/pysql_mcp
- Last Updated: 4/16/2025
Recomended MCP Servers
A proof-of-concept implementation of a Model Context Protocol (MCP) server that runs in WebAssembly (WASM) within a web...
Proxy Oblivious Transfer for Data Sharing.
MCP Server to enable LLM's to connect to the Contentful GraphQL Endpoints
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images
A Model Context Protocol (MCP) server that provides comprehensive access to LinkedIn data and functionalities using the HorizonDataWave...
An MCP Server for querying InfluxDB
MCP 服务器,用于管理桌面图片、查看详情、压缩、移动等(完全让Trae实现)
A simple POC to expose Mythic as a MCP server
mcp model-context-protocol mysql cursor n8n
DoiT official MCP Server
这是一个基于 [ALAPI](https://www.alapi.cn) 的 MCP (Model Control Protocol) 服务器实现,可以通过MCP协议直接调用ALAPI的接口





