This server connects Claude Desktop or any Model Context Protocol (MCP) client to your Neovim instance for seamless text editing and AI assistance.
Key capabilities:
- Buffer management: View and edit current buffer with line numbers
- Command execution: Send Vim commands for navigation, editing, and other operations
- Status retrieval: Get cursor position, mode, filename, selection, window layout, marks, registers, and working directory
- Text manipulation: Insert, replace, or replace all lines in active buffers
- Window control: Split, close, or navigate between Neovim windows
- Mark and register management: Set named marks (a-z) and register content
- Visual selection: Create and manipulate visual mode selections
- Shell command execution: Optionally run shell commands through Neovim (if enabled)
Connects to a Neovim instance to view and manipulate text buffers, run Vim commands, access editor status, manage windows, set marks and registers, and make visual selections. Allows AI to interact directly with content in the Neovim editor.
Leverages Vim's native text editing commands and workflows to enable AI assistance with code and text editing. Supports navigation, manipulation of buffers, window management, and visual selections.
Neovim MCP Server
Connect Claude Desktop (or any Model Context Protocol client) to Neovim using MCP and the official neovim/node-client JavaScript library. This server leverages Vim's native text editing commands and workflows, which Claude already understands, to create a lightweight code or general purpose AI text assistance layer.
Features
- Connects to your nvim instance if you expose a socket file, for example
--listen /tmp/nvim
, when starting nvim - Views your current buffers
- Gets cursor location, mode, file name
- Runs vim commands and optionally shell commands through vim
- Can make edits using insert or replacement
API
Resources
nvim://session
: Current neovim text editor sessionnvim://buffers
: List of all open buffers in the current Neovim session with metadata including modified status, syntax, and window IDs
Tools
- vim_buffer
- Current VIM text editor buffer with line numbers shown
- Input
filename
(string) - Filename is ignored, returns a string of numbered lines with the current active buffer content
- vim_command
- Send a command to VIM for navigation, spot editing, and line deletion
- Input
command
(string) - Runs a vim command first passed through
nvim.replaceTermcodes
. Multiple commands will work if separated by newlines - On error,
'nvim:errmsg'
contents are returned
- vim_status
- Get the status of the VIM editor
- Status contains cursor position, mode, filename, visual selection, window layout, current tab, marks, registers, and working directory
- vim_edit
- Edit lines using insert, replace, or replaceAll in the VIM editor
- Input
startLine
(number),mode
("insert"
|"replace"
|"replaceAll"
),lines
(string) - insert will insert lines at startLine
- replace will replace lines starting at startLine
- replaceAll will replace the entire buffer contents
- vim_window
- Manipulate Neovim windows (split, vsplit, close, navigate)
- Input
command
(string: "split", "vsplit", "only", "close", "wincmd h/j/k/l") - Allows window management operations
- vim_mark
- Set a mark at a specific position
- Input
mark
(string: a-z),line
(number),column
(number) - Sets named marks at specified positions
- vim_register
- Set content of a register
- Input
register
(string: a-z or "),content
(string) - Manages register contents
- vim_visual
- Make a visual selection
- Input
startLine
(number),startColumn
(number),endLine
(number),endColumn
(number) - Creates visual mode selections
Using this simple set of tools, Claude can peer into your neovim session to answer questions as well as make edits to the buffer.
Limitations
- This is a quick proof of concept to experiment with Model Context Protocol. Use at your own risk.
- May not interact well with a custom neovim config!
- Error handling could be better.
- Sometimes Claude doesn't get the vim command input just right.
Configuration
Environment Variables
ALLOW_SHELL_COMMANDS
: Set to 'true' to enable shell command execution (e.g.!ls
). Defaults to false for security.NVIM_SOCKET_PATH
: Set to the path of your Neovim socket. Defaults to '/tmp/nvim' if not specified.
Usage with Claude Desktop
Add this to your claude_desktop_config.json
:
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
local-only server
The server can only run on the client's local machine because it depends on local resources.
Leverages Vim's native text editing commands and workflows, which Claude already understands, to create a lightweight code assistance layer.
Related MCP Servers
- -securityAlicense-qualityFacilitates integration with the Cursor code editor by enabling real-time code indexing, analysis, and bi-directional communication with Claude, supporting concurrent sessions and automatic reconnection.Last updated -22131TypeScriptMIT License
- -securityAlicense-qualityShell and file edit capabilities tightly coupled to provide a powerful coding experience. You can work with different modes: architect and code-writer for separate plan and implementation phase. You can get it to invoke any cli command, e.g., compiling, type checking, linting, github cli, pythonLast updated -508PythonApache 2.0
- -securityAlicense-qualityA comprehensive code analysis and management tool that integrates with Claude Desktop to analyze code at project and file levels, helping adapt changes to projects intelligently.Last updated -29PythonMIT License
- -securityFlicense-qualityA utility toolkit that enhances Claude's code interaction capabilities by providing seamless tools for Java code analysis, manipulation, and testing workflows.Last updated -2TypeScript