mcp-to-neovim rpc bridge with socket communication
Translates Model Context Protocol requests into Neovim RPC calls via Unix socket communication managed by a NeovimManager singleton. The server implements a three-layer architecture (MCP interface, application logic, socket integration) that maintains a persistent connection to running Neovim instances and serializes/deserializes RPC payloads, enabling AI clients to control Neovim as a remote process without direct binary dependencies.
Unique: Uses official neovim/node-client JavaScript library for RPC communication rather than spawning subprocess or implementing custom RPC protocol, ensuring compatibility with Neovim's native RPC interface and reducing maintenance burden. Implements NeovimManager as a singleton pattern to maintain stateful connection across multiple MCP tool invocations.
vs alternatives: More reliable than shell-based Neovim control (nvim --remote) because it uses native RPC protocol with proper error handling and connection state management, and more lightweight than embedding a full Neovim instance as a subprocess.
buffer-aware code reading and context extraction
Exposes the nvim://buffers resource that lists all open buffers with metadata (filename, line count, modification status) and implements vim_buffer tool to read full buffer content or specific line ranges. The system maintains awareness of which buffers are currently loaded in the editor session, enabling AI clients to query editor state and extract code context without requiring file system access.
Unique: Exposes buffer content through MCP resources (nvim://buffers) rather than only as tool outputs, allowing MCP clients to treat editor buffers as first-class knowledge sources that can be referenced in prompts and context windows. Integrates with Neovim's native buffer management rather than implementing custom file tracking.
vs alternatives: More efficient than file system-based code reading because it accesses already-loaded buffers in memory via RPC, avoiding disk I/O and file permission issues. Provides real-time editor state vs static file snapshots.
visual selection and range-based operations
Implements vim_visual_select tool that creates visual selections (character, line, or block mode) on specified line ranges, and vim_get_selection that retrieves currently selected text. The tools use Neovim's cursor positioning and mode-setting RPC calls to establish selections, then enable subsequent operations (delete, copy, format) on the selected range. Selections are mode-aware (visual, visual-line, visual-block).
Unique: Exposes Vim's visual selection modes (character, line, block) as programmable operations rather than keystroke sequences, allowing AI clients to perform mode-specific operations that would be difficult to express otherwise. Uses Neovim's cursor and mode RPC API for precise selection control.
vs alternatives: More precise than line-based edits because it supports character-level and block-level selections. More flexible than regex-based operations because it can select arbitrary ranges regardless of content.
mark and register-based navigation and storage
Implements vim_set_mark and vim_goto_mark tools for creating and navigating to named marks, and vim_get_register/vim_set_register for accessing Vim's register storage. Marks are stored in Neovim's mark table (nvim_buf_set_mark, nvim_buf_get_mark) and registers are accessed via the register API. This enables AI clients to bookmark positions and store text snippets for later retrieval without external state management.
Unique: Exposes Vim's native mark and register systems as MCP tools rather than implementing custom bookmarking, allowing AI clients to leverage Vim's built-in navigation and storage without external state management. Marks integrate with Neovim's buffer-local mark table.
vs alternatives: More integrated than external bookmarking because it uses Vim's native mark system that persists across editor sessions. More efficient than storing state externally because marks and registers are in-memory and accessed via RPC.
tab and window management for multi-view workflows
Implements vim_create_tab, vim_close_tab, and vim_switch_tab tools for managing Neovim's tab interface, and vim_split_window/vim_close_window for window management. The tools use Neovim's tab and window RPC API (nvim_command for :tabnew, :split, etc.) to manipulate the editor layout. Tab and window state is queryable through the session resource.
Unique: Exposes Neovim's tab and window system as programmable operations rather than requiring keystroke simulation, allowing AI clients to organize complex multi-file workflows with structured layout management. Uses native Neovim commands (:tabnew, :split) via RPC.
vs alternatives: More reliable than keystroke-based window management because it uses native RPC commands that don't depend on keybindings or editor state. More flexible than fixed layouts because it allows dynamic tab/window creation based on workflow needs.
code folding and structural navigation
Implements vim_fold and vim_unfold tools that manage code folding using Neovim's folding API. The tools use Neovim's fold commands (:fold, :unfold) to collapse/expand code regions based on syntax or manual folds. vim_get_folds retrieves fold structure for the current buffer, enabling AI clients to understand code organization and navigate at the structural level rather than line-by-line.
Unique: Exposes Neovim's folding system as a way to understand code structure rather than just for visual organization, allowing AI clients to navigate code at the semantic level (functions, classes) rather than raw line numbers. Integrates with Neovim's foldmethod settings.
vs alternatives: More efficient than reading entire files for structural analysis because folds provide a hierarchical view. More flexible than AST-based analysis because it respects user's Neovim folding configuration.
contextual workflow guidance via prompts
Exposes neovim_workflow prompt that provides contextual guidance for using the Neovim MCP server effectively. The prompt includes best practices, common patterns, and workflow recommendations tailored to the user's current editor state. Prompts are static templates that MCP clients can include in their system prompts to guide AI behavior when interacting with Neovim.
Unique: Provides MCP prompts that guide AI behavior when using Neovim tools, rather than relying on implicit understanding. Allows MCP clients to include workflow guidance in their system prompts for better AI decision-making.
vs alternatives: More effective than undocumented tools because it provides explicit guidance on when and how to use each capability. More integrated than external documentation because prompts are delivered through MCP protocol.
error handling and connection state management
Implements robust error handling throughout the MCP server with try-catch blocks around all Neovim RPC calls, connection state validation, and graceful error reporting. The NeovimManager singleton maintains connection state and automatically reconnects on socket failures. Errors are caught at the RPC layer and returned as structured error responses with error codes and messages, preventing cascading failures.
Unique: Implements error handling at the RPC layer with connection state validation, ensuring that transient socket failures don't crash the server. Uses NeovimManager singleton to maintain connection state across multiple tool invocations.
vs alternatives: More reliable than naive RPC calls because it validates connection state and handles socket errors gracefully. More informative than silent failures because it returns structured error responses with context.
+8 more capabilities