
Neovim
STDIOMCP server connecting Claude to Neovim for AI-powered text editing assistance
MCP server connecting Claude to Neovim for AI-powered text editing assistance
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.
--listen /tmp/nvim
, when starting nvimnvim://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 IDsfilename
(string)command
(string)nvim.replaceTermcodes
. Multiple commands will work if separated by newlines'nvim:errmsg'
contents are returnedstartLine
(number), mode
("insert"
| "replace"
| "replaceAll"
), lines
(string)command
(string: "split", "vsplit", "only", "close", "wincmd h/j/k/l")mark
(string: a-z), line
(number), column
(number)register
(string: a-z or "), content
(string)startLine
(number), startColumn
(number), endLine
(number), endColumn
(number)Using this simple set of tools, Claude can peer into your neovim session to answer questions as well as make edits to the buffer.
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.Add this to your claude_desktop_config.json
:
{ "mcpServers": { "MCP Neovim Server": { "command": "npx", "args": [ "-y", "mcp-neovim-server" ], "env": { "ALLOW_SHELL_COMMANDS": "true", "NVIM_SOCKET_PATH": "/tmp/nvim" } } } }
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.