Skip to main content

MCP server for AI-assisted control of Neovim via msgpack-RPC

Project description

nvim-mcp

PyPI Glama MCP score

An MCP server that gives AI agents first-class access to your running Neovim session. It connects through Neovim's native msgpack-RPC socket — no plugins required.

Works with Cursor, Claude Code, Codex, OpenCode, and any MCP-compatible client.

What agents can do

  • See what you see — editor mode, working directory, open buffers, window layout, cursor context, folds, selections, marks, and diagnostics.
  • Edit buffers in memory — find-and-replace or full rewrites with immediate feedback and full undo support. Nothing touches disk until you save.
  • Run any Vim command:w, :e, :vsplit, macros, or anything else you could type at the command line.
  • Send keystrokes — navigate, enter insert mode, trigger mappings.
  • Query LSP diagnostics — errors, warnings, and hints across one buffer or the whole session.
  • Annotate code with highlights — colored extmarks to draw your attention to specific lines.
  • Work with multiple instances — auto-discovers running sessions and connects to the right one. See multiple instances.

Anything you can do in Neovim, the agent can too. See the full tool reference for details.

Demos

Using nvim-mcp across two terminals

Using nvim-mcp with a terminal inside Neovim

Claude and Cursor collaborating in one Neovim instance

Using nvim-mcp in Cursor

Multiple Neovim instances

Quick start

nvim-mcp runs via uv (recommended) or Nix.

  1. Install a launcher.

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

    Install Nix — flakes must be enabled.

  2. Register the MCP server with your client. Example for Cursor (.cursor/mcp.json):

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

    For Claude Code, Codex, Claude Desktop, OpenCode, and other clients, see the configuration guide.

  3. Add agent rules — do not skip this. Without rules, the agent has the tools but doesn't know when or how to use them, and behavior will be unreliable. See the configuration guide for setup.

  4. Start Neovim — on most Linux systems it listens on a Unix socket automatically and is discovered by nvim-mcp. If auto-discovery doesn't work, see environment variables. Running multiple instances? See multiple instances.

Verify it works

Open a file in Neovim and paste this into your AI agent:

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.

Working safely

The tools and agent rules are designed to use non-destructive operations — edits happen in memory, undo history is preserved, and the agent is steered toward buffer operations. But LLMs are non-deterministic, have full access to Neovim's API, and you should assume they will make mistakes. Work in a version-controlled directory.

Requirements

  • Linux
  • Python ≥ 3.10
  • Neovim ≥ 0.11 (older versions work with --listen and NVIM_ADDRESS)

License

MIT — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nvim_mcp-0.7.0.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nvim_mcp-0.7.0-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file nvim_mcp-0.7.0.tar.gz.

File metadata

  • Download URL: nvim_mcp-0.7.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nvim_mcp-0.7.0.tar.gz
Algorithm Hash digest
SHA256 8b232c423b75f39209a37f9618d25273269eac2ef0eb13474419037780345198
MD5 940dc54bfd7622718d6c1cb04dfed64f
BLAKE2b-256 ebbd8a341768c1de2b119a42fc3577bc7675e44c61e1d5d21d9916cead4fc378

See more details on using hashes here.

File details

Details for the file nvim_mcp-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: nvim_mcp-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for nvim_mcp-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c9186495426ab2c894f719d237f7896d15dba58eb24199d3ae93f4494a43c51
MD5 5b3af556ac1967494ca85ed2108a8b50
BLAKE2b-256 0164e0afe784d37b4fdffc40ec20690efbecd5736fefd98fd08521758dd64386

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page