Crate thulp_mcp

Crate thulp_mcp 

Source
Expand description

§thulp-mcp

MCP protocol client wrapping rs-utcp’s MCP transport.

This crate provides a thulp-specific wrapper around rs-utcp’s MCP implementation, adding features like caching, session tracking, and error conversion.

§Features

  • Tools: List, cache, and call MCP tools
  • Resources: List, read, and subscribe to MCP resources
  • Prompts: List and render MCP prompts

§Example

use thulp_mcp::{McpClient, McpTransport};

// Create a new MCP client
let transport = McpTransport::new();
let client = McpClient::new(transport);

// Check connection status
println!("Client connected: {}", client.is_connected());
println!("Session ID: {}", client.session_id());

§Resources Example

use thulp_mcp::ResourcesClient;
use thulp_core::Resource;

let resources = ResourcesClient::new();

// Register a local resource
resources.register(Resource::builder("file:///config.yaml", "config.yaml")
    .mime_type("application/yaml")
    .build());

§Prompts Example

use thulp_mcp::PromptsClient;
use thulp_core::{Prompt, PromptArgument};

let prompts = PromptsClient::new();

// Register a prompt
prompts.register(Prompt::builder("code_review")
    .description("Review code for best practices")
    .argument(PromptArgument::required("code", "Code to review"))
    .build());

Structs§

McpClient
MCP client wrapper.
McpClientBuilder
Builder for McpClient.
McpTransport
Wrapper around rs-utcp’s MCP transport
PromptsClient
MCP Prompts client for managing and rendering prompts.
ResourcesClient
MCP Resources client for managing and accessing resources.

Type Aliases§

Result
Result type alias using Error.