
bigcodegen/mcp-neovim-server
Developer toolsこのページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る
モデルコンテキストプロトコル(MCP)と公式のneovim/node-client JavaScriptライブラリを用いてNeovimを制御する
概要
Claude Desktop(または任意のModel Context Protocolクライアント)をMCPと公式のneovim/node-client JavaScriptライブラリを使ってNeovimに接続します。このサーバーは、Claudeがすでに理解しているVimのネイティブテキスト編集コマンドとワークフローを活用し、軽量コードまたは汎用AIテキストアシスタンスレイヤーを作成します。 - ソケットファイルを公開した場合にnvimインスタンスに接続する(例えばnvim起動時に/tmp/nvimを聞く) - 現在のバッファを表示しバッファの切り替えを管理する - カーソルの位置、モード、ファイル名、マーク、レジスタ、視覚選択を取得 - vimを使ったvimコマンドおよびオプションでシェルコマンドを実行 - 挿入、置換、置換などの編集が可能 - 正則表現対応による検索・置換機能 - クイックフィックス統合付きプロジェクト全体のgrep検索 - 包括的なウィンドウ管理 - 健康監視および接続診断 - nvim://session: 現在のneovimテキストエディタセッション- nvim://buffers: 現在のNeovim...
概要(AI 翻訳)
Claude Desktop(または任意のModel Context Protocolクライアント)をMCPと公式のneovim/node-client JavaScriptライブラリを使ってNeovimに接続します。このサーバーは、Claudeがすでに理解しているVimのネイティブテキスト編集コマンドとワークフローを活用し、軽量コードまたは汎用AIテキストアシスタンスレイヤーを作成します。
特徴
- nvimを起動する際に、例えば
--listen /tmp/nvim]のようなソケットファイルを公開するとnvimインスタンスに接続されます - 現在のバッファを表示し、バッファの切り替えを管理する
- カーソルの位置、モード、ファイル名、マーク、レジスタ、視覚的な選択を取得
- vimコマンドを実行し、必要に応じてvimを通じてシェルコマンドを実行する
- 挿入、置換、置換すべてのモードを使って編集が可能
- 正則表現対応による検索および置換機能
- クイックフィックス統合を用いたプロジェクト全体のgrep検索
- 包括的なウィンドウ管理
- 健康監視および接続診断
API
リソース
nvim://session:現在のneovimテキストエディタセッションnvim://buffers:現在のNeovimセッション内のすべてのオープンバッファのリストで、修正された状態、構文、ウィンドウIDを含むメタデータを含みます
道具
コアツール
- vim_buffer
このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。
README
以下は原文 README の抜粋です。原文を見る。
Neovim MCP Server
Connect Claude Desktop (or any Model Context Protocol client) to Neovim using MCP and the official neovim/node-client JavaScript library. This server leverages Vim’s native text editing commands and workflows, which Claude already understands, to create a lightweight code or general purpose AI text assistance layer.
Features
- Connects to your nvim instance if you expose a socket file, for example
--listen /tmp/nvim, when starting nvim - Views your current buffers and manages buffer switching
- Gets cursor location, mode, file name, marks, registers, and visual selections
- Runs vim commands and optionally shell commands through vim
- Can make edits using insert, replace, or replaceAll modes
- Search and replace functionality with regex support
- Project-wide grep search with quickfix integration
- Comprehensive window management
- Health monitoring and connection diagnostics
API
Resources
nvim://session: Current neovim text editor sessionnvim://buffers: List of all open buffers in the current Neovim session with metadata including modified status, syntax, and window IDs
Tools
Core Tools
- vim_buffer
- Get buffer contents with line numbers (supports filename parameter)
- Input
filename(string, optional) - Get specific buffer by filename - Returns numbered lines with buffer content
- vim_command
- Send a command to VIM for navigation, spot editing, and line deletion
- Input
command(string) - Runs vim commands with
nvim.replaceTermcodes. Multiple commands work with newlines - Shell commands supported with
!prefix whenALLOW_SHELL_COMMANDS=true - On error,
'nvim:errmsg'contents are returned
- vim_status
- Get comprehensive Neovim status
- Returns cursor position, mode, filename, visual selection with enhanced detection, window layout, current tab, marks, registers, working directory, LSP client info, and plugin detection
- Enhanced visual selection reporting: detects visual mode type (character/line/block), provides accurate selection text, start/end positions, and last visual selection marks
- vim_edit
- Edit lines using insert, replace, or replaceAll modes
- Input
startLine(number),mode("insert"|"replace"|"replaceAll"),lines(string) - insert: insert lines at startLine
- replace: replace lines starting at startLine
- replaceAll: replace entire buffer contents
- vim_window
- Manipulate Neovim windows (split, vsplit, close, navigate)
- Input
command(string: “split”, “vsplit”, “only”, “close”, “wincmd h/j/k/l”)
- vim_mark
- Set named marks at specific positions
- Input
mark(string: a-z),line(number),column(number)
- vim_register
- Set content of registers
インストール
npx -y mcp-neovim-server設定
{
"mcpServers": {
"MCP Neovim Server": {
"command": "npx",
"args": [
"-y",
"mcp-neovim-server"
],
"env": {
"ALLOW_SHELL_COMMANDS": "true",
"NVIM_SOCKET_PATH": "/tmp/nvim"
}
}
}
}