Skip to content

🐛 fix: slove the descktop use offical endpoint mcp not use stdio#11813

Merged
arvinxx merged 1 commit into
nextfrom
fix/SomeErrors
Jan 25, 2026
Merged

🐛 fix: slove the descktop use offical endpoint mcp not use stdio#11813
arvinxx merged 1 commit into
nextfrom
fix/SomeErrors

Conversation

@ONLY-yours

@ONLY-yours ONLY-yours commented Jan 25, 2026

Copy link
Copy Markdown
Member

💻 Change Type

fixed: LOBE-4175

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 👷 build
  • ⚡️ perf
  • ✅ test
  • 📝 docs
  • 🔨 chore

🔗 Related Issue

🔀 Description of Change

🧪 How to Test

  • Tested locally
  • Added/updated tests
  • No tests needed

📸 Screenshots / Videos

Before After
... ...

📝 Additional Information

Summary by Sourcery

Adjust MCP deployment selection to consistently prioritize HTTP/cloud endpoints over stdio across desktop and web environments.

Bug Fixes:

  • Ensure desktop uses cloud endpoints when available instead of falling back to stdio-only connections.
  • Align endpoint selection logic so both desktop and web prioritize HTTP/cloud deployments over stdio where possible.

Enhancements:

  • Clean up error logging parameter formatting for MCP connection installation failures.

@vercel

vercel Bot commented Jan 25, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
lobehub Ready Ready Preview, Comment Jan 25, 2026 10:46am

Request Review

@sourcery-ai

sourcery-ai Bot commented Jan 25, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts MCP plugin connection selection logic to always prefer HTTP or cloud endpoints over stdio in both desktop and web, and simplifies error logging parameters formatting.

Sequence diagram for updated MCP connection preference in desktop and web

sequenceDiagram
  actor User
  participant DesktopApp
  participant WebApp
  participant MCPPluginStore
  participant MCPDeploymentOptions
  participant CloudEndpoint

  User ->> DesktopApp: Install or activate MCP plugin
  DesktopApp ->> MCPPluginStore: Request connection for plugin
  MCPPluginStore ->> MCPDeploymentOptions: Get stdioOption, httpOption, haveCloudEndpoint
  MCPDeploymentOptions -->> MCPPluginStore: Options data
  MCPPluginStore ->> MCPPluginStore: Compute hasCloudEndpoint = stdioOption AND haveCloudEndpoint
  alt hasCloudEndpoint in desktop
    MCPPluginStore ->> CloudEndpoint: Create cloud type connection
    CloudEndpoint -->> MCPPluginStore: Cloud connection
  else hasCloudEndpoint is false
    alt httpOption exists
      MCPPluginStore ->> MCPDeploymentOptions: Create HTTP connection
      MCPDeploymentOptions -->> MCPPluginStore: HTTP connection
    else stdioOption exists
      MCPPluginStore ->> MCPDeploymentOptions: Create stdio connection
      MCPDeploymentOptions -->> MCPPluginStore: stdio connection
    end
  end
  MCPPluginStore -->> DesktopApp: Selected connection
  DesktopApp -->> User: MCP plugin ready using endpoint over stdio

  User ->> WebApp: Install or activate MCP plugin
  WebApp ->> MCPPluginStore: Request connection for plugin
  MCPPluginStore ->> MCPDeploymentOptions: Get stdioOption, httpOption, haveCloudEndpoint
  MCPDeploymentOptions -->> MCPPluginStore: Options data
  MCPPluginStore ->> MCPPluginStore: Compute hasCloudEndpoint = stdioOption AND haveCloudEndpoint
  alt hasCloudEndpoint in web
    MCPPluginStore ->> CloudEndpoint: Create cloud type connection
    CloudEndpoint -->> MCPPluginStore: Cloud connection
  else hasCloudEndpoint is false
    alt httpOption exists
      MCPPluginStore ->> MCPDeploymentOptions: Create HTTP connection
      MCPDeploymentOptions -->> MCPPluginStore: HTTP connection
    else no endpoint
      MCPPluginStore -->> WebApp: No valid connection (stdio not used in web)
    end
  end
  MCPPluginStore -->> WebApp: Selected connection
  WebApp -->> User: MCP plugin uses endpoint only
