Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

sovran-mcp

MCP.Pizza Chef: sovran-la

sovran-mcp is a Rust implementation of the Model Context Protocol (MCP) providing a synchronous interface for interacting with MCP servers. It supports tool execution, discovery, prompt management, resource handling, subscriptions, and server capability detection, enabling robust integration of MCP in Rust environments.

Use This MCP server To

Integrate MCP protocol in Rust applications for AI tool orchestration Manage and execute AI tools synchronously within Rust projects Handle resource subscriptions and prompt management in MCP workflows Detect and utilize server capabilities dynamically in Rust-based MCP clients Develop custom MCP servers or clients using Rust for performance and safety

README

sovran_mcp

A synchronous Rust client for the Model Context Protocol (MCP).

Overview

sovran-mcp provides a clean, synchronous interface for interacting with MCP servers. It handles:

  • Tool execution and discovery
  • Prompt management
  • Resource handling and subscriptions
  • Server capability detection

Usage

Add to your Cargo.toml:

[dependencies]
sovran-mcp = "0.3.1"

Basic example:

use sovran_mcp::{McpClient, transport::StdioTransport};

fn main() -> Result<(), sovran_mcp::McpError> {
    // Create and start client
    let transport = StdioTransport::new("npx", &["-y", "@modelcontextprotocol/server-everything"])?;
    let mut client = McpClient::new(transport, None, None);
    client.start()?;

    // List available tools
    if client.supports_tools() {
        let tools = client.list_tools()?;
        println!("Available tools: {:?}", tools);
        
        // Call a tool
        let response = client.call_tool(
            "echo".to_string(),
            Some(serde_json::json!({
                "message": "Hello, MCP!"
            }))
        )?;
    }

    // Clean up
    client.stop()?;
    Ok(())
}

Features

Tool Operations

  • List available tools
  • Execute tools with arguments
  • Handle tool responses (text, images, resources)

Prompt Management

  • List available prompts
  • Retrieve prompts with arguments
  • Handle multi-part prompt messages

Resource Handling

  • List available resources
  • Read resource contents
  • Subscribe to resource changes
  • Handle resource update notifications

Server Capabilities

  • Protocol version detection
  • Feature availability checking
  • Experimental feature support

Handler Support

Sampling Handler

Support for server-initiated LLM completions:

use sovran_mcp::types::*;

struct MySamplingHandler;
impl SamplingHandler for MySamplingHandler {
    fn handle_message(&self, request: CreateMessageRequest) -> Result<CreateMessageResponse, McpError> {
        // Process completion request
        Ok(CreateMessageResponse {
            content: MessageContent::Text(TextContent { 
                text: "Response".to_string() 
            }),
            model: "test-model".to_string(),
            role: Role::Assistant,
            stop_reason: Some("complete".to_string()),
            meta: None,
        })
    }
}

Notification Handler

Support for resource update notifications:

use sovran_mcp::types::*;
use url::Url;

struct MyNotificationHandler;
impl NotificationHandler for MyNotificationHandler {
    fn handle_resource_update(&self, uri: &Url) -> Result<(), McpError> {
        println!("Resource updated: {}", uri);
        Ok(())
    }
}

Error Handling

The crate uses McpError for comprehensive error handling, covering:

  • Transport errors (I/O, connection issues)
  • Protocol errors (JSON-RPC, serialization)
  • Capability errors (unsupported features)
  • Request timeouts
  • Command failures

License

MIT License

Contributing

Contributions welcome! Please feel free to submit a Pull Request.

sovran-mcp FAQ

How do I add sovran-mcp to my Rust project?
Add `sovran-mcp = "0.3.1"` to your Cargo.toml dependencies to include it in your project.
What transport methods does sovran-mcp support?
sovran-mcp supports synchronous transports like StdioTransport for communication with MCP servers.
Can sovran-mcp discover and list available tools?
Yes, it can discover, list, and call available tools exposed by MCP servers.
Does sovran-mcp support asynchronous operations?
sovran-mcp is designed as a synchronous client, focusing on blocking calls for simplicity and reliability.
How does sovran-mcp handle server capability detection?
It automatically detects server capabilities to adapt client behavior accordingly.
Is sovran-mcp compatible with multiple LLM providers?
Yes, it works with MCP servers that can integrate with providers like OpenAI, Claude, and Gemini.
Can I use sovran-mcp for prompt and resource management?
Yes, it provides interfaces for managing prompts and resource subscriptions within MCP workflows.
What programming language is sovran-mcp implemented in?
sovran-mcp is implemented in Rust, offering performance and safety for MCP interactions.