MCP server by jlowin
Cursor MCP Optional Parameter Issue Repro
This repository demonstrates an issue with Cursor's MCP client when calling MCP server tools with optional parameters.

Issue
When calling an MCP tool that has an optional parameter (e.g., b: int | None = None), there's a type validation error. The error message suggests the parameter may be passed as a string instead of an integer, but the root cause isn't fully understood.
Example
The add tool in server.py accepts an optional b parameter. Calling with only the non-optional parameter works fine (e.g., a=100). However, when called with both parameters (a=100, b=200), it results in: Parameter 'b' must be one of types [integer, null], got string.
Reproduction Steps
-
Install dependencies:
uv sync -
The MCP server is configured in
.cursor/mcp.jsonand should be auto-discovered when you open this repository as a workspace in Cursor. -
Ask the Cursor agent to call the
addtool with onlya(e.g., "call the add tool with a = 100"). This should work successfully. -
Ask the Cursor agent to call the
addtool with bothaandb(e.g., "call the add tool with a = 100 and b = 200"). This will reproduce the type validation error.