Skip to content

fix(cli): make MCP ping optional in list command and use configured timeout#26068

Merged
cocosheng-g merged 3 commits intogoogle-gemini:mainfrom
cocosheng-g:mcp-fix
Apr 27, 2026
Merged

fix(cli): make MCP ping optional in list command and use configured timeout#26068
cocosheng-g merged 3 commits intogoogle-gemini:mainfrom
cocosheng-g:mcp-fix

Conversation

@cocosheng-g
Copy link
Copy Markdown
Contributor

@cocosheng-g cocosheng-g commented Apr 27, 2026

Fixes #25599.

Changes:

  • Optional Ping: The ping() call in gemini mcp list is now optional. If it fails but connect() succeeds, the server is reported as Connected. This fixes the "Disconnected" status for Google first-party MCP servers that don't implement ping.
  • Timeout Logic:
    • Connectivity checks now honor the server's explicit timeout configuration if provided.
    • If no timeout is configured, it defaults to 5 seconds (maintaining the previous behavior for command responsiveness).
    • Both connect() and ping() now respect this timeout.
  • Improved Logging: Updated debugLogger.debug to receive the error object separately, improving stack trace visibility in logs for easier troubleshooting.
  • Tests: Added unit tests to verify Connected status on ping failure and correct timeout usage for both connect and ping.

@cocosheng-g cocosheng-g requested a review from a team as a code owner April 27, 2026 19:29
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request improves the robustness of the MCP server listing functionality in the CLI. By making the ping check optional and utilizing configurable timeouts, it ensures better compatibility with various MCP server implementations, including Google's first-party servers, while providing more flexible connection management.

Highlights

  • Optional MCP Ping: The ping command is now optional during MCP server listing, allowing servers that do not implement it to still be marked as connected if the initial connection succeeds.
  • Configurable Timeouts: Replaced the hardcoded 5-second connection timeout with the server's configured timeout value, falling back to a default of 10 minutes.
  • Enhanced Testing: Added unit tests to verify that servers are correctly identified as connected despite ping failures and that the connection logic respects configured timeouts.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the MCP server connection logic to use configured or default timeouts and makes the ping test optional, allowing servers to be marked as connected even if the ping fails. Feedback suggests ensuring the ping call also respects the timeout for consistency and improving debug logging by passing the error object as a separate argument instead of using string interpolation.

Comment thread packages/cli/src/commands/mcp/list.ts
@gemini-cli gemini-cli Bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Apr 27, 2026
@cocosheng-g cocosheng-g added this pull request to the merge queue Apr 27, 2026
Merged via the queue into google-gemini:main with commit 7d08f84 Apr 27, 2026
28 checks passed
@cocosheng-g cocosheng-g deleted the mcp-fix branch April 27, 2026 20:49
TirthNaik-99 pushed a commit to TirthNaik-99/gemini-cli that referenced this pull request May 4, 2026
kimjune01 pushed a commit to kimjune01/gemini-cli-claude that referenced this pull request May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gemini mcp list reports Google first-party MCP servers as "Disconnected" due to unsupported ping() method

2 participants