Expand description
§mcpr-proxy
Full MCP proxy engine: per-request pipeline (intake → request chain
→ router → transport → response chain → emit), upstream forwarding,
SSE streaming, widget CSP rewriting, per-proxy health. Embed this
crate and wire a frontend (axum, warp, anything) around
build_default_pipeline + pipeline::driver::Pipeline::run.
§Module layout
proxy/
├── pipeline/ Per-request pipeline (parse → route → mw → emit)
├── proxy_state.rs ProxyState — the runtime one proxy instance holds
├── forwarding.rs UpstreamClient, forward_request, read_body_capped
├── sse.rs SSE extract/wrap helpers
├── csp.rs CspConfig, DirectivePolicy, WidgetScoped
├── rewrite.rs RewriteConfig, rewrite_response (widget CSP)
└── health.rs ProxyHealth, ConnectionStatus, SharedProxyHealthRe-exports§
pub use csp::CspConfig;pub use csp::Directive;pub use csp::DirectivePolicy;pub use csp::Mode;pub use csp::WidgetScoped;pub use csp::effective_domains;pub use csp::glob_match;pub use health::ConnectionStatus;pub use health::ProxyHealth;pub use health::lock_health;pub use intake::from_axum_parts;pub use pipeline_builder::ProxyPipeline;pub use pipeline_builder::build_default_pipeline;pub use proxy_state::ProxyState;pub use rewrite::RewriteConfig;pub use rewrite::rewrite_response;pub use router::ProxyRouter;pub use transport::ProxyTransport;
Modules§
- csp
- CSP — Declarative Content Security Policy for widgets
- emit
RequestEventconstruction and emission.- forwarding
- health
- Per-proxy connection health and display state.
- intake
- Content-based classification of axum request parts into the
Requestsum type. - pipeline
- Per-request proxy pipeline: a trait-driven middleware chain built on
a small custom driver (see
PIPELINE.md). The entrypoint isdriver::Pipeline::run, constructed once at startup viacrate::proxy::build_default_pipeline. - pipeline_
builder - Default middleware chain construction for the pipeline.
- proxy_
state ProxyState— everything one running proxy instance needs to serve traffic: upstream client, rewrite config, sessions, schema manager, per-proxy health, event bus handle. Request handlers takeArc<ProxyState>.- rewrite
- Response rewriting for widget CSP
- router
- Pure
(Request, Config) -> Routemapping. No I/O. - sse
- transport
- The single I/O layer for the pipeline.