oatpp-mcp
Anthropic’s Model Context Protocol implementation for Oat++
Read more:
Supported features
Autogenerated tools for API
:tada: oatpp-mcp
can automatically generate tools from ApiController
so that you can query your API with LLM. :tada:
- 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:
1mkdir build && cd build 2cmake .. 3make 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.
1 /* Create MCP server */ 2 oatpp::mcp::Server server; 3 4 /* Add prompts */ 5 server.addPrompt(std::make_shared<prompts::CodeReview>()); 6 7 /* Add resource */ 8 server.addResource(std::make_shared<resource::File>()); 9 10 /* Add tools */ 11 server.addTool(std::make_shared<tools::Logger>()); 12 13 /* Run server */ 14 server.stdioListen();
Serve via SSE
1 /* Create MCP server */ 2 oatpp::mcp::Server server; 3 4 /* Add prompts */ 5 server.addPrompt(std::make_shared<prompts::CodeReview>()); 6 7 /* Add resource */ 8 server.addResource(std::make_shared<resource::File>()); 9 10 /* Add tools */ 11 server.addTool(std::make_shared<tools::Logger>()); 12 13 /* Add SSE controller to your HTTP server router */ 14 router->addController(server.getSseController());