๐ณ 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
When crawling you deserve the best.
Last9 MCP Server
Monad MCP
Tutorial App For MCP
Automate your X account using the real browser API
This read-only MCP Server allows you to connect to SAP ERP data from Claude Desktop through CData JDBC...
AI-Powered Penetration Testing Assistant for offensive security testing, focused on web applications and network penetration testing.
A Model Context Protocol (MCP) server for NASA APIs, providing a standardized interface for AI models to interact...





