claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[CRITICAL] MCP Parameter Serialization Bug in Both Claude Code and Claude Desktop

Open hyongok2 opened this issue 1 year ago • 50 comments

Critical MCP Parameter Serialization Bug

Summary

MCP parameter serialization fails consistently on consecutive function calls in both Claude Code and Claude Desktop, making MCP tools effectively unusable for any workflow requiring multiple parameter-based calls.

Environment

  • Platform: Claude Desktop (not Claude Code CLI)
  • Operating System: Windows
  • MCP Servers Tested: mcp-db-server, filesystem
  • Issue Scope: Affects ALL MCP servers requiring parameters

Bug Description

Pattern of Failure:

  • ✅ First call with parameters: SUCCESS
  • ❌ Subsequent calls with parameters: FAIL with "Cannot convert undefined or null to object"
  • ✅ Calls without parameters: SUCCESS (always work)

Reproduction Steps

  1. Make any successful MCP call with parameters (e.g., mcp-db-server:command with SQL)
  2. Attempt a second MCP call with parameters (e.g., mcp-db-server:query with SQL)
  3. Result: Second call fails with "Cannot convert undefined or null to object"
  4. Make a call without parameters (e.g., mcp-db-server:get_database_info)
  5. Result: Call without parameters succeeds

Tested MCP Functions

Database Server (mcp-db-server):

  • get_database_info (no params): ✅ Always works
  • command (sql param): ✅ First call works, ❌ subsequent calls fail
  • query (sql param): ✅ First call works, ❌ subsequent calls fail

Filesystem:

  • list_allowed_directories (no params): ✅ Always works
  • list_directory (path param): ❌ Fails immediately after any previous param call
  • get_file_info (path param): ❌ Fails immediately after any previous param call

Critical Impact

  • Makes MCP unusable: Any workflow requiring >1 parameter call fails
  • Affects both major Claude interfaces: Claude Code AND Claude Desktop
  • Production blocker: Cannot build reliable automations with MCP
  • Cross-platform issue: Not limited to specific OS or setup

Related Issues

This appears related to #3966 and #2089, but is more severe as it affects Claude Desktop users as well, indicating a fundamental problem with Claude's MCP parameter serialization architecture.

Expected Behavior

All MCP calls with proper parameters should succeed regardless of call order or previous calls.

Actual Behavior

Only the first parameter-based MCP call in a session succeeds; all subsequent parameter calls fail with serialization errors.

Workaround

Currently requires restarting the entire Claude session after each parameter-based MCP operation, making MCP impractical for real workflows.


Priority: Critical - This affects the core functionality of MCP across all Claude interfaces.

hyongok2 avatar Jul 23 '25 06:07 hyongok2

Update: Admin Privileges Test Results

Testing Environment: Claude Desktop running with Administrator privileges

Test Results

Ran comprehensive tests with admin privileges to rule out permission-related issues:

Session Start (Fresh)

  1. ✅ mcp-db-server:get_database_info (no params) → SUCCESS
  2. ❌ mcp-db-server:query with SQL parameter → FAILED ("Cannot convert undefined or null to object")
  3. ❌ filesystem:list_directory with path parameter → FAILED
  4. ❌ filesystem:list_allowed_directories (no params) → FAILED

Critical Discovery

Even more severe pattern observed:

  • ✅ First parameter-less call: Works
  • ❌ First parameter call attempt: Fails and corrupts entire MCP session
  • ❌ ALL subsequent calls: Fail, even those without parameters

Conclusion

  • Not a permission issue: Admin privileges do not resolve the problem
  • Complete MCP system failure: First parameter call attempt breaks the entire MCP subsystem
  • Session corruption: Once a parameter call fails, even parameter-less calls start failing
  • Confirms fundamental architectural bug: This is a core MCP implementation defect

This makes the issue even more critical as it shows complete MCP system instability rather than just parameter serialization issues.

Impact Assessment

Severity: CRITICAL++

  • Makes MCP completely unusable in production
  • Single failed parameter call corrupts entire session
  • Affects both Claude Code and Claude Desktop
  • No viable workarounds beyond constant session restarts

hyongok2 avatar Jul 23 '25 06:07 hyongok2

Bump: can confirm, experiencing exactly the same. Tried multiple MCP servers, my own, filesystem, vs code, etc. Consistently get "Cannot convert undefined or null to object" when multiple calls are made in succession or when a call contains multiple parameters/arguments.

Image

umairkamilcodes avatar Jul 23 '25 06:07 umairkamilcodes

See issue https://github.com/anthropics/claude-code/issues/4188

hildebrandt avatar Jul 23 '25 07:07 hildebrandt

"Cannot convert undefined or null to object" when multiple calls are made in succession or when a call contains multiple parameters/arguments.

Same issue here, first tool call works then all other tools from other MCPs returns the same error

TC23345 avatar Jul 23 '25 08:07 TC23345

Dost work even if the session is restarted. On Claude desktop

Mauz013 avatar Jul 23 '25 10:07 Mauz013

Same problem...

aixa-ai avatar Jul 23 '25 11:07 aixa-ai

same here

Kvintus avatar Jul 23 '25 11:07 Kvintus

Remote connectors and dtx also have that problems.. please fix it quickly.

dandacompany avatar Jul 23 '25 11:07 dandacompany

Confirming this exact bug pattern.

I can reproduce the identical behaviour:

  • First MCP call with parameters: SUCCESS
  • Second MCP call with parameters: FAIL with "Cannot convert undefined or null to object"
  • Calls without parameters: Always work

Additionally found that any first MCP call that returns an error (e.g., check a non-existent resource) immediately corrupts the client state, causing all subsequent parameterised calls to fail with the same JavaScript error.

Platform: Claude Desktop Impact: Critical - makes MCP unusable for any multi-step workflows

aicayzer avatar Jul 23 '25 11:07 aicayzer

I get this error: "Failed to call tool execute_sql: TypeError: Cannot convert undefined or null to object" when I try to use mysql_mcp_server. I’ve tried both Sonnet and Opus, and the issue is the same. Is this the same problem you’re experiencing?

cris82mi avatar Jul 23 '25 11:07 cris82mi

Exactly the same @cris82mi. Not an issue with your MCP.

aicayzer avatar Jul 23 '25 11:07 aicayzer

Same issue here.

raudarlabs avatar Jul 23 '25 11:07 raudarlabs

@cris82mi Widespread issue. Suffering the same here.

Kvyii avatar Jul 23 '25 12:07 Kvyii

Same here

SwonDev avatar Jul 23 '25 12:07 SwonDev

Same issue with Jira MCP.

srdi avatar Jul 23 '25 12:07 srdi

Exactly the same issue... Windows 11.

DavidDurlach avatar Jul 23 '25 12:07 DavidDurlach

same issue

anchoret2009 avatar Jul 23 '25 12:07 anchoret2009

Can confirm on macOS Sequoia 15.5

Game breaker for me. I have several long running complex projects and Claude has free rein to read-write persistent memories to a directory I've given it.

grublets avatar Jul 23 '25 12:07 grublets

Confirmed here to. Huge issue for me, killing several critical processes

phodat avatar Jul 23 '25 12:07 phodat

same issue

I'll help you check the PostgreSQL database. Let me start by exploring the database structure to see what's available.Now let me check what tables and other objects are in the main user schema:Let me try a different approach and run a SQL query to check the database:Let me try checking the database health to see if there are any connectivity issues:I'm encountering connectivity issues with the PostgreSQL database - all the functions are returning "Cannot convert undefined or null to object" errors. This suggests the database connection might not be properly configured or the database might not be accessible.

Let me check if there are any database files or alternative data sources available:Let me try checking if there's a DuckDB database available:I'm unable to access the PostgreSQL database due to connectivity issues. All the database functions are returning "Cannot convert undefined or null to object" errors, which suggests:

  1. Database Connection Issues: The PostgreSQL server might not be running or accessible
  2. Configuration Problems: The database connection parameters might not be properly configured
  3. MCP Server Issues: The Model Context Protocol servers that provide database access might not be properly connected

Troubleshooting steps you could try:

  1. Check PostgreSQL Status: Verify that the PostgreSQL service is running
  2. Verify Connection Settings: Ensure the database host, port, username, password, and database name are correctly configured
  3. Network Connectivity: Check if there are any firewall or network issues preventing database access
  4. MCP Configuration: Verify that the PostgreSQL MCP server is properly configured and connected

Would you like me to help you with any specific aspects once the database connectivity is restored? I can assist with:

  • Database schema analysis
  • Performance monitoring
  • Query optimization
  • Health checks
  • Index recommendations

If you have any database dump files or SQL scripts available, I could also help analyze those while the connectivity issues are being resolved.

rrrnhpl avatar Jul 23 '25 12:07 rrrnhpl