Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
31 changes: 22 additions & 9 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Duplicate tools added when combining categories with specific names

When a user specifies both a category tag (like yc_api or yc_api_full) and a specific tool name that belongs to that category, the tool gets added to the tools array twice. The category check pushes all tools from DEFAULT_API_TOOLS/ADDITIONAL_API_TOOLS, and then the for-loop unconditionally pushes any tool whose name matches this.tools, without checking if it was already added. This results in duplicate entries in the ListTools response.

Fix in Cursor Fix in Web

}
if (this.tools.includes(RUN_CODE_TOOL_TAG)) {
const envVars = await this.yepCodeEnv.getEnvVars();
Expand Down