Skip to main content

everruns_mcp/
lib.rs

1//! Transport-agnostic [MCP](https://modelcontextprotocol.io) (Model Context
2//! Protocol) client for Everruns agents.
3//!
4//! `everruns-mcp` is part of the [Everruns](https://everruns.com) ecosystem. It
5//! is the shared MCP client used across Everruns hosts (runtime, worker, and
6//! server), so every host wires MCP the same way without duplicating protocol
7//! logic.
8//!
9//! The crate owns the JSON-RPC client (HTTP, and optional stdio behind the
10//! `stdio` feature), credential acquisition ([`McpAuthProvider`]), result
11//! mapping, and tool execution ([`McpExecutor`], which implements
12//! `everruns_core::McpToolInvoker` so MCP tools register as regular `Tool`s).
13//! Wire types and tool-name helpers live in `everruns-core` and are reused
14//! as-is.
15//!
16//! # Example
17//!
18//! ```
19//! use everruns_mcp::{McpClient, McpConnection};
20//!
21//! # async fn run() -> anyhow::Result<()> {
22//! let client = McpClient::direct();
23//! let connection = McpConnection::http("docs", "https://example.com/mcp");
24//! let tools = client.discover(&connection).await?;
25//! let result = client
26//!     .call(&connection, &tools[0].name, serde_json::json!({}))
27//!     .await?;
28//! # let _ = result;
29//! # Ok(())
30//! # }
31//! ```
32
33pub mod auth;
34pub mod client;
35pub mod executor;
36pub mod http;
37pub mod protocol;
38pub mod result;
39pub mod transport;
40
41#[cfg(feature = "stdio")]
42pub mod stdio;
43
44pub use auth::{
45    McpAuthProvider, McpAuthRequest, McpCredential, NoAuthProvider, StaticAuthProvider,
46};
47pub use client::McpClient;
48pub use executor::{McpConnectionResolver, McpExecutor, StaticConnectionResolver};
49pub use http::{HttpTransport, http_call_tool, http_list_tools, http_send_rpc};
50pub use protocol::Negotiated;
51pub use result::{extract_json_from_response, map_tool_call_result};
52pub use transport::{McpConnection, McpEndpoint, McpTransport};
53
54#[cfg(feature = "stdio")]
55pub use stdio::StdioTransport;