feat(api-converter): 更新API配置并调整持久化令牌策略

- 替换api_config_9p04kww1pu.json为新的api_config_w8kgb73ib3.json配置文件,
  包含登录和单据查询两个API接口

- 修改AuthService类中的persist_token默认值为False,调整令牌持久化策略

- 移除旧的包信息文件、依赖文件和日志文件

- 更新API配置以支持金蝶K3Cloud系统的登录和单据查询功能
This commit is contained in:
2026-03-06 16:19:07 +08:00
parent 3c9fba36e9
commit 8703a61198
22 changed files with 506 additions and 579 deletions

View File

@@ -1,12 +0,0 @@
Metadata-Version: 2.4
Name: lzwcai-mcp-api-converter
Version: 0.2.0
Summary: 基于FastMCP框架的动态API工具服务器自动将企业业务API配置转换为MCP协议工具支持多种传输方式、企业认证和参数验证为AI助手提供标准化的业务接口访问能力。
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: dynaconf>=3.2.11
Requires-Dist: httpx>=0.28.1
Requires-Dist: jinja2==3.1.6
Requires-Dist: mcp[cli]>=1.8.0
Requires-Dist: requests>=2.31.0
Requires-Dist: pypinyin>=0.54.0

View File

@@ -1,25 +0,0 @@
pyproject.toml
setup.cfg
lzwcai_mcp_api_converter/__init__.py
lzwcai_mcp_api_converter.egg-info/PKG-INFO
lzwcai_mcp_api_converter.egg-info/SOURCES.txt
lzwcai_mcp_api_converter.egg-info/dependency_links.txt
lzwcai_mcp_api_converter.egg-info/entry_points.txt
lzwcai_mcp_api_converter.egg-info/requires.txt
lzwcai_mcp_api_converter.egg-info/top_level.txt
lzwcai_mcp_api_converter/src/__init__.py
lzwcai_mcp_api_converter/src/api_config.json
lzwcai_mcp_api_converter/src/create_mcp.py
lzwcai_mcp_api_converter/src/business/__init__.py
lzwcai_mcp_api_converter/src/business/business_util.py
lzwcai_mcp_api_converter/src/business/get_business_api.py
lzwcai_mcp_api_converter/src/core/__init__.py
lzwcai_mcp_api_converter/src/core/api_auth_service.py
lzwcai_mcp_api_converter/src/core/api_base.py
lzwcai_mcp_api_converter/src/core/core_server.py
lzwcai_mcp_api_converter/src/core/get_auth.py
lzwcai_mcp_api_converter/src/core/plugin_base.py
lzwcai_mcp_api_converter/src/util/__init__.py
lzwcai_mcp_api_converter/src/util/api_helper.py
lzwcai_mcp_api_converter/src/util/logger_config.py
lzwcai_mcp_api_converter/src/util/nested_value.py

View File

@@ -1,2 +0,0 @@
[console_scripts]
lzwcai-mcp-api-converter = lzwcai_mcp_api_converter.src.create_mcp:run_main

View File

@@ -1,6 +0,0 @@
dynaconf>=3.2.11
httpx>=0.28.1
jinja2==3.1.6
mcp[cli]>=1.8.0
requests>=2.31.0
pypinyin>=0.54.0

View File

@@ -1 +0,0 @@
lzwcai_mcp_api_converter

View File

@@ -1,37 +0,0 @@
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:215] - ================================================================================
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:216] - 日志系统初始化完成 - 2025-12-30 11:48:23
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:217] - 日志级别: INFO
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:218] - 日志文件: E:\yh-ai\project\lzwcai-szyg\lzwcai-mcp-server-package\lzwcai_mcp_api_converter\lzwcai_mcp_api_converter.log
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:219] - 控制台输出: False
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:220] - 文件输出: True
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:221] - 文件轮转: 最大10MB, 保留5个备份
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.util.logger_config - INFO - [logger_config.py:222] - ================================================================================
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:277] - 开始初始化 MCP 服务器
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:116] - 配置模式: memory
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:124] - 使用内存模式加载配置(多租户支持)
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:135] - 使用环境变量提供的businessUuid: u9ua9ss2l8c
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:139] - 租户配置变量名: businessu9ua9ss2l8c
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:147] - 内存中没有租户 u9ua9ss2l8c 的配置,开始从业务平台获取...
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:168] - 从环境变量bizSysApiIds获取到API IDs: [1970386761072058369, 1970386761185304578, 1970386761583763457, 1970386761420185602]
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:175] - 调用get_business_api_config获取配置API IDs: [1970386761072058369, 1970386761185304578, 1970386761583763457, 1970386761420185602]
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:193] - 开始获取 4 个API的详情...
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:93] - 成功获取 4 个API详情
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:197] - 开始映射为配置格式...
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:158] - 成功映射 4 个API到配置格式
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:159] - 服务名称: lzwcai_mcp_api_converter
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:160] - 域名URL: https://erp.166bg.com/api
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:161] - 描述: 定时任务列表、定时任务详情、任务列表、任务统计列表(按状态)
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.business.get_business_api - INFO - [get_business_api.py:200] - [SUCCESS] 成功生成API配置包含 4 个API
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:177] - 成功获取业务API配置包含 4 个API配置
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:181] - 配置已存储到内存变量: businessu9ua9ss2l8c
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:182] - 当前内存中共有 1 个租户配置
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:292] - 服务器配置 - 名称: lzwcai-mcp-dyntoolapi, 版本: 1.0.0
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.core.api_base - INFO - [api_base.py:262] - 开始处理 4 个API配置
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.core.api_base - INFO - [api_base.py:317] - API配置处理完成成功处理 4 个配置
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.core.api_base - INFO - [api_base.py:389] - ApiBase初始化完成共处理 4 个API配置
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:307] - API 基础服务初始化完成,共 4 个API配置
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:506] - 注册API工具插件
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:509] - API工具插件注册完成
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:779] - 配置文件监控功能已禁用如需启用请设置环境变量ENABLE_CONFIG_WATCH=true
2025-12-30 11:48:23 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:578] - 启动STDIO传输模式
2025-12-30 11:48:24 - lzwcai_mcp_api_converter.src.create_mcp - INFO - [create_mcp.py:391] - 返回工具列表,共 4 个工具

