A prompt tool for code review functionality
A resource tool for file operations
A tool for logging operations
Oat++ MCP provides a robust implementation of Anthropic's Model Context Protocol for the Oat++ C++ web framework. It enables developers to create MCP servers that can automatically generate tools from API controllers, allowing LLMs to interact directly with your RESTful services. The module supports multiple transport methods and core MCP server features including prompts, resources, and tools.
Oat++ MCP is an implementation of Anthropic's Model Context Protocol for the Oat++ C++ web framework. This module allows you to create MCP servers that can be used with LLMs like Claude to interact with your C++ applications and APIs.
Before installing Oat++ MCP, you need to install the main Oat++ framework:
git clone https://github.com/oatpp/oatpp.git
cd oatpp
mkdir build && cd build
cmake ..
make install
git clone https://github.com/oatpp/oatpp-mcp.git
cd oatpp-mcp
mkdir build && cd build
cmake ..
make install
You can create an MCP server in two ways: via STDIO or via HTTP Server-Sent Events (SSE).
When using STDIO, make sure to redirect Oat++ logging to a different stream (e.g., to a file) by providing a custom Logger:
/* Create MCP server */
oatpp::mcp::Server server;
/* Add prompts */
server.addPrompt(std::make_shared<prompts::CodeReview>());
/* Add resource */
server.addResource(std::make_shared<resource::File>());
/* Add tools */
server.addTool(std::make_shared<tools::Logger>());
/* Run server */
server.stdioListen();
To serve via SSE (which can be integrated with your existing HTTP server):
/* Create MCP server */
oatpp::mcp::Server server;
/* Add prompts */
server.addPrompt(std::make_shared<prompts::CodeReview>());
/* Add resource */
server.addResource(std::make_shared<resource::File>());
/* Add tools */
server.addTool(std::make_shared<tools::Logger>());
/* Add SSE controller to your HTTP server router */
router->addController(server.getSseController());
One of the most powerful features of Oat++ MCP is its ability to automatically generate tools from your ApiController
so that LLMs can query your API directly. This allows you to expose your RESTful services to LLMs without writing additional code.
To learn more about this feature, check out the detailed tutorial or explore the example project example-crud (branch add_mcp_server
).
Oat++ MCP supports the following MCP features:
For working examples, refer to the tests in /test/oatpp-mcp/app/ServerTest.cpp
in the repository.