Skip to content

Inspector does not report log messages #184

Closed
@ezyang

Description

@ezyang

Describe the bug
Inspector does not report log messages. It does report progress. We know the log messages are being emitted because Claude Desktop reports them.

To Reproduce

# progress_demo.py
import asyncio
from mcp.server.fastmcp import FastMCP, Context

# Create an MCP server
mcp = FastMCP("Progress Demo")

@mcp.tool()
async def slow_process(duration: float = 5.0, steps: int = 50, ctx: Context = None) -> str:
    """Simulate a slow process while reporting progress.
    
    Args:
        duration: Total duration in seconds (default: 5.0)
        steps: Number of progress steps to report (default: 50)
        ctx: MCP context (automatically injected)
    
    Returns:
        A completion message
    """
    if ctx is None:
        return "Error: Context not available"
    
    sleep_interval = duration / steps
    
    ctx.info(f"Starting slow process: {duration} seconds with {steps} updates")
    
    for i in range(steps + 1):
        # Calculate and report progress percentage
        progress_pct = i / steps
        await ctx.report_progress(i, steps)
        
        # Add some detailed info about the current step
        if i % 5 == 0:
            await ctx.info(f"Processing step {i}/{steps} ({progress_pct:.0%} complete)")
        
        # Sleep for the calculated interval
        await asyncio.sleep(sleep_interval)
    
    ctx.info("Process completed successfully!")
    return f"Successfully completed slow process in {duration} seconds"


if __name__ == "__main__":
    # Run the server directly when the script is executed
    mcp.run()

Run it with inspector, trigger the tool, see only report progress in the window.
Run it with Claude Desktop, look at the mcp log

2025-03-12T04:04:14.665Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 0/50 (0% complete)"}}
2025-03-12T04:04:15.171Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 5/50 (10% complete)"}}
2025-03-12T04:04:15.676Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 10/50 (20% complete)"}}
2025-03-12T04:04:16.182Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 15/50 (30% complete)"}}
2025-03-12T04:04:16.688Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 20/50 (40% complete)"}}
2025-03-12T04:04:17.193Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 25/50 (50% complete)"}}
2025-03-12T04:04:17.698Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 30/50 (60% complete)"}}
2025-03-12T04:04:18.203Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 35/50 (70% complete)"}}
2025-03-12T04:04:18.709Z [Progress Demo] [info] Message from server: {"jsonrpc":"2.0","method":"notifications/message","params":{"level":"info","data":"Processing step 40/50 (80% complete)"}}
2025-03-12T04:04:18.937Z [Progress Demo] [info] Message from client: {"method":"resources/list","params":{},"jsonrpc":"2.0","id":12}

Amusingly, Claude Desktop doesn't report the progress in the logs at all, but that's not really this bug.

Expected behavior
Inspector should show us the logs.

Screenshots

Image

Desktop (please complete the following information):

  • OS: OSX
  • Chrome
  • 133

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions