AO

agentty-org/mcp-cpp

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

4 stars 4 forks 品質 50 トレンド 32

Type-theoretic C++23 implementation of the Model Context Protocol (2025-11-25)

概要

A modern, C++23 implementation of the Model Context Protocol (revision — the stateless core — with interop back to ). Header-only, built on jsonrpc-cpp, no codegen. It has no runtime: no threads, transports, futures or clocks. The protocol is types (every method declared once, in protocol.hpp) and answer tables (a Server for what a server answers, ClientHandlers for the server's callbacks). The host drives a jsonrpc::Engine over whatever byte channel it has and decides what runs where. The protocol is encoded in the type system: every wire message is a closed expression in a small algebra of constructors, and (de)serialisation is a — there is not a single hand-written to_json/from_json at any call site. The MCP schema (schema.ts) is a family of inductive types built from a handful of constructors.

README

以下は原文 README の抜粋です。原文を見る。

mcp-cpp

A modern, type-theoretic C++23 implementation of the Model Context Protocol (revision 2026-07-28 — the stateless core — with dual-era interop back to 2025-11-25). Header-only, built on jsonrpc-cpp, no codegen.

It has no runtime: no threads, transports, futures or clocks. The protocol is types (every method declared once, in protocol.hpp) and answer tables (a Server for what a server answers, ClientHandlers for the server’s callbacks). The host drives a jsonrpc::Engine over whatever byte channel it has and decides what runs where.

The protocol is encoded in the type system: every wire message is a closed expression in a small algebra of constructors, and (de)serialisation is a fold over that expression — there is not a single hand-written to_json/from_json at any call site.

T  ⇄  Json          A Codec witnesses a partial isomorphism with the law
encode   decode         decode ∘ encode = id_T

Why type-theoretic?

The MCP schema (schema.ts) is a family of inductive types built from a handful of constructors. We give those constructors names and compose them:

Schema construct Algebra Combinator
interface { … } (record) product Π fᵢ : Tᵢ record(field…)
A | B tagged by "type" coproduct Σ Aᵢ sum_tagged(key, …)
A | B by shape structural union variant_codec(…)
"a" | "b" | "c" closed enum enum_codec(…)
T[] List functor list_codec
T? Maybe ≅ T + 1 maybe_codec
opaque string id Newtype newtype_codec

A representative type — the elicitation field schema union (SEP-1330) — reads as a single declarative expression:

using PrimitiveSchema = Sum<
    UntitledSingleSelectEnum, TitledSingleSelectEnum,
    UntitledMultiSelectEnum,  TitledMultiSelectEnum,
    NumberSchema, BooleanSchema, StringSchema>;

template <> struct CodecOf {
    static Codec get() {
        return variant_codec(
            codec(), codec(),
            codec(),  codec(),
            codec(), codec(), codec());
    }
};

The algebra, codecs and JSON-RPC engine are jsonrpc-cpp’s, shared with acp-cpp.

Coverage (2025-11-25)

Every export interface / export type in the authoritative

GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →