Skip to content

fix: correct mcp client name and version#3487

Closed
seuros wants to merge 1 commit intogoogle-gemini:mainfrom
seuros:mcpversion
Closed

fix: correct mcp client name and version#3487
seuros wants to merge 1 commit intogoogle-gemini:mainfrom
seuros:mcpversion

Conversation

@seuros
Copy link
Copy Markdown
Contributor

@seuros seuros commented Jul 7, 2025

The mcp client keeps sending the same version 0.0.1 since dawn of time.

This PR, use the package version to give gemini mcp client a version.

@seuros seuros requested a review from a team as a code owner July 7, 2025 22:17
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.

Summary of Changes

Hello @seuros, 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 addresses an issue where the MCP client was reporting a static, outdated version. It updates the client's reported name and dynamically fetches its version from the package configuration, ensuring accurate client identification.

Highlights

  • Client Identification: The MCP client's reported name has been simplified from gemini-cli-mcp-client to gemini.
  • Dynamic Versioning: The hardcoded client version 0.0.1 has been replaced with a dynamic lookup from the package.json file, ensuring the client reports its actual package version.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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 client to use a dynamic version from package.json instead of a hardcoded one, and also updates the client name. The change is straightforward, but there's a critical issue with the relative path used to import package.json, which may cause a runtime error or lead to using an incorrect version. I've suggested a fix for the path.

Comment thread packages/core/src/tools/mcp-client.ts Outdated
@seuros seuros force-pushed the mcpversion branch 4 times, most recently from 94a8b38 to 60fbba4 Compare July 8, 2025 10:52
@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Jul 9, 2025

@gemini-code-assist review

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 client to use the package version from package.json instead of a hardcoded version, and also renames the client. My review identifies a critical issue with how package.json is imported. The current relative path will break when the package is published and consumed as a dependency, causing it to read the version from the wrong package.json. I've provided a suggestion to correct the import path.

Comment thread packages/core/src/tools/mcp-client.ts Outdated
@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Jul 9, 2025

@gemini-code-assist review

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

The pull request updates the MCP client to use the package version. It also changes the client name to 'gemini'. The version update is a good change, but the client name should be more specific to avoid potential conflicts.

