by oatpp
oatpp-mcp is a C++ implementation of Anthropic’s Model Context Protocol (MCP) for the Oat++ web framework, enabling the creation of MCP servers to interact with large language models (LLMs).
oatpp-mcp is a C++ library that implements Anthropic's Model Context Protocol (MCP) within the Oat++ framework. It allows developers to build MCP servers that can communicate with Large Language Models (LLMs) to leverage their capabilities for various tasks, particularly for interacting with APIs.
To use oatpp-mcp, you first need to install the main Oat++ module. Then, clone the oatpp-mcp repository and build it using CMake and make. Once installed, you can create an oatpp::mcp::Server
instance. You can then add prompts, resources, and tools to this server. The server can be run via STDIO or integrated into an existing HTTP server using Server-Sent Events (SSE).
Serve via STDIO:
/* 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();
Serve via SSE:
/* 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());
oatpp-mcp
can automatically generate tools from ApiController
instances, allowing LLMs to query your APIs./test/oatpp-mcp/app/ServerTest.cpp
directory within the repository.Anthropic’s Model Context Protocol implementation for Oat++
Read more:
:tada: oatpp-mcp
can automatically generate tools from ApiController
so that you can query your API with LLM. :tada:
add_mcp_server
)mkdir build && cd build
cmake ..
make install
Find working example in tests /test/oatpp-mcp/app/ServerTest.cpp
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_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();
/* 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());
Please log in to share your review and rating for this MCP.