mcpField
M
mysql_mcpserver_stdio

mysql_mcpserver_stdio

Local
github.com/lanjunfeiDatabases1Updated 79w ago

About mysql_mcpserver_stdio

A web-based generator for developers who need to expose MySQL queries as MCP tools. It creates server scripts that support stdio and SSE, with a database connectivity check included.

Key features

  1. 01Batch-generate MySQL MCP server scripts
  2. 02Configure database connection details
  3. 03Add custom SQL tools
  4. 04Support stdio and SSE transports
  5. 05Include a database connectivity check

Use cases

  1. 01Generate server scripts for multiple MySQL databases
  2. 02Expose SQL queries as MCP tools
  3. 03Test generated servers remotely over SSE

MCP support

Generated scripts implement MCP servers and expose database checks and custom SQL tools to MCP clients over stdio or SSE.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

No install method listed yet

We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.

Repository

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

MySQL MCP 服务器生成器(支持 stdio + SSE)

本项目用于批量生成基于 MySQL 的 MCP 服务器脚本。每个生成的脚本同时支持两种传输方式:

  • stdio – 通过本地子进程 / 管道调用
  • SSE (HTTP) – 通过 /sse 端点提供远程访问(适配 MCP Inspector)

安装

python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux / WSL
source .venv/bin/activate

pip install -r requirements.txt

使用流程

1️⃣ 启动生成器界面
python app.py

在浏览器打开 **http://127.0.0.1:5000**,依次完成:

  1. 输入 MySQL 连接信息(主机、端口、用户、密码、数据库)。
  2. 指定输出文件名(必须以 .py 结尾,如 my_server.py)。
  3. 点击 生成。脚本会自动包含一个 check_database 工具用于快速连通性测试。
2️⃣ 添加自定义工具

进入 “新增工具函数” 页面,为每条 SQL 查询填写:

字段说明
工具函数名使用 snake_case
工具说明1 行描述
SQL 语句使用 %s 占位符传参
输出格式(可选)Python 代码片段,用 content.append() 拼接返回文本

示例格式化代码:

for row in rows:
    content.append(f"设备账号: {row['username']}")
    content.append(f"IPv4: {row['user_ip4']}")

保存后脚本会自动插入工具函数。

3️⃣ 运行生成的服务器脚本
模式命令访问地址
stdio(默认)python my_server.py–
SSE / HTTPpython my_server.py --httphttp://127.0.0.1:8000/sse

📌 注意 当前 FastMCP.run() 默认监听 0.0.0.0:8000。 若需自定义端口,可在启动前设置环境变量,例如:

# Windows
set MCP_PORT=9110
# Linux / macOS / WSL
export MCP_PORT=9110
python my_server.py --http
4️⃣ 用 MCP Inspector 测试
npx @modelcontextprotocol/inspector

连接成功后,即可在左侧看到自动发现的工具列表并进行调用。


项目结构

├── app.py            # Flask GUI 生成器
├── templates/        # Jinja2 + Bootstrap 页面
├── static/           # 前端静态资源
├── requirements.txt  # 依赖列表
└── README.md         # 使用说明(本文件)

祝你开发顺利,快速批量生成 MCP Server!

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.