GitHub - oatpp/oatpp-mcp: Anthropic’s Model Context Protocol implementation for Oat++ (original) (raw)
oatpp-mcp
Anthropic’s Model Context Protocol implementation for Oat++
Read more:
Supported features
Autogenerated tools for API
🎉 oatpp-mcp can automatically generate tools from ApiController so that you can query your API with LLM. 🎉
- Detailed tutorial
- Example project example-crud (branch
add_mcp_server)
Transport
- STDIO
- HTTP SSE
Server features
Build And Install
Pre Requirements
- Install the main oatpp module
Install module
- Clone this repository.
- In the root of the repository run:
mkdir build && cd build
cmake ..
make install
Examples
Find working example in tests /test/oatpp-mcp/app/ServerTest.cpp
Serve via STDIO
Note: make sure to redirect oatpp logging to a different stream - ex.: to file by providing custom Logger.
/* Create MCP server */ oatpp::mcp::Server server;
/* Add prompts */ server.addPrompt(std::make_sharedprompts::CodeReview());
/* Add resource */ server.addResource(std::make_sharedresource::File());
/* Add tools */ server.addTool(std::make_sharedtools::Logger());
/* Run server */ server.stdioListen();
Serve via SSE
/* Create MCP server */ oatpp::mcp::Server server;
/* Add prompts */ server.addPrompt(std::make_sharedprompts::CodeReview());
/* Add resource */ server.addResource(std::make_sharedresource::File());
/* Add tools */ server.addTool(std::make_sharedtools::Logger());
/* Add SSE controller to your HTTP server router */ router->addController(server.getSseController());