anthropics / anthropics/claude-code

[BUG] Claude Desktop 2.2553.1 (Cowork) alphabetically sorts keys of nested objects in MCP tool call arguments

Open
#95,596 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area:cowork area:desktop area:mcp bug has repro platform:windows
Dominant language
TypeScript
Stars
147k
Forks
24k
PR merge metrics
PR metrics pending

Description

What's Wrong?

When Claude Desktop calls an MCP tool with an object argument, every object nested inside that argument arrives at the server with its keys sorted alphabetically. The top-level keys of the argument keep the order the model produced. Only nested objects (inside arrays or inside other objects) are reordered.

Key order is significant for some MCP servers. In this case the argument is a configuration document where a mapping is evaluated one key at a time and later keys reference earlier ones, so the reordering silently changes behavior without any error on either side.

The standalone Claude Code CLI does not do this. The same tool call from Claude Code CLI 2.1.270 arrives with all key order intact.

Environment

  • Claude Desktop 2.2553.1 (current release), Cowork agent mode
  • Reports itself to MCP servers as claude-code 2.1.278
  • OS: Windows 11 64-bit
  • Reproduces on both a cloud session (server sees user agent Claude-User, Anthropic's remote-MCP proxy) and a local stdio MCP server (server sees a local Python bridge, user agent python-httpx2/2.13.0)
  • Does not reproduce from Claude Code CLI 2.1.270 calling the same server directly over HTTP

Steps to reproduce

  1. Expose any MCP tool that takes an object argument declared as {"type": "object", "additionalProperties": true} and echoes the received argument back, or stores it and returns it on a second call.
  2. In Claude Desktop, ask the model to call it with this exact argument and to not reorder any keys:
{
  "alias": "key order test",
  "items": [
    {"zulu": 1, "alpha": 2, "mike": 3}
  ],
  "nested": {"title": "x", "message": "y"},
  "mode": "single"
}
  1. Compare what the server received with what was sent.

Actual (what the server received)

Server receives:

{
  "alias": "key order test",
  "items": [
    {"alpha": 2, "mike": 3, "zulu": 1}
  ],
  "nested": {"message": "y", "title": "x"},
  "mode": "single"
}

Top level alias, items, nested, mode is intact. Every nested object is sorted.

What Should Happen?

The argument arrives with the key order the model produced, as it does from Claude Code CLI.

Evidence that it happens client-side

The receiving server validates the argument as received and emits a warning when a mapping key references a sibling declared later in the same mapping. With the input above, that warning fires from Desktop and does not fire from the CLI, on the same server build, same session, same payload. The server has no key sorting on its request path.

Same result through two unrelated transports (Anthropic's cloud proxy and a local stdio bridge), so the reordering is in the Desktop client before the request leaves it, not in either transport.

Impact

Any MCP server whose object arguments are order-sensitive gets silently altered input. There is no error, so users see the wrong result and blame the server. Related to the earlier Desktop MCP argument regression in #94608 (optional parameters rejected), which is fixed; this is a separate issue that persists on 2.2553.1.

Version info

  • Claude Code Version: Desktop 2.2553.1, reporting as claude-code 2.1.278
  • Platform: Claude Desktop (Cowork)
  • Operating System: Windows 11 64-bit
  • Regression: not known to have worked on an earlier Desktop build; Claude Code CLI 2.1.270 is unaffected
  • Model: Opus 5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named in the report. Start by reproducing the exact nested-object payload in Claude Desktop and comparing the server's received argument with the Claude Code CLI result; done means nested object key order is preserved without changing top-level behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.