Skip to main content
Glama

nvim-mcp

MCP server that spawns and controls a Neovim instance. It lets your AI agent test your Neovim configuration — open files, run commands, execute Lua, send keystrokes, inspect buffers, and capture PNG screenshots.

Three modes serve different needs. PTY mode runs Neovim in a pseudo-terminal with full screenshot support via terminal emulation. Headless mode embeds Neovim without a display, for lightweight scripting. Terminal mode launches Neovim inside a real GUI terminal and captures its window for screenshots.

Terminal mode supports Kitty, Ghostty, and iTerm2 on macOS. Each terminal handles window discovery, focus management, and cleanup through its own strategy. Screenshots use macOS screencapture and require Screen Recording permission.

Requirements

  • Python 3.11+

  • Neovim 0.10+

  • uv (recommended) or pip

Related MCP server: @aetherall/mcp-nvim-tmux

Install

Clone the repo and register in ~/.claude/.mcp.json:

{
  "mcpServers": {
    "neovim": {
      "command": "uv",
      "args": [
        "run", "--project", "/path/to/nvim-mcp",
        "python", "/path/to/nvim-mcp/nvim_mcp_server.py"
      ]
    }
  }
}

Dependencies are managed automatically by uv run --project.

Testing

uv run python tests/test_smoke.py                        # PTY mode with full config
uv run python tests/test_smoke.py --clean                # PTY mode, no config
uv run python tests/test_smoke.py --headless --clean     # Headless mode
uv run python tests/test_smoke.py --terminal kitty       # Terminal mode (Kitty)
uv run python tests/test_smoke.py --terminal ghostty     # Terminal mode (Ghostty)
uv run python tests/test_smoke.py --terminal iterm2      # Terminal mode (iTerm2, macOS)

Add --clean to any terminal mode test to skip loading your nvim config.

How It Works

Three operating modes:

  • PTY mode (default): Spawns nvim in a pseudo-terminal with --listen <socket>. Connects via msgpack-rpc. A background pyte virtual terminal captures TUI output for PNG screenshots.

  • Headless mode: Uses pynvim.attach("child", argv=["nvim", "--embed", "--headless"]). No screenshots. Lighter weight.

  • Terminal mode (macOS only): Launches nvim inside a real terminal emulator (Kitty, Ghostty, iTerm2). Screenshots via macOS screencapture. Terminals launch in the background without stealing focus. Linux support is not yet implemented.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      Enables 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.
      18
      42 PyPI
      68
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Make 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.
      23
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to spawn persistent terminal sessions, send keystrokes, read screen state, and assert output, allowing them to interact with stateful terminal applications like vim, htop, and gdb.
      47 npm
      MIT