You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
LoggingMessageNotification.data is String, so the client fails on object data (e.g. from FastMCP servers) #1180
Bug description
The MCP spec allows any JSON value in notifications/message params.data (type unknown). The SDK declares LoggingMessageNotification.data as String. When a server sends an object, the client cannot parse the notification. It logs an ERROR and drops the log message. The tool call itself still works.
FastMCP sends data as an object for every ctx.info() / ctx.log(): {"msg": "...", "extra": null}. So any SDK client calling a FastMCP tool that logs will hit this.
ERROR i.m.spec.McpClientSession : Error handling notification: Cannot deserialize value of type `java.lang.String` from Object value (token `JsonToken.START_OBJECT`)
(through reference chain: io.modelcontextprotocol.spec.McpSchema$LoggingMessageNotification["data"])
Environment
MCP Java SDK 2.0.1 (also 2.0.0)
Spring AI 2.0.0, Java 21
Server: FastMCP 3.3.1, Streamable HTTP
Steps to reproduce
Run the FastMCP server below.
Call the hello tool with McpSyncClient.
Expected behavior
The notification is parsed and passed to the logging consumers. data should accept any JSON value, as the spec says.
var client = McpClient.sync(
HttpClientStreamableHttpTransport.builder("http://localhost:8000").endpoint("/mcp").build())
.build();
client.callTool(McpSchema.CallToolRequest.builder("hello").build()); // returns "ok", but logs the ERROR above
Possible fix that does not break the API: keep String, but turn a non-string data into its JSON text when parsing.
Activity