This MCP server provides integration between Claude Desktop (or any MCP client) and Neovim, creating a lightweight AI text assistance layer. It allows Claude to view and edit your Neovim buffers, execute vim commands, and interact with your editor session using the Model Context Protocol.
To use the Neovim MCP Server, you'll need to:
When launching Neovim, use the --listen
flag to expose a socket:
nvim --listen /tmp/nvim
Add the following to your claude_desktop_config.json
file:
{
"mcpServers": {
"MCP Neovim Server": {
"command": "npx",
"args": [
"-y",
"mcp-neovim-server"
],
"env": {
"ALLOW_SHELL_COMMANDS": "true",
"NVIM_SOCKET_PATH": "/tmp/nvim"
}
}
}
}
You can customize the server behavior with these environment variables:
/tmp/nvim
)true
to enable shell command execution (defaults to false
for security)Once configured, Claude can interact with your Neovim session through several tools:
Claude can see the current buffer's content, including line numbers, using the vim_buffer
tool.
Claude can run vim commands using the vim_command
tool. For example:
j
, k
, gg
, G
, /pattern
dd
, yy
, p
i
, v
, ESC
Claude can check your cursor position, current mode, filename, and other status information using vim_status
.
Claude can insert or replace text using the vim_edit
tool with parameters:
startLine
: Where to begin editingmode
: "insert" or "replace"lines
: The text content to insert/replaceClaude can manipulate Neovim windows with vim_window
using commands like:
split
vsplit
close
wincmd h/j/k/l
(for navigation)Claude can set marks and modify registers using vim_mark
and vim_register
tools.
Claude can create visual selections using the vim_visual
tool by specifying start and end positions.
Be aware that this is a proof of concept with some limitations:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.