View File

@@ -1 +0,0 @@
lzwc19781970385781825785858token={"authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMTAwMDAwMDEiLCJsb2dpbl91c2VyX2tleSI6IjJmNmViMWVkYTk3MGRlNzI1OTM1YTczNzY5YWZmODJmZDE3MmFmMGIiLCJhYmJyIjoiXHU3MDc1XHU2Y2ZkXHU0ZTA3XHU1ZGRkIiwiYXVkIjoiIiwiZXhwIjoxNzY3MzQ4OTQxLCJpYXQiOjE3NjY3NDQxNDEsImlzcyI6IiIsImp0aSI6IjUyOTIyNzc0ZTdmZDA3MjZkNGEyY2FkMTgyYzEzNjM4IiwibmJmIjoxNzY2NzQ0MTQxLCJzdWIiOiIifQ.S8cvKtUfojJu0JvA1aPgd6H9y5ccd7XOa7UHMqZzn5w"}

View File

@@ -1,483 +0,0 @@
{
"serverName": "lzwcai_mcp_api_converter",
"description": "业务API集合",
"domainUrl": "https://erp.lzwc.cn/api",
"packageName": "lzwcai-mcp-dyntoolapi",
"version": "1.0.0",
"apiConfig": [
{
"id": "2019327913872793602",
"enterpriseId": "1932095424144715777",
"bizSysId": "1970385781825785858",
"domainUrl": "https://erp.lzwc.cn/api",
"interfaceName": "获取内容列表(进销存-采购订单)",
"businessPrompts": "",
"returnType": "JSON",
"returnConversion": "{\"success_param\": \"code==200\", \"status_param\": \"code\", \"msg_param\": \"msg\", \"data\": \"data\"}",
"header": null,
"apiUrl": "/jxcPurchase/queryPageList",
"parametersFormat": "0",
"method": "POST",
"status": 1,
"version": "v1.0",
"authenticationRequired": 1,
"responseExample": null,
"crudType": "0",
"isView": 0,
"templateType": "markdown",
"viewTemplates": null,
"parameters": [
{
"keyParam": null,
"required": 1,
"paramName": "Authorization",
"paramType": "STRING",
"paramPrompts": "注意Bearer后面有一个空格即Bearer+空格+登录返回的token",
"defaultValue": "Bearer {{token}}",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019327913872793602",
"requestType": "header",
"dataFormat": null,
"validity": null,
"sort": "1",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "page",
"paramType": "INTEGER",
"paramPrompts": "当前页码",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019327913872793602",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "2",
"tags": "0",
"example": "1"
},
{
"keyParam": null,
"required": 0,
"paramName": "limit",
"paramType": "INTEGER",
"paramPrompts": "每页条数",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019327913872793602",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "3",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "search",
"paramType": "STRING",
"paramPrompts": "搜索关键字",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019327913872793602",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "4",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "searchList[]",
"paramType": "STRING",
"paramPrompts": "高级搜索条件数组,注意用的时候参数名去掉中括号",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019327913872793602",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "5",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "sceneId",
"paramType": "INTEGER",
"paramPrompts": "场景ID",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019327913872793602",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "6",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "type",
"paramType": "INTEGER",
"paramPrompts": "",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019327913872793602",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "7",
"tags": "0",
"example": "10-采购订单"
}
]
},
{
"id": "2019328946728542210",
"enterpriseId": "1932095424144715777",
"bizSysId": "1970385781825785858",
"domainUrl": "https://erp.lzwc.cn/api",
"interfaceName": "新建内容(进销存-采购订单)",
"businessPrompts": "",
"returnType": "JSON",
"returnConversion": "{\"success_param\": \"code==200\", \"status_param\": \"code\", \"msg_param\": \"msg\", \"data\": \"data\"}",
"header": null,
"apiUrl": "/jxcPurchase/add",
"parametersFormat": "0",
"method": "POST",
"status": 1,
"version": "v1.0",
"authenticationRequired": 1,
"responseExample": null,
"crudType": "0",
"isView": 0,
"templateType": "markdown",
"viewTemplates": null,
"parameters": [
{
"keyParam": null,
"required": 1,
"paramName": "Authorization",
"paramType": "STRING",
"paramPrompts": "注意Bearer后面有一个空格即Bearer+空格+登录返回的token",
"defaultValue": "Bearer {{token}}",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019328946728542210",
"requestType": "header",
"dataFormat": null,
"validity": null,
"sort": "1",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "entity",
"paramType": "ARRAY",
"paramPrompts": "基本信息,参考合同",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019328946728542210",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "2",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "examineFlowData",
"paramType": "ARRAY",
"paramPrompts": "审批流相关信息,参考合同",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019328946728542210",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "3",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "field",
"paramType": "ARRAY",
"paramPrompts": "字段相关信息,参考合同",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019328946728542210",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "4",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "productList",
"paramType": "ARRAY",
"paramPrompts": "产品列表",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019328946728542210",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "5",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "expendList",
"paramType": "ARRAY",
"paramPrompts": "扩展数据列表,字段参数参考为空",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019328946728542210",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "6",
"tags": "0",
"example": ""
}
]
},
{
"id": "2019329359485804545",
"enterpriseId": "1932095424144715777",
"bizSysId": "1970385781825785858",
"domainUrl": "https://erp.lzwc.cn/api",
"interfaceName": "获取内容详情(进销存-采购订单)",
"businessPrompts": "",
"returnType": "JSON",
"returnConversion": "{\"success_param\": \"code==200\", \"status_param\": \"code\", \"msg_param\": \"msg\", \"data\": \"data\"}",
"header": null,
"apiUrl": "/jxcPurchase/queryById/{id}",
"parametersFormat": "0",
"method": "POST",
"status": 1,
"version": "v1.0",
"authenticationRequired": 1,
"responseExample": null,
"crudType": "0",
"isView": 0,
"templateType": "markdown",
"viewTemplates": null,
"parameters": [
{
"keyParam": null,
"required": 1,
"paramName": "Authorization",
"paramType": "STRING",
"paramPrompts": "注意Bearer后面有一个空格即Bearer+空格+登录返回的token",
"defaultValue": "Bearer {{token}}",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019329359485804545",
"requestType": "header",
"dataFormat": null,
"validity": null,
"sort": "1",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 1,
"paramName": "id",
"paramType": "STRING",
"paramPrompts": "",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019329359485804545",
"requestType": "path",
"dataFormat": null,
"validity": null,
"sort": "2",
"tags": "0",
"example": ""
}
]
},
{
"id": "2019330096911556610",
"enterpriseId": "1932095424144715777",
"bizSysId": "1970385781825785858",
"domainUrl": "https://erp.lzwc.cn/api",
"interfaceName": "编辑内容(进销存-采购订单)",
"businessPrompts": "",
"returnType": "JSON",
"returnConversion": "{\"success_param\": \"code==200\", \"status_param\": \"code\", \"msg_param\": \"msg\", \"data\": \"data\"}",
"header": null,
"apiUrl": "/jxcPurchase/update",
"parametersFormat": "0",
"method": "POST",
"status": 1,
"version": "v1.0",
"authenticationRequired": 1,
"responseExample": null,
"crudType": "0",
"isView": 0,
"templateType": "markdown",
"viewTemplates": null,
"parameters": [
{
"keyParam": null,
"required": 1,
"paramName": "Authorization",
"paramType": "STRING",
"paramPrompts": "注意Bearer后面有一个空格即Bearer+空格+登录返回的token",
"defaultValue": "Bearer {{token}}",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019330096911556610",
"requestType": "header",
"dataFormat": null,
"validity": null,
"sort": "1",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "entity",
"paramType": "STRING",
"paramPrompts": "基本信息,参考合同",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019330096911556610",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "2",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "examineFlowData",
"paramType": "STRING",
"paramPrompts": "审批流相关信息,参考合同",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019330096911556610",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "3",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "field",
"paramType": "STRING",
"paramPrompts": "字段相关信息,参考合同",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019330096911556610",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "4",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "productList",
"paramType": "STRING",
"paramPrompts": "产品列表",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019330096911556610",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "5",
"tags": "0",
"example": ""
},
{
"keyParam": null,
"required": 0,
"paramName": "expendList",
"paramType": "STRING",
"paramPrompts": "扩展数据列表,字段参数参考为空",
"defaultValue": "",
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2019330096911556610",
"requestType": "formdata",
"dataFormat": null,
"validity": null,
"sort": "6",
"tags": "0",
"example": ""
}
]
}
]
}

View File

@@ -0,0 +1,219 @@
{
"serverName": "lzwcai_mcp_api_converter",
"description": "登录、单据查询",
"domainUrl": "http://39.108.116.74",
"packageName": "lzwcai-mcp-dyntoolapi",
"version": "1.0.0",
"apiConfig": [
{
"id": "2029506334288154626",
"enterpriseId": "1932095424144715777",
"bizSysId": "2029468454441897985",
"domainUrl": "http://39.108.116.74",
"interfaceName": "登录",
"businessPrompts": "登录",
"returnType": "JSON",
"returnConversion": "{\"success_param\": \"code==200\", \"status_param\": \"code\", \"msg_param\": \"msg\", \"data\": \"data\"}",
"header": null,
"apiUrl": "/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc",
"parametersFormat": "2",
"method": "POST",
"status": 1,
"version": "1.0.0",
"authenticationRequired": 0,
"responseExample": null,
"crudType": "0",
"isView": 0,
"templateType": "markdown",
"viewTemplates": null,
"parameters": [
{
"keyParam": null,
"required": 1,
"paramName": "parameters",
"paramType": "ARRAY",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334288154626",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "1",
"tags": "2",
"example": null
}
]
},
{
"id": "2029506334388817922",
"enterpriseId": "1932095424144715777",
"bizSysId": "2029468454441897985",
"domainUrl": "http://39.108.116.74",
"interfaceName": "单据查询",
"businessPrompts": "单据查询",
"returnType": "JSON",
"returnConversion": "{\"success_param\": \"code==200\", \"status_param\": \"code\", \"msg_param\": \"msg\", \"data\": \"data\"}",
"header": null,
"apiUrl": "/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc",
"parametersFormat": "2",
"method": "POST",
"status": 1,
"version": "1.0.0",
"authenticationRequired": 1,
"responseExample": null,
"crudType": "4",
"isView": 0,
"templateType": "markdown",
"viewTemplates": null,
"parameters": [
{
"keyParam": null,
"required": 1,
"paramName": "parameters",
"paramType": "ARRAY",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "1",
"tags": "2",
"example": null
},
{
"keyParam": null,
"required": 0,
"paramName": "parameters[].FormId",
"paramType": "STRING",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "2",
"tags": "2",
"example": null
},
{
"keyParam": null,
"required": 0,
"paramName": "parameters[].TopRowCount",
"paramType": "INTEGER",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "3",
"tags": "2",
"example": null
},
{
"keyParam": null,
"required": 0,
"paramName": "parameters[].Limit",
"paramType": "INTEGER",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "4",
"tags": "1",
"example": null
},
{
"keyParam": null,
"required": 0,
"paramName": "parameters[].StartRow",
"paramType": "INTEGER",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "5",
"tags": "2",
"example": null
},
{
"keyParam": null,
"required": 0,
"paramName": "parameters[].FilterString",
"paramType": "STRING",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "6",
"tags": "2",
"example": null
},
{
"keyParam": null,
"required": 0,
"paramName": "parameters[].OrderString",
"paramType": "STRING",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "7",
"tags": "3",
"example": null
},
{
"keyParam": null,
"required": 0,
"paramName": "parameters[].FieldKeys",
"paramType": "STRING",
"paramPrompts": "",
"defaultValue": null,
"assoKey": null,
"assoApiId": null,
"memory": 0,
"apiId": "2029506334388817922",
"requestType": "body",
"dataFormat": null,
"validity": null,
"sort": "8",
"tags": "0",
"example": null
}
]
}
]
}

