Skip to content

Conversation

@AndreiGS
Copy link
Contributor

@AndreiGS AndreiGS commented Aug 31, 2025

  • MCP tools were registered as a single tool instead of "recursively" registering MCP server internal tools
  • Plugin logs were not showing

Summary by cubic

Fixes MCP tool registration by expanding and registering each MCP server tool instead of a single wrapper. Restores plugin logs by adding default stderr logging across communication protocols.

  • Bug Fixes

    • Recursively register MCP server tools when an MCP manual is referenced, keeping the "." name prefix.
    • More robust MCP sessions: reuse existing sessions, retry on session-level errors, and clean up on deregister/close.
  • Logging

    • Add a default INFO-level StreamHandler to all protocol plugins when no handlers are configured, so logs show by default.
    • Normalize MCP logs via lightweight helper methods.

@AndreiGS AndreiGS requested a review from h3xxit August 31, 2025 17:35
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

15 issues found across 9 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

@AndreiGS AndreiGS closed this Aug 31, 2025
@AndreiGS AndreiGS reopened this Aug 31, 2025
h3xxit and others added 6 commits September 2, 2025 14:08
…ication_protocol.py

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…cation_protocol.py

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…tion_protocol.py

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…tion_protocol.py

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…tion_protocol.py

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
…ication_protocol.py

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
@h3xxit
Copy link
Member

h3xxit commented Sep 2, 2025

Btw, after changing that, try running utcp-agent with playwright MCP. And see if browser searching works. That's the goal.

@h3xxit h3xxit mentioned this pull request Sep 2, 2025
@h3xxit
Copy link
Member

h3xxit commented Sep 4, 2025

@cubic-dev-ai review

@cubic-dev-ai
Copy link
Contributor

cubic-dev-ai bot commented Sep 4, 2025

@cubic-dev-ai review

@h3xxit I've started the AI code review. It'll take a few minutes to complete.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

7 issues found across 12 files

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.


if "." not in tool_name:
is_resource, name = self._is_resource(tool_name)
server_name, target_resource = normalize(await self._get_tool_server(name, tool_call_template) if not is_resource else await self._get_resource_server(name, tool_call_template))
Copy link
Contributor

Choose a reason for hiding this comment

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

Fully qualified tool names parse the server but then ignore it, re-searching all servers; this can call the wrong server or fail when a specific server was requested.

Prompt for AI agents
Address the following comment on plugins/communication_protocols/mcp/src/utcp_mcp/mcp_communication_protocol.py at line 308:

<comment>Fully qualified tool names parse the server but then ignore it, re-searching all servers; this can call the wrong server or fail when a specific server was requested.</comment>

