neovim-use-mcp
This server provides an MCP interface to a real Neovim instance, enabling agents to edit files and leverage full LSP, formatter, and plugin support with your own Neovim configuration.
File & Buffer Operations
Open, read, edit (replacing line ranges or exact text), insert, and save files. Edits flow through the real buffer, triggering format-on-save and plugin hooks.
LSP Intelligence
Access diagnostics (per file or all buffers), go-to-definition, find references, hover info, workspace-wide symbol rename, code actions (quick fixes), formatting (whole file or range), document symbols (outline), and workspace symbol search.
Power Tools
Run arbitrary Ex commands (
nvim_command) or Lua code (nvim_exec_lua) to drive any Neovim plugin or functionality. These can be disabled with--no-execfor security.
Flexible Modes & Safety
Embedded mode spawns a headless Neovim; attach mode connects to a running instance for live viewing. Safety controls include minimal config, timeouts, line caps, exec disabling, and debug output.
Edits files through a real Neovim instance, providing LSP diagnostics, code actions, symbol renaming, references, hover, formatting, and access to Neovim commands and Lua scripting.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@neovim-use-mcpFix all TypeScript errors in src/utils.ts using LSP diagnostics and code actions"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
neovim-use-mcp
An MCP server that edits files through a real Neovim instance. Your agent gets your language servers, your formatters and your plugins, not a plain text writer.
Real LSP — diagnostics after every edit, rename, code actions, hover, references, document and workspace symbols.
Format on save — edits write the buffer, so
BufWritePreruns and your formatter fires.Plugin access —
nvim_commandandnvim_exec_luareach anything else.stdio transport — the server starts with the agent and stops with it. It also stops the Neovim child process.
Requirements
Item | Version | Note |
Node.js | 18 or later | The server runs on Node. |
Neovim | 0.10 or later | The server calls |
A Neovim config | optional | Without one, you get edits but no LSP. |
Check your Neovim first:
nvim --version
nvim --headless --embed # must start and stay quiet; press Ctrl-C to stopIf that command prints errors, a plugin breaks headless start. Use
--config-mode minimal until you fix the plugin.
Related MCP server: @aetherall/mcp-nvim-tmux
Install
From npm (recommended)
npm install -g neovim-use-mcpOr use npx without a global install:
npx neovim-use-mcpFrom source
git clone https://github.com/santanusinha/neovim-use-mcp.git
cd neovim-use-mcp
npm install
npm run buildThe build writes dist/index.js. That file is the server.
Connect an agent
Add the server to your MCP client config.
With npx (no install needed):
{
"mcpServers": {
"neovim": {
"command": "npx",
"args": ["neovim-use-mcp"],
"env": {
"NVIM_MCP_CWD": "/absolute/path/to/your/project"
}
}
}
}With a global install:
{
"mcpServers": {
"neovim": {
"command": "neovim-use-mcp",
"env": {
"NVIM_MCP_CWD": "/absolute/path/to/your/project"
}
}
}
}From a local build:
{
"mcpServers": {
"neovim": {
"command": "node",
"args": ["/absolute/path/to/neovim-use-mcp/dist/index.js"],
"env": {
"NVIM_MCP_CWD": "/absolute/path/to/your/project"
}
}
}
}NVIM_MCP_CWD sets the project root. The language server uses that root to
find tsconfig.json, go.mod, Cargo.toml and so on. If you leave it out,
the server uses the directory that the agent starts it in.
The server needs no start or stop command. The agent starts it over stdio and stops it on exit. The server then stops its Neovim child process.
First run
Ask your agent to open a file:
Open
src/util/format.tswith the Neovim tools.
A correct answer looks like this:
Opened src/util/format.ts (buffer 1, 59 lines, filetype typescript).
LSP clients: null-ls, quick_lint_js, ts_lsIf you see No LSP client attached, read
When no LSP attaches.
How an agent should work
The tools follow one simple order.
Open the file with
nvim_open_file. This starts the language server. Every LSP tool needs an open buffer.Read with
nvim_read_fileto get numbered lines.Edit with
nvim_edit_text,nvim_edit_linesornvim_insert_lines. Each edit saves the file and returns fresh diagnostics.Fix any new diagnostic with
nvim_code_actions.
Three rules make the results much better:
Use
nvim_rename_symbolfor a rename. Do not use a text replace. The LSP changes every file, and a text replace does not.Use
nvim_edit_textwhen you know the exact text. It fails if the text is not unique, which stops a wrong edit.Stage a multi-file change with
save: false, then callnvim_save_bufferonce per file.
Tools
Buffer and file
Tool | Arguments | Purpose |
|
| Open a file and start its LSP client |
|
| Read numbered lines |
|
| Replace a line range |
|
| Replace exact text |
|
| Insert text before a line |
|
| Write a buffer and run format on save |
| — | List open buffers |
LSP
Tool | Arguments | Purpose |
|
| Errors and warnings |
|
| Find a definition |
|
| Find every reference |
|
| Type and documentation |
|
| Rename across the workspace |
|
| List or apply a quick fix |
|
| Format a file or a range |
|
| Outline a file |
|
| Search symbols in the project |
Lines and columns start at 1.
Escape hatches
Tool | Arguments | Purpose |
|
| Run Lua inside Neovim |
|
| Run an Ex command, for example a plugin command |
These two tools run any code. Turn them off with --no-exec if the agent is
not trusted.
Recipes
Fix every error in a file
nvim_open_file path=src/app.ts
nvim_diagnostics path=src/app.ts severity=error
nvim_code_actions path=src/app.ts line=42 column=9 # list
nvim_code_actions path=src/app.ts line=42 column=9 apply_index=1Rename a symbol everywhere
nvim_open_file path=src/util/format.ts
nvim_document_symbols path=src/util/format.ts # find the line
nvim_rename_symbol path=src/util/format.ts line=28 column=17 new_name=renderIssuesThe tool returns the list of files that it changed and saved.
Change several places, then save once
nvim_edit_text path=src/a.ts old_text="foo(" new_text="bar(" save=false
nvim_edit_text path=src/a.ts old_text="= foo" new_text="= bar" save=false
nvim_save_buffer path=src/a.tsRun a plugin command
nvim_command command="Telescope find_files"
nvim_exec_lua code="return vim.fn.getcwd()"Options
Command line flags win over environment variables.
Flag | Environment | Default | Meaning |
|
|
|
|
|
| — | Socket for attach mode |
|
|
| Path to the nvim binary |
|
|
|
|
|
| exec on | Turn off |
|
| process cwd | Project root for the LSP |
|
|
| Default LSP wait |
|
|
| Line cap for a read |
|
| off | Debug lines on stderr |
Watch the agent work
Attach mode shows you every edit in your own window, live.
# terminal 1
nvim --listen /tmp/nvim.sock
# agent config
node dist/index.js --socket /tmp/nvim.sockIn attach mode the server does not stop your Neovim on exit.
The default is embedded, always. The server spawns its own headless Neovim
and owns it. A socket in the environment does not change the mode, so the
server does not take over your editor when the agent runs in a Neovim
terminal. Ask for attach mode with --socket or --mode attach.
How lazy plugins load
Headless Neovim never fires UIEnter or VeryLazy, so a lazy.nvim setup keeps
nvim-lspconfig and mason asleep, and no language server attaches. On start
the server fires the VeryLazy event and forces those plugins to load. It then
waits for the client count to stay stable, so a slow real language server is not
missed behind a fast linter bridge.
Troubleshooting
When no LSP attaches
nvim_open_file reports No LSP client attached. Try these steps in order.
Confirm the file type is correct. The tool prints it. An empty file type means Neovim did not detect the language.
Raise the wait:
nvim_open_file path=... wait_ms=10000. A cold TypeScript or Rust server needs more than 3 seconds.Check that
NVIM_MCP_CWDpoints at the project root. A server that cannot findtsconfig.jsondoes not start.Start the server with
--debugand read stderr. It prints which plugins the warm-up loaded.Confirm the server starts in your own Neovim for the same file.
The server does not start
Run it by hand and read stderr:
NVIM_MCP_DEBUG=1 node dist/index.jsA healthy start prints:
[nvim-mcp] ready (mode=embedded, exec=true, cwd=/your/project)A plugin breaks headless Neovim
Use --config-mode minimal. The server then runs nvim --clean. You keep the
edit tools, but you lose your plugins and your LSP setup.
Diagnostics look wrong or stale
A linter bridge, for example null-ls with eslint_d, reports an error when
the project has no lint config. Add the config, or make the null-ls source
conditional on a config file. This is an editor setup problem, not a server
problem.
A tool says the text is not unique
nvim_edit_text refuses an ambiguous match on purpose. Add more context lines
to old_text, or set replace_all: true if you truly want every match.
Development
npm run dev # tsc --watch
npm test # vitest, uses a real headless nvim
npm run typecheck # tsc --noEmit
npm run inspect # MCP Inspector UIDocker
A Dockerfile is included for isolated or CI usage. The image bundles Node and Neovim, but has no user Neovim config. Mount your config if you need LSP:
docker build -t neovim-use-mcp .
docker run --rm neovim-use-mcpReleasing
Releases publish to npm through GitHub Actions with OIDC trusted publishing. No npm token is stored.
Bump the version in
package.json.Tag and push:
git tag v0.x.0 && git push origin v0.x.0.Create a GitHub Release from the tag.
The
Publish to npmworkflow builds, tests, and publishes automatically.
Licence
MIT
This is completely vibe coded. I guarantee absolutely nothing!!
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Flicense-qualityDmaintenanceA Model Context Protocol server that utilizes a headless Neovim instance as an IDE kernel for advanced code editing and navigation. It provides tools for LSP-powered diagnostics, buffer management, and structural edits using Tree-sitter.
- Flicense-qualityDmaintenanceAn MCP server that enables AI agents to control Neovim instances running in tmux sessions.
- AlicenseAqualityBmaintenanceMake Neovim feel like Cursor. This MCP server gives an agent full control over the Neovim session it is running inside, including buffers, windows, diagnostics, LSP language intelligence, and terminals.23MIT
- Alicense-qualityDmaintenanceAn MCP server that enables AI agents to navigate and understand codebases through file descriptions, semantic search, and code recommendations without repeatedly scanning files.MIT
Related MCP Connectors
An MCP server that gives your AI access to the source code and docs of all public github repos
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Markdown-first MCP server for Notion API with 8 composite tools and 39 actions.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/santanusinha/neovim-use-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server