mcp-mysql-apifox
This server provides a multi-purpose toolkit integrating MySQL database operations, Apifox API management, HTTP request execution, and FTP file operations.
Read-Only MySQL (
execute_mysql_readonly): Execute read-only statements (SELECT, SHOW, DESCRIBE, etc.) using a DSN connection string — write operations are blocked.Full MySQL Execution (
execute_mysql_only): Execute any MySQL statement (INSERT, UPDATE, DELETE, DDL, etc.) using a DSN connection string, with automatic retry on failure.Import OpenAPI to Apifox (
import_openapi): Import OpenAPI specifications into Apifox from a JSON string, a single JSON file, or a directory of JSON files, using a project ID and API key.Download APIs from Apifox (
download_apis): Download all API definitions from an Apifox project (OpenAPI 3.1 format) to a specified local directory, requiring a project ID and API key.Execute cURL Commands (
run_curl): Parse and execute curl command strings, returning full HTTP response details (status code, headers, body).FTP/FTPS/SFTP File Operations: Connect to remote servers and perform file management including listing, uploading, downloading, deleting, renaming, reading, writing, and managing directories and permissions.
Help (
help): Get assistance on any topic or task.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-mysql-apifox Show me the first 10 users from the database."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
主要功能
在多个命名 MySQL 配置中执行 SQL
解析并执行 curl 命令
通过多个命名 FTP、FTPS 或 SFTP 配置操作远程目录
Related MCP server: Apifox MCP
安装与初始化
配置 MCP 服务:
{ "mcpServers": { "mysql-mcp": { "command": "npx", "args": ["-y", "mcp-mysql-apifox"], "env": {"ENV_PWD": "<your-encryption-password>"} } } }让 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时,沿用原有内置密钥加密方式,配置流程与旧版一致。旧加密配置始终可读取;重新保存时按当前环境变量选择加密方式。若打开的是密码加密文件但未提供密码,配置页仍会打开并提示设置密码,但为避免覆盖无法解密的旧数据,会暂时禁止保存。.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 toolsdownload_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
Scored across 6 tools
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.
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.
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.
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
Related MCP Connectors
Hosted MySQL MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Hosted SQL Server MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
MCP server for querying and analyzing data from ad platforms, analytics tools, and spreadsheets
MCP server for interacting with the Supabase platform
Related MCP Servers
- AlicenseCqualityDmaintenanceAn MCP server that enables MySQL database integration with Claude. You can execute SQL queries and manage database connections.29MIT
- AlicenseCqualityDmaintenanceAn MCP server that integrates Apifox API documentation with AI assistants, allowing AI to extract and understand API information from Apifox projects.246 npmISC
- AlicenseNot gradedqualityDmaintenanceMCP server for connecting to databases (PostgreSQL, MySQL, SQL Server, Redis) enabling SQL queries, table exploration, and Redis key-value operations.1MIT
- AlicenseAqualityDmaintenanceMCP server that provides 22 tools to manage Apidog API documentation, including importing OpenAPI specs, exporting, diffing, analyzing, and bulk-editing endpoints.2224 npm3MIT