1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
//! Shared components used by both client and server.
/// The DEFAULT on-disk credential store — the gated I/O counterpart to
/// [`credential_store`] below.
///
/// Gated on `not(wasm32)` AND `feature = "oauth"` because every item in it needs
/// a filesystem, and `default_credential_path` needs the `oauth` feature's
/// `dirs` dependency. It is a SEPARATE module rather than a gated half of
/// `credential_store` so that the pure tier keeps its "no `#[cfg]` other than
/// `cfg(test)`" property, which is what makes its wasm32 cleanliness reviewable
/// at a glance. It knows nothing about the credential document's shape: the
/// format, the schema migration and the migration report all stay next door.
/// Target-agnostic OAuth credential storage: the three-part key, the record,
/// the document format, the schema 1 to 2 migration and the platform seam.
///
/// Ungated on purpose — a file under the user's home directory is unusable on
/// AWS Lambda and per-container on Cloudflare Workers and Cloud Run, so
/// credential storage lands behind a trait and everything a platform needs in
/// order to implement that trait must compile where the `oauth` feature does
/// not exist, on host AND wasm32. Its only imports are this crate's error type,
/// `serde`, `async_trait`, `parking_lot` and the non-optional `url` crate. Do
/// NOT "tidy" a target or feature gate onto it: a second copy of the document
/// format and its migration is how a platform store and the CLI come to
/// disagree about what a stored credential means. A gated FILE implementation
/// is the deliberate counterpart and belongs in its own module. (Contrast the
/// `#[cfg(not(target_arch = "wasm32"))]` peer/stdio entries elsewhere in this
/// file; `oauth_validation` and `pkce` below carry the same rationale.)
// SMPL-02: the single largest severance win in `src/shared/`.
//
// `event_store.rs` is 421 lines of MCP 2025-11-25 SSE-resumability machinery —
// the `Last-Event-ID` replay store, its resumption tokens and its retention
// window. The 2026-07-28 transport states that resumable SSE streams via
// `Last-Event-ID` are not supported, so on a `full-v2` build not one line of it
// has a caller. Re-measured before this gate landed: ZERO consumers anywhere in
// `src/`, `crates/`, `tests/`, `examples/`, `cargo-pmcp/` or `fuzz/` outside the
// file itself and the re-export below. (The `EventStore`/`InMemoryEventStore`
// that the integration tests DO use is a different, 3-method trait that lives in
// `src/server/streamable_http_server.rs`.)
//
// GATED, NOT DELETED. Both items are PUBLIC API; removing them is a semver-major
// change and belongs to SMPL-F1 / pmcp 3.0 — see `docs/v1-sunset-policy.md`. The
// `#[cfg]` must stay on BOTH this declaration and the `pub use event_store::{…}`
// re-export further down; gating only one of the two is a compile break.
//
// DO NOT "FINISH THE JOB" BY GATING THE SSE FILES (correction A-D03). Neither
// `src/shared/sse_parser.rs` nor `src/shared/sse_optimized.rs` is v1-only: v2's
// `subscriptions/listen` returns a live `text/event-stream`
// (`src/server/streamable_http_server.rs`, whose subscribe handler REJECTS any
// non-V2 era), so SSE framing and parsing are SHARED by both eras. Only
// RESUMABILITY is v1-only. `src/shared/http_constants.rs` is likewise
// deliberately ungated — per-constant gating is plan 117-13's job — and
// `src/shared/session.rs` is unmeasured and deliberately left alone.
/// v1-only SSE resumability: the `Last-Event-ID` replay store and its tokens.
/// Hardened HTTP plumbing for this crate's OAuth/OIDC surfaces: the streaming
/// bounded whole-body read every auth response is read through, and the
/// discovery HTTP client whose redirect policy cannot be steered off the
/// issuer's origin.
///
/// Gated on `feature = "http-client"` because every item in it takes or returns
/// a `reqwest` type; the wasm32 build does not enable that feature and must not
/// see this module. `pub(crate)` on purpose — the four auth files that consume
/// it are all in-crate, and this hardening adds no public surface it does not
/// need.
pub
/// Target-agnostic OAuth authorization-RESPONSE validation (RFC 9207 `iss`,
/// CSRF `state`).
///
/// Ungated on purpose — it must be callable from a Cloudflare Workers or
/// Lambda redirect handler, where the `oauth` feature (and its `webbrowser` /
/// `dirs` / `rand` dependencies) does not exist and does not build. Its only
/// imports are this crate's error type and the non-optional `url` crate, so it
/// compiles on host AND wasm32. Do NOT "tidy" a `cfg` onto it: a second copy of
/// the RFC 9207 decision table is how a platform handler and the CLI come to
/// disagree about what "valid" means. (Contrast the
/// `#[cfg(not(target_arch = "wasm32"))]` peer/stdio entries elsewhere in this
/// file, and note `pkce` below carries the same rationale for the same reason.)
/// Peer back-channel trait for server-to-client RPCs from inside request handlers.
/// Target-agnostic one-slot pending-response buffer for one-shot transports.
///
/// Internal plumbing (`pub(crate)`) backing the `WasmHttpTransport`
/// send→receive correlation; ungated so it host-tests under plain `cargo test`.
pub
/// Target-agnostic PKCE (RFC 7636) crypto helper (verifier/challenge/state).
///
/// Ungated on purpose — compiles on host AND wasm32 via `getrandom::fill`
/// (contrast the `#[cfg(not(target_arch = "wasm32"))]` peer/stdio entries).
// Dead on wasm32 by CONFIGURATION, not by disuse: this module's consumers are the
// native server/client tier (`src/server/core.rs`, `src/server/task_dispatch.rs`,
// `src/client/mod.rs`), all of which are `#[cfg(not(target_arch = "wasm32"))]`. The
// items are `pub(crate)` and very much alive natively, so they must NOT be deleted;
// the wasm build simply has no callers for them. Scoped to wasm32 so genuine dead
// code is still caught on every other target.
// Cross-platform runtime abstraction
// Platform-specific WebSocket modules
/// Streamable HTTP transport implementation for MCP.
// Re-export commonly used types
pub use ;
pub use ;
// The other half of the SMPL-02 `event_store` gate. Must carry the SAME `#[cfg]`
// as the `pub mod event_store;` declaration above — gating one without the other
// is a compile break, not a warning.
pub use ;
pub use init_logging;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use StdioTransport;
pub use ;
pub use UriTemplate;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
// Why: `OptimizedSseTransport` is deprecated on purpose (plan 113.1-03, D-01)
// but is NOT removed — retiring a public item is a 3.0 action, and this
// milestone's additivity claim is "zero removed public items". The `deprecated`
// lint fires on a `pub use` re-export within the defining crate, and `make lint`
// runs with `-D warnings`, so the crate must allow it to compile its own
// retained transport. `OptimizedSseConfig` is deliberately NOT deprecated.
pub use ;
pub use ;
pub use ;