Integrations
Allows interaction with MySQL databases, providing tools to execute SQL queries, retrieve data, and analyze results through a client-server architecture.
pymcp
pymcp
是一个基于 FastMCP 的 Python 项目,提供与 MySQL 数据库交互的工具。该项目支持服务器和客户端之间的通信,并允许通过各种工具检索和分析数据。
项目结构
安装并运行
1.安装依赖项
需要 Python 3.13 或更高版本。要安装依赖项,请运行以下命令:
2. 运行服务器
要运行服务器,请运行main.py
:
服务器默认在0.0.0.0:8080
上运行。
3.运行客户端
要运行客户端,请运行client.py
:
客户端可以与服务器通信以执行 MySQL 查询或查询工具列表。
偏好设置
根据环境的不同,MySQL 设置的应用也有所不同:
- 本地环境:
src/env.py
- 开发环境:
src/env_dev.py
可以通过APP_ENV
环境变量设置环境。默认为local
。
提供的工具
服务器提供的工具有:
describe_tools
列出可用的工具并解释如何使用它们。query_mysql(sql: str)
执行给定的 SQL 查询并返回结果。
例如:query_mysql("SELECT * FROM users LIMIT 10;")
主要文件描述
main.py
这是运行服务器的入口点。初始化 MCP 实例,注册工具,然后运行服务器。
client.py
这是与服务器交互的客户端代码。您可以连接到服务器并调用该工具。
src/mysql_tool.py
这是定义MySQL相关工具的文件。您可以通过query_mysql
等工具执行 SQL 查询。
src/env.py
和src/env_dev.py
包含 MySQL 连接设置的环境变量文件。根据环境加载适当的设置。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
基于FastMCP的服务器,可以与MySQL数据库交互,支持客户端-服务器通信,查询和分析MySQL数据。
Related MCP Servers
- -securityAlicense-qualityAn MCP server that integrates with MySQL databases, enabling secure read and write operations through LLM-driven interfaces with support for transaction handling and performance monitoring.Last updated -483JavaScriptMIT License
- -securityFlicense-qualityFacilitates interaction with a local MySQL database via a RESTful API, supporting database queries and real-time updates with integration for Cursor MCP services.Last updated -2JavaScript
- AsecurityAlicenseAqualityAn MCP server that provides read-only access to MySQL databases.Last updated -469517JavaScriptMIT License
- -securityFlicense-qualityA server that provides MySQL database operations through SSE (Server-Sent Events) based on the MCP (Model-Controller-Provider) framework, enabling real-time data transmission from MySQL databases.Last updated -4Python