SkillAgentSearch skills...

modelcontextprotocol-cpp-sdk

C++17 implementation of the Model Context Protocol (MCP), providing both client and server libraries for building MCP-based AI tooling integrations.

Install / Use

claude mcp add jesspig -- npx -y github:jesspig/modelcontextprotocol-cpp-sdk

If the server publishes to npm under a different name, use that package instead β€” check the repo README.

About this skill
πŸ”Œ

MCP Server

Model Context Protocol server

Quality Score

83/100

Supported Platforms

Claude Code
Claude Desktop

Tags

Our assessment of modelcontextprotocol-cpp-sdk

modelcontextprotocol-cpp-sdk scores 83/100 on our quality scale, 3059th of 4,607 Development & Engineering skills we index.

Its MCP Server is 20 KB long, well organised into 20 sections with 7 code examples: a thorough specification that gives an agent plenty to work with.

It has 3 GitHub stars, so there is little community track record yet; judge it on its content.

Substance
30/30
Structure
20/20
Description
15/15
Adoption
3/20
Freshness
15/15

Maintenance, license and trust

  • The repository was last updated today, so modelcontextprotocol-cpp-sdk is actively maintained.
  • It is released under the MIT license, a permissive license that allows use, modification and commercial use with attribution.
  • Its trust signals score 92/100, with 1 caution from licensing, adoption, age or documentation. These come from repository metadata, not a code audit β€” read the skill file before letting an agent act on it.

modelcontextprotocol-cpp-sdk compared with similar skills

All 4 of these similar skills score higher than modelcontextprotocol-cpp-sdk; compare them before choosing.

SkillScoreStarsUpdatedFormat
modelcontextprotocol-cpp-sdk (this skill)by jesspig833todayMCP Server
Agent-Reachby Panniantong10098.8k2d agoCLAUDE.md
taste-skillby Leonxlnx10098.5k3d agoCLAUDE.md
headroomby headroomlabs-ai10075.6ktodayCLAUDE.md
ai-job-searchby MadsLorentzen10050.7ktodayCLAUDE.md

Frequently asked questions

How do I install modelcontextprotocol-cpp-sdk?
Run claude mcp add jesspig -- npx -y github:jesspig/modelcontextprotocol-cpp-sdk. The install tabs above show the steps for each supported agent.
Which AI agents does modelcontextprotocol-cpp-sdk work with?
It is written for Claude Code and Claude Desktop, as a MCP Server file. Other agents that read the same format can often use it too.
Is modelcontextprotocol-cpp-sdk safe to use?
It is MIT-licensed and scores 92/100 on trust signals. Skills are instructions an agent will follow, so read the file before installing it and do not approve commands you do not understand.
Is modelcontextprotocol-cpp-sdk still maintained?
The repository was last updated today, so modelcontextprotocol-cpp-sdk is actively maintained.

MCP C++ SDK

δΈ­ζ–‡η‰ˆζ–‡ζ‘£οΌšREADME_zh.md

C++17 implementation of the Model Context Protocol (MCP), providing both client and server libraries for building MCP-based AI tooling integrations. License C++17 Platform

<details> <summary>Table of Contents</summary> </details>

What is MCP?

The Model Context Protocol lets you build servers that expose data and functionality to LLM applications in a secure, standardized way. With this SDK you can:

  • Build MCP servers that expose tools, resources, and prompts to any MCP host
  • Build MCP clients that connect to any MCP server
  • Support every standard transport: stdio, Streamable HTTP, SSE, WebSocket

Requirements

| Dependency | Minimum Version | Notes | |----------------|----------------|------------------------------| | CMake | 3.28 | Generator: Ninja recommended | | C++ Compiler | C++17 | MSVC, Clang, GCC | | OpenSSL | (optional) | Controlled by the MCP_WITH_OPENSSL switch (AUTO/ON/OFF, default AUTO). Required for TLS (WebSocket, SSE HTTPS); OAuth PKCE works without it (built-in SHA-256 fallback). Install: vcpkg install openssl / apt install libssl-dev / brew install openssl |

Supported platforms: Windows (MSVC, clang-cl), Linux (GCC, Clang), macOS (Clang).

Installation

Consume the SDK in your own CMake project via FetchContent:

