Skip to main content
Glama

Neovim MCP サーバー

モデルコンテキストプロトコル(MCP)と公式JavaScriptライブラリneovim/node-clientを使用して、Claude Desktop(または任意のクライアント)とNeovimを統合する概念実証です。このサーバーは、Claudeが既に理解しているVimのネイティブテキスト編集コマンドとワークフローを活用して、軽量コードまたは汎用AIテキスト支援レイヤーを作成します。

特徴

  • nvim を起動するときに、たとえば--listen /tmp/nvimようにソケットファイルを公開すると、nvim インスタンスに接続します。

  • 現在のバッファを表示します

  • カーソルの位置、モード、ファイル名を取得します

  • vim コマンドとオプションでシェル コマンドを vim 経由で実行します

  • 挿入または置換を使用して編集できます

Related MCP server: loreto-mcp

API

リソース

  • nvim://session : 現在の Neovim テキストエディタセッション

  • nvim://buffers : 現在の Neovim セッションで開いているすべてのバッファのリスト。変更されたステータス、構文、ウィンドウ ID などのメタデータが含まれます。

ツール

  • vim_バッファ

    • 行番号が表示された現在の VIM テキストエディタバッファ

    • 入力filename (文字列)

    • ファイル名は無視され、現在アクティブなバッファの内容を含む番号付き行の文字列を返します。

  • vimコマンド

    • ナビゲーション、スポット編集、行削除のためにVIMにコマンドを送信します

    • 入力command (文字列)

    • nvim.replaceTermcodesに渡された vim コマンドを実行します。改行で区切れば複数のコマンドも実行できます。

    • エラーの場合は、 'nvim:errmsg'内容が返されます

  • vim_ステータス

    • VIMエディタのステータスを取得する

    • ステータスには、カーソル位置、モード、ファイル名、ビジュアル選択、ウィンドウレイアウト、現在のタブ、マーク、レジスタ、作業ディレクトリが含まれます。

  • vim_edit

    • VIM エディタで insert、replace、replaceAll を使用して行を編集します。

    • 入力startLine (数値)、 mode ( "insert" | "replace" | "replaceAll" )、 lines (文字列)

    • insert は startLine に行を挿入します

    • replaceはstartLineから始まる行を置き換えます

    • replaceAllはバッファの内容全体を置き換えます

  • vim_ウィンドウ

    • Neovim ウィンドウを操作する (分割、vsplit、閉じる、移動)

    • 入力command (文字列: "split"、"vsplit"、"only"、"close"、"wincmd h/j/k/l")

    • ウィンドウ管理操作を可能にする

  • vim_mark

    • 特定の位置にマークを設定する

    • 入力mark (文字列:az)、 line (番号)、 column (番号)

    • 指定された位置に名前付きマークを設定します

  • vim_register

    • レジスタの内容を設定する

    • 入力register (文字列:azまたは ")、 content (文字列)

    • レジスタの内容を管理する

  • vim_visual

    • 視覚的に選択する

    • startLine (数値)、 startColumn (数値)、 endLine (数値)、 endColumn (数値) を入力します。

    • ビジュアルモードの選択を作成します

このシンプルなツールセットを使用すると、Claude は neovim セッションを覗いて質問に答えたり、バッファーを編集したりすることができます。

制限事項

  • これはモデルコンテキストプロトコルを試すための簡単な概念実証です。自己責任でご利用ください。

  • カスタム neovim 構成とうまく連携しない可能性があります。

  • エラー処理は改善される可能性があります。

  • 時々、Claude は vim コマンドを正しく入力できないことがあります。

構成

環境変数

  • ALLOW_SHELL_COMMANDS : シェルコマンド(例!ls )の実行を有効にするには、「true」に設定します。セキュリティ上の理由から、デフォルトは false です。

  • NVIM_SOCKET_PATH : Neovimソケットのパスを設定します。指定されていない場合はデフォルトで「/tmp/nvim」になります。

Claude Desktopでの使用

これをclaude_desktop_config.jsonに追加します:

{
  "mcpServers": {
    "MCP Neovim Server": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-neovim-server"
      ],
      "env": {
        "ALLOW_SHELL_COMMANDS": "true",
        "NVIM_SOCKET_PATH": "/tmp/nvim"
      }
    }
  }
}

ライセンス

このMCPサーバーはMITライセンスに基づいてライセンスされています。つまり、MITライセンスの条件に従って、ソフトウェアを自由に使用、改変、配布することができます。詳細については、プロジェクトリポジトリのLICENSEファイルをご覧ください。

Available Tools

19 tools
vim_bufferC

Get buffer contents with line numbers

Inputs: filename.

vim_buffer_saveC

Save current buffer or save to specific filename

Inputs: filename.

vim_buffer_switchC

Switch between buffers by name or number

Inputs: identifier (required).

vim_commandC

Execute Vim commands with optional shell command support

Inputs: command (required).

vim_editC

Edit buffer content using insert, replace, or replaceAll modes

Inputs: lines (required), mode (required), startLine (required).

vim_file_openC

Open files into new buffers

Inputs: filename (required).

vim_foldC

Manage code folding: create, open, close, and toggle folds

Inputs: action (required), endLine, startLine.

vim_grepC

Project-wide search using vimgrep with quickfix list

Inputs: pattern (required), filePattern.

vim_healthB

Check Neovim connection health

Inputs: no named parameters.

vim_jumpC

Navigate Neovim jump list: go back, forward, or list jumps

Inputs: direction (required).

vim_macroC

Record, stop, and play Neovim macros

Inputs: action (required), count, register.

vim_markB

Set named marks at specific positions in the buffer

Inputs: column (required), line (required), mark (required).

vim_registerC

Manage Neovim register contents

Inputs: content (required), register (required).

vim_search_replaceC

Find and replace with global, case-insensitive, and confirm options

Inputs: pattern (required), replacement (required), confirm, global, +1 more.

vim_statusA

Get comprehensive Neovim status including cursor position, mode, marks, and registers

Inputs: no named parameters.

vim_tabC

Manage Neovim tabs: create, close, and navigate between tabs

Inputs: action (required), filename.

vim_visualC

Create visual mode selections in the buffer

Inputs: endColumn (required), endLine (required), startColumn (required), startLine (required).

vim_windowB

Manage Neovim windows: split, close, and navigate between windows

Inputs: command (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 19 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting specific Neovim operations like buffer management, editing, navigation, and system control. There is no overlap or ambiguity; for example, vim_search handles searching within a buffer while vim_grep handles project-wide searches, and vim_buffer_switch is distinct from vim_tab or vim_window for navigation.

    Naming Consistency5/5

    All tools follow a consistent 'vim_' prefix with descriptive snake_case names that clearly indicate their function, such as vim_buffer_save, vim_command, and vim_search_replace. This uniform pattern makes the tool set predictable and easy to understand, with no deviations in style or structure.

    Tool Count4/5

    With 19 tools, the count is slightly high but reasonable for covering the broad scope of Neovim operations, including editing, navigation, file management, and system health. It avoids being excessive by focusing on core functionalities without redundant tools, though it might feel heavy compared to simpler servers.

    Completeness5/5

    The tool set provides comprehensive coverage of Neovim's core features, including CRUD-like operations for buffers, files, and content, as well as navigation, search, macros, marks, and system status. There are no obvious gaps; it supports full lifecycle management from opening files to editing, saving, and navigating, ensuring agents can handle typical workflows without dead ends.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers