Skip to content

feat(core): add support for MCP progress updates#19046

Open
NTaylorMullen wants to merge 1 commit intomainfrom
ntm/gh.6590
Open

feat(core): add support for MCP progress updates#19046
NTaylorMullen wants to merge 1 commit intomainfrom
ntm/gh.6590

Conversation

@NTaylorMullen
Copy link
Collaborator

@NTaylorMullen NTaylorMullen commented Feb 14, 2026

Summary

Added support for Model Context Protocol (MCP) progress updates to provide real-time feedback for long-running tool calls.

mcpNotifications

Details

  • Core Event System: Added McpProgress event and payload to coreEvents.
  • MCP Client:
    • Implemented McpProgressReporter to manage progressToken to callId mapping.
    • Registered notifications/progress handler to receive and broadcast progress from servers.
    • Automatically generates and attaches progressToken to the _meta field of tool call requests.
  • Scheduler & State Management:
    • Updated ExecutingToolCall type to track progressMessage and progressPercent.
    • Updated Scheduler to listen for progress events and update the state manager.
  • CLI UI:
    • Updated IndividualToolCallDisplay and mapping logic to propagate progress fields.
    • Enhanced ToolInfo component in ToolShared.tsx to display the message and percentage in the tool header while executing.

Example Test Server:

/**
 * @license
 * Copyright 2026 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */

import { Server } from '@modelcontextprotocol/sdk/server/index.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
import {
  CallToolRequestSchema,
  ListToolsRequestSchema,
} from '@modelcontextprotocol/sdk/types.js';

/**
 * A simple MCP server that demonstrates progress updates.
 */
const server = new Server(
  {
    name: 'progress-test-server',
    version: '1.0.0',
  },
  {
    capabilities: {
      tools: {},
    },
  },
);

server.setRequestHandler(ListToolsRequestSchema, async () => {
  return {
    tools: [
      {
        name: 'long_running_tool',
        description: 'A tool that takes some time and sends progress updates.',
        inputSchema: {
          type: 'object',
          properties: {
            seconds: {
              type: 'number',
              description: 'How many seconds to run for.',
              default: 5,
            },
          },
        },
      },
    ],
  };
});

server.setRequestHandler(CallToolRequestSchema, async (request) => {
  const { name, arguments: args, _meta } = request.params;
  const progressToken = _meta?.progressToken;

  if (name === 'long_running_tool') {
    const seconds = (args?.seconds as number) || 5;

    for (let i = 1; i <= seconds; i++) {
      // Send progress notification
      if (progressToken !== undefined) {
        await server.notification({
          method: 'notifications/progress',
          params: {
            progressToken,
            progress: i,
            total: seconds,
            message: `Executing step ${i} of ${seconds}...`,
          },
        });
      }

      // Simulate work
      await new Promise((resolve) => setTimeout(resolve, 1000));
    }

    return {
      content: [
        {
          type: 'text',
          text: `Successfully completed ${seconds} seconds of "work".`,
        },
      ],
    };
  }

  throw new Error(`Tool not found: ${name}`);
});

const transport = new StdioServerTransport();
await server.connect(transport);
console.error('Progress test server running on stdio');

Related Issues

Fixes #6590

How to Validate

  1. Register an MCP server that supports progress notifications (e.g., using the notifications/progress method).
  2. Call a long-running tool on that server.
  3. Verify that the CLI UI displays the progress message and percentage (if provided) in the tool call header during execution.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run

- Implement progressToken generation and notification handling in McpClient
- Update Scheduler to listen for McpProgress events and update tool execution state
- Enhance CLI UI to display real-time progress messages and percentages

Fixes #6590
@NTaylorMullen NTaylorMullen requested a review from a team as a code owner February 14, 2026 00:13
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @NTaylorMullen, 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 introduces comprehensive support for displaying real-time progress updates for long-running Model Context Protocol (MCP) tool calls. It integrates a new event system for progress notifications, updates the core MCP client to handle and report these notifications, and modifies the scheduler to track the progress state. The user interface has also been enhanced to visually present this progress information, providing users with better feedback during tool execution.

