- 将项目名称从 lzwcai-mcp-sqlexecutor 重命名为 lzwcai-mcpskills-analyzeWorkOrder - 更新 README.md 中的安装命令、使用说明和配置示例 - 本地化业务查询名称,将中文业务名称改为英文,如"查询列表"改为"QueryList" - 优化SQL模板,移除中文列别名,使用英文字段名 - 新增销售订单相关查询功能,包括订单列表、订单详情、交付风险预测 - 添加部门人效产值损耗三维仪表盘查询 - 更新包的初始化信息和版本号
139 lines
2.2 KiB
Markdown
139 lines
2.2 KiB
Markdown
# lzwcai-mcpskills-analyzeWorkOrder
|
|
|
|
一个基于 MCP (Model Context Protocol) 的 SQL 查询执行服务器,支持从 JSON 配置文件动态生成查询工具。
|
|
|
|
## 功能特性
|
|
|
|
- 🚀 动态工具生成:从 `businessQueries.json` 自动生成 MCP 工具
|
|
- 🔧 灵活配置:支持自定义业务查询和参数验证
|
|
- 📝 完整日志:详细的操作日志记录
|
|
- 🌐 中文支持:工具名称自动转换为拼音
|
|
|
|
## 安装
|
|
|
|
### 使用 pip 安装
|
|
|
|
```bash
|
|
pip install lzwcai-mcpskills-analyzeWorkOrder
|
|
```
|
|
|
|
### 从源码安装
|
|
|
|
```bash
|
|
git clone <repository-url>
|
|
cd lzwcai_mcp_sqlexecutor
|
|
pip install -e .
|
|
```
|
|
|
|
### 使用 uv 安装(推荐)
|
|
|
|
```bash
|
|
uv pip install lzwcai-mcpskills-analyzeWorkOrder
|
|
```
|
|
|
|
## 使用方法
|
|
|
|
### 命令行启动
|
|
|
|
安装后,可以直接通过命令启动:
|
|
|
|
```bash
|
|
lzwcai-mcpskills-analyzeWorkOrder
|
|
```
|
|
|
|
### 作为 Python 模块运行
|
|
|
|
```bash
|
|
python -m lzwcai_mcp_sqlexecutor.main
|
|
```
|
|
|
|
### 配置到 MCP 客户端
|
|
|
|
在你的 MCP 客户端配置文件中添加:
|
|
|
|
```json
|
|
{
|
|
"mcpServers": {
|
|
"lzwcai-sqlexecutor": {
|
|
"command": "lzwcai-mcpskills-analyzeWorkOrder"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
## 配置说明
|
|
|
|
### businessQueries.json
|
|
|
|
在 `businessQueries.json` 中定义你的业务查询:
|
|
|
|
```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
|
|
|
|
### 本地开发
|
|
|
|
```bash
|
|
# 克隆仓库
|
|
git clone <repository-url>
|
|
cd lzwcai_mcp_sqlexecutor
|
|
|
|
# 安装开发依赖
|
|
pip install -e .
|
|
|
|
# 运行服务器
|
|
python -m lzwcai_mcp_sqlexecutor.main
|
|
```
|
|
|
|
## 构建与发布
|
|
|
|
### 使用 build 构建
|
|
|
|
```bash
|
|
pip install build
|
|
python -m build
|
|
```
|
|
|
|
### 发布到 PyPI
|
|
|
|
```bash
|
|
pip install twine
|
|
twine upload dist/*
|
|
```
|
|
|
|
## 许可证
|
|
|
|
MIT License
|
|
|
|
## 作者
|
|
|
|
lzwcai
|
|
|