Skip to main content
Glama

nvim-mcp

PyPI

一个 MCP 服务器,让 AI 智能体能够直接访问您正在运行的 Neovim 会话。它通过 Neovim 原生的 msgpack-RPC 套接字连接,无需任何插件。

适用于 Cursor、Claude Code、Codex、OpenCode 以及任何兼容 MCP 的客户端。

在将智能体连接到 Neovim 之前,请阅读 安全工作指南

智能体能做什么

  • 查看您的视野 — 编辑器模式、工作目录、打开的缓冲区、窗口布局、光标上下文、折叠、选区、标记和诊断信息。

  • 在内存中编辑缓冲区 — 进行查找替换或全文重写,并获得即时反馈和完整的撤销支持。在您保存之前,不会对磁盘进行任何修改。

  • 运行任何 Vim 命令:w:e:vsplit、宏,或任何您可以在命令行中输入的命令。

  • 发送按键 — 导航、进入插入模式、触发映射。

  • 查询 LSP 诊断信息 — 获取单个缓冲区或整个会话中的错误、警告和提示。

  • 使用高亮标注代码 — 使用彩色 extmarks 来引起您对特定行的注意。

  • 处理多个实例 — 自动发现正在运行的会话并连接到正确的实例。请参阅 多个实例

您在 Neovim 中能做的任何事情,智能体也都能做。详情请参阅 完整工具参考

Related MCP server: Vigentic MCP

演示

快速入门

nvim-mcp 通过 uv(推荐)或 Nix 运行。

Cursor 用户: 一个 市场插件 正在审核中 — 一旦可用,它将同时安装 MCP 服务器和智能体规则(您可以直接跳到第 4 步)。要激活规则,请以类似 "Connect to my Neovim instance" 的话语开始对话,或者在 Settings → Rules 中将规则设置为 "Always" 以在每次对话中应用。

  1. 安装启动器。

    curl -LsSf https://astral.sh/uv/install.sh | sh

    安装 Nix — 必须启用 flakes。

  2. 向您的客户端注册 MCP 服务器。Cursor 的示例 (.cursor/mcp.json):

    {
      "mcpServers": {
        "nvim-mcp": {
          "command": "uvx",
          "args": ["nvim-mcp"]
        }
      }
    }
    {
      "mcpServers": {
        "nvim-mcp": {
          "command": "nix",
          "args": ["run", "github:paulburgess1357/nvim-mcp"]
        }
      }
    }

    对于 Claude Code、Codex、Claude Desktop、OpenCode 和其他客户端,请参阅 配置指南

  3. 添加智能体规则 — 不要跳过此步骤。 如果没有规则,智能体虽然拥有工具,但不知道 何时或如何 使用它们,行为将不可靠。请参阅 配置指南 进行设置。

  4. 启动 Neovim — 在大多数 Linux 系统上,它会自动监听 Unix 套接字并被 nvim-mcp 发现。如果自动发现不起作用,请参阅 环境变量。运行多个实例?请参阅 多个实例

验证是否正常工作

在 Neovim 中打开一个文件,并将以下内容粘贴到您的 AI 智能体中:

For each step: explain what you're about to do, then do it, then tell me
what happened. Wait for me to say "next" before moving on.

1. What file am I in? Highlight the function my cursor is in.
2. Are there any diagnostics? Highlight any lines with errors or warnings.
3. Add a docstring above the function, then show me the diff.
4. Open a vertical split, write a short test for that function, and save both files.

安全工作指南

这些工具和智能体规则旨在执行非破坏性操作 — 编辑在内存中进行,保留撤销历史记录,并且智能体被引导进行缓冲区操作。但大语言模型具有非确定性,且拥有 Neovim API 的完全访问权限,您应该预料到它们会犯错。请在版本控制的目录中工作。

要求

  • Linux

  • Python ≥ 3.10

  • Neovim ≥ 0.11 (旧版本 可通过 --listenNVIM_ADDRESS 使用)

许可证

MIT — 请参阅 LICENSE

Install Server
A
license - permissive license
A
quality
A
maintenance

Maintenance

Maintainers
17hResponse time
3wRelease cycle
5Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server that utilizes a headless Neovim instance as an IDE kernel for advanced code editing and navigation. It provides tools for LSP-powered diagnostics, buffer management, and structural edits using Tree-sitter.
  • F
    license
    A
    quality
    D
    maintenance
    Enables AI agents to navigate code using Neovim's LSP and Treesitter features, and read/write the quickfix list.
    14
  • A
    license
    Not graded
    quality
    D
    maintenance
    A Model Context Protocol server for Neovim that provides LSP-based symbol tools, enabling AI language models to perform code analysis and manipulation such as symbol lookup, renaming, and body replacement via Neovim's built-in LSP.
    6
    Apache 2.0

View all related MCP servers

Related MCP Connectors

  • Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.

  • A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…

  • Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/paulburgess1357/nvim-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server