mysql-server MCP 服务器
用于 MySQL 数据库访问的模型上下文协议服务器
这是一个基于 TypeScript 的 MCP 服务器,提供查询 MySQL 数据库的工具。它通过以下方式演示了 MCP 的核心概念:
- 执行 SQL 查询的工具
- 通过环境变量连接到 MySQL 数据库
特征
工具
query
——执行 SQL 查询- 将 SQL 查询字符串作为必需参数
- 返回查询结果
配置
在 MCP 服务器配置中设置以下环境变量:
- MYSQL_HOST:MySQL 服务器主机
- MYSQL_USER:MySQL 用户名
- MYSQL_PASSWORD:MySQL 密码
- MYSQL_DATABASE:MySQL 数据库名称
发展
安装依赖项:
构建服务器:
对于使用自动重建的开发:
安装
要与 Claude Desktop 一起使用,请添加服务器配置:
在 MacOS 上: ~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
调试
由于 MCP 服务器通过 stdio 进行通信,调试起来可能比较困难。我们推荐使用MCP Inspector ,它以包脚本的形式提供:
检查器将提供一个 URL 来访问浏览器中的调试工具。
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.
基于 TypeScript 的 MCP 服务器,使用环境变量促进 SQL 查询执行和 MySQL 数据库连接。
Related Resources
Related MCP Servers
- -securityAlicense-qualityA template project for building custom MCP servers that enables direct access to PostgreSQL databases, allowing SQL query execution and schema information retrieval through the Model Context Protocol.Last updated -30PythonMIT License
- -securityFlicense-qualityAn MCP server that allows working with MySQL databases by providing tools for executing read-only SQL queries, getting table schemas, and listing database tables.Last updated -6002JavaScript
- -securityFlicense-qualityA Model Context Protocol (MCP) server that converts natural language queries into SQL statements, allowing users to query MySQL databases using conversational language instead of writing SQL code.Last updated -3TypeScript
- -securityFlicense-qualityA template repository for building Model Context Protocol (MCP) servers with TypeScript, featuring full TypeScript support, testing setup, CI/CD pipelines, and modular architecture for easy extension.Last updated -0TypeScript
Appeared in Searches
- Information about MySQL database management system
- A service or tool for downloading and installing SDKs for development
- Developing and redeveloping web frontend and Python backend projects, including frontend-backend integration and debugging
- Free PostgreSQL Database Solutions
- Using Laravel Helper Functions and Resolving MySQL Table Query Errors