<file context>
@@ -260,59 +257,148 @@ async def call_tool(self, caller: &#39;UtcpClient&#39;, tool_name: str, tool_args: Dict[
+
+        if &quot;.&quot; not in tool_name:
+            is_resource, name = self._is_resource(tool_name)
+            server_name, target_resource = normalize(await self._get_tool_server(name, tool_call_template) if not is_resource else await self._get_resource_server(name, tool_call_template))
+            return McpCommunicationProtocol._ParseToolResult(None, server_name, name, is_resource, target_resource)
+        
</file context>

if not logger.hasHandlers(): # Only add default handler if user didn't configure logging
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s"))
logger.addHandler(handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a handler without disabling propagation can cause duplicate log records if root/global handlers are configured later; set propagate=False after adding the default handler.

(Based on your team's feedback about plugin logs not showing by default, this keeps the default handler while preventing duplicates when applications also configure logging.)

Prompt for AI agents
Address the following comment on plugins/communication_protocols/gql/src/utcp_gql/gql_communication_protocol.py at line 19:

<comment>Adding a handler without disabling propagation can cause duplicate log records if root/global handlers are configured later; set propagate=False after adding the default handler.

(Based on your team&#39;s feedback about plugin logs not showing by default, this keeps the default handler while preventing duplicates when applications also configure logging.)</comment>

<file context>
@@ -12,6 +13,13 @@
+if not logger.hasHandlers():  # Only add default handler if user didn&#39;t configure logging
+    handler = logging.StreamHandler(sys.stderr)
+    handler.setFormatter(logging.Formatter(&quot;%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s&quot;))
+    logger.addHandler(handler)
+    logger.setLevel(logging.INFO)
+
</file context>
Suggested change
logger.addHandler(handler)
logger.addHandler(handler); logger.propagate = False

if not logger.hasHandlers(): # Only add default handler if user didn't configure logging
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s"))
logger.addHandler(handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a handler without disabling propagation can cause duplicate logs when global handlers are configured later; set logger.propagate = False when installing the default handler.

(Based on your team's feedback about restoring plugin logs by default; this keeps logs visible without duplicating them when global logging is configured.)

Prompt for AI agents
Address the following comment on plugins/communication_protocols/socket/src/utcp_socket/tcp_communication_protocol.py at line 23:

<comment>Adding a handler without disabling propagation can cause duplicate logs when global handlers are configured later; set logger.propagate = False when installing the default handler.

(Based on your team&#39;s feedback about restoring plugin logs by default; this keeps logs visible without duplicating them when global logging is configured.)</comment>

<file context>
@@ -16,6 +17,12 @@
+if not logger.hasHandlers():  # Only add default handler if user didn&#39;t configure logging
+    handler = logging.StreamHandler(sys.stderr)
+    handler.setFormatter(logging.Formatter(&quot;%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s&quot;))
+    logger.addHandler(handler)
+    logger.setLevel(logging.INFO)
+
</file context>

if not logger.hasHandlers(): # Only add default handler if user didn't configure logging
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s"))
logger.addHandler(handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a handler at import time without disabling propagation can cause duplicate logs if the application configures handlers later; set logger.propagate = False when attaching the default handler.

(Based on your team's feedback about restoring plugin logs by default, this change keeps logs visible while preventing duplicates after later logging configuration.)

Prompt for AI agents
Address the following comment on plugins/communication_protocols/text/src/utcp_text/text_communication_protocol.py at line 32:

<comment>Adding a handler at import time without disabling propagation can cause duplicate logs if the application configures handlers later; set logger.propagate = False when attaching the default handler.

(Based on your team&#39;s feedback about restoring plugin logs by default, this change keeps logs visible while preventing duplicates after later logging configuration.)</comment>

<file context>
@@ -25,6 +26,13 @@
+if not logger.hasHandlers():  # Only add default handler if user didn&#39;t configure logging
+    handler = logging.StreamHandler(sys.stderr)
+    handler.setFormatter(logging.Formatter(&quot;%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s&quot;))
+    logger.addHandler(handler)
+    logger.setLevel(logging.INFO)
+
</file context>
Suggested change
logger.addHandler(handler)
logger.addHandler(handler); logger.propagate = False

if not logger.hasHandlers(): # Only add default handler if user didn't configure logging
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s"))
logger.addHandler(handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a handler without disabling propagation can produce duplicate log entries if the app configures root/ancestor handlers after this module is imported; disable propagation when installing the default handler.

(Based on your team's feedback about restoring plugin logs by adding default logging handlers.)

Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/sse_communication_protocol.py at line 28:

<comment>Adding a handler without disabling propagation can produce duplicate log entries if the app configures root/ancestor handlers after this module is imported; disable propagation when installing the default handler.

(Based on your team&#39;s feedback about restoring plugin logs by adding default logging handlers.)</comment>

<file context>
@@ -21,6 +22,12 @@
+if not logger.hasHandlers():  # Only add default handler if user didn&#39;t configure logging
+    handler = logging.StreamHandler(sys.stderr)
+    handler.setFormatter(logging.Formatter(&quot;%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s&quot;))
+    logger.addHandler(handler)
+    logger.setLevel(logging.INFO)
+
</file context>

if not logger.hasHandlers(): # Only add default handler if user didn't configure logging
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s"))
logger.addHandler(handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a handler without disabling propagation can cause duplicate logs when global/root handlers are configured later. Set logger.propagate = False after adding the handler.

(Based on your team's feedback about restoring plugin logs by default, this ensures logs are shown without duplication when users later configure global logging.)

Prompt for AI agents
Address the following comment on plugins/communication_protocols/http/src/utcp_http/http_communication_protocol.py at line 43:

<comment>Adding a handler without disabling propagation can cause duplicate logs when global/root handlers are configured later. Set logger.propagate = False after adding the handler.

(Based on your team&#39;s feedback about restoring plugin logs by default, this ensures logs are shown without duplication when users later configure global logging.)</comment>

<file context>
@@ -36,6 +37,12 @@
+if not logger.hasHandlers():  # Only add default handler if user didn&#39;t configure logging
+    handler = logging.StreamHandler(sys.stderr)
+    handler.setFormatter(logging.Formatter(&quot;%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s&quot;))
+    logger.addHandler(handler)
+    logger.setLevel(logging.INFO)
+
</file context>
Suggested change
logger.addHandler(handler)
logger.addHandler(handler); logger.propagate = False

if not logger.hasHandlers(): # Only add default handler if user didn't configure logging
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s"))
logger.addHandler(handler)
Copy link
Contributor

Choose a reason for hiding this comment

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

Adding a handler without disabling propagation can cause duplicate logs if global handlers are configured later; set propagate=False when attaching the default handler.

(Based on your team's feedback about restoring plugin logs by default, this ensures logs show once without duplication when apps later configure logging.)

Prompt for AI agents
Address the following comment on plugins/communication_protocols/cli/src/utcp_cli/cli_communication_protocol.py at line 42:

<comment>Adding a handler without disabling propagation can cause duplicate logs if global handlers are configured later; set propagate=False when attaching the default handler.

(Based on your team&#39;s feedback about restoring plugin logs by default, this ensures logs show once without duplication when apps later configure logging.)</comment>

<file context>
@@ -35,6 +36,12 @@
+if not logger.hasHandlers():  # Only add default handler if user didn&#39;t configure logging
+    handler = logging.StreamHandler(sys.stderr)
+    handler.setFormatter(logging.Formatter(&quot;%(asctime)s [%(levelname)s] %(filename)s:%(lineno)d - %(message)s&quot;))
+    logger.addHandler(handler)
+    logger.setLevel(logging.INFO)
+
</file context>

@h3xxit h3xxit merged commit fe3aad0 into dev Sep 5, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants