Logo di Neovim MCP 服务器

Neovim MCP 服务器

Organizzazione
maquina-app

A Ruby implementation of the MCP server protocol for Neovim

Autoremaquina-app
Repositorynvim-mcp-server
LinguaRuby
Fork
1
Stelle
17
Strumenti disponibili
0
Tipo di trasportostdio
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    Neovim MCP 服务器 mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • 0 strumenti disponibili

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni quando forniti dal server.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse open source

    17 stelle e 1 fork nel repository collegato.

Neovim MCP Server

A Ruby implementation of a Model Context Protocol (MCP) server for Neovim. This server allows LLMs (Large Language Models) to interact with Neovim through the Model Context Protocol, providing capabilities to query buffers and perform operations within the editor.

What is MCP?

The Model Context Protocol (MCP) is a standardized way for AI models to interact with their environment. It defines a structured method for models to request and use tools, access resources, and maintain context during interactions.

This Neovim MCP Server implements the MCP specification to give AI models access to Neovim for buffer analysis, file exploration, and editing assistance.

Features

  • Connect to running Neovim instances
  • Query buffers across multiple Neovim sessions
  • Update and save buffers with new content
  • Follow the Model Context Protocol standard
  • Seamless integration with LLM clients

Installation

Install the gem:

bash
gem install nvim-mcp-server

After installation, the nvim-mcp-server executable will be available in your PATH.

Configuration

The Neovim MCP Server follows the XDG Base Directory Specification for configuration files:

  • On macOS: $XDG_CONFIG_HOME/nvim-mcp or ~/.config/nvim-mcp if XDG_CONFIG_HOME is not set
  • On Windows: %APPDATA%\nvim-mcp

The server will automatically create these directories and a log file the first time it runs.

Usage

Starting the server

The Neovim MCP Server can run in two modes:

  1. STDIO mode (default): Communicates over standard input/output for direct integration with clients like Claude Desktop.
  2. HTTP mode: Runs as an HTTP server with JSON-RPC and Server-Sent Events (SSE) endpoints.
bash
# Start in default STDIO mode
nvim-mcp-server

# Start in HTTP mode on the default port (6030)
nvim-mcp-server --mode http

# Start in HTTP mode on a custom port
nvim-mcp-server --mode http -p 8080

# Start in HTTP mode binding to all interfaces (for local network access)
nvim-mcp-server --mode http --bind-all

When running in HTTP mode, the server provides two endpoints:

  • JSON-RPC endpoint: http://localhost:<port>/mcp/messages
  • SSE endpoint: http://localhost:<port>/mcp/sse

Network Access (HTTP Mode)

By default, the HTTP server only binds to localhost for security. If you need to access the server from other machines on your local network (e.g., for testing with multiple devices), you can use the --bind-all flag:

bash
# Allow access from any machine on your local network
nvim-mcp-server --mode http --bind-all

# With a custom port
nvim-mcp-server --mode http --bind-all -p 8080

When using --bind-all:

  • The server binds to 0.0.0.0 instead of localhost
  • Access is allowed from local network IP ranges (192.168.x.x, 10.x.x.x, 172.16.x.x)
  • The server accepts connections from .local domain names (e.g., my-computer.local)
  • Security features remain active to prevent unauthorized access

Security Note: Only use --bind-all on trusted networks. The server includes built-in security features to validate origins and IP addresses, but exposing any service to your network increases the attack surface.

Logging Options

The server logs to a file in your config directory by default. You can customize logging with these options:

bash
# Set the log level (debug, info, error)
nvim-mcp-server --log-level debug

Claude Desktop Integration

The Neovim MCP Server can be used with Claude Desktop by manually configuring the integration.

Direct Configuration

  1. Create the appropriate config directory for your platform:

    • macOS: $XDG_CONFIG_HOME/nvim-mcp or ~/.config/nvim-mcp if XDG_CONFIG_HOME is not set
    • Windows: %APPDATA%\nvim-mcp
  2. Find or create the Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  3. Add or update the MCP server configuration:

json
{
  "mcpServers": {
    "nvimMcpServer": {
      "command": "ruby",
      "args": ["/full/path/to/nvim-mcp-server/exe/nvim-mcp-server"] 
    }
  }
}
  1. Restart Claude Desktop to apply the changes.

Ruby Version Manager Users

Claude Desktop launches the MCP server using your system's default Ruby environment, bypassing version manager initialization (e.g., rbenv, RVM). The MCP server needs to use the same Ruby version where it was installed, as MCP server startup failures can occur when using an incompatible Ruby version.

If you are using a Ruby version manager such as rbenv, you can create a symbolic link to your Ruby shim to ensure the correct version is used:

bash
sudo ln -s /home/your_user/.rbenv/shims/ruby /usr/local/bin/ruby

Replace "/home/your_user/.rbenv/shims/ruby" with your actual path for the Ruby shim.

Using an MCP Proxy (Advanced)

Claude Desktop and many other LLM clients only support STDIO mode communication, but you might want to use the HTTP/SSE capabilities of the server. An MCP proxy can bridge this gap:

  1. Start the Neovim MCP Server in HTTP mode:
bash
nvim-mcp-server --mode http
  1. Install and run an MCP proxy. There are several implementations available in different languages. An MCP proxy allows a client that only supports STDIO communication to communicate via HTTP SSE. Here's an example using a JavaScript-based MCP proxy:
bash
# Install the Node.js based MCP proxy
npm install -g mcp-remote

# Run the proxy, pointing to your running Neovim MCP Server
npx mcp-remote http://localhost:6030/mcp/sse
  1. Configure Claude Desktop (or other LLM client) to use the proxy instead of connecting directly to the server:
json
{
  "mcpServers": {
    "nvimMcpServer": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:6030/mcp/sse"]
    }
  }
}

This setup allows STDIO-only clients to communicate with the Neovim MCP Server through the proxy, benefiting from the HTTP/SSE capabilities while maintaining client compatibility.

Neovim Configuration

For the MCP server to work properly, your Neovim instances need to be started with a named socket:

bash
nvim --listen /tmp/nvim-project_name.sock

You can automate this by adding the following to your Neovim configuration:

lua
-- In your init.lua
local project_name = vim.fn.fnamemodify(vim.fn.getcwd(), ':t')
vim.fn.serverstart('/tmp/nvim-' .. project_name .. '.sock')

How the Server Works

The Neovim MCP Server implements the Model Context Protocol using either:

  • STDIO mode: Reads JSON-RPC 2.0 requests from standard input and returns responses to standard output.
  • HTTP mode: Provides HTTP endpoints for JSON-RPC 2.0 requests and Server-Sent Events.

The server communicates with Neovim instances through Unix sockets located at /tmp/nvim-{project_name}.sock. This allows the server to interact with multiple Neovim instances running different projects.

Available Tools

The server provides the following tools for interacting with Neovim:

1. get_project_buffers

Description: Retrieves a list of files currently open in Neovim that belong to a specific project. This tool connects to a running Neovim instance using its socket file at /tmp/nvim-{project_name}.sock and queries for all open buffers. It then filters the buffers to include only files that have the project name as part of their path. This is useful for determining what files a user is currently editing in a particular project, identifying areas of active development, or tracking work context across multiple files. The tool handles connection failures gracefully and returns complete absolute file paths.

Parameters:

  • project_name: (String, required) The name of the project directory to filter buffers by. This should match a directory name in the file paths of the buffers you want to retrieve. For example, if your project is at '/home/user/projects/my-app', you would use 'my-app' as the project_name. The tool will also use this name to locate the Neovim socket at /tmp/nvim-{project_name}.sock.

Examples

Can you show me which files I have open in my "my-project" Neovim instance?
I'd like to know what files I'm currently working on in the "blog" project.
List all the buffers for the "nvim-mcp-server" project.

2. update_buffer

Description: Updates a buffer with new content provided by the MCP client, saves it to disk, and reloads it. This tool connects to a running Neovim instance, replaces the entire buffer content with the provided content, writes it to disk, and then reloads the buffer. This is useful for applying external changes (like from an AI assistant) to files open in Neovim.

Parameters:

  • project_name: (String, required) The name of the project directory. This is used to locate the Neovim socket at /tmp/nvim-{project_name}.sock.
  • file_path: (String, required) The absolute or relative file path of the buffer to update. This should match the path as shown in Neovim's buffer list.
  • content: (String, required) The new content to write to the buffer. This will replace the entire current content of the buffer.

Examples

Please update the file "src/main.rb" in my "my-project" Neovim instance with the refactored code.
Replace the content of "/home/user/projects/blog/app/controllers/posts_controller.rb" in the "blog" project with the updated controller code.
Update the README.md file in the "nvim-mcp-server" project with the new documentation.

Testing and Debugging

The easiest way to test and debug the Neovim MCP Server is by using the MCP Inspector, a developer tool designed specifically for testing and debugging MCP servers.

To use MCP Inspector with Neovim MCP Server:

bash
# Install and run MCP Inspector with your Neovim MCP Server
npm -g install @modelcontextprotocol/inspector

npx @modelcontextprotocol/inspector /path/to/nvim-mcp-server

This will:

  1. Start your Neovim MCP Server in HTTP mode
  2. Launch the MCP Inspector UI in your browser (default port: 6274)

In the MCP Inspector UI, you can:

  • See all available tools
  • Execute tool calls interactively
  • View request and response details
  • Debug issues in real-time

License

This Neovim MCP server is released under the MIT License, a permissive open-source license that allows for free use, modification, distribution, and private use.

Copyright (c) 2025 Mario Alberto Chávez Cárdenas

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/maquina-app/nvim-mcp-server.

Installazione

TypingMind
Prerequisiti:

Node.js 18+

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

Usa MCP Neovim MCP 服务器 con più modelli IA

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso Neovim MCP 服务器, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Questa integrazione MCP viene eseguita localmente sul tuo dispositivo tramite il connettore MCP di TypingMind.

Guida alla configurazione del connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura MCP.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura MCP e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con Questo dispositivo selezionato
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi Neovim MCP 服务器 come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di Neovim MCP 服务器.
  4. Salva l'elenco dei server.
  5. Aggiorna per verificare che il connettore sia ancora pronto.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "maquina-app-nvim-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "nvim-mcp-server"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di Neovim MCP 服务器, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di Neovim MCP 服务器.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare Neovim MCP 服务器 per aiutarmi con questa attività?
Neovim MCP 服务器
Certo. Ho letto.
Ecco cosa ho trovato con Neovim MCP 服务器.

Domande frequenti

A cosa serve il server MCP Neovim MCP 服务器?

Neovim MCP 服务器 è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare Neovim MCP 服务器 MCP con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare Neovim MCP 服务器 con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP Neovim MCP 服务器 con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando Neovim MCP 服务器, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego Neovim MCP 服务器 MCP a TypingMind?

Neovim MCP 服务器 funziona tramite il connettore MCP locale di TypingMind. È la soluzione ideale quando il server MCP deve accedere a file locali, app desktop, strumenti da riga di comando o risorse private sul tuo computer.

Quali strumenti offre Neovim MCP 服务器 MCP in TypingMind?

Neovim MCP 服务器 mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare Neovim MCP 服务器 MCP?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se Neovim MCP 服务器 richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