Skip to main content

rmcp_server_kit/
lib.rs

1#![forbid(unsafe_code)]
2#![cfg_attr(
3    test,
4    allow(
5        clippy::unwrap_used,
6        clippy::expect_used,
7        clippy::panic,
8        clippy::indexing_slicing,
9        clippy::unwrap_in_result,
10        clippy::print_stdout,
11        clippy::print_stderr
12    )
13)]
14
15//! `rmcp-server-kit` - reusable MCP server framework.
16//!
17//! Provides Streamable-HTTP transport with TLS/mTLS, health endpoints,
18//! structured observability (tracing + JSON logs + audit file),
19//! authentication (Bearer/mTLS/OAuth 2.1 JWT), RBAC, and rate limiting.
20//! Application crates depend on `rmcp-server-kit` and supply their own `ServerHandler`
21//! implementation.
22
23/// Reusable server and observability configuration primitives.
24pub mod config;
25/// Generic error type and `Result` alias for server-side code.
26pub mod error;
27/// Tracing / JSON logs / audit file initialization.
28pub mod observability;
29/// Streamable HTTP transport and server entry points.
30pub mod transport;
31
32/// Authentication state (API keys, mTLS, OAuth JWT) and middleware.
33pub mod auth;
34/// Role-based access control policy engine and middleware.
35pub mod rbac;
36
37/// Memory-bounded keyed rate limiter (LRU + idle eviction).
38pub mod bounded_limiter;
39
40/// Admin diagnostic endpoints (status, auth keys metadata, counters, RBAC).
41pub mod admin;
42
43/// Re-exports for the [`secrecy`] crate's secret-wrapper types.
44pub mod secret;
45
46pub(crate) mod ssrf;
47
48/// Opt-in tool-call hooks (before/after) and result-size cap.
49pub mod tool_hooks;
50
51#[cfg(feature = "oauth")]
52/// OAuth 2.1 JWKS cache, token validation, and token exchange helpers.
53pub mod oauth;
54
55#[cfg(feature = "metrics")]
56/// Prometheus metrics registry shared across server components.
57pub mod metrics;
58
59/// CDP-driven CRL revocation support for mTLS.
60pub mod mtls_revocation;
61
62// Re-export the canonical error types at the crate root for ergonomic
63// `rmcp_server_kit::Result<()>` / `rmcp_server_kit::McpxError` usage in downstream crates.
64pub use crate::error::{McpxError, Result};