
laktek/nvim-mcp-server
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
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 contentnvim://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 directoryget_current_buffer()- Get the currently active bufferget_buffer_content(path)- Get content of a specific buffer by pathupdate_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 diskreload_all_buffers()- Check and reload all buffers that changed on disk
Setup with Claude Code
Option 1: Using the CLI (Recommended)
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:
- Detect Neovim instances running in the current directory
- Expose buffer context to Claude via resources
- 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
- Discovery: Uses
$TMPDIRto find nvim socket files
설치
npx nvim-mcp-server설정
{
"mcpServers": {
"nvim": {
"command": "npx",
"args": ["nvim-mcp-server"]
}
}
}