Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
remove logging
  • Loading branch information
jordanrfrazier committed Nov 18, 2025
commit 79016cd6d1cf1160da3543b1dc0010b5382e9823
7 changes: 2 additions & 5 deletions src/backend/base/langflow/api/v1/mcp_projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -630,12 +630,9 @@ async def install_mcp_config(

# For OAuth/MCP Composer, use the special format
settings = get_settings_service().settings
command = "uv"
command = "uvx"
args = [
"run",
"python",
"-m",
"mcp_composer",
f"mcp-composer{settings.mcp_composer_version}",
"--mode",
"stdio",
"--sse-url",
Expand Down
25 changes: 2 additions & 23 deletions src/lfx/src/lfx/services/mcp_composer/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,11 +419,8 @@ async def _start_project_composer_process(
"""Start the MCP Composer subprocess for a specific project."""
settings = get_settings_service().settings
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Remove unused settings and temporary print debug to fix Ruff failures

Ruff is correctly flagging two issues here:

  • Line 420: settings = get_settings_service().settings is assigned but never used (F841).
  • Lines 472, 481, 534, and 547: print(...) calls (T201) duplicate information that’s already being logged via logger.adebug/logger.aerror.

Since logging already covers these messages, the print calls can be dropped, and the unused settings assignment removed to unblock the style check and avoid confusion about unused configuration.

A minimal cleanup could look like:

@@ async def _start_project_composer_process(
-        """Start the MCP Composer subprocess for a specific project."""
-        settings = get_settings_service().settings
-        cmd = [
+        """Start the MCP Composer subprocess for a specific project."""
+        cmd = [
             "uv",
             "run",
             "python",
             "-m",
             "mcp_composer",
@@
-        # TEMPORARY DEBUG: Print command being executed
-        safe_cmd = self._obfuscate_command_secrets(cmd)
-        await logger.adebug(f"Starting MCP Composer with command: {' '.join(safe_cmd)}")
-        print(f"[MCP Composer] Starting command: {' '.join(safe_cmd)}")
+        safe_cmd = self._obfuscate_command_secrets(cmd)
+        await logger.adebug(f"Starting MCP Composer with command: {' '.join(safe_cmd)}")
@@
-        await logger.adebug(f"Monitoring MCP Composer startup for project {project_id} (PID: {process.pid})")
-        print(f"[MCP Composer] Process started with PID: {process.pid}")
+        await logger.adebug(f"Monitoring MCP Composer startup for project {project_id} (PID: {process.pid})")
@@
-            if process.stderr and select.select([process.stderr], [], [], 0)[0]:
+            if process.stderr and select.select([process.stderr], [], [], 0)[0]:
                 try:
                     stderr_line = process.stderr.readline()
-                    if stderr_line:
-                        print(f"[MCP Composer STDERR] {stderr_line.strip()}")
+                    if stderr_line:
@@
-            if process.stdout and select.select([process.stdout], [], [], 0)[0]:
+            if process.stdout and select.select([process.stdout], [], [], 0)[0]:
                 try:
                     stdout_line = process.stdout.readline()
-                    if stdout_line:
-                        print(f"[MCP Composer STDOUT] {stdout_line.strip()}")
+                    if stdout_line:

(Only the print(...) lines are removed; the select calls and logger usage remain unchanged for now.)

This should clear the current Ruff errors without changing runtime behavior.

Also applies to: 470-473, 481-481, 534-535, 547-548

🧰 Tools
🪛 GitHub Actions: Ruff Style Check

[error] 420-420: F841 Local variable settings is assigned to but never used.

🪛 GitHub Check: Ruff Style Check (3.13)

[failure] 420-420: Ruff (F841)
src/lfx/src/lfx/services/mcp_composer/service.py:420:9: F841 Local variable settings is assigned to but never used

🤖 Prompt for AI Agents
In src/lfx/src/lfx/services/mcp_composer/service.py around lines 420 (and also
affecting 470-473, 481, 534-535, 547-548): remove the unused assignment
"settings = get_settings_service().settings" at line 420 and delete the
temporary print(...) debug calls at the listed locations so Ruff F841 and T201
warnings are resolved; keep the existing logger.adebug/logger.aerror and select
calls intact so behavior is unchanged.

cmd = [
"uv",
"run",
"python",
"-m",
"mcp_composer",
"uvx",
f"mcp-composer{settings.mcp_composer_version}",
"--mode",
"sse",
"--sse-url",
Expand Down Expand Up @@ -466,19 +463,13 @@ async def _start_project_composer_process(
cmd.extend(["--env", env_key, str(value)])

# Start the subprocess with both stdout and stderr captured
# TEMPORARY DEBUG: Print command being executed
safe_cmd = self._obfuscate_command_secrets(cmd)
await logger.adebug(f"Starting MCP Composer with command: {' '.join(safe_cmd)}")
print(f"[MCP Composer] Starting command: {' '.join(safe_cmd)}")

process = subprocess.Popen(cmd, env=env, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) # noqa: ASYNC220, S603

# Monitor the process startup with multiple checks
process_running = False
port_bound = False

await logger.adebug(f"Monitoring MCP Composer startup for project {project_id} (PID: {process.pid})")
print(f"[MCP Composer] Process started with PID: {process.pid}")

for check in range(max_startup_checks):
await asyncio.sleep(startup_delay)
Expand Down Expand Up @@ -526,29 +517,17 @@ async def _start_project_composer_process(
)

# Try to read any available stderr/stdout without blocking
# TEMPORARY DEBUG: Print all output, not just errors
if process.stderr and select.select([process.stderr], [], [], 0)[0]:
try:
stderr_line = process.stderr.readline()
if stderr_line:
print(f"[MCP Composer STDERR] {stderr_line.strip()}")
if "ERROR" in stderr_line:
await logger.aerror(f"MCP Composer error: {stderr_line.strip()}")
else:
await logger.adebug(f"MCP Composer stderr: {stderr_line.strip()}")
except Exception: # noqa: BLE001
pass

# TEMPORARY DEBUG: Also check stdout
if process.stdout and select.select([process.stdout], [], [], 0)[0]:
try:
stdout_line = process.stdout.readline()
if stdout_line:
print(f"[MCP Composer STDOUT] {stdout_line.strip()}")
await logger.adebug(f"MCP Composer stdout: {stdout_line.strip()}")
except Exception: # noqa: BLE001
pass

# After all checks
if not process_running or not port_bound:
# Get comprehensive error information
Expand Down
Loading