Skip to content
Open
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
2 changes: 1 addition & 1 deletion web_ui_utcp_mcp_bridge/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ services:
- "8778:8778"
environment:
- PROVIDERS_PATH=/app/data/providers.json
- HOST=127.0.0.1
- HOST=0.0.0.0
- FASTAPI_PORT=8778
- MCP_PROXY_PORT=8777
- MCP_CLIENT_PORT=8776
Expand Down
4 changes: 2 additions & 2 deletions web_ui_utcp_mcp_bridge/src/utcp_proxy_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ def get(obj, attr, default=None):
for py_name_safe, orig_name in param_map.items():
func_code += f" if {py_name_safe} is not None:\n"
func_code += f" args['{orig_name}'] = {py_name_safe}\n"
func_code += f" return await bridge.client.call_tool('{get(tool, 'name')}', args)\n"
func_code += f" return await client.call_tool('{get(tool, 'name')}', args)\n"
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

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

Tool name is inserted into generated code without escaping; a single quote in the name will break the generated function string.

Prompt for AI agents
Address the following comment on web_ui_utcp_mcp_bridge/src/utcp_proxy_mcp.py at line 86:

<comment>Tool name is inserted into generated code without escaping; a single quote in the name will break the generated function string.</comment>

<file context>
@@ -83,10 +83,10 @@ def get(obj, attr, default=None):
             func_code += f&quot;    if {py_name_safe} is not None:\n&quot;
             func_code += f&quot;        args[&#39;{orig_name}&#39;] = {py_name_safe}\n&quot;
-        func_code += f&quot;    return await bridge.client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
+        func_code += f&quot;    return await client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
 
         # Create function
</file context>
Suggested change
func_code += f" return await client.call_tool('{get(tool, 'name')}', args)\n"
func_code += f" return await client.call_tool({get(tool, 'name')!r}, args)\n"
Fix with Cubic

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

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

Generated proxy references client, but exec assigns it only to locals; at runtime client is not in the function's globals, causing NameError when the proxy is called.

Prompt for AI agents
Address the following comment on web_ui_utcp_mcp_bridge/src/utcp_proxy_mcp.py at line 86:

<comment>Generated proxy references client, but exec assigns it only to locals; at runtime client is not in the function&#39;s globals, causing NameError when the proxy is called.</comment>

<file context>
@@ -83,10 +83,10 @@ def get(obj, attr, default=None):
             func_code += f&quot;    if {py_name_safe} is not None:\n&quot;
             func_code += f&quot;        args[&#39;{orig_name}&#39;] = {py_name_safe}\n&quot;
-        func_code += f&quot;    return await bridge.client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
+        func_code += f&quot;    return await client.call_tool(&#39;{get(tool, &#39;name&#39;)}&#39;, args)\n&quot;
 
         # Create function
</file context>
Fix with Cubic


# Create function
namespace = {"bridge": self}
namespace = { "client": self.client }
exec(func_code, globals(), namespace)
proxy_func = namespace["proxy"]
proxy_func.__name__ = get(tool, 'name', 'utcp_tool').replace('.', '_')
Expand Down