Get the FREE Ultimate OpenClaw Setup Guide →

mcp-cpp

A C++ SDK for the Model Context Protocol (MCP). The SDK will provide a framework for creating MCP servers and clients in C++.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio neumann-labs-mcp-cpp docker run -i neumann-labs/mcp-cpp \
  --env BUILD_TYPE="Release (or Debug as needed)"

How to use

mcp-cpp is a C++ SDK for building MCP servers and clients, providing JSON-RPC 2.0 messaging, support for multiple transport mechanisms (STDIO implemented; HTTP/SSE planned), and a focus on thread-safe, memory-safe design with RAII. The repository includes core types, JSON serialization, error handling utilities, a transport interface, and a simple echo example illustrating basic usage. To get started, you typically build the library with CMake, then run the provided examples to see a concrete server and client in action. Once built, you can implement your own MCP server by wiring your business logic to the JSON-RPC messages and your preferred transport, following the patterns shown in the examples.

How to install

Prerequisites:

  • CMake (minimum version as required by the project)
  • A C++17 capable compiler (e.g., GCC/Clang/MSVC)
  • Basic build tools (make/ninja as configured)

Install and build steps:

  1. Clone the repository: git clone <repository-url> cd mcp-cpp

  2. Create a build directory and configure: cmake -B build -DCMAKE_BUILD_TYPE=Release

  3. Build the library: cmake --build build

  4. Run tests (optional): cd build && ctest

  5. Run the echo example (as a verification step): ./build/examples/simple_server/echo_server In a separate terminal, run: ./build/examples/simple_client/echo_client

Notes:

  • If you prefer a Debug build, adjust -DCMAKE_BUILD_TYPE accordingly.
  • The README indicates planned/implemented transports; ensure your environment supports STDIO or your intended transport for your MCP server.

Additional notes

Tips and considerations:

  • The project emphasizes thread-safety and memory-safety via RAII and smart pointers; leverage these patterns when extending the server.
  • If you plan to enable HTTP/SSE in the future, monitor updates for transport integration steps and corresponding JSON-RPC handling.
  • The provided Echo example is a good starting point to understand message flow: a test request and a notification on startup, followed by interactive echo behavior.
  • Ensure you build in Release mode for production-like performance, or Debug mode during development for easier debugging.
  • If you encounter transport-related issues, verify that the chosen transport (STDIO vs HTTP/SSE) is correctly configured and that any required dependencies are linked.

Related MCP Servers

Sponsor this space

Reach thousands of developers