Metadata-Version: 2.4
Name: mysqlmcp-r
Version: 0.1.0
Summary: MySQL MCP Server with GUI config panel and YAML import
Author: renqingfei
License-Expression: MIT
Keywords: mcp,mysql,gui,cursor,codex
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: PyMySQL>=1.1.0
Requires-Dist: PyYAML>=6.0.0
Requires-Dist: mcp>=1.0.0

# MySQL MCP Server

一个带 GUI 配置面板的 MySQL MCP Server，外部使用方式对齐 `mcp_ssh`，底层改为 MySQL 连接与表操作。

## 功能

- **多连接管理** - 保存多个 MySQL 连接并选择当前活动连接
- **GUI 配置面板** - `mysqlgui` 一键启动，可视化管理连接
- **YAML 导入** - 支持从 Java `application.yml/.yaml` 自动提取 MySQL 配置
- **一键安装** - 安装到 Windsurf / Cursor / Claude Code / Codex
- **MCP 协议** - 通过 stdio 暴露 MySQL 工具
- **全表操作** - 支持查询、DDL、CRUD、表结构查看

## 安装

```bash
pip install mysqlmcp-r
```

## 命令一览

| 命令 | 说明 |
|------|------|
| `mysqlmcp` | 以 MCP Server 模式运行 |
| `mysqlgui` | 启动 GUI 配置面板 |
| `mysqlmcp-install` | 安装到所有 IDE |
| `mysqlmcp-install-windsurf` | 安装到 Windsurf |
| `mysqlmcp-install-cursor` | 安装到 Cursor |
| `mysqlmcp-install-claudecode` | 安装到 Claude Code |
| `mysqlmcp-install-codex` | 安装到 Codex |

## GUI 支持

- 手动填写 `host / port / username / password / database / charset`
- 在“添加/编辑连接”弹窗中选择 YAML 文件自动导入 MySQL datasource
- 测试连接
- 指定当前活动连接

## MCP Tools

- `list_servers`
- `connect`
- `disconnect`
- `get_status`
- `exec_sql`（禁止执行 `DROP TABLE`、`TRUNCATE TABLE`、`DROP DATABASE`）
- `list_databases`
- `list_tables`
- `describe_table`
- `show_create_table`
- `list_columns`
- `create_table`
- `alter_table`
- `rename_table`
- `insert_rows`（`rows` 必须是对象数组，支持多行批量插入）
- `update_rows`（`where_clause` 支持 `?` 或 `%s`）
- `delete_rows`（`where_clause` 支持 `?` 或 `%s`）

## 手动 MCP 配置

```json
{
  "mcpServers": {
    "mysql": {
      "command": "mysqlmcp"
    }
  }
}
```

## 开发测试

```bash
python -m pytest -q
```