include(FetchContent)
FetchContent_Declare(
    mcp-cpp-sdk
    GIT_REPOSITORY https://github.com/jesspig/modelcontextprotocol-cpp-sdk.git
    GIT_TAG        master
)
FetchContent_MakeAvailable(mcp-cpp-sdk)

target_link_libraries(your_target PRIVATE mcp-client mcp-server)

Available library targets: mcp-core, mcp-transport, mcp-protocol, mcp-server, mcp-client, mcp-http. All libraries are static.

Quick Start

cmake --preset debug
cmake --build --preset debug
ctest --preset debug --output-on-failure

Configure presets: debug, release. Ninja generator required.

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  mcp-server        mcp-client       β”‚  Server & Client API
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  mcp-protocol                       β”‚  WireCodec, McpSessionHandler
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  mcp-transport       mcp-http       β”‚  Transports, Streamable HTTP, SSE
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚  mcp-core                           β”‚  Types, JSON-RPC, interfaces
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Library dependency chain: mcp-core (STATIC) β†’ mcp-transport β†’ mcp-protocol β†’ mcp-server | mcp-client. mcp-http depends on mcp-transport. All libraries are static.

  • mcp-core β€” Core types, JSON-RPC message structures, error codes, capabilities, content types, transport interfaces.
  • mcp-transport β€” Transport implementations: StdioServerTransport, StdioClientTransport, SseClientTransport, InMemoryTransport, WebSocketClientTransport, StreamableHttpServerTransport, StreamableHttpClientTransport. Platform-specific I/O in detail/ (posix, win32).
  • mcp-protocol β€” McpSessionHandler (JSON-RPC engine), dual-era WireCodec (2025-11-25 / 2026-07-28), request/response correlation with timeout, MessageFilter pipeline.
  • mcp-server β€” McpServer with tool/resource/prompt registration, IMcpTaskStore (incl. FileTaskStore), MRTR (InputRequiredResult), server β†’ client elicitation, subscription management.
  • mcp-client β€” McpClient with server discovery (server/discover β†’ initialize fallback), version negotiation, OAuth (PKCE/CIMD with DCR fallback), MRTR (InputRequired loop), tool cache, FileTokenCache.
  • mcp-http β€” HTTP server for Streamable HTTP mode: HttpServer, EventStore (SSE event persistence), StreamableHttpServerTransport, StreamableHttpClientTransport.

All transports

| Transport | Client | Server | Description | |-----------------|--------|--------|--------------------------------------------------| | Stdio | Yes | Yes | stdin/stdout pipes, subprocess communication | | Streamable HTTP | Yes | Yes | HTTP POST with JSON/session-mode responses | | SSE | Yes | YesΒΉ | Server-Sent Events for push notifications | | WebSocket | Yes | No | TCP-based bidirectional (self-hosted WebSocketClient) | | InMemory | Yes | Yes | In-process transport for testing |

ΒΉ SSE server-side is provided through StreamableHttpServerTransport when enable_legacy_sse is true, which serves an SSE stream via HTTP GET.

Usage

Server

#include <mcp/server/McpServer.hpp>
#include <mcp/transport/StdioServerTransport.hpp>

using namespace mcp;

int main() {
    auto transport = std::make_shared<StdioServerTransport>();

    ServerOptions opts;
    opts.server_info = Implementation{"MyServer", "1.0.0"};

    auto server = McpServer::Create(transport, opts);

    server->RegisterTool("echo",
        ToolOptions{}.Description("Echo input text back"),
        [](const RequestContext<CallToolRequestParams>& ctx) -> CallToolResult {
            std::string text;
            if (ctx.Params().arguments) {
                auto* v = ctx.Params().arguments->Find("text");
                if (v) text = v->GetString();
            }
            CallToolResult result;
            result.content.push_back(TextContent{"text", text});
            return result;
        });

    server->Run();
    return 0;
}

Client

#include <mcp/client/McpClient.hpp>
#include <mcp/transport/StdioClientTransport.hpp>

using namespace mcp;

StdioClientTransportOptions transport_opts;
transport_opts.command = "path/to/server";
auto factory = std::make_shared<StdioClientTransport>(transport_opts);
auto transport = factory->Connect();
ClientOptions opts;
opts.client_info = Implementation{"MyClient", "1.0.0"};

auto client = McpClient::Create(transport, opts);

auto tools = client->ListTools();
for (const auto& tool : tools.tools) {
    std::cout << tool.name << "\n";
}

