thulp_mcp/lib.rs
1//! # thulp-mcp
2//!
3//! MCP protocol client wrapping rs-utcp's MCP transport.
4//!
5//! This crate provides a thulp-specific wrapper around rs-utcp's MCP implementation,
6//! adding features like caching, session tracking, and error conversion.
7//!
8//! ## Features
9//!
10//! - **Tools**: List, cache, and call MCP tools
11//! - **Resources**: List, read, and subscribe to MCP resources
12//! - **Prompts**: List and render MCP prompts
13//!
14//! ## Example
15//!
16//! ```rust
17//! use thulp_mcp::{McpClient, McpTransport};
18//!
19//! // Create a new MCP client
20//! let transport = McpTransport::new();
21//! let client = McpClient::new(transport);
22//!
23//! // Check connection status
24//! println!("Client connected: {}", client.is_connected());
25//! println!("Session ID: {}", client.session_id());
26//! ```
27//!
28//! ## Resources Example
29//!
30//! ```rust
31//! use thulp_mcp::ResourcesClient;
32//! use thulp_core::Resource;
33//!
34//! let resources = ResourcesClient::new();
35//!
36//! // Register a local resource
37//! resources.register(Resource::builder("file:///config.yaml", "config.yaml")
38//! .mime_type("application/yaml")
39//! .build());
40//! ```
41//!
42//! ## Prompts Example
43//!
44//! ```rust
45//! use thulp_mcp::PromptsClient;
46//! use thulp_core::{Prompt, PromptArgument};
47//!
48//! let prompts = PromptsClient::new();
49//!
50//! // Register a prompt
51//! prompts.register(Prompt::builder("code_review")
52//! .description("Review code for best practices")
53//! .argument(PromptArgument::required("code", "Code to review"))
54//! .build());
55//! ```
56
57#[cfg(feature = "ares")]
58mod ares_integration;
59mod client;
60mod error;
61mod prompts;
62mod resources;
63mod server;
64mod transport;
65
66#[cfg(feature = "ares")]
67pub use ares_integration::{AresMcpClient, AresToolRegistry};
68pub use client::{McpClient, McpClientBuilder};
69pub use error::Result;
70pub use prompts::PromptsClient;
71pub use resources::ResourcesClient;
72pub use server::{McpServer, McpServerBuilder, ToolHandler};
73pub use transport::McpTransport;
74
75#[cfg(test)]
76mod tests {
77 #[tokio::test]
78 async fn client_can_be_created() {
79 // This is a basic test to ensure the client struct can be instantiated
80 assert!(true);
81 }
82}