Official · MODEL CONTEXT PROTOCOL
mcp-neovim-server
Control Neovim using Model Context Protocol (MCP) and the official neovim/node-client JavaScript library
WHAT IT CONNECTS
mcp-neovim-server 为 AI Agent 提供什么
- 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
- `nvim://session`: Current neovim text editor session
- `nvim://buffers`: List of all open buffers in the current Neovim session with metadata including modified status, syntax, and window IDs
- **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
- 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.
- `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.
SECURITY
MCP 收录不等于安全审核
MCP 服务器可能获得模型上下文、凭据、本地文件或调用外部系统的权限。连接 Agent 前,请检查代码、环境变量、网络行为、软件包来源与维护状态。