@@ -42,10 +42,16 @@ The plugin follows a modular architecture with these main components:
42
42
43
43
4 . ** Diff Integration** (` lua/claudecode/diff.lua ` )
44
44
45
+ - ** MCP-compliant blocking diff operations** for Claude Code integration
45
46
- Native Neovim diff support with configurable options
47
+ - ** Scratch buffer system** replacing temporary files for enhanced security
48
+ - ** Coroutine-based blocking** that waits for user interaction (save/close)
49
+ - ** Event monitoring system** with autocmds for save/close/reject detection
50
+ - ** Comprehensive resource cleanup** with automatic state management
51
+ - ** State management** for concurrent diff operations with unique identifiers
46
52
- Current-tab mode (default) to reduce tab clutter
47
53
- Helpful keymaps: ` <leader>dq ` (exit), ` <leader>da ` (accept all)
48
- - Automatic temporary file cleanup
54
+ - Returns MCP-compliant responses: ` FILE_SAVED ` + content or ` DIFF_REJECTED ` + tab_name
49
55
50
56
5 . ** Selection Tracking** (` lua/claudecode/selection.lua ` )
51
57
@@ -67,6 +73,23 @@ The plugin follows a modular architecture with these main components:
67
73
- Exposes setup and control functions
68
74
- Manages plugin lifecycle
69
75
76
+ ## MCP Compliance Enhancements
77
+
78
+ The plugin now features a ** fully MCP-compliant openDiff tool** that implements the Model Context Protocol specification for blocking operations:
79
+
80
+ ### Key MCP Features
81
+
82
+ - ** Blocking Operation** : openDiff now waits indefinitely for user interaction instead of returning immediately
83
+ - ** MCP Content Array Format** : Returns responses as ` {content: [{type: "text", text: "..."}]} `
84
+ - ** User Action Detection** : Monitors save events, buffer/tab close events, and explicit accept/reject actions
85
+ - ** Concurrent Operation Support** : Multiple diffs can run simultaneously with unique tab identifiers
86
+ - ** Resource Management** : Comprehensive cleanup of buffers, autocmds, and state on completion
87
+
88
+ ### Response Formats
89
+
90
+ - ** FILE_SAVED** : When user saves/accepts changes, returns the final file content
91
+ - ** DIFF_REJECTED** : When user closes/rejects the diff, returns the tab name
92
+
70
93
## Development Status
71
94
72
95
The plugin is in beta stage with:
@@ -76,8 +99,9 @@ The plugin is in beta stage with:
76
99
- Enhanced selection tracking with multi-mode support
77
100
- Lock file management implemented
78
101
- Complete MCP tool framework with dynamic registration
79
- - Core MCP tools: openFile, openDiff, getCurrentSelection, getOpenEditors
80
- - Native Neovim diff integration with configurable options
102
+ - Core MCP tools: openFile, ** openDiff (MCP-compliant)** , getCurrentSelection, getOpenEditors
103
+ - ** Enhanced diff integration** with blocking operations and MCP compliance
104
+ - ** Scratch buffer-based diff system** with automatic resource management
81
105
- Terminal integration (Snacks.nvim and native support)
82
106
- Comprehensive test suite (55+ tests passing)
83
107
0 commit comments