Skip to main content
Glama
mcp-mysql-apifox

mcp-mysql-apifox

by 327100395

主要功能

  • 在多个命名 MySQL 配置中执行 SQL

  • 解析并执行 curl 命令

  • 通过多个命名 FTP、FTPS 或 SFTP 配置操作远程目录

Related MCP server: Apifox MCP

安装与初始化

  1. 配置 MCP 服务:

    {
      "mcpServers": {
        "mysql-mcp": {
          "command": "npx",
          "args": ["-y", "mcp-mysql-apifox"],
          "env": {"ENV_PWD": "<your-encryption-password>"}
        }
      }
    }
  2. 让 AI 先调用 MCP 的 config 工具,并传入目标项目的绝对路径 projectRoot。该工具会打开仅监听 127.0.0.1 的本地配置页面后立即返回;页面会保留 1 小时,保存后自动关闭。可添加任意数量的数据库和 FTP 配置,保存后生成加密的 .env.mma。

    也可在终端执行:

    # macOS / Linux
    ENV_PWD="your-encryption-password" npx -y mcp-mysql-apifox config /absolute/path/to/project
    # PowerShell
    $env:ENV_PWD="your-encryption-password"; npx -y mcp-mysql-apifox config /absolute/path/to/project
    # 或安装到本地后:npm run config -- /absolute/path/to/project

    已有配置需要在页面确认覆盖,也可用 --force 跳过确认。

    可通过环境变量 ENV_PWD 设置全局加密密码,密码仅由当前进程读取,不写入用户目录。设置后,保存的配置使用 PBKDF2-SHA256 派生的 AES-256-GCM 密钥;之后启动时也需设置相同变量才能解密。未设置 ENV_PWD 时,沿用原有内置密钥加密方式,配置流程与旧版一致。旧加密配置始终可读取;重新保存时按当前环境变量选择加密方式。若打开的是密码加密文件但未提供密码,配置页仍会打开并提示设置密码,但为避免覆盖无法解密的旧数据,会暂时禁止保存。

  3. .env.mma 已加入 .gitignore,不要提交它。旧版单套 dotenv 配置仍可读取;重新通过初始化页面保存即可升级为加密格式。

多配置使用

  • 配置名称支持中文、英文字母、数字、下划线和连字符,例如 生产库、备份服务器-1。

  • 调用 list_configs(projectRoot) 可查看已保存的数据库和 FTP 配置名称。

  • MySQL 工具的可选 database 参数指定数据库配置名;不传时使用 default。

  • ftp_connect 的可选 profile 参数指定 FTP 配置名;connection 仍是本次运行的 FTP 会话名,两者可不同。

例如,先用 database: "reporting" 访问报表库;再以 profile: "backup"、connection: "backup-session" 建立备份服务器会话。工具错误只会提示缺失或不可用的配置名称,不会返回凭据或配置文件内容。

可用工具

list_configs

列出项目已保存的配置,不建立网络连接,不返回密码、私钥口令等凭据。

  • projectRoot: 项目根目录绝对路径(必填)

  • 返回示例:{"status":"success","res":{"databases":["default","生产库"],"ftps":["备份服务器"]}}

  • 项目尚未配置时返回提示,要求先调用 config 工具。

execute_mysql_only

执行任意 MySQL SQL,支持分号分隔的多条语句。

  • projectRoot: 项目根目录绝对路径

  • database: 数据库配置名称(可选,默认 default)

  • sql: SQL 语句

  • params: SQL 参数(可选)

execute_mysql_readonly

执行只读 MySQL 语句。

  • projectRoot: 项目根目录绝对路径

  • database: 数据库配置名称(可选,默认 default)

  • sql: SQL 语句

run_curl

解析并执行 curl 命令。

  • curl: curl 命令字符串

FTP 工具

先调用 ftp_connect(projectRoot, connection?, profile?),然后可使用 ftp_list、ftp_cd、ftp_upload、ftp_download、ftp_delete、ftp_rename、ftp_read、ftp_write、ftp_append、ftp_stat、ftp_exists、ftp_mkdir、ftp_rmdir 和 ftp_chmod。

上传和下载的相对本地路径以建立该会话时传入的项目根目录解析。

Available Tools

6 tools
download_apisB

从Apifox下载所有API到指定目录,可传递目录绝对路径、Apifox项目ID和API密钥(读取规则或用户指定的)

Inputs: apiKey (required), rootDir (required), projectId (required).

execute_mysql_onlyA

仅执行execute_mysql_readonly不支持的mysql语句,使用前读取规则或用户指定的DSN链接

Inputs: dsn (required), sql (required).

execute_mysql_readonlyA

执行只读mysql语句(仅支持SELECT、SHOW、DESCRIBE等查询操作),使用前读取规则或用户指定的DSN链接

Inputs: dsn (required), sql (required).

helpC

需要获取协助时调用

Inputs: title (required).

import_openapiA

导入OpenAPI数据到Apifox,在用户明确生成api文档时使用,使用前读取规则或用户指定的项目ID和API密钥,可导入json字符串/包含json文档的目录/json文件

Inputs: input (required), apiKey (required), projectId (required).

run_curlB

解析并执行curl命令,返回HTTP请求结果

Inputs: curl (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool has a distinct purpose: two MySQL tools clearly separate read and write operations, two Apifox tools handle download and import, plus generic help and curl tools. No overlap or ambiguity.

    Naming Consistency4/5

    Most tools follow a verb_noun pattern with underscores (e.g., download_apis, execute_mysql_readonly), but 'help' is a single word without a verb or object, causing slight inconsistency.

    Tool Count4/5

    Six tools cover the core functionalities of MySQL and Apifox integration. The count is slightly low but still reasonable for the defined scope, leaving room for additional operations.

    Completeness3/5

    Missing common operations like listing, updating, or deleting Apifox resources, and MySQL lacks schema exploration tools. The set covers basic read/write and import/export but has notable gaps.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      D
      maintenance
      An MCP server that integrates Apifox API documentation with AI assistants, allowing AI to extract and understand API information from Apifox projects.
      2
      46 npm
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server for connecting to databases (PostgreSQL, MySQL, SQL Server, Redis) enabling SQL queries, table exploration, and Redis key-value operations.
      1
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server that provides 22 tools to manage Apidog API documentation, including importing OpenAPI specs, exporting, diffing, analyzing, and bulk-editing endpoints.
      22
      24 npm
      3
      MIT