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++.
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:
-
Clone the repository: git clone <repository-url> cd mcp-cpp
-
Create a build directory and configure: cmake -B build -DCMAKE_BUILD_TYPE=Release
-
Build the library: cmake --build build
-
Run tests (optional): cd build && ctest
-
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
xiaozhi-esp32
An MCP-based chatbot | 一个基于MCP的聊天机器人
unreal
Enable AI assistant clients like Cursor, Windsurf and Claude Desktop to control Unreal Engine through natural language using the Model Context Protocol (MCP).
deeppowers
DEEPPOWERS is a Fully Homomorphic Encryption (FHE) framework built for MCP (Model Context Protocol), aiming to provide end-to-end privacy protection and high-efficiency computation for the upstream and downstream ecosystem of the MCP protocol.
cpp
Lightweight C++ MCP (Model Context Protocol) SDK
x64dbgMCP
Model Context Protocol for x64dbg & x32dbg
processhacker
your ai debugger, vibe hacking tool