This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Rust-based MCP (Model Context Protocol) server that provides seamless integration with Neovim instances. The server acts as a bridge between AI assistants and Neovim editors, enabling operations like LSP integration, diagnostic analysis, and file manipulation through structured MCP tools and resources.
More details in @./docs/development.md .
# Development build and run
cargo build
cargo run -- --connect auto
# Connect to specific targets
cargo run -- --connect 127.0.0.1:6666
cargo run -- --connect /tmp/nvim.sock
# HTTP server mode with auto-connection
cargo run -- --http-port 8080 --connect auto
# Production build
cargo build --release# Run all tests with output
./scripts/run-test.sh -- --show-output
# Run specific test modules
./scripts/run-test.sh -- --show-output neovim::integration_tests
# Skip integration tests (which require Neovim)
./scripts/run-test.sh -- --skip=integration_tests --show-output
# Run tests with coverage
./scripts/run-cov.sh -- --show-outputpre-commit run --all-files- MCP Server Core (
src/server/core.rs): Main server implementation with connection management using DashMap for thread-safe concurrent access - Neovim Client (
src/neovim/client.rs): Handles communication with Neovim instances via nvim-rs msgpack-rpc - Tool System (
src/server/tools.rs): 26+ MCP tools for LSP operations, file navigation, and diagnostics - Resource System (
src/server/resources.rs): Connection-scoped diagnostic resources with URI schemes - Transport Layer: Supports both stdio and HTTP server transports via rmcp
- Integration Tests: Full MCP client-server communication tests in
src/server/integration_tests.rsandsrc/neovim/integration_tests.rs - LSP Testing: Comprehensive Go/gopls integration with test data in
src/testdata/ - Global Test Mutex: Prevents port conflicts during concurrent execution
- Automated Setup: Tests spawn and manage Neovim instances automatically
- Code Coverage: LLVM-based coverage using grcov with HTML/Cobertura/Markdown reports
Read @./Cargo.toml
Uses Nix flakes for reproducible development environments. Read @./flake.nix
Enter development shell: nix develop . (if not already in Nix shell)
When adding connection-aware MCP tools:
- Add parameter struct in
src/server/tools.rswithconnection_id: String - Implement tool method with
#[tool(description = "...")]attribute - Use
self.get_connection(&connection_id)?for connection validation - Return
Result<CallToolResult, McpError> - Update integration tests
- Tool is automatically registered via
#[tool_router]macro
- Layered Errors:
ServerError(top-level) andNeovimError(Neovim-specific) - MCP Compliance: Errors properly formatted for MCP protocol responses
- Comprehensive Propagation: I/O and nvim-rs errors properly converted and handled