nvim-editor-mcp
Allows AI agents to interact with a Neovim instance, providing tools for opening files, executing Lua, fetching diagnostics, setting the quickfix list, and showing notifications.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
nvim-editor-mcp
MCP server bridging tool calls to Neovim editor actions via RPC.
Exposes Neovim operations (open files, run Lua, diagnostics, quickfix, notifications) as Model Context Protocol tools, so AI agents can drive your editor — whether spawned directly from Neovim or orchestrated alongside Neovim in a Herdr workspace.
Pi Agent Extension & Package
This repository is also a native Pi Agent package and extension.
Installation in Pi
You can install the extension either globally (available across all sessions) or locally for a single project.
1. Install Locally (from this directory)
Global install (persists in
~/.pi/agent/settings.json, available in all projects):pi install ./Project-level install (persists in
.pi/settings.jsonfor current project only):pi install -l ./Try for one session without installing:
pi -e ./extensions/index.ts
2. Install from Git Remote
Global install from GitHub:
pi install git:github.com/gierdo/nvim-editor-mcpInstall a specific branch, tag, or release:
pi install git:github.com/gierdo/nvim-editor-mcp@v0.1.2Project-level install from Git:
pi install -l git:github.com/gierdo/nvim-editor-mcp
Managing the Package
Inspect installed packages:
pi listUpdate all git/npm packages:
pi update --extensionsRemove the package:
pi remove git:github.com/gierdo/nvim-editor-mcp(orpi remove ./)
Extension Features
The Pi extension provides a deep bi-directional bridge between Pi and Neovim:
Zero-config MCP Server: Auto-registers
nvim-editor-mcpviapi.registerMcpServerand inherits the agent's Herdr topology.Proactive Editor Context: Injects active buffer, cursor location (
line:col), total lines, and modified status into<active_editor_context>before every agent turn.Command-Triggered Follow Edits: Follow code changes made by Pi directly into Neovim on demand using
/followor/nvim follow(with interactive file selection via/follow select, history via/follow list, and opt-in auto-following with/follow auto on).Command-Triggered Quickfix Sync: Parses compiler and test failures from
bashruns (pytest,tsc,cargo,go, etc.) and loads them into Neovim's quickfix list (:copen) on demand using/qfor/quickfix(with opt-in auto-syncing via/qf auto on).Dirty Buffer Protection: Checks if Neovim has unsaved buffer modifications before file edits and triggers
:wall.Turn Notifications: Displays a notification in Neovim (
vim.notify) when Pi finishes an autonomous run.Status Bar Indicator: Shows active connection status in Pi's status bar via
ctx.ui.setStatus.Interactive Slash Commands:
/follow(or/nvim follow) - Navigate Neovim to the file and line of the latest edit made by Pi./follow select- Interactively select from recent edits to open in Neovim./follow list- List recent file edits made by Pi in the session./follow auto [on|off](or/nvim autofollow) - Toggle automatic following on edit./qf(or/quickfix,/nvim qf) - Load recent test or compiler errors into Neovim quickfix list (:copen)./qf list- View parsed test/compiler errors in Pi without touching Neovim./qf clear- Clear recorded error findings./qf auto [on|off](or/nvim autoqf) - Toggle automatic quickfix syncing on failure./nvim status- Inspect attached socket, active file, cursor position, auto-follow status, and open buffers./nvim select- Interactive instance switcher modal (ctx.ui.select)./nvim open <path> [line]- Open a file at a specific line in Neovim./nvim diags [path]- Fetch and display LSP diagnostics in Pi./nvim lua <expr>- Evaluate arbitrary Lua expressions.
Rich Tool Renderers: Formats
mcp__nvim-editor-mcp__*tools with color-coded diagnostic tables and status badges in Pi's terminal UI.
Related MCP server: @aetherall/mcp-nvim-tmux
Installation
Requires uv and Python ≥ 3.11.
uv tool install .This puts nvim-editor-mcp on your PATH.
Usage
# Auto-discover socket (via $NVIM, Herdr topology, or cwd matching)
nvim-editor-mcp
# Explicit socket path
nvim-editor-mcp --socket /tmp/nvim.sock
# Show a Vim message whenever the MCP performs an action
nvim-editor-mcp --notify
# Or via environment variable: NVIM_MCP_NOTIFY=true nvim-editor-mcpThe server runs in stdio MCP mode. If no --socket is given and $NVIM is
unset, the server starts without an active connection and lazily resolves the
target Neovim instance on the first tool call (or via attach_nvim).
Herdr Integration & Workflow
nvim-editor-mcp has first-class integration with Herdr, enabling
multi-pane workflows where coding agents and Neovim instances run side by side
in organized workspaces and tabs.
How It Works
When multiple Neovim instances are running across the system, nvim-editor-mcp
inspects each discovered socket and queries the active Herdr session
($HERDR_SOCKET_PATH) to collect rich context for every editor instance:
Working directory (
cwd) and open buffers from Neovim.Herdr topology (
pane,tab,workspace) from the instance'sHERDR_PANE_ID,HERDR_TAB_ID, andHERDR_WORKSPACE_IDenvironment variables, cross-referenced against a live Herdrsession.snapshotso moved panes and human-readable workspace/tab labels stay accurate.
Example output from list_nvim_instances:
[0] /run/user/1000/nvim.12345.0 | cwd: /home/user/app/backend | herdr: [pane w1:p1, tab w1:t1 (api), workspace w1 (app)] | buffers: [src/main.py, tests/test_api.py] [recommended]
[1] /run/user/1000/nvim.23456.0 | cwd: /home/user/app/frontend | herdr: [pane w1:p3, tab w1:t2 (web), workspace w1 (app)] | buffers: [src/App.tsx]
[2] /run/user/1000/nvim.34567.0 | cwd: /home/user/other-repo | herdr: [pane w2:p1, tab w2:t1 (main), workspace w2 (other)] | buffers: [README.md]Instance Selection & Agent Workflow
Agents orchestrated inside a Herdr workspace should interact with a Neovim instance in the same Herdr workspace, preferring instances in the same working directory:
Explicit socket (
--socketor$NVIM): Used immediately when provided (for example, when launched from inside Neovim via codecompanion.nvim).Single running instance: Automatically attached when only one Neovim socket exists on the host.
Automatic workspace &
cwdmatching: When multiple instances are running,nvim-editor-mcpcompares the agent's Herdr caller context ($HERDR_PANE_ID,$HERDR_TAB_ID,$HERDR_WORKSPACE_ID) and working directory against all running instances:Scopes candidates to instances in the same Herdr workspace when running inside Herdr.
Prefers an instance in the same working directory (
cwd) (breaking ties using the agent's Herdr tab).Falls back to an unambiguous instance in the same Herdr tab, and then the single instance in the same Herdr workspace.
Disambiguation via
list_nvim_instancesandattach_nvim: If multiple instances remain ambiguous (e.g., two Neovim panes open in different subdirectories of the same Herdr workspace when neither matches the agent's exactcwd), the tool call returns the full instance listing. The agent should:Inspect
list_nvim_instances(which marks[attached]or[recommended]when a match exists).Select an instance in the same Herdr workspace (
$HERDR_WORKSPACE_ID), preferring one in the same working directory (or closest project directory / tab).Call
attach_nvim(socket="/path/to/socket")to bind the session.
Tools
Tool | Description |
| List running Neovim instances with socket path, |
| Connect to a Neovim instance by socket path, or auto-attach to the matching instance in the current working directory / Herdr workspace |
| Detach from the current Neovim instance |
| Open a file at a specific line |
| Populate the quickfix list and open it |
| Fetch LSP diagnostics for a file or all open buffers |
| Execute arbitrary Lua in Neovim and return the result as JSON |
| Show a notification message in Neovim |
MCP client configuration
{
"mcpServers": {
"nvim-editor-mcp": {
"command": "nvim-editor-mcp"
}
}
}Development
Setup
uv syncThis creates a .venv and installs all runtime + dev dependencies.
Linting & formatting
uv run ruff check .
uv run ruff format .Type checking
uv run ty checkTests
Python tests:
uv run pytestPi extension tests:
npm test
# or
npm run typecheck && npm testAll checks (CI-style)
uv run ruff check . && uv run ruff format --check . && uv run ty check && uv run pytest && npm run typecheck && npm testLicense
GPL-2.0
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for Clipkit — gives AI agents a video toolbox via the Clipkit schema.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI assistants to control running Neovim sessions via RPC socket, supporting command execution, state inspection, and LSP actions. Automatically discovers Neovim instances and supports multi-instance management on Linux and macOS.1823 PyPI68MIT
- AlicenseBqualityDmaintenanceAn MCP server that enables AI agents to control Neovim instances running in tmux sessions.12MIT
- AlicenseAqualityDmaintenanceMake 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
- AlicenseAqualityBmaintenanceEnables AI clients to interact with Neovim buffers via MCP tools, providing buffer and cursor context.66 npmISC