
neumann-labs/mcp-cpp 是从 https://github.com/neumann-labs/mcp-cpp. 导入的 MCP 服务器候选
概览
neumann-labs/mcp-cpp 是从 https://github.com/neumann-labs/mcp-cpp. 导入的 MCP 服务器候选
概述(AI 翻译)
一个现代的 C++20 SDK,用于模型上下文协议 (MCP),目标协议修订版2025-11-25。
状态: 测试版。线格式锁定于官方MCP规范;C++ API 在 1.0 之前可能还会有改进。
为什么
LLM 应用越来越需要统一的方式来与工具、资源和 提示提供者。MCP就是该协议;该SDK旨在成为一个干净、快速, 符合规范的C++实现,适合嵌入编辑器、集成开发环境, 代理、本地应用和高吞吐量服务器。
设计目标:
- Spec-faithful。 字段名、方法名和行为均与 官方 TypeScript 模式 逐字逐句。
- 习语 C++20. RAII,值语义,
std::variant用于求和类型, 异步结果的未来,没有继承层级,而复合 做。 - 表面小,杠杆大。 聚焦的公共API;大部分工作 它会出现在几个名字鲜明的类型之后。
- **生产准备。**消毒干净,线头安全,必须在的地方安全,不行 热门路径上的隐藏配置。
0.1 里有什么
| 能力 | 服务器 | 客户端 | 注释 |
|---|---|---|---|
| 初始化 / 能力协商 | ✅ | ✅ | 规格 2025-11-25 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
mcp-cpp
A modern C++20 SDK for the Model Context Protocol (MCP), targeting protocol revision 2025-11-25.
Status: beta. The wire format is locked to the official MCP spec; the C++ API may still see refinements before 1.0.
Why
LLM applications increasingly need a uniform way to talk to tool, resource, and prompt providers. MCP is that protocol; this SDK aims to be a clean, fast, spec-faithful C++ implementation suitable for embedding in editors, IDEs, agents, native applications, and high-throughput servers.
Design goals:
- Spec-faithful. Field names, method names, and behaviors match the official TypeScript schema verbatim.
- Idiomatic C++20. RAII, value semantics,
std::variantfor sum types, futures for async results, no inheritance hierarchies where composition will do. - Small surface, big leverage. A focused public API; most of the work happens behind a few well-named types.
- Production-ready. Sanitizer-clean, thread-safe where it must be, no hidden allocations on hot paths.
What’s in 0.1
| Capability | Server | Client | Notes |
|---|---|---|---|
| Initialize / capabilities negotiation | ✅ | ✅ | spec 2025-11-25 |
| Tools (list, call) | ✅ | ✅ | text/image/audio content blocks |
| Resources (list, read, templates, subscribe/unsubscribe) | ✅ | ✅ | text + base64 blob contents |
| Prompts (list, get) | ✅ | ✅ | typed messages with content blocks |
Sampling (sampling/createMessage) |
✅ initiator | ✅ responder | server-initiated LLM calls |
Roots (roots/list) |
✅ initiator | ✅ responder | client-side filesystem scopes |
Completion (completion/complete) |
✅ | ✅ | autocompletion suggestions |
Cancellation (notifications/cancelled) |
✅ | ✅ | wire-level support |
Progress (notifications/progress) |
✅ | ✅ | typed token + handler |
Logging (notifications/message, logging/setLevel) |
✅ | ✅ | RFC-5424 levels |
Ping (ping) |
✅ | ✅ | bi-directional liveness |
| Pagination | ✅ | ✅ | configurable page size |
stdio transport |
✅ | ✅ | spec-correct framing |
| Streamable HTTP transport | ✅ | ✅ | POST + SSE GET stream + session ids |
Tasks (tasks/get/result/list/cancel, status notifications) |
✅ | ✅ | augment tools/call via task field; spec 2025-11-25 |
Elicitation (elicitation/create, form + url modes) |
✅ initiator | ✅ responder | spec 2025-11-25 |
| OAuth 2.1 authorization (HTTP) | ✅ | ✅ | bearer + RFC 9728 protected resource metadata |
Quick start
A minimal server
#include
int main() {
mcp::Server server{
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →