Edit tool changes not persisted when MCP is enabled

Resolved 💬 1 comment Opened Dec 20, 2025 by manojvas Closed Dec 20, 2025

Summary

When running Claude Code with MCP (Model Context Protocol) enabled, the Edit tool reports success but file changes are not persisted to the filesystem. The same tasks work correctly when MCP is disabled.

Environment

  • Claude Code version: 2.0.70
  • Model: claude-sonnet-4-5-20250929
  • Platform: Docker container (GitHub Actions runner)
  • MCP Server: Bito AI Architect (code search tools)

Reproduction

Command (Treatment - MCP enabled, FAILS)

claude --print \
  --permission-mode acceptEdits \
  --allowedTools "Bash,Edit,Read,Write,Grep,Glob,WebFetch,Task,TodoWrite,mcp__bito-architect" \
  --mcp-config '{"mcpServers":{"bito-architect":{"url":"https://..."}}}' \
  --output-format stream-json \
  --verbose \
  -p "Fix this bug..."

Command (Baseline - MCP disabled, WORKS)

claude --print \
  --permission-mode acceptEdits \
  --allowedTools "Bash,Edit,Read,Write,Grep,Glob,WebFetch,Task,TodoWrite" \
  --output-format stream-json \
  --verbose \
  -p "Fix this bug..."

Observed Behavior

With MCP Enabled (Bug)

  1. Agent calls Edit tool on /testbed/lib/ansible/executor/play_iterator.py
  2. Edit tool returns success: "The file has been updated"
  3. Agent runs git diff and sees the changes (27 lines added)
  4. Agent completes with "subtype":"success"
  5. After agent exits, running git diff shows NO changes
  6. changes.patch file is empty/not generated

Without MCP (Works Correctly)

  1. Agent calls Edit tool on the same file
  2. Edit tool returns success
  3. Agent runs git diff and sees changes
  4. Agent completes successfully
  5. After agent exits, git diff still shows the changes
  6. changes.patch file contains the diff

Evidence from Agent Logs

Edit tool success message (MCP enabled):

{
  "tool_use_id": "toolu_019rNdzuBBqv7Vh4bKWzCSF2",
  "type": "tool_result",
  "content": "The file /testbed/lib/ansible/executor/play_iterator.py has been updated..."
}

Git diff inside agent session (MCP enabled):

diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py
index 1a53f3e701..e8d2b21ed4 100644
--- a/lib/ansible/executor/play_iterator.py
+++ b/lib/ansible/executor/play_iterator.py
@@ -188,6 +188,33 @@ class PlayIterator:
+        # Fix end-of-role markers after tag filtering
+        # ... 27 lines added

But after agent exits:

$ git diff
# (empty output)

Impact

This bug prevents MCP-enabled workflows from making any code changes. We discovered this during an A/B evaluation comparing baseline (no MCP) vs treatment (with MCP) runs on SWE-bench tasks. All 80+ treatment runs showed 0 code changes despite the agent successfully calling Edit.

Additional Context

  • The issue is 100% reproducible across multiple tasks and repositories
  • Both baseline and treatment use the same Docker container and git setup
  • The only difference is the --mcp-config flag and MCP tools in --allowedTools
  • Agent exit code is 1 for MCP runs vs 0 for baseline (possibly related)

Workaround

None known. Disabling MCP allows Edit to work correctly.

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