โœจ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more

๐Ÿณ 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=db in your .env file.


๐Ÿงช Tools Exposed

  • run_sql_query(query: str) -> list
  • get_table_schema(table_name: str) -> list
  • list_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! ๐ŸŽ‰

Featured Templates

View More
Customer service
Multi-language AI Translator
136 921
Customer service
Service ERP
126 1188
Customer service
AI-Powered Product List Manager
153 868
Data Analysis
Pharmacy Admin Panel
252 1957
AI Assistants
Image to text with Claude 3
152 1366
AI Characters
Sarcastic AI Chat Bot
129 1713

Start your free trial

Build your solution today. No credit card required.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.