Skip to main content

mcpr_core/proxy/
mod.rs

1//! # mcpr-proxy
2//!
3//! Full MCP proxy engine: per-request pipeline (intake → request chain
4//! → router → transport → response chain → emit), upstream forwarding,
5//! SSE streaming, widget CSP rewriting, per-proxy health. Embed this
6//! crate and wire a frontend (axum, warp, anything) around
7//! [`build_default_pipeline`] + [`pipeline::driver::Pipeline::run`].
8//!
9//! ## Module layout
10//!
11//! ```text
12//! proxy/
13//! ├── pipeline/       Per-request pipeline (parse → route → mw → emit)
14//! ├── proxy_state.rs  ProxyState — the runtime one proxy instance holds
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 emit;
24pub mod forwarding;
25pub mod health;
26pub mod intake;
27pub mod pipeline;
28pub mod pipeline_builder;
29pub mod proxy_state;
30pub mod rewrite;
31pub mod router;
32pub mod sse;
33pub mod transport;
34
35pub use csp::{
36    CspConfig, Directive, DirectivePolicy, Mode, WidgetScoped, effective_domains, glob_match,
37};
38pub use health::{
39    ConnectionStatus, ProxyHealth, SharedProxyHealth, lock_health, new_shared_health,
40};
41pub use intake::from_axum_parts;
42pub use pipeline_builder::{ProxyPipeline, build_default_pipeline};
43pub use proxy_state::ProxyState;
44pub use rewrite::{RewriteConfig, rewrite_response};
45pub use router::ProxyRouter;
46pub use transport::ProxyTransport;