Expand description
§mcpls-core
Core library for MCP (Model Context Protocol) to LSP (Language Server Protocol) translation.
This crate provides the fundamental building blocks for bridging AI agents with language servers, enabling semantic code intelligence through MCP tools.
§Architecture
The library is organized into several modules:
lsp- LSP client implementation for communicating with language serversmcp- MCP tool definitions and handlersbridge- Translation layer between MCP and LSP protocolsconfig- Configuration types and loadingerror- Error types for the library
§Example
ⓘ
use mcpls_core::{serve, serve_with, Transport, ServerConfig};
#[tokio::main]
async fn main() {
let config = ServerConfig::load().expect("failed to load config");
// Stdio (default):
let result = serve(config).await;
// HTTP (requires `transport-http` feature):
// let http = mcpls_core::HttpConfig::new("127.0.0.1:3000".parse().unwrap());
// let result = serve_with(config, Transport::Http(http)).await;
// See `serve`/`serve_with`'s "Shutdown" docs: process::exit avoids a
// runtime-shutdown hang under the stdio transport.
std::process::exit(if result.is_ok() { 0 } else { 1 });
}Re-exports§
pub use config::ProjectConfigStatus;pub use config::ProjectConfigTrust;pub use config::ServerAllowlist;pub use config::ServerConfig;pub use config::WorkspaceTrust;pub use error::Error;pub use transport::Transport;pub use transport::AllowedHost;transport-httppub use transport::AllowedOrigin;transport-httppub use transport::ConnectionLimit;transport-httppub use transport::HeaderReadTimeout;transport-httppub use transport::HttpConfig;transport-httppub use transport::HttpPath;transport-httppub use transport::InvalidAllowedHost;transport-httppub use transport::InvalidAllowedOrigin;transport-httppub use transport::InvalidHttpPath;transport-httppub use transport::LeaseWindow;transport-httppub use transport::ListenLease;transport-httppub use transport::ProbeDeadline;transport-httppub use transport::ProbeInterval;transport-httppub use transport::RequestBodyLimit;transport-httppub use transport::ResponseStreamDeadline;transport-httppub use transport::SessionLimit;transport-httppub use transport::StreamLiveness;transport-httppub use transport::WriteStallTimeout;transport-http
Modules§
- bridge
- Translation layer between MCP and LSP protocols.
- config
- Configuration types and loading.
- error
- Error types for mcpls-core.
- lsp
- LSP client implementation.
- mcp
- MCP tool definitions and handlers.
- transport
- Transport selection for the MCP server.
Functions§
- escape_
control - Escape every control character, line/paragraph separator and bidi control
in
s(\n,\r,\tby name, the rest as\u{..}), borrowingsunchanged when it has none. - needs_
control_ escape - Whether
ccould forge a log line or reorder displayed text, i.e. whetherescape_controlrewrites it. - serve
- Start the MCPLS server with the given configuration over stdio.
- serve_
with - Start the MCPLS server with an explicit transport.