cxxmcp 1.1.6
C++ MCP SDK
Loading...
Searching...
No Matches
run.hpp File Reference

Convenience header providing one-call entry points for ServerPeer::Builder::run() and ClientPeer::Builder::run(). More...

#include "cxxmcp/service.hpp"

Go to the source code of this file.

Detailed Description

Convenience header providing one-call entry points for ServerPeer::Builder::run() and ClientPeer::Builder::run().

Server - build, serve, and block until shutdown:

#include <cxxmcp/run.hpp>
int main() {
.name("my-server")
.stdio()
.tool<Json, Json>("echo", [](const Json& in) { return in; })
.run();
}
static Builder builder()
Starts a fluent builder for common server peer construction.
Definition peer.hpp:4872
Convenience header providing one-call entry points for ServerPeer::Builder::run() and ClientPeer::Bui...

Client - build, serve, run a callback, then stop:

#include <cxxmcp/run.hpp>
int main() {
.streamable_http("http://127.0.0.1:3000/mcp")
.run([](auto& svc) {
svc.peer().initialize();
svc.peer().call_tool("echo", Json{{"value", "hello"}});
});
}
static Builder builder()
Starts a fluent builder for common client peer construction.
Definition peer.hpp:2989