greentic_mcp_client/lib.rs
1#![forbid(unsafe_code)]
2//! Client for remote MCP servers over Streamable HTTP (JSON-RPC 2.0).
3//!
4//! Not to be confused with [`greentic-mcp`](https://github.com/greenticai/greentic-mcp)
5//! (`greentic-mcp-exec`), which loads and executes `wasix:mcp` **WASM
6//! components** locally. This crate is the network-client side: it connects to
7//! remote MCP servers, lists their tools, and invokes them.
8//!
9//! The [`proto`] module is sans-io and compiles for `wasm32-wasip2`
10//! (`default-features = false`); the [`client`] module (feature `native`, on
11//! by default) adds two transports sharing the [`client::McpClient`] shape:
12//! [`McpHttpClient`] (reqwest, remote) and [`McpStdioClient`] (tokio process,
13//! local subprocess speaking newline-delimited JSON-RPC).
14
15pub mod auth;
16pub mod error;
17pub mod proto;
18
19#[cfg(feature = "native")]
20pub mod client;
21
22pub use auth::McpAuth;
23pub use error::{McpError, ProtoError, ServerError, ToolCallError};
24pub use proto::{McpToolDef, PROTOCOL_VERSION, ToolOutput};
25
26#[cfg(feature = "native")]
27pub use client::{McpClient, McpClientOptions, McpHttpClient, McpStdioClient, ServerInfo};