mcpkit-testing
Testing utilities for the Model Context Protocol (MCP).
This crate provides mocks, fixtures, and assertions for testing MCP servers and clients.
Features
- Mock servers and clients for unit testing
- Test fixtures with pre-configured tools/resources
- Custom assertions for MCP-specific scenarios
Usage
Mock Server
use ;
use ToolOutput;
let server = new
.tool
.build;
// Use in tests with MemoryTransport
Test Fixtures
use fixtures;
let tools = sample_tools;
let resources = sample_resources;
Assertions
use assert_tool_result;
use CallToolResult;
let result = text;
assert_tool_result!;
Exports
| Export | Purpose |
|---|---|
MockServer |
Mock MCP server for testing |
MockServerBuilder |
Builder for mock servers |
MockTool |
Mock tool definition |
assert_tool_success |
Assert tool call succeeded |
assert_tool_error |
Assert tool call failed |
sample_tools |
Pre-configured test tools |
sample_resources |
Pre-configured test resources |
Part of mcpkit
This crate is part of the mcpkit SDK. For most use cases, depend on mcpkit directly rather than this crate.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.