2.5 KiB
Neovim MCP Architecture (Cross-Platform)
We use a modular, cross-platform approach for MCP Neovim integration to cleanly connect with Neovim instances across Windows and WSL.
The Architecture
mcp-memory-server: The core Windows daemon (handles state, lock-files, and global graph).mcp-memory-stub: The WSL proxy that forwards standard json-rpc to the Windows daemon.mcp-memory-nvim: The unified cross-platform Neovim MCP server binary (mcp-memory-nvim.exeon Windows,mcp-memory-nvimon Linux). Its sole responsibility is finding active Neovim instances (via named pipes on Windows or domain sockets on Unix/WSL) and sending RPC commands to them.
This isolates editor-control logic natively to whichever OS environment execution is running in.
How the MCP Server Gets Called
The Antigravity CLI (agy) acts as the MCP Client and automatically manages the lifecycle of these servers.
-
Registration: The servers are registered in the global configuration file:
- WSL:
/home/riz/.gemini/config/mcp_config.json - Windows:
C:\Users\reazul.ashraf\.gemini\config\mcp_config.json
- WSL:
-
Execution: When
agystarts up, it readsmcp_config.json. If it finds"win-nvim": { "command": "C:\\Users\\reazul.ashraf\\.local\\bin\\mcp-memory-nvim.exe" }, it will spawn that binary as a background subprocess using standardstdio. -
Communication:
- The LLM requests to use a consolidated tool (e.g.,
nvim_workspacewith actionfocus, ornvim_exec). - The
agyCLI sends a JSON-RPC request to themcp-memory-nvimsubprocess via itsstdin. - The Rust MCP Server receives the request, connects to the Neovim active socket/pipe (
~/.gemini/active_nvim.txtor\\.\pipe\nvim.*), sends the Msgpack-RPC command, and writes the JSON-RPC response back tostdout. - The
agyCLI reads the response fromstdoutand returns it to the LLM context.
- The LLM requests to use a consolidated tool (e.g.,
Capabilities & Requirements
To use this architecture, Neovim must run the gemini-integration.lua script to broadcast its active socket to ~/.gemini/active_nvim.txt.
The MCP server provides 5 cohesive mega-tools:
nvim_buffer(actions:read,replace,save,undo,redo,create_scratch)nvim_workspace(actions:list_buffers,list_windows,focus,split,cwd)nvim_intelligence(actions:hover,definition,references,outline,query,diagnostics,rename,code_action)nvim_ui(actions:highlight,ghost_text,clear)nvim_exec(actions:lua,vimscript,terminal)