Skip to content

progressToken type mismatch breaks progress callback between spring-ai and python-sdk #1600

@myifeng

Description

@myifeng

Initial Checks

Description

Environment

Spring AI version: 1.1.0-RC1

mcp version: 1.20.0

Language: Java (Spring Boot) + Python (async client)

Description

I'm testing the progress callback feature in the MCP protocol, but no progress notifications are received on the Python client side.
The tool executes successfully and returns "success", but the registered progress_callback function is never triggered.

Example Code

@McpTool(description = "Test progress callback.")
public String testProgress(McpSyncRequestContext context, @McpProgressToken String progressToken) {
    log.info("progressToken: {}", progressToken);

    if (progressToken != null) {
        context.progress(p -> p.progress(0.0).total(1.0).message("Starting analysis"));
    }

    if (progressToken != null) {
        context.progress(p -> p.progress(1.0).total(1.0).message("Analysis complete"));
    }

    return "success";
}

Expected behavior:

The progress messages (“Starting analysis” and “Analysis complete”) should be sent to the client.

Actual behavior:

The progressToken is not null, and both context.progress(...) calls are executed (confirmed by logs).

However, no progress messages are received on the Python side.

async def handle_progress_message(progress: float, total: float | None, message: str | None) -> None:
    """Handle progress messages"""
    print(f"\r🔍 {message}", end='', flush=True)
    print()

async def call_tool(self, name: str, args: dict) -> Any:
    loop = self._worker_task.get_loop()
    coro = self.session.call_tool(name, progress_callback=handle_progress_message, arguments=args)

    if loop is asyncio.get_running_loop():
        return await coro

    fut: concurrent.futures.Future = asyncio.run_coroutine_threadsafe(coro, loop)
    return await asyncio.wrap_future(fut)

Expected behavior:

The function handle_progress_message() should be called twice with messages from the server.

Actual behavior:

The function is never called.

The tool call completes successfully and returns the "success" string, but no progress updates are printed.

Question

Is there any known limitation or additional setup required to enable progress callbacks between Spring AI’s MCP implementation and mcp-python?

Do I need to:

Enable streaming or a specific event type in the connection?

Return progress updates differently from the Java side?

Any example or clarification on how progress events are supposed to flow between these two implementations would be very helpful.


### Python & MCP Python SDK

```Text
Spring AI version: 1.1.0-RC1

mcp version: 1.20.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds confirmationNeeds confirmation that the PR is actually required or needed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions