nzrsky/lsp-mcp-server
If you are the rightful owner of lsp-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
LSP-MCP Server is a high-performance bridge server written in Zig that connects Language Server Protocol (LSP) servers to Model Context Protocol (MCP) clients, enabling AI coding assistants to interact with any LSP-compatible language server.
LSP-MCP Server
A high-performance bridge server written in Zig that connects Language Server Protocol (LSP) servers to Model Context Protocol (MCP) clients. This enables AI coding assistants like Claude Code, Claude Desktop, Gemini CLI, and GitHub Copilot to interact with any LSP-compatible language server.
๐ฆ Installation
Package Managers
Homebrew (macOS & Linux)
brew install nzrsky/tap/lsp-mcp-server
Nix/NixOS
# Nix profile
nix profile install github:nzrsky/lsp-mcp-server
# NixOS configuration.nix
services.lsp-mcp-server.enable = true;
Debian/Ubuntu
# Add repository
curl -fsSL https://github.com/nzrsky/lsp-mcp-server/releases/latest/download/pubkey.gpg | sudo apt-key add -
echo "deb https://github.com/nzrsky/lsp-mcp-server/releases/latest/download/ stable main" | sudo tee /etc/apt/sources.list.d/lsp-mcp-server.list
# Install
sudo apt update && sudo apt install lsp-mcp-server
RHEL/Fedora/CentOS
# Fedora
sudo dnf install lsp-mcp-server
# RHEL/CentOS (with EPEL)
sudo dnf install epel-release
sudo dnf install lsp-mcp-server
Arch Linux (AUR)
# Using yay
yay -S lsp-mcp-server
# Using paru
paru -S lsp-mcp-server
openSUSE
sudo zypper install lsp-mcp-server
Alpine Linux
sudo apk add lsp-mcp-server
FreeBSD
pkg install lsp-mcp-server
NetBSD
pkg_add lsp-mcp-server
Gentoo
emerge lsp-mcp-server
Void Linux
xbps-install lsp-mcp-server
Universal Package Managers
Snap (Linux)
sudo snap install lsp-mcp-server
Flatpak (Linux)
flatpak install flathub org.lsp_mcp_server.LspMcpServer
AppImage (Linux)
# Download and run
wget https://github.com/nzrsky/lsp-mcp-server/releases/latest/download/lsp-mcp-server-x86_64.AppImage
chmod +x lsp-mcp-server-x86_64.AppImage
./lsp-mcp-server-x86_64.AppImage
Smithery (Cross-platform)
smithery install lsp-mcp-server
Container Images
Docker
# Official image
docker pull ghcr.io/nzrsky/lsp-mcp-server:latest
# Docker Hub
docker pull nzrsky/lsp-mcp-server:latest
Podman
podman pull ghcr.io/nzrsky/lsp-mcp-server:latest
Language-Specific Package Managers
Cargo (Rust ecosystem)
cargo install lsp-mcp-server
npm (Node.js ecosystem)
npm install -g lsp-mcp-server
Go
go install github.com/nzrsky/lsp-mcp-server@latest
Manual Installation
Pre-built Binaries
Download from GitHub Releases:
- Linux:
lsp-mcp-server-linux-x86_64.tar.gz
- macOS:
lsp-mcp-server-macos-x86_64.tar.gz
/lsp-mcp-server-macos-arm64.tar.gz
- Windows:
lsp-mcp-server-windows-x86_64.zip
- FreeBSD:
lsp-mcp-server-freebsd-x86_64.tar.gz
Build from Source
git clone https://github.com/nzrsky/lsp-mcp-server.git
cd lsp-mcp-server
make build
sudo make install
Cloud & CI/CD
GitHub Actions
- name: Setup LSP-MCP Server
uses: nzrsky/setup-lsp-mcp-server@v1
with:
version: 'latest'
GitLab CI
image: ghcr.io/nzrsky/lsp-mcp-server:latest
Kubernetes
kubectl apply -f https://github.com/nzrsky/lsp-mcp-server/releases/latest/download/kubernetes.yaml
โจ Features
- ๐ Generic LSP Client: Works with any LSP-compatible language server
- ๐ค MCP Server: Full Model Context Protocol implementation for AI assistants
- ๐ Multi-Language Support: Zig, Rust, Go, TypeScript, Python, and more
- โ๏ธ Configurable: Flexible server selection and settings
- ๐ก๏ธ Robust: Built-in timeout handling and graceful fallbacks
- ๐งช Tested: Comprehensive BDD test suite with real protocol testing
- ๐ณ Containerized: Docker support for easy deployment
- ๐ฆ Multi-Platform: Supports all major package managers and platforms
๐ Quick Start
# Run with Docker (fastest)
docker run --rm -v "$(pwd):/workspace" ghcr.io/nzrsky/lsp-mcp-server:latest --server zls
# Install with package manager
brew install nzrsky/tap/lsp-mcp-server # macOS/Linux
nix profile install github:nzrsky/lsp-mcp-server # Nix
sudo apt install lsp-mcp-server # Ubuntu/Debian
sudo dnf install lsp-mcp-server # Fedora/RHEL
# Use immediately
lsp-mcp-server --server zls
๐ง Usage
Basic Usage
# Use with ZLS (Zig Language Server)
lsp-mcp-server --server zls
# Use with Rust Analyzer
lsp-mcp-server --server rust-analyzer
# Use with Go Language Server
lsp-mcp-server --server gopls
# Use custom configuration
lsp-mcp-server --config /path/to/config.json
AI Assistant Integration
Claude Code
Add to your Claude Code configuration:
{
"mcpServers": {
"lsp-bridge": {
"command": "lsp-mcp-server",
"args": ["--server", "zls"]
}
}
}
Claude Desktop
Add to claude_desktop_config.json
:
{
"mcpServers": {
"lsp-bridge": {
"command": "/usr/local/bin/lsp-mcp-server",
"args": ["--server", "rust-analyzer"]
}
}
}
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
โ AI Assistant โ โ lsp-mcp-server โ โ Language Server โ
โ (Claude Code) โโโโโบโ (Zig Bridge) โโโโโบโ (ZLS/etc.) โ
โโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโ
MCP Bridge LSP
The server acts as a protocol bridge:
- MCP Side: Receives requests from AI assistants using Model Context Protocol
- Bridge: Translates between MCP and LSP protocols
- LSP Side: Communicates with language servers using Language Server Protocol
๐ ๏ธ Supported Language Servers
Language | Server | Installation |
---|---|---|
Zig | ZLS | brew install zls |
Rust | rust-analyzer | cargo install rust-analyzer |
Go | gopls | go install golang.org/x/tools/gopls@latest |
TypeScript | typescript-language-server | npm install -g typescript-language-server |
Python | python-lsp-server | pip install python-lsp-server |
C/C++ | clangd | brew install llvm |
Java | jdtls | Eclipse JDT Language Server |
C# | omnisharp | OmniSharp Language Server |
โ๏ธ Configuration
Create a configuration file at ~/.config/lsp-mcp-server/config.json
:
{
"servers": {
"zls": {
"command": "zls",
"args": [],
"languages": ["zig"],
"initialization_options": {}
},
"rust-analyzer": {
"command": "rust-analyzer",
"args": [],
"languages": ["rust"],
"initialization_options": {
"cargo": {"buildScripts": {"enable": true}}
}
}
},
"mcp": {
"timeout_ms": 5000,
"tools": {
"hover": {"enabled": true},
"definition": {"enabled": true},
"completion": {"enabled": true}
}
}
}
See for a complete example.
๐งช Testing
The project includes a comprehensive test suite with mock LSP servers to eliminate timeouts:
# Quick development testing (30 seconds)
make test-mock
# Full development workflow
make quick
# Run unit tests only
make test
# Run BDD integration tests with mock servers
make test-bdd-mock
# Run all tests (comprehensive)
make test-comprehensive
# Simulate full CI pipeline locally
make ci-local
Testing Features
- โ Mock LSP Servers: No external dependencies or timeouts
- โ Real Protocol Testing: Full JSON-RPC LSP protocol compliance
- โ Fast Feedback: Tests complete in 30 seconds vs 2+ minutes
- โ Multiple Scenarios: Server initialization, tools listing, LSP connection, hover requests
- โ Professional CI: Comprehensive testing pipeline
๐ณ Docker Usage
Development Environment
# Clone and start development container
git clone https://github.com/nzrsky/lsp-mcp-server.git
cd lsp-mcp-server
make docker-dev
Production Deployment
FROM ghcr.io/nzrsky/lsp-mcp-server:latest
# Add your language servers
RUN npm install -g typescript-language-server
# Copy configuration
COPY config.json /etc/lsp-mcp-server/config.json
ENTRYPOINT ["lsp-mcp-server"]
CMD ["--server", "typescript-language-server"]
๐ฆ Installation Options
Package Managers
Platform | Command |
---|---|
Homebrew | brew install nzrsky/tap/lsp-mcp-server |
Nix | nix profile install github:nzrsky/lsp-mcp-server |
APT | sudo apt install lsp-mcp-server |
YUM/DNF | sudo dnf install lsp-mcp-server |
Smithery | smithery install lsp-mcp-server |
Docker | docker pull ghcr.io/nzrsky/lsp-mcp-server |
System Integration
- systemd: Automatic service configuration
- NixOS: Full NixOS module with declarative configuration
- Home Manager: User-level Nix configuration
- Docker Compose: Multi-container development environment
See for detailed installation instructions.
๐ค Contributing
We welcome contributions! Please see our .
Development Setup
# Clone the repository
git clone https://github.com/nzrsky/lsp-mcp-server.git
cd lsp-mcp-server
# Install dependencies (Nix)
make dev
# Or install Zig manually
curl -L https://ziglang.org/download/0.14.1/zig-linux-x86_64-0.14.1.tar.xz | tar -xJ
# Quick development cycle
make quick
# Run comprehensive tests
make test-comprehensive
# Simulate CI locally before pushing
make ci-local
Project Structure
โโโ src/
โ โโโ main.zig # Entry point and CLI
โ โโโ mcp.zig # MCP protocol implementation
โ โโโ lsp_client.zig # Generic LSP client
โ โโโ config.zig # Configuration management
โโโ tests/
โ โโโ bdd_framework.zig # BDD testing framework
โ โโโ test_runner.zig # BDD test scenarios
โโโ config/ # Configuration examples
โโโ debian/ # Debian packaging
โโโ Formula/ # Homebrew formula
โโโ packaging/ # RPM packaging
โโโ Dockerfile # Container configuration
โโโ flake.nix # Nix flake
โโโ docker-compose.yml # Development environment
๐ Performance
- Memory: ~10MB RAM usage
- Startup: <100ms initialization time
- Latency: <10ms protocol translation overhead
- Throughput: Handles 1000+ requests/second
๐ Security
- Sandboxed: Runs with minimal privileges
- Validated: All inputs are validated and sanitized
- Isolated: Language servers run in separate processes
- Configurable: Security policies can be customized
๐ Documentation
- - Comprehensive installation instructions
- - Full configuration example
- - MCP protocol details
- - Development workflow
- - Technical details
๐ Troubleshooting
Common Issues
- Language server not found: Ensure it's installed and in PATH
- Connection timeout: Check language server logs and increase timeout
- Permission denied: Verify binary permissions and user access
Debug Mode
# Enable debug logging
LSP_MCP_LOG_LEVEL=debug lsp-mcp-server --server zls
# Test connectivity
lsp-mcp-server --server zls --test
# Run local development tests
make test-mock
# Check formatting and build
make quick
๐ License
This project is licensed under the MIT License - see the file for details.
๐ Acknowledgments
- Zig Programming Language - Systems programming language
- Language Server Protocol - Protocol specification
- Model Context Protocol - AI integration protocol
- ZLS - Zig Language Server
- rust-analyzer - Rust Language Server
๐ Roadmap
- WebSocket Support: Alternative to stdio for web integration
- Language Server Discovery: Automatic detection of installed servers
- Plugin System: Custom protocol extensions
- Metrics: Prometheus/OpenTelemetry integration
- GUI Configuration: Web-based configuration interface
- Multi-Server: Support multiple language servers simultaneously
Built with โค๏ธ in Zig | Powered by LSP and MCP
GitHub โข Documentation โข Issues โข Discussions