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
{{ message }}
Repository navigation
Commit fe3f4e3
Browse filesBrowse the repository at this point in the historyBrowse files
fix(mcp): stop advertising code_execution while enable_code_execution is off (#1261)
* fix(mcp): stop advertising code_execution while enable_code_execution is off
A disabled code_execution was still listed in tools/list on every surface
that carries it (/mcp in the default retrieve_tools routing mode, /mcp/call,
/mcp/code) as a "Code Execution (Disabled)" stub whose handler refused every
call. Clients pick tools from the list, not from descriptions, so agents kept
calling it and burning a round trip per session before falling back (#1236).
- buildCodeExecutionTool returns nothing when the flag is off; the default
surface now registers through the same builder (one definition).
- RefreshCodeExecutionAvailability adds/removes the tool in place on the
default surface (AddTools / DeleteTools) and rebuilds the routing-mode
surfaces through content-guarded refreshers, so a runtime flip emits
notifications/tools/list_changed exactly once per surface and an
unrelated config reload emits nothing. The call-tool surface gains the
same fingerprint guard the code-exec surface already had; both guards are
seeded at init so the first reload does not re-announce an unchanged set.
- The handler-level gate still refuses a call that arrives by name (REST,
CallToolDirect, a cached listing) with the same wording.
Goldens: the frozen retrieve_tools_mode / code_execution_mode goldens were
captured with the flag off and carried the stub; they are regenerated with
that single entry removed, and the enumerated-delta gates (toolslist
snapshot + menu surface) now allow exactly that one removal per surface.
The pre099 / pre-feature baselines are untouched.
Closes#1236
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
* docs(code-execution): stale MCP tool lists get unknown-tool, not the enable hint
Review round 1 (astra): an MCP tools/call for the withdrawn name is refused
by mcp-go as an unknown tool; only REST/CLI callers reach the handler gate
and its "enable it" message. Also drop the restart step from the
"tool not found in tools list" troubleshooting entry — the flag is
hot-reloaded.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: docs/code_execution/troubleshooting.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -31,12 +31,12 @@ Common issues, error messages, and solutions for the `code_execution` tool.
31
31
Error: code_execution is disabled in configuration. Set 'enable_code_execution: true' in config file.
32
32
```
33
33
34
-
**Cause**: The `code_execution` feature is disabled by default for security.
34
+
**Cause**: The `code_execution` feature is disabled by default for security. While it is disabled the tool is not listed in `tools/list`, so an MCP client will normally not see it at all; this error appears when a call reaches the handler by name anyway (the REST API or the CLI). An MCP client that calls the name from a stale tool list gets an unknown-tool error instead.
35
35
36
36
**Solution**:
37
37
1. Edit your configuration file (`~/.mcpproxy/mcp_config.json`)
3.The flag is hot-reloaded: the running proxy picks up the change, advertises the tool, and sends `notifications/tools/list_changed` to connected sessions. No restart is needed; clients that do not honor `list_changed` need to reconnect to see the tool.
40
40
41
41
**Example Configuration**:
42
42
```json
@@ -56,13 +56,12 @@ Error: code_execution is disabled in configuration. Set 'enable_code_execution:
56
56
57
57
**Symptom**: LLM agent lists available tools but `code_execution` is missing.
58
58
59
-
**Cause**: Feature is not enabled or server didn't restart after configuration change.
59
+
**Cause**: Feature is not enabled — a disabled `code_execution` is deliberately absent from `tools/list` — or the client is holding a tool list from before the flag was enabled.
60
60
61
61
**Solution**:
62
62
1. Verify configuration has `"enable_code_execution": true`
63
-
2. Restart mcpproxy server
64
-
3. Reconnect LLM client
65
-
4. List tools again
63
+
2. The change is hot-reloaded and announced with `notifications/tools/list_changed`; if the client does not honor that notification, reconnect it
Copy file name to clipboardExpand all lines: docs/configuration.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1264,7 +1264,7 @@ See [Tool Quarantine](features/tool-quarantine.md) for complete details.
1264
1264
1265
1265
| Field | Type | Default | Description |
1266
1266
|-------|------|---------|-------------|
1267
-
|`enable_code_execution`| boolean |`false`| Enable JavaScript/TypeScript code execution tool (disabled by default for security) |
1267
+
|`enable_code_execution`| boolean |`false`| Enable JavaScript/TypeScript code execution tool (disabled by default for security). While `false` the `code_execution` tool is not advertised in `tools/list`. Hot-reloaded: a flip adds/removes the tool and sends `notifications/tools/list_changed`|
1268
1268
|`code_execution_timeout_ms`| integer |`120000`| Default timeout in milliseconds (1-600000, max 10 minutes) |
1269
1269
|`code_execution_max_tool_calls`| integer |`0`| Maximum tool calls per execution (0 = unlimited) |
1270
1270
|`code_execution_pool_size`| integer |`10`| Number of JavaScript VM instances in pool (1-100) |
Copy file name to clipboardExpand all lines: docs/features/code-execution.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ Enable code execution in your config:
37
37
38
38
| Option | Type | Default | Description |
39
39
|--------|------|---------|-------------|
40
-
|`enable_code_execution`| boolean |`false`| Enable the code execution tool |
40
+
|`enable_code_execution`| boolean |`false`| Enable the code execution tool. While `false` the tool is not listed in `tools/list`; a flip is hot-reloaded and announced with `notifications/tools/list_changed`|
Copy file name to clipboardExpand all lines: docs/features/routing-modes.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -165,7 +165,7 @@ Code execution mode is designed for multi-step orchestration workflows. Instead
165
165
- Complex conditional logic that would require many round-trips in other modes
166
166
- Data transformation pipelines (fetch from one tool, transform, send to another)
167
167
168
-
**Note:** Code execution must be enabled in config (`"enable_code_execution": true`). If disabled, the `code_execution` tool appears but returns an error message directing the user to enable it.
168
+
**Note:** Code execution must be enabled in config (`"enable_code_execution": true`). While it is disabled, the `code_execution` tool is not listed in `tools/list` on any endpoint, so clients that pick tools from the list never attempt it. An MCP `tools/call` for the name is refused as an unknown tool; a call that reaches the handler through the REST API or the CLI is refused with an error directing the user to enable it. The flag is hot-reloadable: flipping it adds or removes the tool on the live surfaces and sends `notifications/tools/list_changed` to connected sessions, no restart required.
0 commit comments