Get the FREE Ultimate OpenClaw Setup Guide →

nvim

MCP server for exposing Neovim buffers to AI agents like Claude Code

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio laktek-nvim-mcp-server npx nvim-mcp-server

How to use

This MCP server exposes Neovim buffers and makes them available to Claude Code as resources, enabling context-aware editing and real-time buffer updates. It discovers Neovim instances running in the current directory and exposes two core resources: nvim://current-buffer, which contains the active buffer with its path and content, and nvim://open-buffers, which lists all open buffers with metadata. In addition, a set of Cloud-based tools lets Claude interact with Neovim directly, such as listing buffers, fetching and updating buffer content, opening files, and reloading buffers. Once configured, Claude can reference these resources in prompts and invoke the provided tools to inspect or modify buffers without leaving the editor.

To use the server, install and start Claude Code with the MCP server configured via npx nvim-mcp-server. Claude will automatically discover the server and expose its resources to your prompts. You can also manually verify configuration with claude mcp list or by using the /mcp command inside Claude Code to check server status. The tools enable concrete workflows like refactoring the current file, updating a specific buffer, or creating and opening new files directly in Neovim, all through the Claude interface.

How to install

Prerequisites:

  • Node.js 16+ installed on your machine
  • Neovim installed with RPC support and a running Neovim instance in your project directory
  • Claude Code (or an MCP client) capable of loading MCP servers

Installation steps:

  1. Install Node.js if you haven’t already (https://nodejs.org/).
  2. Ensure Neovim is running in your project directory and that you can connect to its RPC socket.
  3. Add the MCP server configuration to Claude Code:
    • Automatic setup (recommended): run claude mcp add --transport stdio nvim -- npx nvim-mcp-server
    • Manual setup: add the following to ~/.claude.json under mcpServers: { "nvim": { "command": "npx", "args": ["nvim-mcp-server"] } }
  4. Restart Claude Code to apply changes.
  5. Verify the setup: claude mcp list or use /mcp inside Claude Code to check server status.

Additional notes

Tips and caveats:

  • The MCP server uses Neovim sockets discovered under $TMPDIR (macOS/Linux) as described in the docs. Ensure your Neovim instance is in the current directory when starting Claude Code.
  • Buffers are exposed as resources and can be updated in real time. When you call update_buffer(path, content), the changes are pushed to Neovim immediately.
  • Absolute paths are recommended when referencing buffers to avoid ambiguity.
  • If you encounter connection issues, restart Claude Code after updating the MCP configuration and confirm that the Neovim socket exists (e.g., ls $TMPDIR/nvim*/0).
  • The server communicates via stdio to the MCP client, so you’ll need an MCP client like Claude Code to interact with it properly.
  • Prerelease or development environments may require additional flags or environment variables; consult the project README for any environment-specific notes.

Related MCP Servers

Sponsor this space

Reach thousands of developers