MCP parameter validation failure for integer in anyOf [integer, null] schemas

Where does the bug appear (feature/product)?

Cursor IDE

Describe the Bug

Cursor’s MCP parameter validation rejects certain integer values with error “Parameter ‘X’ must be one of types [integer, null], got number”

OBSERVED BEHAVIOR:

  • Parameters with schema {“type”: “integer”} appear to work
  • Parameters with schema {“anyOf”: [{“type”: “integer”}, {“type”: “null”}]} fail validation

TEST CASE:
Testing two integer parameters in the same MCP tool:

  • Parameter A: {“type”: “integer”} - accepted by Cursor
  • Parameter B: {“anyOf”: [{“type”: “integer”}, {“type”: “null”}]} - rejected by Cursor

When testing the same parameters via direct MCP JSON-RPC protocol (bypassing Cursor), both work correctly.

This suggests the issue may be related to how Cursor validates anyOf type unions with an integer type.

Steps to Reproduce

  1. Configure any MCP server with a tool having an integer parameter using anyOf schema:
    {“anyOf”: [{“type”: “integer”}, {“type”: “null”}]}

  2. Attempt to call the tool from Cursor AI chat with an integer value (e.g., 100)

  3. Observe validation error: “got number”

COMPARISON TEST:

  • Same MCP server, parameter with {“type”: “integer”} only: Works
  • Parameter with {“anyOf”: [{“type”: “integer”}, {“type”: “null”}]}: Fails

DIRECT PROTOCOL TEST:
Sending the same request directly via MCP JSON-RPC bypassing Cursor:
echo ‘{“jsonrpc”:“2.0”,“method”:“tools/call”,“params”:{“name”:“test-tool”,“arguments”:{“testParam”:100}},“id”:2}’ | mcp-server-command
Result: Success (returns data)

This suggests the validation occurs in Cursor’s layer before reaching the MCP server.

Expected Behavior

Per JSON Schema specification, numeric values without fractional parts should match type “integer” in all contexts, including within anyOf type unions.

Expected: Both schemas should accept integer values like 100

  • {“type”: “integer”}
  • {“anyOf”: [{“type”: “integer”}, {“type”: “null”}]}

Operating System

Linux

Current Cursor Version (Menu → About Cursor → Copy)

Version: 2.0.60 (user setup)
VSCode Version: 1.99.3
Commit: c6d93c13f57509f77eb65783b28e75a857b74c00
Date: 2025-11-05T00:50:54.645Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100

For AI issues: which model did you use?

N/A - This is an MCP parameter validation bug, not model-specific

For AI issues: add Request ID with privacy disabled

N/A - Issue occurs in parameter validation

TEST RESULTS:

  • Simple integer type: Passes validation
  • anyOf [integer, null]: Fails validation
  • Direct MCP protocol: Both work

This pattern suggests a possible issue with anyOf type union handling.

Related forum discussion: Problem with cursor MCP schema validation numeric vs integer

Additional Information

I previously opened MCP parameter validation fails for integer in anyOf [integer, null] schemas and marked it “Cursor works, but with this issue,” but after testing further, Cursor is unusable and I have to revert to a different IDE until this is fixed.

Does this stop you from using Cursor

Yes - Cursor is unusable

Got a fix for this will be out shortly