Comment thread packages/core/src/tools/mcp-client.ts Outdated
Comment on lines +214 to +217
const mcpClient = new Client({
name: 'gemini-cli-mcp-client',
version: '0.0.1',
name: 'gemini',
version: pkg.version,
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.

high

Using a hardcoded client name could lead to confusion or conflicts if multiple applications use the same name. Consider using a more specific name, potentially incorporating the application name or environment, to ensure uniqueness and easier identification in logs and monitoring systems.

Also, the version should be validated to ensure it is a valid semantic version.

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

The pull request updates the MCP client's name and version to use the package version. The client name is changed to 'gemini' and the version is dynamically pulled from the package.json file. A review comment suggests using a more specific client name to avoid potential confusion.

Comment thread packages/core/src/tools/mcp-client.ts Outdated
Comment thread packages/core/src/tools/mcp-client.ts Outdated
@seuros seuros force-pushed the mcpversion branch 2 times, most recently from deeb237 to 184b29d Compare July 22, 2025 08:44
@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Jul 22, 2025

@gemini-code-assist review

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 client to use the package version, improving consistency. The version string is now plumbed through the configuration, and all necessary call sites, including tests, have been updated. Additional unit tests and ensuring the version is used everywhere are recommended.

Comment thread packages/core/src/tools/mcp-client.ts
Comment thread packages/core/src/config/config.ts Outdated
@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Jul 22, 2025

@gemini-code-assist review

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 correctly addresses the issue of the MCP client sending a hardcoded name and version. The changes effectively plumb the CLI's package version down to the MCP client instantiation.

The implementation is consistent across the affected packages, and the necessary updates to tests and configuration parameters have been made. The use of getCliVersion with a fallback to 'unknown' is a robust approach.

I've reviewed the changes for correctness, security, and maintainability, and I don't see any issues of high or critical severity. The code appears solid and achieves the stated goal of the pull request.

Copy link
Copy Markdown
Collaborator

@NTaylorMullen NTaylorMullen left a comment

Choose a reason for hiding this comment

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

Looks like you have some merge conflicts as well. Feel free to @ me once done though and I can work on getting this merged!

Comment thread packages/core/src/config/config.ts Outdated
@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Aug 1, 2025

@NTaylorMullen The build is ready for merge.

Comment thread packages/core/src/config/flashFallback.test.ts Outdated
@seuros seuros requested a review from NTaylorMullen August 8, 2025 08:20
@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Aug 8, 2025

@NTaylorMullen here you go

@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Aug 12, 2025

@NTaylorMullen can you approve the build ? i would like to have this PR merged, i want to release few servers and i would appreciate if the version of version is detect so the server don't offer a feature that not supported.

@cornmander
Copy link
Copy Markdown
Contributor

Hi, could you update again? I would like to get this change in. Sorry about the delay.

@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Aug 28, 2025

@cornmander fixed.

you can squash merge it.

@seuros
Copy link
Copy Markdown
Contributor Author

seuros commented Sep 5, 2025

@cornmander @NTaylorMullen any issue on merging this ?

Comment thread packages/cli/src/config/config.ts Outdated
@seuros seuros requested a review from a team as a code owner September 23, 2025 20:40
@seuros seuros force-pushed the mcpversion branch 2 times, most recently from 09d8348 to 3b99406 Compare September 23, 2025 20:55
@seuros seuros requested a review from jakemac53 September 23, 2025 20:55
@seuros seuros force-pushed the mcpversion branch 2 times, most recently from 540eb71 to 3a2a0a5 Compare September 28, 2025 09:15
The mcp client now reports 'gemini' as its name and uses the actual CLI version instead of hardcoded '0.0.1'

Changes:
- Pass CLI version through config chain from gemini.tsx to MCP client
- Update MCP client name from 'gemini-cli-mcp-client' to 'gemini'
- Use dynamic version from getCliVersion() instead of hardcoded value
- Update all test files to pass version parameter
@chrstnb
Copy link
Copy Markdown
Contributor

chrstnb commented Oct 29, 2025

I think this has been covered by some other changes. Please re-open if I'm wrong! Thanks for the contribution!

@chrstnb chrstnb closed this Oct 29, 2025
reconsumeralization pushed a commit to reconsumeralization/gemini-cli that referenced this pull request Nov 9, 2025
This commit addresses several TODO comments and code issues across the codebase:

1. Fix ide-client.ts - Use CLI version instead of hardcoded '1.0.0' (issue google-gemini#3487)
   - Updated MCP client initialization to use process.env['CLI_VERSION']
   - Consistent with pattern used in contentGenerator.ts
   - Affects both HTTP and stdio transport connections

2. Fix ide-server.ts - Clarify newContent parameter as optional
   - Changed TODO to clear documentation explaining why newContent is optional
   - Defaults to empty string to support creating new files or showing empty diffs

3. Fix task.ts - Add proper prompt_id handling (lines 810, 850)
   - Added promptId field to Task class
   - Generate unique prompt_id in constructor using task-${id}-${uuid} pattern
   - Now properly passes prompt_id to sendMessageStream calls
   - Follows same pattern as Turn class in core

4. Fix testing_utils.ts - Document MockTool duplication
   - Updated TODO to note similarity with core MockTool
   - Explains why a2a-server version is needed (mock function support)
   - Recommends future consolidation

5. Document stdin-context.test.ts sandbox limitation
   - Enhanced TODO with detailed root cause analysis
   - Explained stdin forwarding issue: test process → node process → container
   - Identified issue in sandbox.ts stdio handling
   - Provided potential fix approach

All changes maintain backward compatibility and follow existing code patterns.
alih552 added a commit to alih552/gemini-cli that referenced this pull request Jan 21, 2026
Aman071106 added a commit to Aman071106/gemini-cli that referenced this pull request Feb 22, 2026
TrueAlpha-spiral added a commit to Sovereign-Data-Foundation/gemini-cli that referenced this pull request Feb 24, 2026
This change ensures that the IdeClient uses the actual version of the CLI when establishing a connection to the IDE companion extension.

- Modified `IdeClient` to accept an optional version in `connect()`.
- Updated `Config` to store and propagate the version to `IdeClient`.
- Updated CLI configuration loader to fetch the actual version from `package.json` and pass it to the `Config`.
- Added unit tests in `packages/core/src/config/config.test.ts` to verify the propagation of the version.

Closes google-gemini#3487.

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Gyanranjan-Priyam added a commit to Gyanranjan-Priyam/gemini-cli that referenced this pull request Mar 7, 2026
Resolves google-gemini#3487

- Import getVersion from utils/version.js
- Replace hardcoded '1.0.0' with actual CLI version in HTTP connection
- Replace hardcoded '1.0.0' with actual CLI version in stdio connection
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.

5 participants