View File

@@ -687,7 +687,7 @@ class AuthService:
self,
user_id: Optional[str],
biz_sys_id: Optional[str],
persist_token: bool = True,
persist_token: bool = False,
) -> Dict[str, Any]:
"""
完整的请求鉴权处理
@@ -725,7 +725,7 @@ class AuthService:
user_id: Optional[str],
biz_sys_id: Optional[str],
token: Optional[str] = None,
persist_token: bool = True,
persist_token: bool = False,
) -> Optional[Union[str, Dict[str, Any]]]:
"""
检查用户Token是否有效如无效则重新获取
@@ -760,7 +760,7 @@ class AuthService:
# 如果环境变量存在,直接返回值
if exists:
self.logger.info(
f"从环境变量获取到用户{user_id}业务系统{biz_sys_id}的Token"
f"从环境变量获取到用户{user_id}业务系统{biz_sys_id}的Token: {token_value}"
)
return token_value
@@ -774,7 +774,7 @@ class AuthService:
return await self._refresh_user_token(user_id, biz_sys_id, token_name, persist_token)
async def _refresh_user_token(
self, user_id: str, biz_sys_id: str, token_name: str, persist_token: bool = True
self, user_id: str, biz_sys_id: str, token_name: str, persist_token: bool = False
) -> Optional[Union[str, Dict[str, Any]]]:
"""刷新用户Token"""
# 获取鉴权类型和认证数据