Highlights

  • Real-time Progress Updates: Implemented comprehensive support for displaying real-time progress updates for long-running Model Context Protocol (MCP) tool calls.
  • Core Event System Integration: Integrated a new McpProgress event and its payload into the core event system to broadcast progress notifications.
  • MCP Client Enhancements: Enhanced the MCP client to manage progressToken to callId mappings, register a notifications/progress handler, and automatically attach progressToken to tool call requests.
  • Scheduler and State Management Updates: Updated the ExecutingToolCall type and the Scheduler to listen for progress events and update the state manager with progressMessage and progressPercent.
  • CLI UI Display: Modified the CLI UI components (IndividualToolCallDisplay, ToolInfo) and mapping logic to propagate and display progress messages and percentages in the tool header during execution.
Changelog
  • packages/cli/src/ui/components/messages/ToolMessage.test.tsx
    • Added a test case to verify that progress information is rendered for executing tools.
  • packages/cli/src/ui/components/messages/ToolMessage.tsx
    • Added progressMessage and progressPercent as props.
    • Passed new progress props to the ToolInfo component.
  • packages/cli/src/ui/components/messages/ToolShared.tsx
    • Extended ToolInfoProps with optional progressMessage and progressPercent.
    • Modified ToolInfo component to display progress details when a tool is executing.
  • packages/cli/src/ui/hooks/toolMapping.ts
    • Mapped new progress-related fields from the core state to the UI display model.
  • packages/cli/src/ui/types.ts
    • Extended the IndividualToolCallDisplay interface with optional progress message and percentage properties.
  • packages/core/src/scheduler/scheduler.ts
    • Subscribed the scheduler to CoreEvent.McpProgress events.
    • Implemented a handler to update tool call status with progress messages and percentages.
  • packages/core/src/scheduler/state-manager.test.ts
    • Added a test to confirm progressMessage and progressPercent are updated in the state manager.
  • packages/core/src/scheduler/state-manager.ts
    • Incorporated progressMessage and progressPercent into the data structure for executing tool calls.
  • packages/core/src/scheduler/types.ts
    • Updated the ExecutingToolCall type to include optional progressMessage and progressPercent fields.
  • packages/core/src/tools/mcp-client.test.ts
    • Updated notification handler mocks to support multiple schemas.
    • Adjusted test expectations for setNotificationHandler calls.
    • Modified listTools call expectation to include the progressReporter.
  • packages/core/src/tools/mcp-client.ts
    • Introduced McpProgressReporter interface and implemented it in McpClient.
    • Added a map to track progressToken to callId mappings.
    • Registered a notification handler for ProgressNotificationSchema to process and emit progress events.
    • Implemented registerProgressToken and unregisterProgressToken methods.
    • Modified McpCallableTool to generate and attach a progressToken to tool call requests and manage its lifecycle.
  • packages/core/src/utils/events.ts
    • Defined a new McpProgressPayload interface and added McpProgress event to the core event system.
    • Added emitMcpProgress method to CoreEventEmitter.
Activity
  • The pull request author, NTaylorMullen, created this pull request.
  • The pull request includes new test cases for the UI components and state manager.
  • The pull request description provides a detailed summary, specific changes, validation steps, and a pre-merge checklist.
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.

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.

@github-actions
Copy link

Size Change: +3.36 kB (+0.01%)

Total Size: 24.4 MB

Filename Size Change
./bundle/gemini.js 24.4 MB +3.36 kB (+0.01%)
ℹ️ View Unchanged
Filename Size
./bundle/sandbox-macos-permissive-open.sb 890 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB
./bundle/sandbox-macos-strict-open.sb 4.82 kB
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB

compressed-size-action

Copy link
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 introduces support for Model Context Protocol (MCP) progress updates, providing real-time feedback for long-running tool calls. The changes are well-structured, spanning from the core event system and MCP client to the scheduler and CLI UI components. Key additions include the McpProgress event, a McpProgressReporter in the client to manage progress tokens, and UI updates to display progress messages and percentages. The implementation is robust, with proper handling of token registration/unregistration and state updates. The accompanying tests are thorough and cover the new functionality well. Overall, this is a solid feature addition that enhances the user experience for tool execution.

@gemini-cli gemini-cli bot added priority/p2 Important but can be addressed in a future release. area/core Issues related to User Interface, OS Support, Core Functionality 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. labels Feb 14, 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 🔒 maintainer only ⛔ Do not contribute. Internal roadmap item. priority/p2 Important but can be addressed in a future release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Client not sending progressToken to MCP Server

1 participant