Skip to main content

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

Project description

nvim-mcp

PyPI

An MCP server that gives any AI agent first-class access to your running Neovim session. Agents can see your editor state, read and edit buffers, run commands, send keystrokes, query diagnostics, and annotate code with highlights — all through Neovim's native msgpack-RPC socket.

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

Demos

Using nvim-mcp with a terminal inside Neovim

Claude and Cursor collaborating in one Neovim instance

Using nvim-mcp in Cursor

Using nvim-mcp across two terminals

Tools

Agents can run any Vim command and send any keystrokes, so anything you can do in Neovim, the agent can too. Dedicated tools handle the most common operations without requiring the agent to construct raw commands:

Tool Purpose
get_state Session snapshot — mode, cwd, buffers, windows, cursor context, folds, selections, marks, diagnostics
send_command Run ex commands (:w, :e path, :wincmd v, etc.)
send_keys Send keystrokes (Esc is prepended automatically)
read_full_buf / read_buf_range Read buffer contents with line numbers
find_and_replace_buf Exact-match find and replace in a buffer
write_full_buf Replace entire buffer contents
get_all_diagnostics / get_buf_diagnostics LSP diagnostics (errors, warnings, hints)
highlight_range / highlight_ranges Annotate lines with colored extmarks
clear_highlights Remove MCP highlights from a buffer
connect Discover and connect to running Neovim instances

Buffer edits are in-memory — nothing is written to disk until saved. Running instances are auto-discovered; when multiple exist, the agent picks by index, socket path, or terminal PID.

Setup

  1. Install uv if you don't have it: curl -LsSf https://astral.sh/uv/install.sh | sh
  2. Register the MCP server — example for Cursor (.cursor/mcp.json):
{
  "mcpServers": {
    "nvim-mcp": {
      "command": "uvx",
      "args": ["nvim-mcp"]
    }
  }
}

See config/README.md for other clients (Claude CLI, Codex, etc.) or to run from a local clone.

  1. Add agent rules — registering the server gives the agent the tools, but a rule file teaches it when and how to use them. Run ./config/generate-configs.sh and pick your client.
  2. Start Neovim — it listens on an RPC socket by default.

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.

Requirements

  • Linux
  • Python ≥ 3.10
  • Neovim ≥ 0.11

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.6.0.tar.gz (15.3 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.6.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nvim_mcp-0.6.0.tar.gz
  • Upload date:
  • Size: 15.3 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":"25.10","id":"questing","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.6.0.tar.gz
Algorithm Hash digest
SHA256 987044bd1cd2d742797a06d76f140099765bc86f80e1031d20b9af83d425740f
MD5 c3559d9081280bfb0681fb5509f9e5db
BLAKE2b-256 4f7b5bfb6468f2e3589d71cf6b3ab05d752547dad8e703399730c80ab037c7d4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nvim_mcp-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 17.7 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":"25.10","id":"questing","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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d67d2713481b3e0b48dad9fd8d1e0e78d2c2445610cf07875144fad59d7b7bba
MD5 d91a0c60063ee1b774cd13d1d02f656b
BLAKE2b-256 3e628cfa58a191329928f9d497daa429024d3a3a3388e1aa1d53964b502419ff

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