Install
$ agentstack add mcp-liuli-neko-coro-cpp-mcp ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
coro-cpp-mcp
Lightweight C++ Coroutines MCP (Model Context Protocol)
Overview
该项目为轻量级C++协程库,基于C++20协程实现。提供了基础的mcp-server的实现框架。 项目使用xmake构建,所有依赖均可全头。
Usage
install deps
xmake f -m debug -cvy
build
build example/server 下面的示例
xmake build server-example
run
运行example/server 下面的示例,
xmake run server-example
该示例基于stdio。可以手动输入json进行交互
{"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"Cline","version":"3.13.1"}},"jsonrpc":"2.0","id":0}
{"method":"notifications/initialized","jsonrpc":"2.0"}
{"method": "tools/list", "jsonrpc": "2.0", "id": 1}
{"method": "tools/call", "params": {"name": "add", "arguments": {"a": 13, "b": 22}}, "jsonrpc": "2.0", "id": 2}
{"method": "tools/call", "params": {"name": "mult", "arguments": {"a": 15, "b": 42}}, "jsonrpc": "2.0", "id": 3}
{"method": "tools/call", "params": {"name": "div", "arguments": {"a": 16, "b": 22}}, "jsonrpc": "2.0", "id": 4}
{"method": "tools/call", "params": {"name": "div", "arguments": {"a": 1, "b": 0}}, "jsonrpc": "2.0", "id": 5}
也可以配置到cline的本地服务中,配置完成后即可让ai使用。
Example
server
以下是服务端简易的使用说明,完整的示例请参考example/server。
```c++ // 定义 struct TowParams { // 定义参数结构体 double a; double b; }; struct MCPTools { ToolFunction add{"sum of two numbers"}; // 定义add函数。 }; int main([[maybeunused]] int argc, [[maybeunused]] char argv[]) { ILIASNAMESPACE::PlatformContext platform; McpServer server(platform); // 创建服务,并自动注册MCPTools中的函数 server.setinstructions("This is a test server"); // 设置说明(可选) server.setCapabilities(ResourcesCapability{.subscribe = {}, .listchanged = {}}); // 设置能力(可选) server->add.paramsDescription({{"a", "first number"}, {"b", "second number"}}); // 设置参数说明(可选) server.registertool_function("mult", std::function([](Params p) { return p.a p.b;})); // 通过函数注册函数
auto logFile = (std::filesystem::currentpath() / "log.txt").string(); server.registerlocalfileresource("log", logFile); // 注册本地文件资源
// 注册静态资源 server.registerresource({.uri = "myuri", .name = "my_name", .description = "my github name", .metadata = std::nullopt, .annotations = std::nullopt}, TextResourceContents{.text = "liuli-neko"});
// 注册动态资源 server.registerresource({.uri = "myuri2", .name = "my_name2", .description = "my github name2", .metadata = std::nullopt, .annotations = std::nullopt}, [](std::optional meta) -> TextResourceContents { // you can use the meta to determine what to return return TextResourceContents{.text = "https://github.com/liuli-neko"}; });
// 自定以jsonrpc回复 server.jsonrpcserver()->resourcesTemplatesList = [](auto) -> ListResourceTemplatesResult { // 您可以在这里返回你自己的资源模板列表 return {}; };
iliaswait server.start("stdio://stdout-stdin"); // 启动服务 iliaswait server.wait(); // 等待服务结束 }
### client
以下是一个简单的客户端示例,完整的示例请参考`example/client/`。
```cpp
struct TowParams { // 定义参数结构体
double a;
double b;
};
struct MCPTools {
ToolFunction add{"sum of two numbers"}; // 定义一个方法,参数为TowParams,返回值为double
};
int main([[maybe_unused]] int argc, [[maybe_unused]] char* argv[]) {
ILIAS_NAMESPACE::PlatformContext platform;
McpClient client(platform); // 创建客户端并自动注册MCPTools里面定义的方法
ilias_wait client.connect("stdio://stdout-stdin"); // 连接服务
auto ret = ilias_wait client->add({.a = 5, .b = 2}); // 调用服务端的方法
std::cout << "add: " << ret.value_or(-1) << std::endl; // 输出结果
return 0;
}
Source & license
This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: liuli-neko
- Source: liuli-neko/coro-cpp-mcp
- License: MIT
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.