LN

laktek/nvim-mcp-server

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

19 stars 8 forks 품질 55 트렌드 22

MCP server for exposing Neovim buffers to AI agents like Claude Code

개요

MCP (Model Context Protocol) server that integrates Neovim buffers with Claude Code, enabling seamless buffer awareness and real-time updates. - - Currently active buffer with path and content - - List of all open buffers with metadata - - List all open buffers in nvim instances running in current directory - - Get the currently active buffer - - Get content of a specific buffer by path - - Update buffer content directly in nvim (changes appear immediately!) - - Open a file in nvim (useful after creating new files) - - Reload a buffer from disk - - Check and reload all buffers that changed on disk Run the following command in your terminal: This will automatically add the server to your ~/.claude.json configuration. Alternatively, manually edit ~/.claude.json: After adding the configuration, restart Claude Code for changes to take effect. Check that the server is configured correctly:

README

원문 README의 일부입니다. 원문 보기.

Neovim MCP Server

MCP (Model Context Protocol) server that integrates Neovim buffers with Claude Code, enabling seamless buffer awareness and real-time updates.

Features

Resources (Auto-available Context)

  • nvim://current-buffer - Currently active buffer with path and content
  • nvim://open-buffers - List of all open buffers with metadata

Tools (Claude Can Invoke)

  • list_nvim_buffers() - List all open buffers in nvim instances running in current directory
  • get_current_buffer() - Get the currently active buffer
  • get_buffer_content(path) - Get content of a specific buffer by path
  • update_buffer(path, content) - Update buffer content directly in nvim (changes appear immediately!)
  • open_file(path) - Open a file in nvim (useful after creating new files)
  • reload_buffer(path) - Reload a buffer from disk
  • reload_all_buffers() - Check and reload all buffers that changed on disk

Setup with Claude Code

Run the following command in your terminal:

claude mcp add --transport stdio nvim -- npx nvim-mcp-server

This will automatically add the server to your ~/.claude.json configuration.

Option 2: Manual Configuration

Alternatively, manually edit ~/.claude.json:

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

After adding the configuration, restart Claude Code for changes to take effect.

Verify Setup

Check that the server is configured correctly:

claude mcp list

Or use /mcp within Claude Code to check server status.

Usage

Once configured, the MCP server will automatically:

  1. Detect Neovim instances running in the current directory
  2. Expose buffer context to Claude via resources
  3. Enable buffer operations via tools

Example Workflows

1. Refactor Current File

You: "Refactor the current file to use async/await"

Claude:
- Reads nvim://current-buffer resource automatically
- Sees you're working on src/api.js
- Refactors the code
- Calls update_buffer() to push changes to nvim
- Changes appear instantly in your editor!

2. Check Open Buffers

You: "What files do I have open in nvim?"

Claude:
- Calls list_nvim_buffers() tool
- Shows you all open buffers

3. Update Specific Buffer

You: "Add error handling to src/utils.js"

Claude:
- Calls get_buffer_content("src/utils.js")
- Adds error handling
- Calls update_buffer() to apply changes
- You see updates in nvim immediately

4. Create and Open New File

You: "Create a new component called Button.jsx"

Claude:
- Creates the file using Write tool
- Calls open_file("src/components/Button.jsx")
- File opens in your nvim automatically
- You can continue editing right away!

How It Works

  1. Discovery: Uses $TMPDIR to find nvim socket files
GitHub에서 전체 README 보기

설치

npx nvim-mcp-server
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

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