auto result = client->CallTool("echo",
    JsonValue::Object{{"text", "Hello, MCP!"}});

OAuth Support

The client supports the MCP OAuth authorization flow:

  • Authorization Code + PKCE flow with S256 code challenge
  • CIMD client identity with DCR fallback (an http(s):// client_id is fetched as a client metadata document; dynamic registration only when no client_id is configured)
  • Token refresh and revocation
  • Pluggable token cache (ITokenCache), persistent FileTokenCache included
  • DPoP (RFC 9449): server-side proof verification on the Streamable HTTP resource server β€” off by default, turned on per deployment with the experimental enable_dpop switch (StreamableHttpServerOptions::bearer_auth->enable_dpop), and requires OpenSSL; the client side can bind the authorization scheme and mint proofs (OAuthClientOptions::enable_dpop), but transports attach per-request DPoP proof when apply_per_request_headers/observe_response_challenge are bound via ApplyDPoPProofHeader/ObserveDPoPNonce
OAuthClientOptions oauth_opts;
oauth_opts.server_url = "https://auth.server.com/.well-known/oauth-authorization-server";
oauth_opts.client_id = "client-id";
oauth_opts.redirect_uri = "http://localhost:3000/callback";

OAuthClientProvider auth(oauth_opts);
auth.Authenticate();

Protocol Versions

| Version | Status | Key Features | |-------------|---------|-----------------------------------| | 2025-11-25 | Legacy | initialize handshake, standalone sampling/roots/list | | 2026-07-28 | Current | server/discover, per-request _meta, MRTR (InputRequiredResult), subscriptions/listen |

The WireCodec factory auto-selects the correct codec for the negotiated version via a simple string comparison (version >= "2026-07-28").

Conformance Tests

113 conformance tests covering protocol type serialization across both eras:

  • JSON-RPC message round-trips (request, notification, response, error)
  • WireCodec era-gating (2025 vs 2026 method/notification sets)
  • Tool, Resource, Prompt serialization with annotations and icons
  • Content variant dispatch (text, image, audio, embedded resource)
  • Elicitation and ElicitResultTyped<T>
  • MRTR (InputRequiredResult, InputRequests, factory helpers)
  • Structured meta (RequestMetaObject, NotificationMetaObject)
  • Extensions capability, ResultType enum, SubscriptionFilter
  • Tasks (get/update/cancel), Logging (8 levels)
  • Pagination, caching, protocol version helpers

Examples

Runnable examples in examples/:

| Example | Description | |----------------------------------|------------------------------------------------| | EchoServer | Minimal server with tool, resource, and prompt | | WeatherServer | Server with external API integration | | SimpleClient | Client that connects to a server in-process |

Build and run:

cmake --preset debug -DMCP_BUILD_EXAMPLES=ON
cmake --build --preset debug
# Run the echo server:
build/debug/examples/EchoServer/EchoServer

References

This SDK was developed against the official MCP protocol specification and reference implementations:

| Language | Repository | Tier | |------------|-----------------------------------------------------------------|--------| | Python | modelcontextprotocol/python-sdk | Tier 1 | | TypeScript | modelcontextprotocol/typescript-sdk | Tier 1 | | Go | modelcontextprotocol/go-sdk | Tier 1 | | C# | modelcontextprotocol/csharp-sdk | Tier 1 | | Rust | modelcontextprotocol/rust-sdk | Tier 1 | | Ruby | modelcontextprotocol/ruby-sdk | Tier 1 | | Java | modelcontextprotocol/java-sdk | Tier 2 | | Swift | modelcontextprotocol/swift-sdk | Tier 3 | | PHP | modelcontextprotocol/php-sdk | Tier 3 | | Kotlin | modelcontextprotocol/kotlin-sdk | Tier 3 |

Tiers follow the official SDK list (2026-07-28 revision): 6 Tier 1 (TypeScript, Python, C#, Go, Rust, Ruby β€” Rust promoted to Tier 1 via [PR #3287](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/328

Truncated for display β€” read the full file on GitHub.

Related Skills

View on GitHub
GitHub Stars3
CategoryDevelopment
Updated1h ago
Forks0

Languages

C++

Trust signals

92/100

From repository metadata: license, adoption, age and documentation. Not a code audit β€” see the Safety scan above for what the skill file itself contains.

1 low
modelcontextprotocol-cpp-sdk β€” MCP Server: Install & Safety Check | SkillAgent