Neovim MCP Server logo

Neovim MCP Server

by bigcodegen

A proof of concept integration between Claude Desktop and Neovim using Model Context Protocol (MCP). This server leverages Vim's native text editing commands and workflows to create a lightweight code or general purpose AI text assistance layer.

View on GitHub

Last updated: N/A

What is Neovim MCP Server?

This server is a proof-of-concept integration that allows Claude Desktop (or any client) to interact with Neovim through the Model Context Protocol (MCP). It enables AI-powered text editing and assistance by leveraging Neovim's existing commands and workflows.

How to use Neovim MCP Server?

  1. Ensure Neovim is running with a socket exposed (e.g., --listen /tmp/nvim). 2. Configure Claude Desktop to use the server by adding the provided configuration to claude_desktop_config.json. 3. Set the necessary environment variables (e.g., ALLOW_SHELL_COMMANDS, NVIM_SOCKET_PATH). 4. Use Claude to interact with your Neovim session.

Key features of Neovim MCP Server

  • Connects to Neovim instance via socket

  • Views current buffers and their metadata

  • Gets cursor location, mode, and file name

  • Runs Vim commands and shell commands through Vim

  • Edits buffers using insert, replace, or replaceAll

  • Manages Neovim windows (split, vsplit, close, navigate)

  • Sets marks and manages registers

  • Creates visual mode selections

Use cases of Neovim MCP Server

  • AI-assisted code editing in Neovim

  • General-purpose AI text assistance within Neovim

  • Answering questions about the current Neovim session

  • Automating repetitive text editing tasks

  • Navigating and manipulating Neovim windows through AI commands

FAQ from Neovim MCP Server

What is Model Context Protocol (MCP)?

MCP is a protocol that enables communication and data exchange between different applications, allowing them to share context and work together.

How do I enable shell commands?

Set the ALLOW_SHELL_COMMANDS environment variable to 'true'. Note that this may introduce security risks.

What if Claude doesn't get the Vim command right?

This is a known limitation. The server is a proof of concept, and error handling could be improved. Try rephrasing your command.

What is the default Neovim socket path?

The default socket path is '/tmp/nvim'. You can change it using the NVIM_SOCKET_PATH environment variable.

What kind of edits can I do?

You can insert, replace, or replace all lines in the VIM editor.