What Theodolite does
Theodolite provides an editor-free bridge between MCP clients and language servers. It owns language-server sessions for a workspace, keeps the server binaries and configuration pinned, and exposes a closed set of MCP tools for code intelligence. The supported server configurations include bacon-ls for diagnostics, rust-analyzer for Rust semantics, lua-language-server, and serve-d for D projects.
The read surface includes session status, diagnostics, hover, definition, declaration, type definition, implementation, references, document symbols, workspace symbols, code-action listings, rename previews, and session restart. Code actions are listed without returning their edit payloads, while rename previews calculate an edit set without writing files. There is no unrestricted LSP-method passthrough, formatting tool, generic file editor, or command-execution passthrough.
How it works
The bridge communicates with its MCP host over stdio using NDJSON JSON-RPC. It starts language-server children from configured absolute paths and maintains one supervised session for each workspace/server pair, with a maximum of four sessions. A failed session is not silently recreated; callers use session_restart to request a new one.
Readiness is based on the LSP initialization exchange and a server-specific condition rather than a fixed delay. For example, rust-analyzer must finish observed loading activity and answer a probe. Results are canonically ordered and byte-bounded. Oversized responses produce a typed error with the actual item count instead of being silently truncated, and failures use stable typed error codes.
Child processes run under supervisors that own the server process tree. Shutdown attempts the LSP shutdown and exit sequence before escalating through the supervisor, while server death causes the rest of that tree to be terminated. This process ownership also covers leaked descendants.
Setup and configuration
Build the release binary with Cargo, then start it with a TOML configuration file:
cargo build --release
./target/release/theodolite --config bridge.toml
Use bridge.toml.example as the configuration shape. Configure real absolute binary paths and pin the exact output expected from each server's --version probe on the target machine. The bridge rejects invalid configuration rather than starting with an ambiguous setup.
Language-server entries are configuration data, not compiled-in server implementations. A serve-d entry uses plain stdio, requires no arguments, and needs a PATH containing dub and dcd-server; its readiness condition waits for the first successful workspace-file response. Its project activation can initially return the same empty result that a direct LSP client would receive during activation.
Tools and capabilities
- Query diagnostics with push results merged with pull diagnostics when the language server supports both, including channel provenance.
- Navigate through definitions, declarations, type definitions, implementations, and references.
- Inspect hover text and document or workspace symbol indexes.
- Preview renames and list code actions without applying their edits.
- Inspect session state and restart a dead session explicitly.
- Optionally apply code actions or renames under the mutation gate.
Mutation is off by default. The gated mode requires a non-empty allowlist of MCP client names. When enabled for an allowlisted handshake identity, code_action_apply and rename_apply become available. Applications validate workspace boundaries, file state, UTF-8, ranges, overlaps, and version hashes before writing; writes are atomic per file and touched files are re-synchronized. File creation, deletion, and renaming are refused.
Limitations and notes
The server is intentionally a bounded read-oriented surface. It cannot execute arbitrary LSP methods, format files, run workspace commands, or honor server-pushed workspace/applyEdit requests. Sessions are limited to four workspace/server pairs, and a dead session remains dead until session_restart is used.
Mutation authorization is routing metadata from the MCP handshake, not an authentication mechanism. Apply handles are single-use and tied to a session and document versions; forged, reused, cross-session, or stale handles are denied. Rename application recomputes the operation and refuses the entire write if any tracked document changed.
serve-d installations need attention to the binary's runtime dependencies. The packaged binary referenced by the project may require a different LDC shared-library pair than the host provides, so a compatible source-built binary and matching PATH may be necessary.