Skip to main content

soma_mcp_client/
lib.rs

1// Render per-item feature-requirement badges when rustdoc runs on nightly with
2// `--cfg docsrs` (docs.rs posture; locally via `cargo xtask doc --docsrs-cfg`).
3// Inert under the stable CI doc gate: stable rustdoc never sets `docsrs`.
4#![cfg_attr(docsrs, feature(doc_auto_cfg))]
5//! Reusable outbound MCP client runtime.
6//!
7//! This crate owns upstream configuration, stdio and HTTP/WebSocket transport
8//! setup, upstream discovery, response caps, and per-upstream call helpers.
9
10pub mod config;
11pub mod net;
12#[cfg(feature = "oauth")]
13pub mod oauth;
14pub mod process;
15pub mod security;
16pub mod upstream;
17
18use thiserror::Error;
19
20#[derive(Debug, Error)]
21pub enum ConfigError {
22    #[error("{field}: {message}")]
23    InvalidField {
24        field: &'static str,
25        message: String,
26    },
27}
28
29impl ConfigError {
30    pub(crate) fn invalid(field: &'static str, message: impl Into<String>) -> Self {
31        Self::InvalidField {
32            field,
33            message: message.into(),
34        }
35    }
36}
37
38/// Crate version from Cargo metadata.
39pub const VERSION: &str = env!("CARGO_PKG_VERSION");
40
41#[cfg(test)]
42#[path = "lib_tests.rs"]
43mod tests;