You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
C1: Default /mcp endpoint now respects routing_mode config by using
GetMCPServerForMode() instead of always using retrieve_tools server.
C2: lookupToolPermission now uses exact match via lookupToolAnnotations
(StateView) as primary lookup, with BM25 index search (limit 20) as
fallback. Prevents wrong permission tier from fuzzy search results.
I1: When code execution is disabled in config, the /mcp/code endpoint
returns a clear error message instead of confusing runtime failure.
"- Standard ES5.1+ JavaScript (no require(), filesystem, or network access)\n\n"+
220
-
"**Available tools for orchestration**:\n%s\n\n"+
221
-
"Use call_tool('serverName', 'toolName', {args}) to invoke tools.",
222
-
toolCatalog,
223
-
)
224
-
225
208
tools:=make([]mcpserver.ServerTool, 0, 2)
226
209
227
-
// code_execution tool with enhanced description
228
-
codeExecutionTool:=mcp.NewTool("code_execution",
229
-
mcp.WithDescription(codeExecDescription),
230
-
mcp.WithTitleAnnotation("Code Execution"),
231
-
mcp.WithDestructiveHintAnnotation(true),
232
-
mcp.WithString("code",
233
-
mcp.Required(),
234
-
mcp.Description("JavaScript source code (ES5.1+) to execute. Use `input` to access input data and `call_tool(serverName, toolName, args)` to invoke upstream tools."),
235
-
),
236
-
mcp.WithObject("input",
237
-
mcp.Description("Input data accessible as global `input` variable in JavaScript code (default: {})"),
238
-
),
239
-
mcp.WithObject("options",
240
-
mcp.Description("Execution options: timeout_ms (1-600000, default: 120000), max_tool_calls (>= 0, 0=unlimited), allowed_servers (array of server names, empty=all allowed)"),
241
-
),
242
-
)
243
-
tools=append(tools, mcpserver.ServerTool{
244
-
Tool: codeExecutionTool,
245
-
Handler: p.handleCodeExecution,
246
-
})
210
+
// Check if code execution is enabled in config
211
+
ifp.config!=nil&&!p.config.EnableCodeExecution {
212
+
// Code execution is disabled: register a stub tool that returns a clear error message
213
+
codeExecutionTool:=mcp.NewTool("code_execution",
214
+
mcp.WithDescription("Code execution is currently disabled. Enable it by setting \"enable_code_execution\": true in your mcpproxy config."),
returnmcp.NewToolResultError("Code execution is disabled. Enable it by setting \"enable_code_execution\": true in your mcpproxy configuration file."), nil
226
+
},
227
+
})
228
+
} else {
229
+
// Build enhanced description with available tools catalog
230
+
ctx:=context.Background()
231
+
toolCatalog:=p.buildToolCatalogDescription(ctx)
232
+
233
+
codeExecDescription:=fmt.Sprintf(
234
+
"Execute JavaScript code that orchestrates multiple upstream MCP tools in a single request. "+
235
+
"Use this when you need to combine results from 2+ tools, implement conditional logic, loops, or data transformations.\n\n"+
236
+
"**Available in JavaScript**:\n"+
237
+
"- `input` global: Your input data passed via the 'input' parameter\n"+
"- Standard ES5.1+ JavaScript (no require(), filesystem, or network access)\n\n"+
240
+
"**Available tools for orchestration**:\n%s\n\n"+
241
+
"Use call_tool('serverName', 'toolName', {args}) to invoke tools.",
242
+
toolCatalog,
243
+
)
244
+
245
+
// code_execution tool with enhanced description
246
+
codeExecutionTool:=mcp.NewTool("code_execution",
247
+
mcp.WithDescription(codeExecDescription),
248
+
mcp.WithTitleAnnotation("Code Execution"),
249
+
mcp.WithDestructiveHintAnnotation(true),
250
+
mcp.WithString("code",
251
+
mcp.Required(),
252
+
mcp.Description("JavaScript source code (ES5.1+) to execute. Use `input` to access input data and `call_tool(serverName, toolName, args)` to invoke upstream tools."),
253
+
),
254
+
mcp.WithObject("input",
255
+
mcp.Description("Input data accessible as global `input` variable in JavaScript code (default: {})"),
256
+
),
257
+
mcp.WithObject("options",
258
+
mcp.Description("Execution options: timeout_ms (1-600000, default: 120000), max_tool_calls (>= 0, 0=unlimited), allowed_servers (array of server names, empty=all allowed)"),
0 commit comments