Skip to content

fix: adds handling for WSL on installing MCP on Claude on Windows#8738

Merged
lucaseduoli merged 8 commits into
mainfrom
fix/mcp_OS
Jun 26, 2025
Merged

fix: adds handling for WSL on installing MCP on Claude on Windows#8738
lucaseduoli merged 8 commits into
mainfrom
fix/mcp_OS

Conversation

@lucaseduoli
Copy link
Copy Markdown
Collaborator

@lucaseduoli lucaseduoli commented Jun 25, 2025

This pull request enhances the handling of configurations for MCP servers, particularly in WSL environments, and improves logging for better debugging and user feedback. Key changes include introducing WSL-specific logic for determining configuration paths, adding detailed debug logs, and updating user-facing messages.

Backend Improvements

  • WSL-Specific Configuration Handling:

    • Added logic to detect WSL environments and determine Windows configuration paths for Claude, including fallbacks for user directory discovery. This ensures compatibility with WSL setups. [1] [2]
    • Updated the is_wsl variable to improve readability and reusability across functions.
  • Enhanced Debug Logging:

    • Added debug logs to track project server name generation and configuration checks for both Cursor and Claude clients, aiding in troubleshooting. [1] [2]
    • Included warnings for JSON parsing failures and fallback scenarios in WSL configuration handling.

Frontend Improvement

  • Improved User Feedback:
    • Updated the success message in McpServerTab to inform users that a client restart may be required to reflect changes.

Summary by CodeRabbit

  • New Features
    • Improved support for Windows Subsystem for Linux (WSL) environments when installing and checking MCP Server configurations, ensuring correct detection and file path handling.
  • Bug Fixes
    • Enhanced reliability and error handling when locating configuration files for the Claude client across different platforms.
  • Style
    • Updated the success message after MCP Server installation to inform users they may need to restart their client to see changes.

@lucaseduoli lucaseduoli requested a review from Cristhianzl June 25, 2025 19:45
@lucaseduoli lucaseduoli self-assigned this Jun 25, 2025
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jun 25, 2025
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 25, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes add robust support for detecting and handling Windows Subsystem for Linux (WSL) environments when installing and checking MCP configuration for the "claude" client. This includes dynamic config path resolution, improved error handling, and enhanced debug logging. Additionally, the frontend success message for MCP Server installation was updated for clarity.

Changes

File(s) Change Summary
src/backend/base/langflow/api/v1/mcp_projects.py Enhanced WSL detection and handling for MCP config installation/checking, improved logging, unified server name logic.
src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx Updated MCP Server installation success message for user clarity.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Frontend
    participant Backend
    participant OS/WSL

    User->>Frontend: Request MCP Server install/check
    Frontend->>Backend: API call (install_mcp_config or check_installed_mcp_servers)
    Backend->>OS/WSL: Detect environment (Linux/WSL/Windows)
    alt WSL Detected
        Backend->>OS/WSL: Get Windows username via cmd.exe
        Backend->>OS/WSL: Construct config path under /mnt/c/Users/{username}/...
    else Not WSL
        Backend->>OS/WSL: Use standard config path logic
    end
    Backend->>Backend: Adjust logic for config path, SSE URL, logging
    Backend->>Frontend: Respond with result/status
    Frontend->>User: Show success message (updated message)
Loading

Possibly related PRs

  • langflow-ai/langflow#8271: Extends the same install and check functions for MCP configuration, with the current changes directly building upon and enhancing WSL support and logging.

Suggested labels

bug, size:M, lgtm

Suggested reviewers

  • deon-sanchez
  • edwinjosechittilappilly
✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix/mcp_OS

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 25, 2025
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src/backend/base/langflow/api/v1/mcp_projects.py (2)

545-545: Remove unnecessary pass statement.

             except json.JSONDecodeError:
                 logger.warning("Failed to parse Cursor config JSON at: %s", cursor_config_path)
-                pass

614-614: Remove unnecessary pass statement.

             except json.JSONDecodeError:
                 logger.warning("Failed to parse Claude config JSON at: %s", claude_config_path)
-                pass
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 557120d and 211592c.

📒 Files selected for processing (2)
  • src/backend/base/langflow/api/v1/mcp_projects.py (3 hunks)
  • src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`src/frontend/**/*.{ts,tsx,js,jsx}`: All React and TypeScript/JavaScript source files for the frontend must reside under src/frontend/ and use .ts, .tsx, .js, or .jsx extensions.

src/frontend/**/*.{ts,tsx,js,jsx}: All React and TypeScript/JavaScript source files for the frontend must reside under src/frontend/ and use .ts, .tsx, .js, or .jsx extensions.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/frontend_development.mdc)

List of files the instruction was applied to:

  • src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx
`src/frontend/src/pages/**/*`: Page-level React components must be placed under src/frontend/src/pages/.

src/frontend/src/pages/**/*: Page-level React components must be placed under src/frontend/src/pages/.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/frontend_development.mdc)

List of files the instruction was applied to:

  • src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx
