Copy Neovim selections as cheap LLM/agent references, and optionally expose live editor context through a local MCP bridge.
# Clipboard path (any agent UI)
Visual select -> :CopySendSelection / keymap -> @path#L8-10 on +
# Optional agent MCP path
MCP tool call -> stdio proxy -> local WebSocket JSON-RPC -> Neovim editor state
Neovim owns the local WebSocket server and binds it to 127.0.0.1. Agents launch scripts/copy-nvim-proxy.js, which reads the bridge state file written by Neovim and maps MCP tool calls to WebSocket JSON-RPC requests.
{
"rafaeelricco/copy.nvim",
config = true,
}require("copy").setup({
port_range = { min = 10000, max = 65535 },
auto_start = true,
log_level = "info",
send = {
keymap = "<leader>as",
register = "+",
},
})| Command | Description |
|---|---|
:CopyBridgeStart |
Start the local WebSocket bridge |
:CopyBridgeStop |
Stop the local WebSocket bridge |
:CopyBridgeStatus |
Show bridge status |
:'<,'>CopySendSelection |
Copy @relpath#L… for the selected saved file range |
Visual <leader>as copies a reference like @docs/guides/onboarding-manager.md#L8-10. Paste it into any LLM or agent composer. v1 does not submit directly to an agent thread.
get_current_selectionget_current_bufferget_open_buffersget_diagnosticsget_workspace_folders
Wire agents via .mcp.json → node ./scripts/copy-nvim-proxy.js. Bridge state lives at stdpath("state")/copy.nvim/bridge.json (override with COPY_NVIM_BRIDGE_STATE). Skill: skills/copy-nvim/SKILL.md.
nvim --headless -u tests/minimal_init.lua -c "PlenaryBustedDirectory tests/" -c "qa!"
node --test tests/proxy/*.test.mjs