View File

@@ -667,7 +667,9 @@ class ApiClient:
auth_result.get("error_response", {}).get("status_code"),
)
return auth_result.get("tokenHeader", {})
token_header = auth_result.get("tokenHeader", {})
logger.info(f"API调用获取到Token - 用户ID: {user_id}, 业务系统ID: {biz_sys_id}, Token: {token_header}")
return token_header
def _contains_file(self, data: Dict[str, Any]) -> bool:

View File

@@ -1,9 +1,9 @@
import os
os.environ["modelId"] = "1946471611735015425"
os.environ["bizSysId"] = "1970385781825785858"
os.environ["bizSysApiIds"] = "[\"2019327913872793602\",\"2019328946728542210\",\"2019329359485804545\",\"2019330096911556610\"]"
os.environ["businessUuid"] = "9p04kww1pu"
os.environ["bizSysId"] = "2029468454441897985"
os.environ["bizSysApiIds"] = "[\"2029506334288154626\",\"2029506334388817922\"]"
os.environ["businessUuid"] = "w8kgb73ib3"
os.environ["LZWCAI_CORP_MANAGER_URL"] = "http://192.168.2.236:8088"
# 导入模块
from lzwcai_mcp_api_converter.src.create_mcp import run_main

View File

@@ -1,6 +1,6 @@
[project]
name = "lzwcai-mcp-api-converter"
version = "0.2.0"
version = "0.2.1"
description = "基于FastMCP框架的动态API工具服务器自动将企业业务API配置转换为MCP协议工具支持多种传输方式、企业认证和参数验证为AI助手提供标准化的业务接口访问能力。"
readme = "README.md"
requires-python = ">=3.10"

View File

