Neovim Integration
STDIOConnect Claude Desktop to Neovim using MCP for AI text assistance.
Connect Claude Desktop to Neovim using MCP for AI text 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.
Version 0.5.2 - Now with comprehensive error handling, improved MCP compliance, and helpful workflow prompts!
--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, optional) - Get specific buffer by filenamecommand
(string)nvim.replaceTermcodes
. Multiple commands work with newlines!
prefix when ALLOW_SHELL_COMMANDS=true
'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)identifier
(string | number) - Buffer name or numberfilename
(string, optional) - Save to specific filefilename
(string) - File to openpattern
(string), ignoreCase
(boolean, optional), wholeWord
(boolean, optional)pattern
(string), replacement
(string), global
(boolean, optional), ignoreCase
(boolean, optional), confirm
(boolean, optional)pattern
(string), filePattern
(string, optional) - File pattern to searchaction
("record" | "stop" | "play"), register
(string, a-z), count
(number, optional)action
("new" | "close" | "next" | "prev" | "first" | "last" | "list"), filename
(string, optional)action
("create" | "open" | "close" | "toggle" | "openall" | "closeall" | "delete"), startLine
/endLine
(numbers, for create)direction
("back" | "forward" | "list")Using this comprehensive set of 19 tools, Claude can peer into your neovim session, navigate buffers, perform searches, make edits, record macros, manage tabs and folds, and handle your complete development workflow with standard Neovim features.
The server implements comprehensive error handling with custom error classes and consistent error responses:
New in v0.5.2: All tools now include robust try-catch error handling that returns meaningful error messages in proper MCP format. Features include connection health monitoring, graceful error propagation, and actionable error messages to help diagnose issues.
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.