feat(api-converter): 更新API配置并调整持久化令牌策略
- 替换api_config_9p04kww1pu.json为新的api_config_w8kgb73ib3.json配置文件, 包含登录和单据查询两个API接口 - 修改AuthService类中的persist_token默认值为False,调整令牌持久化策略 - 移除旧的包信息文件、依赖文件和日志文件 - 更新API配置以支持金蝶K3Cloud系统的登录和单据查询功能
This commit is contained in:
@@ -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
|
||||
@@ -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
|
||||
@@ -1 +0,0 @@
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
[console_scripts]
|
||||
lzwcai-mcp-api-converter = lzwcai_mcp_api_converter.src.create_mcp:run_main
|
||||
@@ -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
|
||||
@@ -1 +0,0 @@
|
||||
lzwcai_mcp_api_converter
|
||||
@@ -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 个工具
|
||||
@@ -1 +0,0 @@
|
||||
lzwc19781970385781825785858token={"authorization": "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjoiMTAwMDAwMDEiLCJsb2dpbl91c2VyX2tleSI6IjJmNmViMWVkYTk3MGRlNzI1OTM1YTczNzY5YWZmODJmZDE3MmFmMGIiLCJhYmJyIjoiXHU3MDc1XHU2Y2ZkXHU0ZTA3XHU1ZGRkIiwiYXVkIjoiIiwiZXhwIjoxNzY3MzQ4OTQxLCJpYXQiOjE3NjY3NDQxNDEsImlzcyI6IiIsImp0aSI6IjUyOTIyNzc0ZTdmZDA3MjZkNGEyY2FkMTgyYzEzNjM4IiwibmJmIjoxNzY2NzQ0MTQxLCJzdWIiOiIifQ.S8cvKtUfojJu0JvA1aPgd6H9y5ccd7XOa7UHMqZzn5w"}
|
||||
Binary file not shown.
Binary file not shown.
@@ -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": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -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"""
|
||||
# 获取鉴权类型和认证数据
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user