mcpkit-core
Core types and traits for the Model Context Protocol (MCP).
This crate provides the foundational building blocks for the MCP SDK:
- Protocol types: JSON-RPC 2.0 request/response/notification types
- MCP types: Tools, resources, prompts, tasks, content, sampling, elicitation
- Capability negotiation: Client and server capabilities
- Error handling: Unified
McpErrortype with rich diagnostics - Typestate connection: Compile-time enforced connection lifecycle
- OAuth 2.1 / PKCE: Authentication primitives
Runtime Agnostic
This crate does not depend on any async runtime. It can be used with Tokio, smol, or any other executor.
Protocol Version
Implements MCP protocol version 2025-11-25 with backward compatibility for 2024-11-05.
Usage
use ;
// Create a tool definition
let tool = new
.description
.input_schema;
// Create server capabilities
let caps = new
.with_tools
.with_resources
.with_tasks;
// Create server info
let info = new;
Feature Flags
fancy-errors- Enable miette's fancy error reporting with terminal colors
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.