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)
- Agent calls Edit tool on
/testbed/lib/ansible/executor/play_iterator.py - Edit tool returns success:
"The file has been updated" - Agent runs
git diffand sees the changes (27 lines added) - Agent completes with
"subtype":"success" - After agent exits, running
git diffshows NO changes changes.patchfile is empty/not generated
Without MCP (Works Correctly)
- Agent calls Edit tool on the same file
- Edit tool returns success
- Agent runs
git diffand sees changes - Agent completes successfully
- After agent exits,
git diffstill shows the changes changes.patchfile 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-configflag 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.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