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;
12#[doc(hidden)]
13pub mod input_check_hook;
14pub mod server;
15pub mod tools;
16
17/// The Engine's production guard must hold for this crate's unit tests too:
18/// they see the Engine without `cfg(test)` and run as package
19/// `lean-ctx-server`, and once sent telemetry to production from CI.
20#[cfg(test)]
21mod production_endpoint_tests {
22 #[test]
23 fn unit_tests_of_this_crate_are_refused_a_remote_endpoint() {
24 assert!(lean_ctx::core::data_dir::sandboxed());
25 let _url =
26 lean_ctx::test_env::EnvVarGuard::set("LEAN_CTX_API_URL", "https://api.leanctx.com");
27 assert_eq!(
28 lean_ctx::telemetry_transport::api_url(),
29 "http://127.0.0.1:9"
30 );
31 }
32}
33
34/// The containment helper test of this crate's unit-test harness, at the path
35/// the Engine starts its helpers and guards on (`shell::containment::tests`).
36#[cfg(all(test, unix))]
37mod shell {
38 mod containment {
39 mod tests {
40 #[test]
41 #[ignore = "subprocess helper for the containment tests"]
42 fn containment_helper() {
43 lean_ctx::shell::containment::tests::containment_helper_main();
44 }
45 }
46 }
47}