mcpls-core
The translation layer that makes AI understand code semantically.
mcpls-core bridges MCP and LSP protocols, transforming AI tool calls into language server requests and translating rich semantic responses back. It's the engine behind mcpls.
What it does
- Protocol translation — Converts MCP tool calls to LSP requests and back
- Position encoding — Handles MCP's 1-based positions ↔ LSP's 0-based coordinates
- LSP lifecycle — Manages language server processes (spawn, initialize, shutdown)
- Document tracking — Lazy-loads files, maintains synchronization state
- Configuration — Parses TOML configs, discovers LSP servers
[!NOTE] This is the library crate. For the CLI, see
mcpls.
Installation
[]
= "0.2"
Architecture
flowchart LR
subgraph mcpls-core
M["mcp/"] -->|"tool calls"| B["bridge/"]
B -->|"LSP requests"| L["lsp/"]
C["config/"] -.->|"settings"| L
end
| Module | Responsibility |
|---|---|
mcp/ |
MCP server implementation with rmcp, 13 tool handlers |
bridge/ |
Position encoding, document state, request translation |
lsp/ |
JSON-RPC 2.0 client, process management, protocol types |
config/ |
TOML parsing, server discovery, workspace configuration |
Usage
use Config;
use McplsServer;
async
Design principles
- Zero unsafe — Memory safety enforced at compile time
- Async-native — Built on Tokio for concurrent LSP management
- Error context — Rich error types with
thiserror, never panics - Resource limits — Bounded document tracking, configurable timeouts
License
Dual-licensed under Apache 2.0 or MIT.