Skip to content

Commit 2376269

Browse files
authored
Merge pull request #19 from yepcode/feature/YEP-3037
YEP-3037 Allow to use only selected api tools in MCP
2 parents 2abdec7 + 38129cc commit 2376269

2 files changed

Lines changed: 23 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ You can control which tools are enabled by setting the `YEPCODE_MCP_TOOLS` envir
162162
- `run_code`: Enables the code execution tool
163163
- `yc_api`: Enables all basic API management tools (processes, schedules, variables, storage, executions, modules)
164164
- `yc_api_full`: Enables all API management tools including version-related tools (extends `yc_api` with additional process and module version management tools)
165+
- any specific API tool name (e.g., `execute_process_sync`, `get_execution`,...)
165166

166167
**Process tags:**
167168
- Any tag used in your YepCode processes (e.g., `mcp-tool`, `core`, `automation`, etc.)

src/server.ts

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,21 @@ const API_TOOL_TAGS = {
121121
FULL: "yc_api_full",
122122
};
123123

124+
const DEFAULT_API_TOOLS = [
125+
...storageToolDefinitions,
126+
...variablesToolDefinitions,
127+
...schedulesToolDefinitions,
128+
...processesToolDefinitions,
129+
...executionsToolDefinitions,
130+
...modulesToolDefinitions,
131+
];
132+
133+
const ADDITIONAL_API_TOOLS = [
134+
...processesWithVersionsToolDefinitions,
135+
...modulesWithVersionsToolDefinitions,
136+
...authToolDefinitions,
137+
];
138+
124139
const DEFAULT_TOOL_TAGS = [RUN_CODE_TOOL_TAG, RUN_PROCESS_TOOL_TAG];
125140

126141
dotenv.config();
@@ -293,17 +308,15 @@ class YepCodeMcpServer extends Server {
293308
this.tools.includes(API_TOOL_TAGS.DEFAULT) ||
294309
this.tools.includes(API_TOOL_TAGS.FULL)
295310
) {
296-
tools.push(...storageToolDefinitions);
297-
tools.push(...variablesToolDefinitions);
298-
tools.push(...schedulesToolDefinitions);
299-
tools.push(...processesToolDefinitions);
300-
tools.push(...executionsToolDefinitions);
301-
tools.push(...modulesToolDefinitions);
311+
tools.push(...DEFAULT_API_TOOLS);
302312
}
303313
if (this.tools.includes(API_TOOL_TAGS.FULL)) {
304-
tools.push(...processesWithVersionsToolDefinitions);
305-
tools.push(...modulesWithVersionsToolDefinitions);
306-
tools.push(...authToolDefinitions);
314+
tools.push(...ADDITIONAL_API_TOOLS);
315+
}
316+
for (const tool of [...DEFAULT_API_TOOLS, ...ADDITIONAL_API_TOOLS]) {
317+
if (this.tools.includes(tool.name)) {
318+
tools.push(tool);
319+
}
307320
}
308321
if (this.tools.includes(RUN_CODE_TOOL_TAG)) {
309322
const envVars = await this.yepCodeEnv.getEnvVars();

0 commit comments

Comments
 (0)