@@ -0,0 +1,137 @@
2026-02-13 15:34:10 - root - INFO - [logger_config.py:117] - 日志系统初始化完成 - 日志目录: E:\yh-ai\project\lzwcai-szyg\lzwcai-mcp-server-package\lzwcai_workflow_to_mcp\lzwcai_workflow_to_mcp\logs
2026-02-13 15:34:10 - mcp.server.lowlevel.server - DEBUG - [server.py:154] - Initializing server 'workflow_mcp_server'
2026-02-13 15:34:10 - mcp.server.lowlevel.server - DEBUG - [server.py:380] - Registering handler for ListToolsRequest
2026-02-13 15:34:10 - mcp.server.lowlevel.server - DEBUG - [server.py:441] - Registering handler for CallToolRequest
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:334] - ==================================================
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:335] - Workflow MCP Server 启动
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:336] - ==================================================
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:341] - 命令行参数: {'mode': 'api', 'json_path': None, 'workflow_id': None}
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:344] - 使用模式: api
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:103] - ApiLoader 初始化工作流ID: 2005892514011795457
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:111] - 开始从 API 加载工作流配置工作流ID: 2005892514011795457
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:115] - [客户端初始化] base_url=http://192.168.2.236:8088
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:116] - [客户端初始化] token=wf_ce270212b2ee45ab9c81714a7c243c56
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:117] - [客户端初始化] execute_timeout=600.0s
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:148] - [API请求] GET http://192.168.2.236:8088/system/workflowManage/getByWorkflowId/2005892514011795457
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - DEBUG - [api_client.py:149] - [API请求] Headers: {'X-API-Key': 'wf_ce270212b2ee45ab9c81714a7c243c56'}
2026-02-13 15:34:11 - httpcore.connection - DEBUG - [_trace.py:45] - connect_tcp.started host='192.168.2.236' port=8088 local_address=None timeout=30.0 socket_options=None
2026-02-13 15:34:11 - httpcore.connection - DEBUG - [_trace.py:45] - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x0000018F42AB4380>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_headers.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_headers.complete
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_body.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_body.complete
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_headers.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'', [(b'Vary', b'Origin'), (b'Vary', b'Access-Control-Request-Method'), (b'Vary', b'Access-Control-Request-Headers'), (b'X-Content-Type-Options', b'nosniff'), (b'X-XSS-Protection', b'1; mode=block'), (b'X-Frame-Options', b'SAMEORIGIN'), (b'Content-Type', b'application/json'), (b'Transfer-Encoding', b'chunked'), (b'Date', b'Fri, 13 Feb 2026 07:34:05 GMT'), (b'Keep-Alive', b'timeout=60'), (b'Connection', b'keep-alive')])
2026-02-13 15:34:11 - httpx - INFO - [_client.py:1025] - HTTP Request: GET http://192.168.2.236:8088/system/workflowManage/getByWorkflowId/2005892514011795457 "HTTP/1.1 200 "
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_body.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_body.complete
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - response_closed.started
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - response_closed.complete
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:156] - [API响应] HTTP 200
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - DEBUG - [api_client.py:157] - [API响应] Headers: {'vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json', 'transfer-encoding': 'chunked', 'date': 'Fri, 13 Feb 2026 07:34:05 GMT', 'keep-alive': 'timeout=60', 'connection': 'keep-alive'}
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:162] - [API响应] 获取工作流配置成功: workflow_id=2005892514011795457
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - DEBUG - [api_client.py:163] - [API响应] Body: {
"msg": "查询成功",
"code": 200,
"data": [
{
"id": "2013554734817918978",
"createBy": "yy8z7",
"createTime": "2026-01-20 18:10:33",
"updateBy": "yy8z7",
"updateTime": "2026-02-13 15:30:40",
"serviceId": "2013554734784364545",
"uniqueName": "登记资产",
"name": "dengjizichan_0220941f",
"description": "阿三大苏打啊",
"visualizable": 0,
"toolPrompt": null,
"toolType": "api",
"datasourceId": null,
"sqlTemplate": null,
"sqlParams": "[]",
"resultType": null,
"sourceType": null,
"trainingTaskId": null,
"tableMetadataIds": null,
"executionCount": 0,
"visualizationConfigs": null,
"inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"workflow_extraContext\":{\"description\":\"工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填\"}},\"required\":[]}",
"outputJsonSchema": "{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}},\"additionalProperties\":false}",
"lastExecutionTime": null
}
]
}
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:116] - API 响应原始数据: {
"msg": "查询成功",
"code": 200,
"data": [
{
"id": "2013554734817918978",
"createBy": "yy8z7",
"createTime": "2026-01-20 18:10:33",
"updateBy": "yy8z7",
"updateTime": "2026-02-13 15:30:40",
"serviceId": "2013554734784364545",
"uniqueName": "登记资产",
"name": "dengjizichan_0220941f",
"description": "阿三大苏打啊",
"visualizable": 0,
"toolPrompt": null,
"toolType": "api",
"datasourceId": null,
"sqlTemplate": null,
"sqlParams": "[]",
"resultType": null,
"sourceType": null,
"trainingTaskId": null,
"tableMetadataIds": null,
"executionCount": 0,
"visualizationConfigs": null,
"inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"workflow_extraContext\":{\"description\":\"工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填\"}},\"required\":[]}",
"outputJsonSchema": "{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}},\"additionalProperties\":false}",
"lastExecutionTime": null
}
]
}
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:124] - API 响应 data 字段: [
{
"id": "2013554734817918978",
"createBy": "yy8z7",
"createTime": "2026-01-20 18:10:33",
"updateBy": "yy8z7",
"updateTime": "2026-02-13 15:30:40",
"serviceId": "2013554734784364545",
"uniqueName": "登记资产",
"name": "dengjizichan_0220941f",
"description": "阿三大苏打啊",
"visualizable": 0,
"toolPrompt": null,
"toolType": "api",
"datasourceId": null,
"sqlTemplate": null,
"sqlParams": "[]",
"resultType": null,
"sourceType": null,
"trainingTaskId": null,
"tableMetadataIds": null,
"executionCount": 0,
"visualizationConfigs": null,
"inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"workflow_extraContext\":{\"description\":\"工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填\"}},\"required\":[]}",
"outputJsonSchema": "{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}},\"additionalProperties\":false}",
"lastExecutionTime": null
}
]
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - INFO - [main.py:135] - 从 API 加载工作流配置成功工作流ID: 2005892514011795457, 配置数量: 1
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - INFO - [main.py:165] - 已加载 1 个工具配置
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - INFO - [main.py:352] - 开始运行 MCP Server (stdio 模式)
2026-02-13 15:34:11 - asyncio - DEBUG - [proactor_events.py:634] - Using proactor: IocpProactor
2026-02-13 15:34:12 - mcp.server.lowlevel.server - DEBUG - [server.py:582] - Received message: root=InitializedNotification(method='notifications/initialized', params=None, jsonrpc='2.0')
2026-02-13 15:34:36 - mcp.server.lowlevel.server - DEBUG - [server.py:582] - Received message: <mcp.shared.session.RequestResponder object at 0x0000018F42BC42C0>
2026-02-13 15:34:36 - mcp.server.lowlevel.server - INFO - [server.py:619] - Processing request of type ListToolsRequest
2026-02-13 15:34:36 - mcp.server.lowlevel.server - DEBUG - [server.py:621] - Dispatching request of type ListToolsRequest
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - INFO - [main.py:171] - 收到 ListTools 请求,当前配置数量: 1
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:178] - 处理工具配置: name=dengjizichan_0220941f, description=阿三大苏打啊...
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:185] - 从 sqlParams 转换的 inputSchema: {"type": "object", "properties": {}, "required": []}
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - INFO - [main.py:237] - ListTools 响应: 返回 1 个工具
2026-02-13 15:34:36 - mcp.server.lowlevel.server - DEBUG - [server.py:662] - Response sent

