Files
lzwcai-mcp-server-package/lzwcai_mcp_sqlexecutor
yuanzhipeng 9c597c9b0d feat: 添加数据库管理平台MCP Server
新增lzwcai-mcp-agile-db项目,提供数据库管理、表操作、数据CRUD、
API密钥管理、技能与工具管理等功能。

包含33个工具:
- 数据源管理:创建、更新、删除数据源
- 数据库与表管理:表结构操作、数据查询等
- API密钥管理:密钥创建、权限管理等
- 技能与工具管理:SQL工具创建、配置更新等
- 数据导入和SQL执行功能

添加了完整的README文档说明安装使用方法,
以及Python 3.12版本支持和基本项目结构。
2026-06-11 09:53:40 +08:00
..

lzwcai-mcp-sqlexecutor

一个基于 MCP (Model Context Protocol) 的 SQL 查询执行服务器,支持从 JSON 配置文件动态生成查询工具。

功能特性

  • 🚀 动态工具生成:从 businessQueries.json 自动生成 MCP 工具
  • 🔧 灵活配置:支持自定义业务查询和参数验证
  • 📝 完整日志:详细的操作日志记录
  • 🌐 中文支持:工具名称自动转换为拼音

安装

使用 pip 安装

pip install lzwcai-mcp-sqlexecutor

从源码安装

git clone <repository-url>
cd lzwcai_mcp_sqlexecutor
pip install -e .

使用 uv 安装(推荐)

uv pip install lzwcai-mcp-sqlexecutor

使用方法

命令行启动

安装后,可以直接通过命令启动:

lzwcai-mcp-sqlexecutor

作为 Python 模块运行

python -m lzwcai_mcp_sqlexecutor.main

配置到 MCP 客户端

在你的 MCP 客户端配置文件中添加:

{
  "mcpServers": {
    "lzwcai-sqlexecutor": {
      "command": "lzwcai-mcp-sqlexecutor"
    }
  }
}

配置说明

businessQueries.json

businessQueries.json 中定义你的业务查询:

[
  {
    "id": "query-001",
    "businessName": "用户订单查询",
    "businessDescription": "根据用户ID查询订单信息",
    "sqlTemplate": "SELECT * FROM orders WHERE user_id = {{userId}}",
    "parameters": {
      "type": "object",
      "required": ["userId"],
      "properties": {
        "userId": {
          "type": "integer",
          "description": "用户的唯一标识符",
          "examples": [10086]
        }
      }
    }
  }
]

开发

依赖项

  • Python >= 3.13
  • httpx >= 0.28.1
  • mcp[cli] >= 1.10.1
  • pypinyin >= 0.53.0

本地开发

# 克隆仓库
git clone <repository-url>
cd lzwcai_mcp_sqlexecutor

# 安装开发依赖
pip install -e .

# 运行服务器
python -m lzwcai_mcp_sqlexecutor.main

构建与发布

使用 build 构建

pip install build
python -m build

发布到 PyPI

pip install twine
twine upload dist/*

许可证

MIT License

作者

lzwcai