mcpkit-testing 0.1.0

Testing utilities for mcpkit
Documentation

Testing utilities for the MCP SDK.

This crate provides mocks, fixtures, and assertions for testing MCP servers and clients. It includes:

  • Mock servers and clients for unit testing
  • Test fixtures with pre-configured tools/resources
  • Custom assertions for MCP-specific scenarios

Overview

Mock Server

use mcpkit_testing::{MockServer, MockTool};
use mcpkit_core::types::ToolOutput;

let server = MockServer::new()
    .tool(MockTool::new("add")
        .description("Add two numbers")
        .handler(|args| Ok(ToolOutput::text("42"))))
    .build();

// Use in tests with MemoryTransport

Test Fixtures

use mcpkit_testing::fixtures;

let tools = fixtures::sample_tools();
let resources = fixtures::sample_resources();

Assertions

use mcpkit_testing::assert_tool_result;
use mcpkit_core::types::CallToolResult;

let result = CallToolResult::text("42");
assert_tool_result!(result, "42");