nvim-mcp
by paulburgess1357·★ 54·综合分 45
MCP服务器通过msgpack-RPC连接AI代理与Neovim,实现无插件的代码编辑和命令执行。
概述
nvim-mcp为AI代理提供直接访问运行中Neovim实例的能力,通过Neovim原生的msgpack-RPC协议使其能够查看缓冲区、执行命令、内存编辑文件、查询诊断等。支持Cursor、Claude Code、Codex和OpenCode等多个AI客户端。该服务器强调安全性,通过内存操作和保留撤销历史确保在更改保存到磁盘前不会造成意外破坏。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您希望AI代理直接与您的Neovim编辑器进行交互以进行代码编辑、分析或自动化,而无需任何插件时,选择nvim-mcp。
什么时候不要选它
如果您使用的是其他编辑器、需要无确认的磁盘写入操作,或在需要身份验证的安全多用户环境中工作,不要选择nvim-mcp。
此 server 暴露的工具
从 README 抽取出 6 个工具get_neovim_stateGet current Neovim editor state including mode, working directory, buffers, windows, cursor position, folds, selections, marks, and diagnostics.
edit_bufferEdit buffer contents in memory with find-and-replace or full rewrites.
run_vim_commandExecute any Vim command in Neovim.
send_keystrokesSend keystrokes to Neovim to navigate, enter modes, or trigger mappings.
get_lsp_diagnosticsQuery LSP diagnostics for errors, warnings, and hints across a buffer or the whole session.
add_highlightAdd colored extmarks to highlight specific lines or code regions.
说明:Tool names were inferred from the 'What agents can do' section. The actual tool names and signatures may differ and should be verified in the full tool reference (docs/TOOLS.md).
可对比工具
安装
安装
使用 uv(推荐)
- 安装 uv:
curl -LsSf https://astral.sh/uv/install.sh | sh- 在您的客户端注册 MCP 服务器。对于 Cursor,添加到
.cursor/mcp.json:
{
"mcpServers": {
"nvim-mcp": {
"command": "uvx",
"args": ["nvim-mcp"]
}
}
}对于 Claude Desktop 等其他客户端,请参阅[配置指南](config/README.md)。
使用 Nix
确保已安装 Nix 并启用了 flakes:
{
"mcpServers": {
"nvim-mcp": {
"command": "nix",
"args": ["run", "github:paulburgess1357/nvim-mcp"]
}
}
}- 添加代理规则以指定 AI 应何时以及如何使用工具。请参阅[配置指南](config/README.md#2-add-agent-rules)。
- 启动 Neovim。在大多数 Linux 系统上,它会被自动发现。
FAQ
- Neovim 中是否需要安装插件?
- 不需要,nvim-mcp 使用 Neovim 原生的 msgpack-RPC 套接字工作,无需任何插件。
- 支持哪些 AI 客户端?
- 支持 Cursor、Claude Code、Codex、OpenCode 以及任何兼容 MCP 的客户端。
nvim-mcp 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。