nvim-ui-mcp

nvim-ui-mcp

An MCP server that lets AI agents see, act on, and verify the rendered Neovim UI, like a Playwright for Neovim. It provides tools to launch/attach to Neovim, observe the screen, send input, and wait for conditions.

Category
访问服务器

README

<div align="center">

nvim-ui-mcp

Playwright for Neovim agents.

An MCP server that lets AI agents see, act on, and verify the real, rendered Neovim UI — not just buffer text and API state.

License: MIT Node Neovim npm

</div>


<p align="center"> Most Neovim MCP servers expose buffers, diagnostics, and editor APIs.<br> <code>nvim-ui-mcp</code> attaches as a real Neovim UI client and hands the agent the <b>rendered screen</b> — windows, floats, completion menus, cursor, and mode — so it can reproduce bugs, drive plugin workflows, and verify visual results the same way a human staring at a terminal would. </p>

<p align="center">Think <b>Playwright, but for Neovim.</b></p>

Table of Contents

<ul> <li><a href="#requirements">Requirements</a></li> <li><a href="#installation">Installation</a></li> <li><a href="#mcp-client-configuration">MCP Client Configuration</a></li> <li><a href="#tools">Tools</a></li> <li><a href="#usage">Usage</a></li> <li><a href="#gotchas">Gotchas</a></li> <li><a href="#attach-mode">Attach Mode</a></li> <li><a href="#development">Development</a></li> <li><a href="#license">License</a></li> </ul>

Requirements

<table> <tr><td><b>Neovim</b></td><td>0.10+, on <code>PATH</code></td></tr> <tr><td><b>Node.js</b></td><td>22+</td></tr> <tr><td><b>OS</b></td><td>Linux, macOS, or Windows</td></tr> </table>

Installation

npm install -g nvim-ui-mcp

MCP Client Configuration

<details open> <summary><b>Claude Code</b></summary>

claude mcp add nvim-ui -- npx -y nvim-ui-mcp

</details>

<details> <summary><b>Any JSON-config client</b> (<code>claude_desktop_config.json</code>, <code>.mcp.json</code>, …)</summary>

{
  "mcpServers": {
    "nvim-ui": {
      "command": "npx",
      "args": ["-y", "nvim-ui-mcp"]
    }
  }
}

</details>

Tools

Exactly 8 tools — deliberately not a generic nvim_* API wrapper.

<table> <thead> <tr><th>Tool</th><th>Purpose</th></tr> </thead> <tbody> <tr><td><code>nvim_launch</code></td><td>Start an isolated, disposable Neovim this server owns</td></tr> <tr><td><code>nvim_attach</code></td><td>Attach to a running Neovim via its <code>--listen</code> address</td></tr> <tr><td><code>nvim_observe</code></td><td>Rendered screen + cursor, mode, size, buffer/window, float geometry</td></tr> <tr><td><code>nvim_observe_diff</code></td><td>Only what changed since the last observation</td></tr> <tr><td><code>nvim_input</code></td><td>Send keys in Neovim notation (<code>ihello<Esc></code>, <code><C-n></code>, …)</td></tr> <tr><td><code>nvim_command</code></td><td>Run an Ex command</td></tr> <tr><td><code>nvim_wait</code></td><td>Block until a screen condition holds</td></tr> <tr><td><code>nvim_close</code></td><td>Terminate a launched instance (refuses attach-mode sessions)</td></tr> </tbody> </table>

Usage

The loop is observe → act → wait → observe:

// 1. Start an isolated instance
nvim_launch  { "clean": true, "rows": 24, "cols": 80 }
//          → { "sessionId": "nvim-1", ... }

// 2. Look at the real screen
nvim_observe { "sessionId": "nvim-1" }
//          → { "screen": "…24 rows of text…", "cursor": {...}, "mode": {...} }

// 3. Act
nvim_input   { "sessionId": "nvim-1", "keys": "ihello world<Esc>" }

// 4. Synchronize before looking again — see Gotchas below
nvim_wait    { "sessionId": "nvim-1", "condition": "contains", "text": "hello world" }

// 5. Verify, cheaply
nvim_observe_diff { "sessionId": "nvim-1" }
//          → { "changed": true, "rowChanges": [{ "row": 0, "after": "hello world…" }] }

nvim_close   { "sessionId": "nvim-1" }

Gotchas

<details open> <summary><b>Always wait before observing</b></summary> <br>

nvim_input and nvim_command return as soon as Neovim accepts the request — not when the screen has repainted. Observing immediately races the redraw.

</details>

<details open> <summary><b>Prefer level-triggered waits</b></summary> <br>

contains / not-contains test current screen content, so they work whether the redraw lands before or after the wait started. redraw, screen-change, and idle are edge-triggered and can miss a repaint that already happened — use idle only when you cannot predict the resulting text.

</details>

<details> <summary><b>Floating windows are already in <code>screen</code></b></summary> <br>

Neovim composites floats into a single grid, so popup and float content is already in the rendered text. The floats array from nvim_observe reports each float's row, col, width, and height — how you tell a completion popup from buffer text at the same coordinates.

</details>

Attach Mode

nvim --listen /tmp/nvim.sock
nvim_attach { "address": "/tmp/nvim.sock" }

The instance belongs to you, so nvim_close refuses it. Neovim sizes the screen to the smallest attached UI, so requesting a size can shrink your own view.

Development

npm install
npm test          # unit + integration, needs a real nvim binary
npm run typecheck
npm run lint
npm run build

See DESIGN.md for the architecture, the UI event pipeline, and the known gaps.

License

<a href="./LICENSE">MIT</a>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选