Skip to content

Installation ​

Requirements ​

DependencyMinimumNotes
CMake3.28Ninja generator required
C++ CompilerC++17MSVC, Clang, GCC
OpenSSLOptional (dev headers)Governed by MCP_WITH_OPENSSL (AUTO/ON/OFF, default AUTO) together with the find_package(OpenSSL) result: when enabled, MCP_HAVE_OPENSSL is defined and OpenSSL is linked for mcp-transport/mcp-client/mcp-ext (all applied through the single INTERFACE target mcp-openssl). Used for TLS in the self-hosted network stack (WebSocket, SSE HTTPS, etc.) and RAND_bytes for PKCE verifier generation. When disabled, TLS support is compiled out and PKCE falls back to BCryptGenRandom (Windows) / std::random_device (POSIX) with the built-in SHA-256

Configure requires no network access: the only external dependency, OpenSSL, is located via find_package on the local machine and no third-party source is fetched.

MCP_WITH_OPENSSL semantics: AUTO (default — enabled when find_package(OpenSSL) finds it), ON (force-enabled; configure fails when OpenSSL is not found), OFF (force-disabled — MCP_HAVE_OPENSSL is not defined and OpenSSL is not linked even when installed); the build system no longer sniffs headers via __has_include to infer OpenSSL availability.

Consume via FetchContent ​

cmake
include(FetchContent)
FetchContent_Declare(
    mcp-cpp-sdk
    GIT_REPOSITORY https://github.com/modelcontextprotocol/cpp-sdk
    GIT_TAG        main
)
FetchContent_MakeAvailable(mcp-cpp-sdk)

target_link_libraries(your_target PRIVATE mcp-client mcp-server)

Available library targets:

TargetTypeDescription
mcp-coreSTATICCore protocol types
mcp-transportSTATICTransport implementations
mcp-protocolSTATICJSON-RPC engine, WireCodec
mcp-httpSTATICHTTP/SSE server transport
mcp-serverSTATICMcpServer, tools/resources/prompts
mcp-clientSTATICMcpClient, OAuth, MRTR

Conformance Fixture ​

The official conformance server fixture (examples/conformance/server) requires an explicit build switch (default OFF):

bash
cmake --preset debug -DMCP_BUILD_CONFORMANCE=ON -DMCP_BUILD_EXAMPLES=ON
cmake --build --preset debug

The conformance client (examples/conformance/client) builds with MCP_BUILD_EXAMPLES=ON. Local reproduction of the CI conformance workflow: scripts/run-conformance.sh server|client.