Skip to main content

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

Project description

nvim-mcp

PyPI

nvim-mcp is an MCP server that lets AI assistants (Cursor, Claude, and others) control a running Neovim session: open buffers, move the cursor, run LSP actions, inspect layout, and more. It talks to Neovim directly over its default Unix socket using msgpack-RPC, discovers instances automatically, and exposes four tools.

Platforms: Linux and macOS only.

https://github.com/user-attachments/assets/a546b3d5-082e-4f3d-aaaf-e94d997d506a

Install

uv tool install nvim-mcp

Or run without installing:

uvx nvim-mcp

Quick start

  1. Start Neovim (it listens on an RPC socket by default) — this works in any terminal, including the integrated terminal in Cursor, VS Code, or similar editors.
  2. Set up your MCP client and agent rules — see config/ for everything you need.
  3. The assistant can now control Neovim through 4 tools.

Tools

Tool Purpose
nvim_send The universal interface. Send any ex command, Vimscript expression, or key sequence to Neovim. Three modes: command, eval, keys.
nvim_state Structured snapshot: current file, cursor position, mode, window layout, modified buffers, cwd, and more.
nvim_connect Connect to a Neovim instance. Auto-connects when only one exists; lists all when multiple are found.
nvim_recipes Browse operation recipes by category (files, navigation, buffers, windows, marks, registers, folds, LSP).

Multi-instance

One Neovim instance running? Tools auto-connect. Multiple? nvim_connect lists them — pick by index, socket_path, or terminal_pid. Set NVIM_SOCKET_PATH to skip discovery entirely.

Setup

See config/ for MCP client registration (Cursor, Claude Desktop, Claude CLI) and example agent rule files.

Manual testing

Open Neovim, then copy-paste the block below into your AI assistant to verify the MCP server end-to-end:

Run through these tests one at a time. After each test, tell me what happened
and wait for my OK before moving to the next one.

1. Connect to my Neovim instance and show me the current file, cursor position, and mode.
2. Create a new file called /tmp/nvim-mcp-test.py and add a few lines of Python to it (a function, a comment, a print statement).
3. Save the file, then tell me the total line count.
4. Go to line 1, then jump to the last line. Tell me the cursor position after each move.
5. What is the current working directory in Neovim?
6. Open a vertical split with /tmp/nvim-mcp-test2.py, write a short function in it, and save it.
7. Switch back to the original window and confirm which file is shown.
8. Add a comment above the first function in the current file and save.
9. Are there any unsaved buffers? List all open buffers.
10. Search for the word "def" in the current buffer. Tell me which lines match.
11. Close the current buffer without saving, then close the remaining buffer.
12. Show me the LSP recipes for Neovim.

Requirements

  • Python ≥ 3.10
  • Linux or macOS
  • Neovim with RPC socket enabled (default)

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.3.0.tar.gz (11.6 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.3.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nvim_mcp-0.3.0.tar.gz
  • Upload date:
  • Size: 11.6 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.3.0.tar.gz
Algorithm Hash digest
SHA256 a94fabaf4ce65cbe70281a35214a93e48ef145e898f2b2ea9acb57e4254233c5
MD5 238f3a7a610d67f47a66f93e70dcddd0
BLAKE2b-256 9e2fa2e2bcc14658d90764d25be0cab9d793b778a609c816dba8626fbf9b5cc1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nvim_mcp-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 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.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 71bfdd2f1bbab1721c81fa36966eb29fa9fcf9cd910abda6c403ea3d966ee428
MD5 dc5d047f8e3daaae9a9549fa384f8a37
BLAKE2b-256 e20abb794a7c9d6a61aaa3278c7cf83f99dc6342d4a3d6a9308399f3702f9924

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