View File

@@ -0,0 +1,137 @@
2026-02-13 15:34:10 - root - INFO - [logger_config.py:117] - 日志系统初始化完成 - 日志目录: E:\yh-ai\project\lzwcai-szyg\lzwcai-mcp-server-package\lzwcai_workflow_to_mcp\lzwcai_workflow_to_mcp\logs
2026-02-13 15:34:10 - mcp.server.lowlevel.server - DEBUG - [server.py:154] - Initializing server 'workflow_mcp_server'
2026-02-13 15:34:10 - mcp.server.lowlevel.server - DEBUG - [server.py:380] - Registering handler for ListToolsRequest
2026-02-13 15:34:10 - mcp.server.lowlevel.server - DEBUG - [server.py:441] - Registering handler for CallToolRequest
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:334] - ==================================================
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:335] - Workflow MCP Server 启动
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:336] - ==================================================
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:341] - 命令行参数: {'mode': 'api', 'json_path': None, 'workflow_id': None}
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:344] - 使用模式: api
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:103] - ApiLoader 初始化工作流ID: 2005892514011795457
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.main - INFO - [main.py:111] - 开始从 API 加载工作流配置工作流ID: 2005892514011795457
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:115] - [客户端初始化] base_url=http://192.168.2.236:8088
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:116] - [客户端初始化] token=wf_ce270212b2ee45ab9c81714a7c243c56
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:117] - [客户端初始化] execute_timeout=600.0s
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:148] - [API请求] GET http://192.168.2.236:8088/system/workflowManage/getByWorkflowId/2005892514011795457
2026-02-13 15:34:10 - lzwcai_workflow_to_mcp.utils.api_client - DEBUG - [api_client.py:149] - [API请求] Headers: {'X-API-Key': 'wf_ce270212b2ee45ab9c81714a7c243c56'}
2026-02-13 15:34:11 - httpcore.connection - DEBUG - [_trace.py:45] - connect_tcp.started host='192.168.2.236' port=8088 local_address=None timeout=30.0 socket_options=None
2026-02-13 15:34:11 - httpcore.connection - DEBUG - [_trace.py:45] - connect_tcp.complete return_value=<httpcore._backends.sync.SyncStream object at 0x0000018F42AB4380>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_headers.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_headers.complete
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_body.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_body.complete
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_headers.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_headers.complete return_value=(b'HTTP/1.1', 200, b'', [(b'Vary', b'Origin'), (b'Vary', b'Access-Control-Request-Method'), (b'Vary', b'Access-Control-Request-Headers'), (b'X-Content-Type-Options', b'nosniff'), (b'X-XSS-Protection', b'1; mode=block'), (b'X-Frame-Options', b'SAMEORIGIN'), (b'Content-Type', b'application/json'), (b'Transfer-Encoding', b'chunked'), (b'Date', b'Fri, 13 Feb 2026 07:34:05 GMT'), (b'Keep-Alive', b'timeout=60'), (b'Connection', b'keep-alive')])
2026-02-13 15:34:11 - httpx - INFO - [_client.py:1025] - HTTP Request: GET http://192.168.2.236:8088/system/workflowManage/getByWorkflowId/2005892514011795457 "HTTP/1.1 200 "
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_body.started request=<Request [b'GET']>
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - receive_response_body.complete
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - response_closed.started
2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - response_closed.complete
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:156] - [API响应] HTTP 200
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - DEBUG - [api_client.py:157] - [API响应] Headers: {'vary': 'Origin, Access-Control-Request-Method, Access-Control-Request-Headers', 'x-content-type-options': 'nosniff', 'x-xss-protection': '1; mode=block', 'x-frame-options': 'SAMEORIGIN', 'content-type': 'application/json', 'transfer-encoding': 'chunked', 'date': 'Fri, 13 Feb 2026 07:34:05 GMT', 'keep-alive': 'timeout=60', 'connection': 'keep-alive'}
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - INFO - [api_client.py:162] - [API响应] 获取工作流配置成功: workflow_id=2005892514011795457
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.utils.api_client - DEBUG - [api_client.py:163] - [API响应] Body: {
"msg": "查询成功",
"code": 200,
"data": [
{
"id": "2013554734817918978",
"createBy": "yy8z7",
"createTime": "2026-01-20 18:10:33",
"updateBy": "yy8z7",
"updateTime": "2026-02-13 15:30:40",
"serviceId": "2013554734784364545",
"uniqueName": "登记资产",
"name": "dengjizichan_0220941f",
"description": "阿三大苏打啊",
"visualizable": 0,
"toolPrompt": null,
"toolType": "api",
"datasourceId": null,
"sqlTemplate": null,
"sqlParams": "[]",
"resultType": null,
"sourceType": null,
"trainingTaskId": null,
"tableMetadataIds": null,
"executionCount": 0,
"visualizationConfigs": null,
"inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"workflow_extraContext\":{\"description\":\"工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填\"}},\"required\":[]}",
"outputJsonSchema": "{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}},\"additionalProperties\":false}",
"lastExecutionTime": null
}
]
}
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:116] - API 响应原始数据: {
"msg": "查询成功",
"code": 200,
"data": [
{
"id": "2013554734817918978",
"createBy": "yy8z7",
"createTime": "2026-01-20 18:10:33",
"updateBy": "yy8z7",
"updateTime": "2026-02-13 15:30:40",
"serviceId": "2013554734784364545",
"uniqueName": "登记资产",
"name": "dengjizichan_0220941f",
"description": "阿三大苏打啊",
"visualizable": 0,
"toolPrompt": null,
"toolType": "api",
"datasourceId": null,
"sqlTemplate": null,
"sqlParams": "[]",
"resultType": null,
"sourceType": null,
"trainingTaskId": null,
"tableMetadataIds": null,
"executionCount": 0,
"visualizationConfigs": null,
"inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"workflow_extraContext\":{\"description\":\"工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填\"}},\"required\":[]}",
"outputJsonSchema": "{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}},\"additionalProperties\":false}",
"lastExecutionTime": null
}
]
}
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:124] - API 响应 data 字段: [
{
"id": "2013554734817918978",
"createBy": "yy8z7",
"createTime": "2026-01-20 18:10:33",
"updateBy": "yy8z7",
"updateTime": "2026-02-13 15:30:40",
"serviceId": "2013554734784364545",
"uniqueName": "登记资产",
"name": "dengjizichan_0220941f",
"description": "阿三大苏打啊",
"visualizable": 0,
"toolPrompt": null,
"toolType": "api",
"datasourceId": null,
"sqlTemplate": null,
"sqlParams": "[]",
"resultType": null,
"sourceType": null,
"trainingTaskId": null,
"tableMetadataIds": null,
"executionCount": 0,
"visualizationConfigs": null,
"inputJsonSchema": "{\"type\":\"object\",\"properties\":{\"workflow_extraContext\":{\"description\":\"工作流额外的上下文参数(如环境变量等),可以是任何类型,非必填\"}},\"required\":[]}",
"outputJsonSchema": "{\"type\":\"object\",\"properties\":{\"text\":{\"type\":\"string\"}},\"additionalProperties\":false}",
"lastExecutionTime": null
}
]
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - INFO - [main.py:135] - 从 API 加载工作流配置成功工作流ID: 2005892514011795457, 配置数量: 1
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - INFO - [main.py:165] - 已加载 1 个工具配置
2026-02-13 15:34:11 - lzwcai_workflow_to_mcp.main - INFO - [main.py:352] - 开始运行 MCP Server (stdio 模式)
2026-02-13 15:34:11 - asyncio - DEBUG - [proactor_events.py:634] - Using proactor: IocpProactor
2026-02-13 15:34:12 - mcp.server.lowlevel.server - DEBUG - [server.py:582] - Received message: root=InitializedNotification(method='notifications/initialized', params=None, jsonrpc='2.0')
2026-02-13 15:34:36 - mcp.server.lowlevel.server - DEBUG - [server.py:582] - Received message: <mcp.shared.session.RequestResponder object at 0x0000018F42BC42C0>
2026-02-13 15:34:36 - mcp.server.lowlevel.server - INFO - [server.py:619] - Processing request of type ListToolsRequest
2026-02-13 15:34:36 - mcp.server.lowlevel.server - DEBUG - [server.py:621] - Dispatching request of type ListToolsRequest
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - INFO - [main.py:171] - 收到 ListTools 请求,当前配置数量: 1
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:178] - 处理工具配置: name=dengjizichan_0220941f, description=阿三大苏打啊...
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - DEBUG - [main.py:185] - 从 sqlParams 转换的 inputSchema: {"type": "object", "properties": {}, "required": []}
2026-02-13 15:34:36 - lzwcai_workflow_to_mcp.main - INFO - [main.py:237] - ListTools 响应: 返回 1 个工具
2026-02-13 15:34:36 - mcp.server.lowlevel.server - DEBUG - [server.py:662] - Response sent

View File

@@ -7,8 +7,8 @@ import os
if __name__ == "__main__":
# 设置环境变量
os.environ["workflowId"] = "2020107946473074690"
os.environ["workflowExecuteKey"] = "wf_20170f33487d41459c180c6a277991a4"
os.environ["workflowId"] = "2005892514011795457"
os.environ["workflowExecuteKey"] = "wf_ce270212b2ee45ab9c81714a7c243c56"
os.environ["backendBaseUrl"] = "http://192.168.2.236:8088"
# Import and run the actual MCP server