pluginbridge / Source /Plugin /McpServer.h
RAM2118's picture
Upload Source/Plugin/McpServer.h
9209b46 verified
Raw History Blame
929 Bytes
#pragma once
#include <thread>
#include <atomic>
#include <string>
#include <memory>
#include <functional>
namespace httplib { class Server; }
class HelperConnection;
class McpServer
{
public:
McpServer(int port, HelperConnection& helper);
~McpServer();
void start();
void stop();
bool isRunning() const;
int getPort() const { return port; }
// Set by Processor so get_analysis can call back
std::function<std::string()> getAnalysisCallback;
private:
void setupRoutes();
std::string handleInitialize(const std::string& requestBody);
std::string handleToolsList(const std::string& requestBody);
std::string handleToolsCall(const std::string& requestBody);
std::unique_ptr<httplib::Server> server;
std::thread serverThread;
std::atomic<bool> running{false};
int port;
std::string sessionId;
bool initialized = false;
HelperConnection& helper;
};