Integrations
Uses .env files for configuration and secure management of database credentials and connection parameters
Offers cross-platform compatibility for Linux systems with specified log file locations and installation instructions
Provides cross-platform support for macOS with documented log file locations and installation procedures
MySQL 导航器 MCP
一个强大的 MySQL/MariaDB 数据库导航工具,使用 MCP(模型控制协议),可轻松进行数据库查询和管理。
特征
- 连接到 MySQL/MariaDB 数据库
- 动态切换不同的数据库
- 使用类型安全执行 SQL 查询
- 检索数据库架构信息
- 查询参数的 Pydantic 模型验证
- 安全凭证管理
- 综合测井系统
- 连接池和重试机制
- SSL/TLS 支持安全连接
日志文件位置(跨平台)
默认情况下,所有日志都写入:
- Windows:
C:\Users\<YourUsername>\.mcp\mcp-db.log
- macOS/Linux:
/home/<yourusername>/.mcp/mcp-db.log
/mcp-db.log 或/Users/<yourusername>/.mcp/mcp-db.log
mcp-db.log
如果您的主目录中不存在.mcp
文件夹,应用程序将自动创建该文件夹。如果遇到任何问题,您可以手动创建该文件夹:
视窗:
Copy
macOS/Linux:
Copy
安装
来自 PyPI(推荐给大多数用户):
Copy
来自源代码(用于开发):
Copy
- 使用您的数据库凭证创建一个
.env
文件:
Copy
使用示例
1.命令行
直接从终端运行 MCP 服务器:
Copy
2. 在光标处
要在Cursor中使用此 MCP 服务器:
- 打开 Cursor 设置并添加一个新的 MCP 服务器。
- 使用以下配置(示例):
Copy
- 确保
.env
文件的路径是绝对的。
3.在Claude桌面
如果 Claude Desktop 支持 MCP 服务器:
- 添加一个新的 MCP 服务器,并使用上面的
--config
参数将其指向mcp-db
命令。 - 有关添加自定义 MCP 服务器的详细信息,请参阅 Claude Desktop 的文档。
查询参数
查询字典支持以下参数:
table_name
(必填):要查询的表的名称select_fields
(可选):要选择的字段列表(默认为[“*”])where_conditions
(可选):WHERE 子句的字段值对字典order_by
(可选):排序依据的字段列表order_direction
(可选):排序方向“ASC”或“DESC”(默认值:“ASC”)limit
(可选):要返回的记录数offset
(可选):要跳过的记录数group_by
(可选):分组依据的字段列表having
(可选):HAVING 子句的字段值对字典join_table
(可选):要连接的表的名称join_type
(可选):JOIN 操作的类型(默认值:“INNER”)join_conditions
(可选):连接条件字典
安全功能
- 数据库凭证通过配置文件管理
- 密码在 Pydantic 模型中存储为 SecretStr
- 所有查询参数的输入验证
- 通过参数化查询预防 SQL 注入
- SSL/TLS 加密连接支持
- 连接字符串清理
- 查询速率限制
- 查询参数清理
生产特点
错误处理
- 全面的数据库操作错误处理
- 连接超时处理
- 失败连接的自动重试机制
- 所有参数的输入验证
表现
- 连接池以实现最佳资源利用
- 查询执行时间记录
- 连接池统计信息
- 性能指标收集
监控
- 具有不同日志级别的结构化日志记录
- 查询执行跟踪
- 连接状态监控
- 错误率追踪
贡献
- 分叉存储库
- 创建你的功能分支(
git checkout -b feature/amazing-feature
) - 提交您的更改(
git commit -m 'Add some amazing feature'
) - 推送到分支(
git push origin feature/amazing-feature
) - 打开拉取请求
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
MySQL 导航器 MCP
Related MCP Servers
- -securityFlicense-qualityA TypeScript-based MCP server that facilitates SQL query execution and MySQL database connectivity using environment variables.Last updated -25JavaScript
- AsecurityAlicenseAqualityAn MCP server that provides read-only access to MySQL databases.Last updated -469517JavaScriptMIT License
- -securityAlicense-qualityA Model Context Protocol (MCP) server that enables AI assistants to interact with MySQL databases by executing SQL queries and checking database connectivity.Last updated -TypeScriptMIT License
- AsecurityFlicenseAqualityMCP server that allows Claude AI to interact directly with MySQL databases, enabling query execution and table information retrieval through natural language.Last updated -163JavaScript