Cpp SDK
Modern C++23 implementation of the Model Context Protocol (MCP)
Ask AI about Cpp SDK
Powered by Claude ยท Grounded in docs
I know everything about Cpp SDK. Ask me about installation, configuration, usage, or troubleshooting.
0/500
Reviews
Documentation
C++ MCP SDK
A modern, header-only C++ implementation of the Model Context Protocol (MCP).
Note: This SDK is currently in early development. It aims to become the official C++ SDK for MCP through community collaboration.
What is MCP?
The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.
Why C++ MCP SDK?
- ๐ Performance: Native C++ performance for latency-critical applications
- ๐ฎ Native Integration: Perfect for game engines, CAD software, scientific computing
- ๐ง System-Level Control: Fine-grained control over memory, threading, and I/O
- ๐ฆ Header-Only: Minimal dependencies, easy integration
- ๐ Cross-Platform: Works on Linux, macOS, Windows, and embedded systems
- โก Modern C++23: Leverages coroutines, ranges, and modules
Features
Current Status (v0.1.0-alpha)
- Project structure and build system
- Core utilities (async ops, RAII wrappers, string formatting)
- Pythonic naming conventions
- MCP Protocol Types (JSON-RPC 2.0)
- Transport Layer (stdio, HTTP/SSE)
- Client Implementation
- Server Implementation
- Resource Management
- Tool/Prompt Support
Planned Features
- WebSocket transport
- Sampling support
- Comprehensive examples
- Full test coverage
- Documentation site
Quick Start
Prerequisites
- Compiler: GCC 13+, Clang 16+, or MSVC 19.34+ (C++23 support)
- Platform: Linux, macOS, or Windows
- Dependencies: See DEPENDENCIES.md
Installation
# Clone the repository
git clone https://github.com/pooriayousefi/cpp-sdk.git
cd cpp-sdk
# Initialize dependencies (git submodules)
git submodule update --init --recursive
# Build the project
g++ -std=c++23 builder.cpp -o builder
./builder --release --executable
Basic Usage (Coming Soon)
#include <pooriayousefi/mcp/server.hpp>
#include <pooriayousefi/mcp/transport/stdio.hpp>
using namespace pooriayousefi::mcp;
int main() {
// Create MCP server
auto server = Server::builder()
.name("my-cpp-server")
.version("1.0.0")
.build();
// Add a tool
server.add_tool("greet", [](const json& args) {
return json{{"message", "Hello, " + args["name"].get<std::string>()}};
});
// Run over stdio
server.run(transport::Stdio{});
return 0;
}
Project Structure
cpp-sdk/
โโโ include/
โ โโโ pooriayousefi/
โ โ โโโ mcp/
โ โ โโโ client.hpp # MCP client
โ โ โโโ server.hpp # MCP server
โ โ โโโ protocol.hpp # Protocol types
โ โ โโโ transport/ # Transport implementations
โ โ โ โโโ stdio.hpp # Stdio transport
โ โ โ โโโ sse.hpp # HTTP/SSE transport
โ โ โโโ types.hpp # Core MCP types
โ โโโ core/ # Utility headers
โ โโโ asyncops.hpp # Async operations & coroutines
โ โโโ raiiiofsw.hpp # RAII filesystem wrappers
โ โโโ stringformers.hpp # String formatting
โ โโโ utilities.hpp # General utilities
โโโ examples/ # Example implementations
โโโ tests/ # Unit tests
โโโ external/ # External dependencies (submodules)
โโโ docs/ # Documentation
โโโ AUTHORS # Project contributors
โโโ LICENSE # MIT License
โโโ DEPENDENCIES.md # Dependency information
โโโ README.md # This file
Design Philosophy
Namespace Structure
All code is organized under the pooriayousefi namespace:
pooriayousefi::mcp::core // Core protocol types
pooriayousefi::mcp::transport // Transport implementations
pooriayousefi::mcp::client // Client implementation
pooriayousefi::mcp::server // Server implementation
pooriayousefi::core // General utilities
Coding Conventions
- Classes/Structs:
PascalCase(e.g.,McpServer) - Functions/Variables:
snake_case(e.g.,add_tool()) - Constants:
UPPER_SNAKE_CASE(e.g.,MAX_BUFFER_SIZE) - Namespaces: lowercase (e.g.,
pooriayousefi::mcp) - Indentation: Allman style (braces on new lines)
Dependencies Strategy
- Header-only libraries only: No linking complexity
- Minimal dependencies: Only nlohmann/json, asio, cpp-httplib
- Zero Boost: Using standalone alternatives
- See DEPENDENCIES.md for details
Contributing
We welcome contributions! This project aims to become the official C++ SDK for MCP.
How to Contribute
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
See CONTRIBUTING.md for detailed guidelines (coming soon).
Roadmap to Official SDK
- Phase 1 (Current): Core implementation and architecture
- Phase 2: Community adoption and feedback
- Phase 3: Proposal to modelcontextprotocol organization
- Phase 4: Official SDK status with potential corporate partnership
Related Projects
Community
- Discussions: GitHub Discussions
- Issues: GitHub Issues
- MCP Community: Official MCP Discussions
License
This project is licensed under the MIT License - see the LICENSE file for details.
Copyright (c) 2025 The C++ MCP SDK Authors
Acknowledgements
- Created and maintained by Pooria Yousefi
- Inspired by the official Go and Rust MCP SDKs
- Built with support from the MCP community
Status: Early Development | Version: 0.1.0-alpha | Last Updated: October 2025
