Database Tools for Claude AI

Integrations

  • Allows Claude to query MySQL databases directly, execute SQL queries, get information about tables (including size and structure), and receive formatted query results.

Claude AI 的数据库工具

这是一个 MCP(模型上下文协议)服务器,允许 Claude AI 直接与 MySQL 数据库交互。

特征

  • 通过 Claude 查询 MySQL 数据库
  • 执行任何有效的 SQL 查询
  • 获取有关表的信息,包括大小和结构
  • 格式化结果以便于在 Claude 中阅读

安装

要安装和使用此工具,请按照以下步骤操作:

  1. 克隆或下载存储库
    git clone [repository-url]
    或下载并解压 ZIP 文件。
  2. 安装依赖项导航到项目目录并运行:
    npm install

配置

为了让 Claude 使用此工具,您需要将配置添加到您的claude_desktop_config.json文件中,该文件通常位于:

C:\Users\YOUR_USER\AppData\Roaming\Claude\claude_desktop_config.json

具有以下结构:

{ "mcpServers": { // Other existing configurations... "database-tools": { "command": "node", "args": [ "C:\\path\\to\\index.js" ] } } }

用法

配置完成后,您可以使用以下命令从 Claude 与 MySQL 数据库进行交互:

  1. 列出所有数据库
    “在 MySQL 中执行查询以显示数据库。”
  2. 查看数据库中的表
    “在 MySQL 中执行查询以显示表name_table 。”
  3. 查询表的大小
    “在 MySQL 中执行查询以显示表name_table的大小。”
  4. 执行自定义查询
    “在 MySQL 中执行查询:‘您希望查询执行的操作的描述。’”

安全

此工具使用mysql.js文件中配置的权限运行。请确保提供的凭据仅具有您要允许的操作所需的必要权限。

故障排除

如果您遇到连接问题,请检查:

  • MySQL 正在运行
  • mysql.js中的凭据正确
  • Claude配置文件中的路径是正确的

执行

要查询数据库,只需向 Claude 询问类似“显示我的 MySQL 中的所有数据库”或“用户表的大小是多少?”

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

Tools

MCP 服务器允许 Claude AI 直接与 MySQL 数据库交互,从而实现通过自然语言执行查询和检索表信息。

  1. Features
    1. Installation
      1. Configuration
        1. Usage
          1. Security
            1. Troubleshooting
              1. Implementation
                ID: q7rr1u7sw5