MCP Connector

Generate API Tools from C++ Controllers

C++ MCP implementation for the Oat++ web framework - auto-generate MCP tools from your REST API controllers.

Works with githuboatpp

Maintainer of this project? Claim this page to edit the listing.


86
Spark score
out of 100
Updated Dec 2024
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Automate the creation of query tools for your C++ API controllers. This asset generates code that allows LLMs to interact with your API, streamlining development and integration.

Outcomes

What it gets done

01

Auto-generate API query tools from C++ ApiController definitions.

02

Enable LLM-driven querying of your API via generated tools.

03

Support for STDIO and HTTP SSE transports for API interaction.

04

Facilitate code generation and API integration within C++ projects.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-oatpp-mcp | bash

Capabilities

Tools your agent gets

autogenerated_api_tools

Automatically generates tools from ApiController to query your API using LLM

logger

Tool for logging functionality

Overview

oatpp-mcp MCP Server

oatpp-mcp implements the Model Context Protocol for the Oat++ C++ web framework, with the ability to auto-generate MCP tools from existing API controllers or manually register custom prompts, resources, and tools, served over STDIO or HTTP SSE. Use it when building an MCP-exposed web service on the Oat++ C++ framework specifically. Not applicable for projects not built on Oat++.

What it does

oatpp-mcp is Anthropic's Model Context Protocol implementation for the Oat++ C++ web framework. Its standout feature is automatically generating MCP tools from an existing ApiController, so an LLM can query your REST API without you hand-writing separate tool definitions.

When to use - and when NOT to

Use it when you're building a C++ web service with Oat++ and want to expose it to an LLM via MCP - either by auto-generating tools straight from your API controllers, or by manually registering custom prompts, resources, and tools. It supports both STDIO transport (for local process-based MCP clients) and HTTP SSE transport (for serving multiple remote clients over your existing HTTP router). Do not use it if your project isn't built on Oat++ - this is a framework-specific integration, not a standalone or language-agnostic MCP server.

Capabilities

  • Autogenerated API tools: generate MCP tools directly from an ApiController, letting an LLM query your API without manual tool authoring (see the linked tutorial and the example-crud project's add_mcp_server branch).
  • Prompts: register custom MCP prompts (e.g. a CodeReview prompt) via server.addPrompt(...).
  • Resources: register MCP resources (e.g. a File resource) via server.addResource(...).
  • Tools: register custom MCP tools (e.g. a Logger tool) via server.addTool(...).
  • Transport: serve over STDIO (server.stdioListen()) or HTTP SSE by adding server.getSseController() to your existing HTTP router.

How to install

Requires the main oatpp module installed first. Then build and install this module:

mkdir build && cd build
cmake ..
make install

Example usage (STDIO transport):

oatpp::mcp::Server server;
server.addPrompt(std::make_shared<prompts::CodeReview>());
server.addResource(std::make_shared<resource::File>());
server.addTool(std::make_shared<tools::Logger>());
server.stdioListen();

Note: redirect Oat++'s own logging to a different stream (e.g. a file via a custom Logger) when serving over STDIO, since STDIO is reserved for MCP protocol messages. A working example is available in the test suite at /test/oatpp-mcp/app/ServerTest.cpp.

Who it's for

C++ developers building web services on Oat++ who want to expose their REST APIs (or custom prompts/resources/tools) to LLMs via MCP without switching languages or frameworks.

Source README

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:

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_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());

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.