`src/backend/base/langflow/api/v1/*.py`: API endpoints for version 1 should be implemented in src/backend/base/langflow/api/v1/.

src/backend/base/langflow/api/v1/*.py: API endpoints for version 1 should be implemented in src/backend/base/langflow/api/v1/.

📄 Source: CodeRabbit Inference Engine (.cursor/rules/backend_development.mdc)

List of files the instruction was applied to:

  • src/backend/base/langflow/api/v1/mcp_projects.py
🧬 Code Graph Analysis (1)
src/backend/base/langflow/api/v1/mcp_projects.py (1)
src/frontend/src/constants/constants.ts (1)
  • MAX_MCP_SERVER_NAME_LENGTH (563-563)
🪛 Ruff (0.11.9)
src/backend/base/langflow/api/v1/mcp_projects.py

454-454: Do not catch blind exception: Exception

(BLE001)


456-458: Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling

(B904)


457-457: Use explicit conversion flag

Replace with conversion flag

(RUF010)


545-545: Unnecessary pass statement

Remove unnecessary pass

(PIE790)


589-589: Do not catch blind exception: Exception

(BLE001)


614-614: Unnecessary pass statement

Remove unnecessary pass

(PIE790)

🪛 GitHub Check: Ruff Style Check (3.13)
src/backend/base/langflow/api/v1/mcp_projects.py

[failure] 457-457: Ruff (RUF010)
src/backend/base/langflow/api/v1/mcp_projects.py:457:111: RUF010 Use explicit conversion flag


[failure] 456-458: Ruff (B904)
src/backend/base/langflow/api/v1/mcp_projects.py:456:25: B904 Within an except clause, raise exceptions with raise ... from err or raise ... from None to distinguish them from errors in exception handling


[failure] 454-454: Ruff (BLE001)
src/backend/base/langflow/api/v1/mcp_projects.py:454:28: BLE001 Do not catch blind exception: Exception


[failure] 614-614: Ruff (PIE790)
src/backend/base/langflow/api/v1/mcp_projects.py:614:17: PIE790 Unnecessary pass statement


[failure] 589-589: Ruff (BLE001)
src/backend/base/langflow/api/v1/mcp_projects.py:589:24: BLE001 Do not catch blind exception: Exception


[failure] 545-545: Ruff (PIE790)
src/backend/base/langflow/api/v1/mcp_projects.py:545:17: PIE790 Unnecessary pass statement

🪛 Pylint (3.3.7)
src/backend/base/langflow/api/v1/mcp_projects.py

[refactor] 556-596: Too many nested blocks (6/5)

(R1702)

🪛 GitHub Actions: Ruff Style Check
src/backend/base/langflow/api/v1/mcp_projects.py

[error] 454-454: BLE001 Do not catch blind exception: Exception.

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Optimize new Python code in this PR
  • GitHub Check: Update Starter Projects
🔇 Additional comments (5)
src/backend/base/langflow/api/v1/mcp_projects.py (4)

358-359: LGTM! Clean WSL detection implementation.

The WSL detection logic is well-implemented and follows the standard approach of checking for "microsoft" in the platform release string.


360-385: Well-implemented WSL URL adjustment logic.

The code correctly handles the WSL networking challenge where Windows applications need to access WSL services. The fallback mechanism ensures the service remains functional even if IP detection fails.


404-405: Good addition of debug logging for server name tracking.

The debug logging will help troubleshoot configuration matching issues between installation and verification.


515-522: Good consistency improvement in server name generation.

The server name generation now matches the install function logic, including proper handling of default folder names. This ensures reliable configuration checking.

src/frontend/src/pages/MainPage/pages/homePage/components/McpServerTab.tsx (1)

412-412: Excellent UX improvement for the success message.

The updated message clearly informs users that a client restart may be needed, which aligns perfectly with the backend MCP configuration changes and helps prevent user confusion.

Comment thread src/backend/base/langflow/api/v1/mcp_projects.py Outdated
Comment thread src/backend/base/langflow/api/v1/mcp_projects.py Outdated
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 25, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 25, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 25, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 25, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 26, 2025
@lucaseduoli lucaseduoli added the fast-track Skip tests and sends PR into the merge queue label Jun 26, 2025
@github-actions github-actions Bot added bug Something isn't working and removed bug Something isn't working labels Jun 26, 2025
@lucaseduoli lucaseduoli enabled auto-merge June 26, 2025 14:27
@lucaseduoli lucaseduoli added this pull request to the merge queue Jun 26, 2025
Merged via the queue into main with commit b08d080 Jun 26, 2025
25 of 28 checks passed
@lucaseduoli lucaseduoli deleted the fix/mcp_OS branch June 26, 2025 14:39
Khurdhula-Harshavardhan pushed a commit to JigsawStack/langflow that referenced this pull request Jul 1, 2025
…ngflow-ai#8738)

* Added handling for wsl isntallation of claude

* Fixed installed server not appearing

* Added message to restart

* fix formatting and error handling

* fixed lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working fast-track Skip tests and sends PR into the merge queue lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants