Skip to content

Breaking change in v0.16.3: Automatic setLoggingLevel call fails for servers with incomplete logging implementation #696

@mxcoppell

Description

@mxcoppell

Issue Summary

MCP Inspector v0.16.3 introduced a breaking change where it automatically calls setLoggingLevel("debug") when connecting to servers that advertise logging capability. This breaks servers that declare logging: {} capability but don't implement the actual logging handlers.

Breaking Change Details

Introduced in: v0.16.3
Affected files:

  • cli/src/client/connection.ts
  • client/src/lib/hooks/useConnection.ts

Problematic code:

// In cli/src/client/connection.ts
if (client.getServerCapabilities()?.logging) {
  // default logging level is undefined in the spec, but the user of the
  // inspector most likely wants debug.
  await client.setLoggingLevel("debug");
}

Problem Description

Many MCP servers declare logging capability but don't implement the actual SetLevelRequestSchema handler. This was working fine in v0.16.2 because the inspector didn't automatically call logging methods.

With v0.16.3, these servers now fail to connect with the error:

"Connection Error - Check if your MCP server is running and proxy token is correct"

Reproduction Steps

  1. Create an MCP server that declares logging capability but doesn't implement handlers:

    new McpServer(SERVER_INFO, {
      capabilities: {
        resources: {},
        tools: {},
        prompts: {},
        logging: {},  // Declared but no handler implemented
        experimental: {}
      }
    });
  2. Try connecting with MCP Inspector v0.16.2 → ✅ Works

  3. Try connecting with MCP Inspector v0.16.3 → ❌ Fails

Suggested Solutions

Option 1: Best Effort Approach (Recommended)

Make the logging level call non-blocking and gracefully handle failures:

if (client.getServerCapabilities()?.logging) {
  try {
    await client.setLoggingLevel("debug");
  } catch (error) {
    console.warn("Failed to set logging level, continuing without debug logging:", error);
    // Continue connection anyway
  }
}

Option 2: Check for Specific Logging Methods

Only call setLoggingLevel if the server explicitly supports it:

const capabilities = client.getServerCapabilities();
if (capabilities?.logging?.setLevel) {  // Check for specific capability
  await client.setLoggingLevel("debug");
}

Option 3: Make it Configurable

Add a flag to disable automatic logging level setting:

// CLI option: --no-auto-logging
// Config option: autoLogging: false
if (capabilities?.logging && !options.disableAutoLogging) {
  await client.setLoggingLevel("debug");
}

Impact

This affects any MCP server that:

  • Declares logging capability in their server info
  • Doesn't implement the complete logging handler suite
  • Was working fine with previous inspector versions

Related

This follows the principle that capability advertisement should not be a hard requirement for basic connectivity. Servers should be able to partially implement capabilities without breaking connections.

Workaround

Server developers can fix this by implementing the missing logging handlers:

import { SetLevelRequestSchema } from '@modelcontextprotocol/sdk/types.js';

server.setRequestHandler(SetLevelRequestSchema, async (request) => {
  const { level } = request.params;
  console.log(`Setting logging level to: ${level}`);
  return {};
});

But this should not be required for basic connectivity to work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions