Skip to main content
Glama

MySQL MCP Server

by dave-wind

@davewind/mysql-mcp-服务器

提供对 Mysql 数据库的只读访问的模型上下文协议 (MCP) 服务器。该服务器使 LLM 能够检查数据库模式并执行只读查询。

主要特点

1.只读数据库访问:通过 SQL 验证和只读事务强制执行只读操作
2.Schema Discovery:自动识别并公开数据库表结构
3.SQL查询执行:提供接受并执行SELECT语句的查询工具
4.模型上下文协议合规性:实现 MCP 规范,与兼容的 LLM 无缝集成
5.配置简单:只需极少的配置即可轻松设置

工具

  • 询问
    • 对连接的数据库执行只读 SQL 查询
    • 输入: sql (字符串):要执行的 SQL 查询
    • 所有查询都在只读事务中执行

资源

服务器为数据库中的每个表提供架构信息:

  • 表模式mysql://user:password@localhost:3306/database
    • 每个表的 JSON 架构信息
    • 包括列名和数据类型
    • 从数据库元数据中自动发现

安装

npm install @davewind/mysql-mcp-server -g

配置

MCP设置配置文件:

建议使用

{ "mcpServers": { "mysql": { "command": "npx", "args": ["-y", "@davewind/mysql-mcp-server", "mysql://user:password@localhost:port/database"], } } }

测试

替换 mysql://user@localhost/ 和 npm run inspector

"scripts": { "inspector": "npx @modelcontextprotocol/inspector@0.10.2 build/index.js mysql://user:password@localhost:port/database }

环境

node v18 +

系统架构

MySQL MCP 服务器充当 LLM 和 MySQL 数据库之间的中介,根据模型上下文协议处理请求。

组件交互

组件交互

安全模型

MySQL MCP 服务器实现了严格的安全模型,以确保数据库访问是只读的。

安全措施包括:

1.SQL 查询验证仅允许 SELECT 语句 2.在 READ ONLY 事务中执行所有查询 3.不支持数据修改操作(INSERT、UPDATE、DELETE 等) 4.不支持数据库模式修改(CREATE、ALTER、DROP 等)

与法学硕士 (LLM) 的整合

MySQL MCP 服务器旨在与任何支持模型上下文协议 (MCP) 的 LLM 系统兼容。它遵循 MCP 规范,通过 stdio 上的 JSON-RPC 进行通信。

执照

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

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.

为 LLM 提供 MySQL 数据库只读访问权限的服务器,允许他们检查数据库模式并执行只读查询。

  1. 主要特点
    1. 工具
      1. 资源
        1. 安装
          1. 配置
            1. 测试
            2. 环境
            3. 系统架构
            4. 组件交互
            5. 组件交互
            6. 安全模型
            7. 与法学硕士 (LLM) 的整合
          2. 执照

            Related MCP Servers

            • -
              security
              A
              license
              -
              quality
              Enables LLMs to interact with MySQL databases by inspecting schemas and executing safe, read-only queries within transactions.
              Last updated -
              6
              JavaScript
              MIT License
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that provides read-only access to MySQL databases, enabling LLMs to inspect database schemas and execute read-only queries.
              Last updated -
              5,426
              418
              TypeScript
              MIT License
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server providing read-only access to MySQL databases, enabling LLMs to inspect database schemas and execute read-only queries.
              Last updated -
              5,426
              TypeScript
              MIT License
              • Linux
              • Apple
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that provides read-only access to MySQL databases, enabling LLMs to inspect database schemas and execute read-only queries.
              Last updated -
              5,426
              MIT License

            View all related MCP servers

            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/dave-wind/mysql-mcp-server'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server