Loading

Flow diagram for MCP plugin connection selection logic

flowchart TD
  Start(["Start MCP connection selection"]) --> CheckCloud["Check hasCloudEndpoint = stdioOption AND haveCloudEndpoint"]

  CheckCloud -->|"hasCloudEndpoint = true"| UseCloud["Use cloud endpoint connection (type=cloud)"]
  UseCloud --> End

  CheckCloud -->|"hasCloudEndpoint = false"| CheckHttp["Check httpOption exists"]

  CheckHttp -->|"httpOption exists"| UseHttp["Use HTTP endpoint connection (type=http)"]
  UseHttp --> End

  CheckHttp -->|"no httpOption"| CheckDesktop["Check isDesktop AND stdioOption"]

  CheckDesktop -->|"true"| UseStdio["Use stdio connection (type=stdio)"]
  UseStdio --> End

  CheckDesktop -->|"false"| NoConnection["No usable connection (installation fails or logs error)"]
  NoConnection --> End

  End(["End MCP connection selection"])
Loading

File-Level Changes

Change Details Files
Update MCP deployment selection to always prefer HTTP/cloud endpoints over stdio and align desktop behavior with web.
  • Remove detection of non-HTTP deployments and the desktop-specific condition that could cause stdio to be used even when an endpoint exists
  • Change cloud endpoint availability check to depend only on presence of a stdio option and haveCloudEndpoint, regardless of desktop vs web
  • Simplify shouldUseHttpDeployment to be true whenever an HTTP deployment option exists, making endpoint selection consistent across environments
  • Clarify comments to describe the new prioritization: endpoint (HTTP/cloud) over stdio for both desktop and web, with web not supporting stdio
src/store/tool/slices/mcpStore/action.ts
Tidy MCP installation error logging payload formatting.
  • Reformat the params object construction for errorLog to a more compact, consistent indentation style without changing runtime behavior
src/store/tool/slices/mcpStore/action.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jan 25, 2026
@gru-agent

gru-agent Bot commented Jan 25, 2026

Copy link
Copy Markdown
Contributor

TestGru Assignment

Summary

Link CommitId Status Reason
Detail 0b2cabd ✅ Finished

History Assignment

Files

File Pull Request
src/store/tool/slices/mcpStore/action.ts ❌ Failed (I failed to setup the environment.)

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

@dosubot dosubot Bot added the 🐛 Bug label Jan 25, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • The new endpoint selection logic is now quite implicit; consider extracting the decision (cloud vs http vs stdio for desktop/web) into a small helper with clearly named branches to make the priority rules easier to understand and maintain.
  • The inline comment Web: endpoint only (stdio not supported) may not fully match the actual behavior depending on upstream fallback to stdio; consider either enforcing that rule in code or updating the comment to accurately reflect the current behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new endpoint selection logic is now quite implicit; consider extracting the decision (cloud vs http vs stdio for desktop/web) into a small helper with clearly named branches to make the priority rules easier to understand and maintain.
- The inline comment `Web: endpoint only (stdio not supported)` may not fully match the actual behavior depending on upstream fallback to stdio; consider either enforcing that rule in code or updating the comment to accurately reflect the current behavior.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov

codecov Bot commented Jan 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.62%. Comparing base (8ea08dd) to head (0b2cabd).
⚠️ Report is 40 commits behind head on next.

Additional details and impacted files
@@            Coverage Diff             @@
##             next   #11813      +/-   ##
==========================================
- Coverage   73.74%   73.62%   -0.13%     
==========================================
  Files        1211     1211              
  Lines       97357    97511     +154     
  Branches    12630    10587    -2043     
==========================================
- Hits        71797    71793       -4     
- Misses      25469    25627     +158     
  Partials       91       91              
Flag Coverage Δ
app 67.26% <100.00%> (-0.01%) ⬇️
database 85.08% <ø> (-1.58%) ⬇️
packages/agent-runtime 88.57% <ø> (ø)
packages/context-engine 85.49% <ø> (ø)
packages/conversation-flow 92.32% <ø> (ø)
packages/file-loaders 87.04% <ø> (ø)
packages/memory-user-memory 67.12% <ø> (-0.13%) ⬇️
packages/model-bank 100.00% <ø> (ø)
packages/model-runtime 86.72% <ø> (ø)
packages/prompts 78.32% <ø> (ø)
packages/python-interpreter 92.90% <ø> (ø)
packages/ssrf-safe-fetch 0.00% <ø> (ø)
packages/utils 93.07% <ø> (ø)
packages/web-crawler 95.62% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Store 67.23% <100.00%> (-0.01%) ⬇️
Services 50.35% <ø> (ø)
Server 68.36% <0.00%> (-0.02%) ⬇️
Libs 39.86% <ø> (ø)
Utils 93.60% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0b2cabdb59

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +300 to 304
// Prioritize endpoint (http/cloud) over stdio in all environments
// Desktop: endpoint > stdio
// Web: endpoint only (stdio not supported)
let shouldUseHttpDeployment = !!httpOption;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Avoid forcing HTTP on desktop when stdio is available

This change makes desktop always choose the HTTP deployment when a URL is present, even if a stdio deployment exists. For MCPs that publish an HTTP option for web (or for optional self-hosting) alongside a working stdio command, desktop now skips the dependency check and tries to connect to the HTTP URL, which commonly isn’t running by default, so installs succeed but tool execution fails until the user manually starts a server. The previous logic only selected HTTP on desktop when no non‑HTTP deployment existed, so this is a regression for dual‑mode plugins.

Useful? React with 👍 / 👎.

@arvinxx arvinxx merged commit 370bf16 into next Jan 25, 2026
47 of 50 checks passed
@arvinxx arvinxx deleted the fix/SomeErrors branch January 25, 2026 18:25
@lobehubbot

Copy link
Copy Markdown
Member

❤️ Great PR @ONLY-yours ❤️

The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world.

lobehubbot pushed a commit that referenced this pull request Jan 25, 2026
## [Version&nbsp;2.0.0-next.379](v2.0.0-next.378...v2.0.0-next.379)
<sup>Released on **2026-01-25**</sup>

#### ✨ Features

- **utils**: Added `trimBasedOnBatchProbe` for truncating without compromising structured data.

#### 🐛 Bug Fixes

- **desktop**: Prevent duplicate IPC handler registration from dynamic imports.
- **misc**: Fix update memory tools, resolve server version check issue for desktop app, slove the descktop use offical endpoint mcp not use stdio.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's improved

* **utils**: Added `trimBasedOnBatchProbe` for truncating without compromising structured data, closes [#11836](#11836) ([6dac3d1](6dac3d1))

#### What's fixed

* **desktop**: Prevent duplicate IPC handler registration from dynamic imports, closes [#11827](#11827) ([c3fd2dc](c3fd2dc))
* **misc**: Fix update memory tools, closes [#11831](#11831) ([cfc03dd](cfc03dd))
* **misc**: Resolve server version check issue for desktop app, closes [#11834](#11834) ([0bd2a59](0bd2a59))
* **misc**: Slove the descktop use offical endpoint mcp not use stdio, closes [#11813](#11813) ([370bf16](370bf16))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>
@lobehubbot

Copy link
Copy Markdown
Member

🎉 This PR is included in version 2.0.0-next.379 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

🐛 Bug released on @next size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants