lean_ctx_server/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2#![recursion_limit = "256"]
3#![warn(clippy::undocumented_unsafe_blocks)]
4
5//! The MCP server and its tools, above the Engine library (`lean_ctx`): an
6//! edit here re-checks this crate and the crates above it, not the Engine.
7
8/// Agent-tools session server (`lean-ctx engine agent-tools`).
9pub mod agent_tools_cmd;
10/// Low-level Apache in-process tool-execution façade for Engine embedders.
11pub mod engine;
12pub mod server;
13pub mod tools;
14
15/// The Engine's production guard must hold for this crate's unit tests too:
16/// they see the Engine without `cfg(test)` and run as package
17/// `lean-ctx-server`, and once sent telemetry to production from CI.
18#[cfg(test)]
19mod production_endpoint_tests {
20 #[test]
21 fn unit_tests_of_this_crate_are_refused_a_remote_endpoint() {
22 assert!(lean_ctx::core::data_dir::sandboxed());
23 let _url =
24 lean_ctx::test_env::EnvVarGuard::set("LEAN_CTX_API_URL", "https://api.leanctx.com");
25 assert_eq!(
26 lean_ctx::telemetry_transport::api_url(),
27 "http://127.0.0.1:9"
28 );
29 }
30}
31
32/// The containment helper test of this crate's unit-test harness, at the path
33/// the Engine starts its helpers and guards on (`shell::containment::tests`).
34#[cfg(all(test, unix))]
35mod shell {
36 mod containment {
37 mod tests {
38 #[test]
39 #[ignore = "subprocess helper for the containment tests"]
40 fn containment_helper() {
41 lean_ctx::shell::containment::tests::containment_helper_main();
42 }
43 }
44 }
45}