Skip to main content
Glama

NeoVimMCP

MCP server that receives Neovim buffer updates over HTTP and exposes editor context as MCP tools — to clients on this machine or on any other device on your network.

How it works

Neovim (Lua plugin) --HTTP POST--> NeoVimMCP server <--MCP over HTTP-- phone / laptop / any client

Neovim pushes buffer, cursor, selection and yank state to the server on autocmds; the server keeps the latest snapshot per instance in memory and serves it over the MCP Streamable HTTP transport. Nothing depends on a Unix socket, so an MCP client on another device only needs to reach this machine's IP and port.

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

Features

  • MCP over Streamable HTTP — reachable from other devices on the same network

  • HTTP ingest endpoint Neovim POSTs to

  • In-memory state store with focus tracking across multiple Neovim instances

  • Tools for cursor context, line ranges, selection, yank, full buffer and paths

  • Optional bearer-token auth

  • stdio transport still available for local-only setups

Start the server

npm install
npm run build
npm start

The startup banner prints the URLs to use:

[MCP] HTTP listening on 0.0.0.0:4389
[MCP]   MCP endpoint:   http://192.168.1.42:4389/mcp
[MCP]   Neovim ingest:  http://192.168.1.42:4389/nvim/state

Environment variables

Variable

Default

Purpose

NVIM_MCP_HOST

0.0.0.0

Bind address. Use 127.0.0.1 to keep it local-only.

NVIM_MCP_PORT

4389

Listen port.

NVIM_MCP_TOKEN

(unset)

When set, every request except /health needs Authorization: Bearer <token>.

NVIM_MCP_TRANSPORT

http

Set to stdio (or pass --stdio) to also serve MCP over stdio.

Security: the default bind exposes your buffer contents to everyone on the network. Set NVIM_MCP_TOKEN whenever the server is not bound to loopback — the server warns at startup if you have not. For access beyond your LAN, put it behind a tunnel or reverse proxy with TLS rather than forwarding the port.

Connect Neovim

Copy nvim/nvim-mcp.lua into your config's lua/ directory (or add this repo's nvim/ folder to your runtimepath), then:

require("nvim-mcp").setup({
  url = "http://127.0.0.1:4389",
  -- token = "your-token",          -- must match NVIM_MCP_TOKEN
  -- instance = "work-laptop",      -- defaults to hostname-pid
})

Requires curl on PATH. Commands: :NvimMcpSync pushes immediately, :NvimMcpStatus shows the configured URL and instance id.

Connect an MCP client

Any client that speaks the MCP Streamable HTTP transport, on any device that can reach the machine:

{
  "mcpServers": {
    "nvim": {
      "type": "http",
      "url": "http://192.168.1.42:4389/mcp",
      "headers": { "Authorization": "Bearer your-token" }
    }
  }
}

In Claude Code: claude mcp add --transport http nvim http://192.168.1.42:4389/mcp.

For a local-only stdio setup instead:

{
  "mcpServers": {
    "nvim": {
      "command": "node",
      "args": ["/absolute/path/to/nvimMCP/dist/server.js", "--stdio"]
    }
  }
}

Note that stdio mode still binds the HTTP ingest port so Neovim has somewhere to POST — only one instance can own that port at a time.

MCP tools exposed

  • list_editors — every registered Neovim instance and how stale it is

  • get_cursor_context

  • get_lines

  • get_selection

  • get_yank

  • get_full_file

  • get_path

Every tool except list_editors takes an optional instance argument; without it, the most recently focused Neovim is used. Responses include age_ms so a client can tell how fresh the snapshot is.

HTTP API

Method

Path

Purpose

POST

/mcp

MCP Streamable HTTP endpoint (also GET/DELETE for sessions)

POST

/nvim/state

Neovim pushes a state snapshot; absent fields keep their previous value

POST

/nvim/focus

Mark { "instance": "..." } as the active editor

POST

/nvim/detach

Remove an instance from the store

GET

/nvim/state

Dump the store (debugging)

GET

/health

Unauthenticated liveness check

Docker

docker build -t nvimmcp .
docker run -p 4389:4389 -e NVIM_MCP_TOKEN=your-token nvimmcp

Available Tools

6 tools
get_cursor_contextGet Cursor ContextA

Returns current file, filetype, cursor position, and nearby lines.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses what information is returned (file, filetype, cursor position, nearby lines) but does not specify details like the number of nearby lines or output format. Without annotations, this is adequate but incomplete.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is clear and to the point. Every word earns its place, and it is front-loaded with the key action and results.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

While the description explains the return values, it lacks details on how many nearby lines are returned or the structure of the output. Given the absence of an output schema, more specificity would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema is empty, so the description carries the full burden. It adds meaning by explaining the tool's output, which is beyond the schema's scope. Baseline for zero parameters is 4.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states what the tool returns: current file, filetype, cursor position, and nearby lines. This is specific and distinguishes it from sibling tools like get_lines or get_selection.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as get_lines or get_full_file. The agent must infer usage from the description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_full_fileGet Full FileA

Returns full current buffer content.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.7/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description bears the full burden. It accurately describes a non-destructive read operation with no side effects, providing complete transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with no extraneous words. Perfectly concise and front-loaded with the essential verb and resource.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters, no output schema, and a simple purpose, the description is fully complete. It leaves no ambiguity about what the tool does.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so schema coverage is 100%. Description adds no parameter info, but none is needed. Baseline 4 applies for zero-parameter tools.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states action (Returns) and resource (full current buffer content), distinguishing it from sibling tools that return specific parts (cursor context, lines, selection, yank, path).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when/not-to-use guidance, but the purpose is self-evident for a simple retrieval tool with no parameters. The context of sibling tools implies this is for the entire buffer.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_linesGet Line RangeA

Returns lines from start to end (0-indexed, end-exclusive).

ParametersJSON Schema
NameRequiredDescriptionDefault
endYes
startYes

TDQS

A3.5/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided. Description is minimal, stating only the read-like behavior. It does not disclose error handling, performance, or what happens for invalid indices.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, direct sentence that conveys the core functionality. Zero wasted words, front-loaded with purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Simple tool with no output schema. The description explains what it does but omits return format and error conditions. Given the sibling tools, some usage guidance would improve completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema has 0% description coverage, but the description adds crucial details: parameters are 0-indexed and end-exclusive. This adds significant meaning beyond the schema's type constraints.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it returns lines from start to end with 0-indexed, end-exclusive semantics. It distinguishes from siblings (get_full_file, get_path, etc.) by focusing on a specific range.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like get_full_file. The description does not mention context or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_pathGet file path absolute and relativeB

Returns the absolute and relative path of the current file.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.2/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does not disclose whether the tool requires a saved file, what happens if no file is open (error or default?), or whether the file must be on disk. The return format (e.g., string, object) is not mentioned.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that directly states the tool's purpose. Every word is necessary and there is no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters and no output schema, the description is minimal. It does not specify the format of the path strings, whether they are absolute/relative as separate values, or what the path is relative to (e.g., workspace root?). For a simple tool it is adequate but lacks some completeness.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so schema coverage is trivially 100%. The description adds value by clarifying the context ('current file'), which is more informative than the empty schema alone. Baseline for 0 params is 4, and this is met.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool returns absolute and relative path of the current file, which clearly indicates the action and resource. It differentiates from siblings like get_cursor_context or get_lines, but could be more specific about which file (e.g., currently open file).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool vs alternatives like get_cursor_context or get_full_file. There is no mention of prerequisites or context needed (e.g., must have a file open). The description does not help the agent decide between similar path-related tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_selectionGet Visual SelectionA

Returns last visual selection based on '< and '> marks.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It states the tool is read-only (returns a selection based on marks), which is the key behavioral trait. It does not mention what happens when no selection exists, but for a simple read, this is acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no wasted words. It is front-loaded with the core action ('Returns last visual selection') and immediately provides the basis ('based on '< and '> marks').

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema), the description is fairly complete. It explains what is returned and the basis. It could optionally note that the selection is text or positions, but the name and context make it clear enough.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has no parameters, and schema coverage is 100%. The description does not need to add parameter info, and it adds value by explaining what the returned selection corresponds to (based on marks). Baseline 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool returns the last visual selection based on '< and '> marks. It uses a specific verb ('Returns') and resource ('last visual selection'), and distinguishes from sibling tools like get_cursor_context or get_lines, which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage: use this tool when you need the last visual selection. It does not explicitly state when to use it versus alternatives, but given the sibling tools' names, the context is clear enough. No exclusions or when-not-to-use are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_yankGet Yank RegisterA

Returns unnamed register text and register type.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.9/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description indicates a read operation (returns), which is transparent enough for a simple getter. However, with no annotations provided, it could benefit from stating whether the register might be empty or any side effects, but it's adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, minimal yet complete. Every word is necessary; no fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given zero parameters, no output schema, and a simple read operation, the description is fully adequate. No gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, and the description adds no extra info beyond the empty schema. Baseline 4 for no params is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it returns unnamed register text and register type, using a specific verb and resource. It distinguishes from siblings like get_cursor_context or get_lines which serve different purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool or when not to, nor any mention of alternatives. The description only states what it does without context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 6 tool updatesv1.0.1
    • First observedget_cursor_context
    • First observedget_full_file
    • First observedget_lines
    • First observedget_path
    • First observedget_selection
    • First observedget_yank

TDQS

A3.7/5.0

Scored across 6 tools

Disambiguation5/5

Each tool retrieves a distinct piece of information: cursor context, line range, selection, yank register, full file, and file path. There is no overlap in purpose.

Naming Consistency5/5

All tools follow a consistent 'get_' prefix followed by a clear noun describing the fetched data (e.g., get_cursor_context, get_lines). No mixing of styles.

Tool Count4/5

With 6 tools covering essential read operations, the count is reasonable for a focused inspection server, though slightly on the lower side.

Completeness2/5

The server provides only read operations, lacking any mutation tools like edit, execute commands, or buffer management. This leaves significant gaps for a NeoVim integration.

Maintenance

ActivityMaintained
ResponsivenessUnresponsive

Related MCP Connectors

Related MCP Servers