Skip to content

[Claude Desktop Windows] Schema compilation fails with complex MCP outputSchemas containing $defs #174

@Maladjez

Description

@Maladjez

Bug Description

Claude Desktop (Windows) v1.0.1768 fails to compile MCP tool schemas that contain complex outputSchema definitions with nested $defs and $ref references. This prevents MCP tools from being usable despite successful server startup and tool registration.

Environment

  • OS: Windows Server 2022 Enterprise (VMware VM)
  • Claude Desktop Version: 1.0.1768
  • Architecture: x64
  • Node Version: 22.21.1 (bundled)

Affected MCP Servers

  • @modelcontextprotocol/server-postgres (v1.22.0)
  • @modelcontextprotocol/server-filesystem (Extension v0.2.0)
  • mcp-server-jetbrains

All servers use complex outputSchema with $defs sections.

Symptoms

  1. MCP servers start successfully ✅
  2. MCP protocol handshake completes ✅
  3. Tools are registered successfully ✅
  4. BUT: Frontend shows 50+ schema compilation errors ❌
  5. Tool calls timeout after ~5 minutes ❌
  6. No tools/call requests ever reach MCP servers ❌

Error Logs

From claude_ai-web.log:

[error] Error compiling schema, function code: var refVal1 = refVal[1]; var validate = function(data, dataPath, parentData, parentDataProperty, rootData) { 'use strict';  var vErrors = null;  var errors = 0; if (rootData === undefined) rootData = data; var errs_1 = errors; var errs_2 = errors; if ((typeof data !== "number" || (data % 1) || data !== data)) { validate.errors = [ { keyword: 'type' , dataPath: (dataPath || '') + "" , schemaPath: '#/definitions/nonNegativeInteger/type' , params: { type: 'integer' } , message: 'should be integer' } ]; return false; }...

Repeated 50+ times for different schema definitions

MCP Communication Flow

✅ 1. Server starts: postgres-mcp v1.22.0
✅ 2. Handshake: {"method":"initialize",...}
✅ 3. Server responds: {"result":{"protocolVersion":"2025-06-18",...}}
✅ 4. tools/list request sent
✅ 5. Server returns tools with complex outputSchema containing $defs
❌ 6. Frontend attempts schema compilation → FAILS
❌ 7. User initiates tool call → Frontend sends COMPLETION request to claude.ai
❌ 8. Request times out after ~5 minutes: "TypeError: Failed to fetch"
❌ 9. No tools/call request ever sent to MCP server

Example Problematic Schema

From PostgreSQL MCP server tools/list response:

{
  "name": "list_schemas",
  "outputSchema": {
    "$defs": {
      "Annotations": {
        "properties": {
          "priority": {
            "anyOf": [
              {
                "maximum": 1,
                "minimum": 0,
                "type": "number"
              },
              {"type": "null"}
            ]
          }
        }
      },
      "TextContent": {...},
      "EmbeddedResource": {
        "properties": {
          "resource": {
            "anyOf": [
              {"$ref": "#/$defs/TextResourceContents"},
              {"$ref": "#/$defs/BlobResourceContents"}
            ]
          }
        }
      }
    },
    "properties": {
      "result": {
        "items": {
          "anyOf": [
            {"$ref": "#/$defs/TextContent"},
            {"$ref": "#/$defs/ImageContent"}
          ]
        }
      }
    }
  }
}

Reproduction Steps

  1. Install Claude Desktop v1.0.1768 on Windows
  2. Configure claude_desktop_config.json:
{
  "mcpServers": {
    "postgres": {
      "command": "uvx",
      "args": ["mcp-server-postgres", "postgresql://user:pass@host:5432/db"]
    }
  }
}
  1. Start Claude Desktop
  2. Observe in logs:
    • main.log: Servers start successfully
    • mcp.log: tools/list returns schemas with $defs
    • claude_ai-web.log: 50+ "Error compiling schema" errors
  3. Attempt to use any tool → Timeout after 5 minutes

Expected Behavior

  • Schema validator should handle JSON Schema Draft-07 with $defs
  • Tool calls should be sent to MCP servers
  • Tools should execute successfully

Actual Behavior

  • Schema compilation fails silently
  • Frontend never sends tools/call requests to MCP servers
  • User sees "Claude is not available" after 5-minute timeout

Workaround

None found. MCP tools are completely unusable in Claude Desktop v1.0.1768 on Windows when servers use complex outputSchemas.

Additional Context

  • Problem occurs with all MCP servers that use $defs in outputSchema
  • Problem persists even without Filesystem Extension
  • Network connectivity confirmed working (corporate proxy configured correctly)
  • MCP servers themselves work correctly (verified by examining stdio communication)
  • Schema validator appears to choke specifically on nonNegativeInteger type definitions and nested $ref structures

Logs Available

Can provide full logs if needed:

  • main.log - Startup sequence
  • mcp.log - MCP protocol communication
  • claude_ai-web.log - Frontend errors
  • mcp-server-*.log - Individual server logs

Request

Please investigate the JSON Schema validator used in Claude Desktop Windows build. The validator appears incompatible with the schema format used by official MCP servers from @modelcontextprotocol.

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