mcpkit-core 0.2.0

Core types and traits for the Model Context Protocol (MCP)
Documentation

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 McpError type 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 mcpkit_core::{
    types::{Tool, ToolOutput, Content},
    capability::{ServerCapabilities, ServerInfo},
    state::Connection,
};

// Create a tool definition
let tool = Tool::new("search")
    .description("Search the database")
    .input_schema(serde_json::json!({
        "type": "object",
        "properties": {
            "query": { "type": "string" }
        },
        "required": ["query"]
    }));

// Create server capabilities
let caps = ServerCapabilities::new()
    .with_tools()
    .with_resources()
    .with_tasks();

// Create server info
let info = ServerInfo::new("my-server", "1.0.0");

Feature Flags

This crate currently has no optional features. All functionality is included by default.