mcpls-core 0.8.0

Core library for MCP to LSP protocol translation
Documentation

mcpls-core

Crates.io docs.rs License

The translation layer that lets AI agents understand code semantically.

mcpls-core is the library behind mcpls. It turns MCP tool calls into language server requests, manages the language server processes, and translates the answers back. Use it to embed the bridge in your own application; to just use mcpls, install the mcpls binary.

User documentation: https://bug-ops.github.io/mcpls/. API documentation: https://docs.rs/mcpls-core.

Installation

[dependencies]
mcpls-core = "0.8"

Enable the transport-http feature to serve over Streamable HTTP:

[dependencies]
mcpls-core = { version = "0.8", features = ["transport-http"] }

Usage

use mcpls_core::{ServerConfig, Transport};

#[tokio::main]
async fn main() {
    let config = ServerConfig::load().expect("failed to load config");
    let result = mcpls_core::serve_with(config, Transport::Stdio).await;
    // Exit explicitly: the stdio reader parks an uncancellable thread, so
    // returning from `main` can hang on SIGTERM. See `serve_with`'s docs.
    std::process::exit(if result.is_ok() { 0 } else { 1 });
}

Features

  • Protocol translation between MCP tools and LSP requests, with 1-based to 0-based position and encoding conversion
  • Language server lifecycle management: spawn, initialize, restart, shutdown
  • Non-blocking startup: the MCP server accepts connections while language servers initialize
  • Lazy document tracking and a diagnostics cache for push-based notifications, refreshed from disk edits for subscribed resources
  • TOML configuration, server discovery by project markers, and trust controls (untrusted launcher, open-then-verify file access)
  • Cancellation of in-flight tool calls, forwarded to the language server as $/cancelRequest
  • stdio and optional HTTP transports

Learn more

License

Dual-licensed under Apache 2.0 or MIT.