by bigcodegen
mcp-neovim-server connects Claude Desktop (or any Model Context Protocol client) to Neovim, allowing AI to interact with and control your Neovim session for enhanced text editing and development workflows.
mcp-neovim-server is an MCP (Model Context Protocol) server that bridges the gap between AI clients like Claude Desktop and the Neovim text editor. It enables AI to understand and interact with your Neovim session, leveraging Vim's native commands and workflows to provide an AI-powered text assistance layer for coding and general-purpose text editing.
To use mcp-neovim-server, you need to connect it to your Neovim instance. This typically involves exposing a socket file (e.g., --listen /tmp/nvim
) when starting Neovim. Once connected, an MCP client like Claude Desktop can interact with your Neovim session. You can install it either by downloading the DXT package and dragging it to Claude Desktop or by manually configuring your claude_desktop_config.json
with the provided command and environment variables.
ALLOW_SHELL_COMMANDS=true
).mcp-neovim-server is ideal for developers and users who want to:
Q: Does mcp-neovim-server work with standard Vim? A: No, it requires a socket connection, which is a feature of Neovim, not standard Vim.
Q: Can I execute shell commands through mcp-neovim-server?
A: Shell command execution is disabled by default for security reasons. You can enable it by setting the ALLOW_SHELL_COMMANDS
environment variable to true
.
Q: What if I have a complex Neovim configuration or many plugins? A: The server may not interact well with highly complex Neovim configurations or a large number of plugins. It's designed to leverage native Vim features that Claude already understands.
Q: How do I specify the Neovim socket path?
A: You can set the NVIM_SOCKET_PATH
environment variable to the path of your Neovim socket. The default path is /tmp/nvim
if not specified.
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.3 - Now with a DXT package!
--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..dxt
file from ReleasesAdd 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.
Please log in to share your review and rating for this MCP.