A Model Context Protocol (MCP) server that provides seamless integration with Neovim instances, enabling AI assistants to interact with your editor through connections and access diagnostic information via structured resources.
69
stars
316
commits
Rust
primary language
Sep 9, 2026
updated
A Model Context Protocol (MCP) server that provides seamless integration with Neovim instances, enabling AI assistants to interact with your editor through connections and access diagnostic information via structured resources. Supports both stdio and HTTP server transport modes for different integration scenarios.
cargo install nvim-mcp
This repository is a flake that exposes the server as its default package and app.
Run it directly, without installing anything:
nix run github:linw1995/nvim-mcp -- --version
Or install it imperatively into your profile:
nix profile install github:linw1995/nvim-mcp
The snippet below installs the Neovim plugin and the server binary,
then registers it with Claude Code declaratively. No cargo install
build step and no manual claude mcp add:
# flake.nix
inputs.nvim-mcp.url = "github:linw1995/nvim-mcp";
# home-manager module (inputs must be in scope)
{ pkgs, lib, inputs, ... }:
let
nvim-mcp = inputs.nvim-mcp.packages.${pkgs.system}.default;
in
{
programs.neovim = {
enable = true;
plugins = [
(pkgs.vimUtils.buildVimPlugin {
pname = "nvim-mcp";
version = inputs.nvim-mcp.shortRev or "unstable";
src = inputs.nvim-mcp;
})
];
extraLuaConfig = ''require("nvim-mcp").setup({})'';
};
# Requires home-manager's programs.claude-code module.
programs.claude-code = {
enable = true;
mcpServers.nvim = {
type = "stdio";
command = lib.getExe nvim-mcp;
args = [ "--connect" "auto" ];
};
};
}
This registers the nvim MCP server for every project, so you can skip
the manual claude mcp add step below.
Tip: git spawns throwaway Neovim instances to edit commit, merge and
rebase messages. If those load your full config they each call setup()
and register an extra socket in the same git root. Guard the call so
exactly one socket exists per repository:
local transient = false
for _, arg in ipairs(vim.fn.argv()) do
if arg:match("COMMIT_EDITMSG$") or arg:match("MERGE_MSG$")
or arg:match("git%-rebase%-todo$") or arg:match("TAG_EDITMSG$") then
transient = true
end
end
if not transient then
require("nvim-mcp").setup({})
end
git clone https://github.com/linw1995/nvim-mcp.git && cd nvim-mcp
cargo install --path .
With a plugin manager like lazy.nvim:
return {
"linw1995/nvim-mcp",
build = "cargo install --path .",
opts = {},
}
claude or other MCP clients# Auto-connect to current project Neovim instances (recommended)
claude mcp add -s local nvim -- nvim-mcp --log-file . \
--log-level debug --connect auto
# Analyze diagnostics in current Neovim instance
claude "analyze @nvim:nvim-diagnostics://"
For detailed information, see:
Basic development setup:
# Enter development shell
nix develop .
# Run tests
cargo test -- --show-output
# Build and run
cargo run -- --connect auto
See Development Guide for complete setup instructions, testing procedures, and contribution guidelines.
Rust
92.5%
Lua
6.2%
A Model Context Protocol (MCP) server that provides seamless integration with Neovim instances, enabling AI assistants to interact with your editor through connections and access diagnostic information via structured resources.
69
stars
316
commits
Rust
primary language
Sep 9, 2026
updated
A Model Context Protocol (MCP) server that provides seamless integration with Neovim instances, enabling AI assistants to interact with your editor through connections and access diagnostic information via structured resources. Supports both stdio and HTTP server transport modes for different integration scenarios.
cargo install nvim-mcp
This repository is a flake that exposes the server as its default package and app.
Run it directly, without installing anything:
nix run github:linw1995/nvim-mcp -- --version
Or install it imperatively into your profile:
nix profile install github:linw1995/nvim-mcp
The snippet below installs the Neovim plugin and the server binary,
then registers it with Claude Code declaratively. No cargo install
build step and no manual claude mcp add:
# flake.nix
inputs.nvim-mcp.url = "github:linw1995/nvim-mcp";
# home-manager module (inputs must be in scope)
{ pkgs, lib, inputs, ... }:
let
nvim-mcp = inputs.nvim-mcp.packages.${pkgs.system}.default;
in
{
programs.neovim = {
enable = true;
plugins = [
(pkgs.vimUtils.buildVimPlugin {
pname = "nvim-mcp";
version = inputs.nvim-mcp.shortRev or "unstable";
src = inputs.nvim-mcp;
})
];
extraLuaConfig = ''require("nvim-mcp").setup({})'';
};
# Requires home-manager's programs.claude-code module.
programs.claude-code = {
enable = true;
mcpServers.nvim = {
type = "stdio";
command = lib.getExe nvim-mcp;
args = [ "--connect" "auto" ];
};
};
}
This registers the nvim MCP server for every project, so you can skip
the manual claude mcp add step below.
Tip: git spawns throwaway Neovim instances to edit commit, merge and
rebase messages. If those load your full config they each call setup()
and register an extra socket in the same git root. Guard the call so
exactly one socket exists per repository:
local transient = false
for _, arg in ipairs(vim.fn.argv()) do
if arg:match("COMMIT_EDITMSG$") or arg:match("MERGE_MSG$")
or arg:match("git%-rebase%-todo$") or arg:match("TAG_EDITMSG$") then
transient = true
end
end
if not transient then
require("nvim-mcp").setup({})
end
git clone https://github.com/linw1995/nvim-mcp.git && cd nvim-mcp
cargo install --path .
With a plugin manager like lazy.nvim:
return {
"linw1995/nvim-mcp",
build = "cargo install --path .",
opts = {},
}
claude or other MCP clients# Auto-connect to current project Neovim instances (recommended)
claude mcp add -s local nvim -- nvim-mcp --log-file . \
--log-level debug --connect auto
# Analyze diagnostics in current Neovim instance
claude "analyze @nvim:nvim-diagnostics://"
For detailed information, see:
Basic development setup:
# Enter development shell
nix develop .
# Run tests
cargo test -- --show-output
# Build and run
cargo run -- --connect auto
See Development Guide for complete setup instructions, testing procedures, and contribution guidelines.
Rust
92.5%
Lua
6.2%