mcpr_core/proxy/mod.rs
1//! # mcpr-proxy
2//!
3//! Full MCP proxy engine: per-request pipeline (parse → route → middleware
4//! → forward → emit), upstream forwarding, SSE streaming, widget CSP
5//! rewriting, widget bundle serving, per-proxy health. Embed this crate and
6//! wire a frontend (axum, warp, anything) around [`pipeline::run`].
7//!
8//! ## Module layout
9//!
10//! ```text
11//! proxy/
12//! ├── pipeline/ Per-request pipeline (parse → route → mw → emit)
13//! ├── proxy_state.rs ProxyState — the runtime one proxy instance holds
14//! ├── widgets.rs Widget HTML bundle serving + discovery
15//! ├── forwarding.rs UpstreamClient, forward_request, read_body_capped
16//! ├── sse.rs SSE extract/wrap helpers
17//! ├── csp.rs CspConfig, DirectivePolicy, WidgetScoped
18//! ├── rewrite.rs RewriteConfig, rewrite_response (widget CSP)
19//! └── health.rs ProxyHealth, ConnectionStatus, SharedProxyHealth
20//! ```
21
22pub mod csp;
23pub mod forwarding;
24pub mod health;
25pub mod pipeline;
26pub mod proxy_state;
27pub mod rewrite;
28pub mod sse;
29pub mod widgets;
30
31pub use csp::{
32 CspConfig, Directive, DirectivePolicy, Mode, WidgetScoped, effective_domains, glob_match,
33};
34pub use health::{
35 ConnectionStatus, ProxyHealth, SharedProxyHealth, lock_health, new_shared_health,
36};
37pub use proxy_state::ProxyState;
38pub use rewrite::{RewriteConfig, rewrite_response};
39pub use widgets::WidgetSource;