diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/PKG-INFO b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/PKG-INFO deleted file mode 100644 index d5a8bb6..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/PKG-INFO +++ /dev/null @@ -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 diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/SOURCES.txt b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/SOURCES.txt deleted file mode 100644 index 48815ae..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/SOURCES.txt +++ /dev/null @@ -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 \ No newline at end of file diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/dependency_links.txt b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/dependency_links.txt deleted file mode 100644 index 8b13789..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/dependency_links.txt +++ /dev/null @@ -1 +0,0 @@ - diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/entry_points.txt b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/entry_points.txt deleted file mode 100644 index 7504d25..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/entry_points.txt +++ /dev/null @@ -1,2 +0,0 @@ -[console_scripts] -lzwcai-mcp-api-converter = lzwcai_mcp_api_converter.src.create_mcp:run_main diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/requires.txt b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/requires.txt deleted file mode 100644 index df9559c..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/requires.txt +++ /dev/null @@ -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 diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/top_level.txt b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/top_level.txt deleted file mode 100644 index f33e29f..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.egg-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -lzwcai_mcp_api_converter diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.log b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.log deleted file mode 100644 index e322619..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter.log +++ /dev/null @@ -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 个工具 diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/.env_lzwcai_mcp_api_converter b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/.env_lzwcai_mcp_api_converter deleted file mode 100644 index b31b845..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/.env_lzwcai_mcp_api_converter +++ /dev/null @@ -1 +0,0 @@ -lzwc19781970385781825785858token={"authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMTAwMDAwMDEiLCJsb2dpbl91c2VyX2tleSI6IjJmNmViMWVkYTk3MGRlNzI1OTM1YTczNzY5YWZmODJmZDE3MmFmMGIiLCJhYmJyIjoiXHU3MDc1XHU2Y2ZkXHU0ZTA3XHU1ZGRkIiwiYXVkIjoiIiwiZXhwIjoxNzY3MzQ4OTQxLCJpYXQiOjE3NjY3NDQxNDEsImlzcyI6IiIsImp0aSI6IjUyOTIyNzc0ZTdmZDA3MjZkNGEyY2FkMTgyYzEzNjM4IiwibmJmIjoxNzY2NzQ0MTQxLCJzdWIiOiIifQ.S8cvKtUfojJu0JvA1aPgd6H9y5ccd7XOa7UHMqZzn5w"} diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/__pycache__/__init__.cpython-312.pyc b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/__pycache__/__init__.cpython-312.pyc deleted file mode 100644 index 42a2177..0000000 Binary files a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/__pycache__/__init__.cpython-312.pyc and /dev/null differ diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/__pycache__/create_mcp.cpython-312.pyc b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/__pycache__/create_mcp.cpython-312.pyc index 1718742..ad00b8b 100644 Binary files a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/__pycache__/create_mcp.cpython-312.pyc and b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/__pycache__/create_mcp.cpython-312.pyc differ diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/api_config_9p04kww1pu.json b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/api_config_9p04kww1pu.json deleted file mode 100644 index 1072a01..0000000 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/api_config_9p04kww1pu.json +++ /dev/null @@ -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": "" - } - ] - } - ] -} \ No newline at end of file diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/api_config_w8kgb73ib3.json b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/api_config_w8kgb73ib3.json new file mode 100644 index 0000000..f2ddf69 --- /dev/null +++ b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/api_config_w8kgb73ib3.json @@ -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 + } + ] + } + ] +} \ No newline at end of file diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/api_auth_service.py b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/api_auth_service.py index 48c08b2..c0438af 100644 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/api_auth_service.py +++ b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/api_auth_service.py @@ -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""" # 获取鉴权类型和认证数据 diff --git a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/core_server.py b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/core_server.py index 176a9e3..68073d7 100644 --- a/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/core_server.py +++ b/lzwcai_mcp_api_converter/lzwcai_mcp_api_converter/src/core/core_server.py @@ -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: diff --git a/lzwcai_mcp_api_converter/main.py b/lzwcai_mcp_api_converter/main.py index db69f49..52490a4 100644 --- a/lzwcai_mcp_api_converter/main.py +++ b/lzwcai_mcp_api_converter/main.py @@ -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 diff --git a/lzwcai_mcp_api_converter/pyproject.toml b/lzwcai_mcp_api_converter/pyproject.toml index 902ddb6..5f200f2 100644 --- a/lzwcai_mcp_api_converter/pyproject.toml +++ b/lzwcai_mcp_api_converter/pyproject.toml @@ -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" diff --git a/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/__pycache__/main.cpython-312.pyc b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/__pycache__/main.cpython-312.pyc new file mode 100644 index 0000000..2aad1c1 Binary files /dev/null and b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/__pycache__/main.cpython-312.pyc differ diff --git a/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/__pycache__/schema_converter.cpython-312.pyc b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/__pycache__/schema_converter.cpython-312.pyc new file mode 100644 index 0000000..83efa78 Binary files /dev/null and b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/__pycache__/schema_converter.cpython-312.pyc differ diff --git a/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp.log b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp.log new file mode 100644 index 0000000..ed7b947 --- /dev/null +++ b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp.log @@ -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= +2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_headers.started request= +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= +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= +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= +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: +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 diff --git a/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp_daily.log b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp_daily.log new file mode 100644 index 0000000..ed7b947 --- /dev/null +++ b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp_daily.log @@ -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= +2026-02-13 15:34:11 - httpcore.http11 - DEBUG - [_trace.py:45] - send_request_headers.started request= +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= +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= +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= +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: +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 diff --git a/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp_error.log b/lzwcai_workflow_to_mcp/lzwcai_workflow_to_mcp/logs/lzwcai_workflow_to_mcp_error.log new file mode 100644 index 0000000..e69de29 diff --git a/lzwcai_workflow_to_mcp/main.py b/lzwcai_workflow_to_mcp/main.py index 7e44bdf..4077d21 100644 --- a/lzwcai_workflow_to_mcp/main.py +++ b/lzwcai_workflow_to_mcp/main.py @@ -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