Vim MCP Server
@breggles
About Vim MCP Server
An MCP server for driving Vim. Connect your coding agent to show you changed files in Vim, or get it to advise you on the code in your open buffers. Can also set your quickfix/location list to direct you to multiple points in your code.
Basic information
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"vim": {
"type": "remote",
"url": "http://localhost:8765/mcp",
"enabled": true
}
}
}Tools
16List all open buffers
Read buffer contents (optionally a line range)
Replace, insert, or delete lines in a buffer
Open a file via `:edit`
Save a buffer via `:write` (opt-in, see above)
Close a buffer via `:bdelete`
Get current cursor position
Move cursor to a line and column
Get the current visual selection, if any
Run an arbitrary Ex command (opt-in, see above)
Get the current quickfix list entries
Set the quickfix list
Get the location list for the current window
Set the location list for the current window
Get Vim's message history (`:messages` output)
Open a side-by-side diff view in a new tab (files or content)
Overview
What is Vim MCP Server?
Vim MCP Server is an MCP (Model Context Protocol) server embedded in Vim that exposes tools over HTTP. It lets MCP-compatible clients—such as AI coding agents—read and modify buffers, move the cursor, retrieve visual selections, manage quickfix and location lists, open side-by-side diffs, read message history, and run Ex commands.
How to use Vim MCP Server?
Install the plugin using your preferred Vim plugin manager (e.g., vim‑plug, Vundle, or manual clone). Start the server in Vim with :McpServerStart (default port 8765). Optionally, set g:mcp_server_autostart = 1 in your vimrc to start it automatically. Point your MCP client at http://127.0.0.1:8765/mcp.
Key features of Vim MCP Server
- List, read, edit, open, save, and close buffers.
- Get and set cursor position.
- Retrieve the current visual selection.
- Run arbitrary Ex commands (opt‑in).
- Manage quickfix and location lists.
- Read Vim message history.
- Show a side‑by‑side diff view in a new tab.
Use cases of Vim MCP Server
- AI coding agents that inspect and modify Vim buffers programmatically.
- Automating buffer navigation and editing via MCP‑compatible tools.
- Integrating Vim’s quickfix and location lists into external workflows.
- Retrieving Vim’s message history for debugging or logging.
FAQ from Vim MCP Server
What are the Vim requirements?
Vim must be compiled with +python3.
How do I start and stop the server?
Use :McpServerStart [port] to start and :McpServerStop to stop. Check status with :McpServerStatus.
Which tools are opt‑in and how do I enable them?
execute_command, save_buffer, and edit_buffer are disabled by default. Enable them by setting g:mcp_server_allow_execute, g:mcp_server_allow_save, or g:mcp_server_allow_edit to 1 in your vimrc.
How do I configure an MCP client for this server?
Set the client to connect to http://127.0.0.1:8765/mcp. For example, in OpenCode’s opencode.jsonc add the server with "type": "remote" and the URL.
How can I read‑only tools in OpenCode plan mode?
In opencode.jsonc under agent.plan.tools, disable all vim_* tools and then re‑enable specific read‑only ones like vim_list_buffers, vim_get_buffer, etc.
More Other MCP servers
Unity MCP ✨
justinpbarnettUnity MCP acts as a bridge between AI assistants and your Unity Editor. Give your LLM tools to manage assets, control scenes, edit scripts, and automate tasks within Unity.
ICSS
chokcoco不止于 CSS
Reactive Resume
amruthpillaiA one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
Blender
ahujasidOpen-source MCP to use Blender with any LLM
MCP Go 🚀
mark3labsA Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.
Comments