Skip to main content

hyperlane_plugin_mcp/
lib.rs

1//! hyperlane-plugin-mcp
2//!
3//! Model Context Protocol (MCP) Streamable HTTP server plugin for Hyperlane
4//! with `XxHash3_64` tool/resource/prompt registries, sharded TTL session
5//! management with high-entropy IDs, Origin validation, and an opt-in
6//! [`ServerHook`].
7
8mod r#const;
9mod r#enum;
10mod r#fn;
11mod r#impl;
12mod r#static;
13mod r#struct;
14mod r#type;
15
16#[cfg(test)]
17#[path = "../tests/mod.rs"]
18mod tests;
19
20pub use {r#const::*, r#enum::*, r#struct::*, r#type::*};
21
22pub(crate) use {r#fn::*, r#static::*};
23
24use std::{
25    array::from_fn,
26    borrow::Cow,
27    collections::VecDeque,
28    error::Error,
29    fmt::{self, Display, Formatter},
30    future::Future,
31    pin::Pin,
32    process,
33    str::from_utf8,
34    sync::{
35        Arc, OnceLock, RwLock, RwLockReadGuard, RwLockWriteGuard,
36        atomic::{AtomicU64, AtomicUsize, Ordering},
37    },
38    time::{Duration, Instant, SystemTime, UNIX_EPOCH},
39};
40
41use {
42    hyperlane::{
43        APPLICATION_JSON, CONTENT_TYPE, Context, HashMapXxHash3_64, HttpStatus, ORIGIN, Request,
44        ResponseError, ServerHook, Status, Stream, hash_map_xx_hash3_64,
45    },
46    lombok_macros::*,
47    serde::{
48        Deserialize, Deserializer, Serialize,
49        de::{self, IgnoredAny, MapAccess, SeqAccess, Visitor},
50    },
51    serde_json::{Map, Number, Value, from_slice, to_vec, to_writer},
52};