From 38129ccc773aefefef0e0b4385f746709165b7fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcos=20Mui=CC=81n=CC=83o=20Garci=CC=81a?= Date: Tue, 25 Nov 2025 10:23:32 +0100 Subject: [PATCH] Allow to use only selected api tools in MCP --- README.md | 1 + src/server.ts | 31 ++++++++++++++++++++++--------- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 5e944a5..eb85a9e 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,7 @@ You can control which tools are enabled by setting the `YEPCODE_MCP_TOOLS` envir - `run_code`: Enables the code execution tool - `yc_api`: Enables all basic API management tools (processes, schedules, variables, storage, executions, modules) - `yc_api_full`: Enables all API management tools including version-related tools (extends `yc_api` with additional process and module version management tools) +- any specific API tool name (e.g., `execute_process_sync`, `get_execution`,...) **Process tags:** - Any tag used in your YepCode processes (e.g., `mcp-tool`, `core`, `automation`, etc.) diff --git a/src/server.ts b/src/server.ts index 8ac9a49..d942975 100644 --- a/src/server.ts +++ b/src/server.ts @@ -121,6 +121,21 @@ const API_TOOL_TAGS = { FULL: "yc_api_full", }; +const DEFAULT_API_TOOLS = [ + ...storageToolDefinitions, + ...variablesToolDefinitions, + ...schedulesToolDefinitions, + ...processesToolDefinitions, + ...executionsToolDefinitions, + ...modulesToolDefinitions, +]; + +const ADDITIONAL_API_TOOLS = [ + ...processesWithVersionsToolDefinitions, + ...modulesWithVersionsToolDefinitions, + ...authToolDefinitions, +]; + const DEFAULT_TOOL_TAGS = [RUN_CODE_TOOL_TAG, RUN_PROCESS_TOOL_TAG]; dotenv.config(); @@ -293,17 +308,15 @@ class YepCodeMcpServer extends Server { this.tools.includes(API_TOOL_TAGS.DEFAULT) || this.tools.includes(API_TOOL_TAGS.FULL) ) { - tools.push(...storageToolDefinitions); - tools.push(...variablesToolDefinitions); - tools.push(...schedulesToolDefinitions); - tools.push(...processesToolDefinitions); - tools.push(...executionsToolDefinitions); - tools.push(...modulesToolDefinitions); + tools.push(...DEFAULT_API_TOOLS); } if (this.tools.includes(API_TOOL_TAGS.FULL)) { - tools.push(...processesWithVersionsToolDefinitions); - tools.push(...modulesWithVersionsToolDefinitions); - tools.push(...authToolDefinitions); + tools.push(...ADDITIONAL_API_TOOLS); + } + for (const tool of [...DEFAULT_API_TOOLS, ...ADDITIONAL_API_TOOLS]) { + if (this.tools.includes(tool.name)) { + tools.push(tool); + } } if (this.tools.includes(RUN_CODE_TOOL_TAG)) { const envVars = await this.yepCodeEnv.getEnvVars();