mcp-core
Core types and traits for the Model Context Protocol (MCP) SDK.
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
This crate is runtime-agnostic and does not depend on any async runtime. It can be used with Tokio, async-std, smol, or any other executor.
Protocol Version
This crate implements MCP protocol version 2025-11-25.
Example
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
This crate currently has no optional features. All functionality is included by default.