Skip to main content

objectiveai_mcp_proxy/
lib.rs

1//! ObjectiveAI MCP proxy library.
2//!
3//! Other crates can `use objectiveai_mcp_proxy::{ConfigBuilder, run}` and
4//! spawn the proxy in-process; the binary at `main.rs` is a thin wrapper
5//! that reads `Config` from the environment and calls [`run`].
6
7mod logging;
8mod mcp;
9mod queue_delegate;
10mod run;
11mod session;
12mod session_manager;
13mod upstream;
14
15use std::sync::Arc;
16
17use objectiveai_sdk::mcp::Client;
18
19use crate::session_manager::SessionManager;
20
21/// Shared state every axum handler reaches via `State<AppState>`.
22#[derive(Clone)]
23pub struct AppState {
24    pub sessions: Arc<SessionManager>,
25    pub client: Arc<Client>,
26    /// Optional in-process queue-read delegate. `Some` when an
27    /// embedder (the API) plugged one in at [`setup`] time;
28    /// `None` for the CLI's standalone proxy — tool calls then
29    /// never invoke the delegate seam.
30    pub queue_delegate: Option<Arc<dyn QueueDelegate>>,
31}
32
33pub use queue_delegate::{QueueDelegate, QueueRead};
34pub use run::*;
35pub use session_manager::parse_key_env;