Python MySQL MCP
Allows interaction with MySQL databases, providing tools to execute SQL queries, retrieve data, and analyze results through a client-server architecture.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Python MySQL MCPshow me the top 10 customers by total purchase amount"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
pymcp
pymcp is a Python project based on FastMCP that provides tools for interacting with MySQL databases. The project supports communication between servers and clients, and allows data to be retrieved and analyzed through various tools.
Project Structure
pymcp/
├── client.py # 클라이언트 코드
├── main.py # 서버 실행 코드
├── src/
│ ├── env.py # 로컬 환경 설정
│ ├── env_dev.py # 개발 환경 설정
│ ├── mcp_instance.py # MCP 인스턴스 초기화
│ ├── mysql_tool.py # MySQL 관련 도구 정의
├── pyproject.toml # 프로젝트 메타데이터 및 의존성
├── requirements.txt # 의존성 목록
└── README.md # 프로젝트 설명Related MCP server: Jewei MSSQL MCP Server
Install and run
1. Install dependencies
Requires Python 3.13 or later. To install dependencies, run the following command:
pip install -r requirements.txt2. Run the server
To run the server, run main.py :
python main.pyThe server runs on 0.0.0.0:8080 by default.
3. Run the client
To run the client, run client.py :
python client.pyClients can communicate with the server to execute MySQL queries or query a list of tools.
Preferences
MySQL settings are applied differently depending on the environment:
Local environment :
src/env.pyDevelopment environment :
src/env_dev.py
The environment can be set via APP_ENV environment variable. The default is local .
export APP_ENV=dev # 개발 환경 설정Tools provided
The tools provided by the server are:
describe_tools
Lists available tools and explains how to use them.query_mysql(sql: str)
Executes a given SQL query and returns the results.
Example:query_mysql("SELECT * FROM users LIMIT 10;")
Main File Description
main.py
This is the entry point to running the server. It initializes the MCP instance, registers the tools, and then runs the server.
client.py
This is the client code that interacts with the server. It connects to the server and can call tools.
src/mysql_tool.py
This is a file that defines MySQL-related tools. You can execute SQL queries using tools such as query_mysql .
src/env.py and src/env_dev.py
Environment variable file containing MySQL connection settings. Loads appropriate settings depending on the environment.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that provides read-only access to MySQL databases.451970MIT
- Alicense-qualityBmaintenanceA FastMCP-based server that enables executing Microsoft SQL Server data queries and table structure queries through a standardized MCP protocol interface.6MIT
- Flicense-quality-maintenanceAn MCP server that enables interaction with MySQL databases through the Model Context Protocol, allowing execution of SQL queries and database table listing operations from Cline AI.
- Alicense-qualityDmaintenanceA production-ready MCP server for MySQL database operations, providing secure HTTP endpoints for read-only queries, performance analysis, and server monitoring.4511MIT
Related MCP Connectors
GibsonAI MCP server: manage your databases with natural language
An MCP server giving access to Grafana dashboards, data and more.
MCP server for managing Prisma Postgres.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/hoonzinope/pymcp-mysql'
If you have feedback or need assistance with the MCP directory API, please join our Discord server