From 68beb27be094ce27b6a8ccf7672d7dbad90c2414 Mon Sep 17 00:00:00 2001 From: xuzhang52 Date: Thu, 24 Apr 2025 10:18:10 +0800 Subject: [PATCH 1/5] config: add glama.json --- glama.json | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 glama.json diff --git a/glama.json b/glama.json new file mode 100644 index 0000000..597aeab --- /dev/null +++ b/glama.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://glama.ai/mcp/schemas/server.json", + "maintainers": [ + "iflytek" + ] +} \ No newline at end of file From 2d8c95327fa71fc2df346edc4aff037d3104a54e Mon Sep 17 00:00:00 2001 From: zxreaper Date: Tue, 29 Apr 2025 21:37:14 +0800 Subject: [PATCH 2/5] config: add Dockerfile --- Dockerfile | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..9e70829 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,11 @@ +FROM python:3.11.11-slim + +RUN pip install uv + +WORKDIR /app + +COPY . /app + +ENV CONFIG_PATH='./config.yaml' + +CMD ["uv", "run", "python", "./src/mcp_server/server.py"] From 360fbda13fb04d57f96eabad3f71c7bc4ed3ae84 Mon Sep 17 00:00:00 2001 From: xuzhang52 Date: Wed, 30 Apr 2025 10:19:55 +0800 Subject: [PATCH 3/5] feat: get workflow's config by setting environment variables. --- Dockerfile | 9 ++++++++- src/mcp_server/entities/ifly_client.py | 18 ++++++++++++------ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9e70829..ee03bb4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,13 @@ WORKDIR /app COPY . /app -ENV CONFIG_PATH='./config.yaml' +ENV FLOWS='[ + { + "flow_id": "id1", + "name": "flow1", + "description": "desc1", + "api_key": "key1:secret1" + } +]' CMD ["uv", "run", "python", "./src/mcp_server/server.py"] diff --git a/src/mcp_server/entities/ifly_client.py b/src/mcp_server/entities/ifly_client.py index 659bcfc..0a1f03c 100644 --- a/src/mcp_server/entities/ifly_client.py +++ b/src/mcp_server/entities/ifly_client.py @@ -21,16 +21,22 @@ class SysTool(Enum): class IFlyWorkflowClient(ABC): base_url = "https://xingchen-api.xf-yun.com" - def __init__(self, config_path: str = os.getenv("CONFIG_PATH")): + def __init__(self, config_path: str = os.getenv("CONFIG_PATH"), env_config: str = os.getenv("FLOWS")): """ init :param config_path: config path,default is CONFIG_PATH """ - if not config_path: - raise ValueError("CONFIG_PATH is not set") - - with open(config_path, 'r', encoding='utf-8') as file: - self.flows = [Flow(**flow) for flow in yaml.safe_load(file)] + self.flows = [] + if config_path: + with open(config_path, 'r', encoding='utf-8') as file: + for flow in yaml.safe_load(file): + self.flows.append(Flow(**flow)) + if env_config: + flows = json.loads(env_config) + for flow in flows: + self.flows.append(Flow(**flow)) + if len(self.flows) == 0: + raise Exception("Unable to find config in CONFIG_PATH or environment variables.") self.name_idx: Dict[str, int] = {} # get flow info From 169f9632e05f79a67ffc4a7b056c1ecd3bdb5fd9 Mon Sep 17 00:00:00 2001 From: xuzhang52 Date: Wed, 30 Apr 2025 11:48:46 +0800 Subject: [PATCH 4/5] config: update Dockerfile --- Dockerfile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index ee03bb4..6b690ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,13 +6,13 @@ WORKDIR /app COPY . /app -ENV FLOWS='[ - { - "flow_id": "id1", - "name": "flow1", - "description": "desc1", - "api_key": "key1:secret1" - } +ENV FLOWS='[ \ + { \ + "flow_id": "id1", \ + "name": "flow1", \ + "description": "desc1", \ + "api_key": "key1:secret1" \ + } \ ]' CMD ["uv", "run", "python", "./src/mcp_server/server.py"] From 37253ce489384df24d6f5a7cdc5b7dbefa86c7ed Mon Sep 17 00:00:00 2001 From: xuzhang52 Date: Wed, 30 Apr 2025 11:49:07 +0800 Subject: [PATCH 5/5] docs: Update README.md --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 0747e06..3e80b50 100644 --- a/README.md +++ b/README.md @@ -73,6 +73,20 @@ Before using the mcp server, you should prepare a config.yaml to save your workf api_key: 'API Key:API Secret' # required ``` +### Set workflow info in Environment Variable +You can also choose to set workflow info in environment variables. For example, configure environment variables in Dockerfile: +```Dokerfile +ENV FLOWS='[ \ + { \ + "flow_id": "id1", \ + "name": "flow1", \ + "description": "desc1", \ + "api_key": "key1:secret1" \ + } \ +]' +``` + + #### Get workflow authentication information 1. [Create a bot](https://xinghuo.xfyun.cn/botcenter/createbot) ![](./images/create_workflow.png)