Skip to content

Add oneMCP Support to Gemini-CLI via MCPSDK Integration #20118

@Nayana-Parameswarappa

Description

@Nayana-Parameswarappa

Overview
The current Gemini-CLI lacks native support for oneMCP. To align with the evolving MCP ecosystem and streamline our authentication logic, we have refactored the CLI to integrate the MCPSDK. This transition replaces our internal "roll-your-own" authentication implementation with a standardized industry approach.

Problem Statement
Previously, the Gemini-CLI relied on a custom authentication implementation. This created several points of friction:

Maintenance Overhead: Maintaining duplicate authentication logic within the CLI increased the surface area for bugs.

Manual Scope Management: The legacy system required manual handling of permissions, which was prone to misalignment with MCP standards.

Ecosystem Drift: Without SDK integration, staying up-to-date with the rapidly changing MCP world was a manual and tedious process.

Proposed Changes
We have implemented a comprehensive update to the Gemini-CLI to support oneMCP natively:

  1. MCPSDK Integration
    The codebase has been refactored to utilize the MCPSDK as the primary handler for authentication. By delegating these responsibilities to the SDK, we ensure the CLI follows the most current standards without redundant code.

  2. Graceful Scope Discovery
    One of the primary benefits of this update is the ability to gracefully discover scopes for oneMCP. The SDK handles the negotiation of permissions automatically, providing a more seamless experience for the end-user.

  3. Codebase Refactoring
    Removed deprecated internal auth modules. Updated the CLI handshake logic to interface directly with MCPSDK endpoints.Standardized error handling for authentication failures.

Key Benefits
Reduced Complexity: Eliminating custom auth code reduces technical debt and makes the CLI easier to maintain.

Better Tracking: Using the official SDK allows us to stay in sync with the MCP ecosystem with minimal effort.

Improved Security: Leveraging a standardized SDK ensures that authentication follows best practices and receives security updates as they are released.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/coreIssues related to User Interface, OS Support, Core Functionality🔒 maintainer only⛔ Do not contribute. Internal roadmap item.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions