[BUG] Claude Desktop MCP fails on all parameterized calls for filesystem tool — "Cannot convert undefined or null to object"

Resolved 💬 11 comments Opened Jul 23, 2025 by jinho7 Closed Jul 23, 2025

Environment

  • Platform (select one):
  • Claude Desktop with MCP [Claude CLI Code works fine — this bug occurs only in the Desktop app]

Bug Description

Claude Desktop fails consistently on all parameter-based MCP operations for the @modelcontextprotocol/server-filesystem tool, including:

  • read\_file
  • get\_file\_info
  • directory\_tree
  • search\_files

Only list_directory (which requires no parameters) succeeds.

The error returned is:

Error executing code: Cannot convert undefined or null to object

This issue does not occur in Claude CLI, suggesting the problem is specific to Claude Desktop’s parameter serialization or transmission layer.

---

Expected Behavior

  • File and directory operations with valid parameters should execute normally.
  • MCP tools should receive properly serialized arguments.
  • Behavior should be consistent between Claude CLI and Claude Desktop.

---

Actual Behavior

  • list_directory works correctly (no parameters).
  • All parameter-based operations fail with serialization errors.
  • Works flawlessly on Claude CLI with the same configuration and tool.

---

🛠️ Troubleshooting Attempted

  • ✅ Verified MCP server output
  • ✅ Confirmed correct ~/.claude/mcp.config.json
  • ✅ Used absolute file paths
  • ✅ Restarted Claude Desktop and MCP multiple times
  • ✅ Confirmed functionality in Claude CLI
  • ❌ No workaround found — issue persists in all Desktop sessions

---

🧾 Configuration Used

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/{MyName}"
      ]
    }
  }
}

---

Technical Analysis

The error message:
TypeError: Cannot convert undefined or null to object

suggests that the parameter object passed from Claude Desktop is either missing or not properly constructed. This usually happens in JavaScript when:

  • Object.keys(), Object.entries() or Object.assign() are called on undefined
  • Destructuring is attempted on null/undefined

Since list_directory (no params) works, but read_file (needs path) fails, this is likely due to MCP parameter serialization logic breaking down inside Claude Desktop.

---

Affected Operations

  • ✅ list\_directory: success
  • ❌ read\_file: fails
  • ❌ get\_file\_info: fails
  • ❌ directory\_tree: fails
  • ❌ search\_files: fails

---

System Info

  • Claude Desktop Version: Claude 0.12.28 (5f9bc7) — 2025-07-18T21:14:50.000Z
  • Claude CLI: All MCP operations work as expected
  • Operating System: macOS 15.4.1 (Sequoia) Build 24E263
  • Node.js Version: v22.17.1
  • npm Version: 10.9.2
  • Terminal: macOS Terminal & iTerm2

---

Related Issues

---

Priority

🔴 High — prevents any meaningful use of MCP in Claude Desktop for parameter-based tools.
Workflows relying on file reading, writing, or searching are completely blocked.

View original on GitHub ↗

This issue has 11 comments on GitHub. Read the full discussion on GitHub ↗