#pragma once #include #include #include #include #include #include #include namespace httplib { class Server; } class HelperConnection; class McpServer { public: McpServer(HelperConnection& helper); ~McpServer(); void start(); void stop(); bool isRunning() const; int getPort() const { return port; } // Callbacks set by Processor std::function getAnalysisCallback; std::function channelNameCallback; // Param callbacks — wired to inProcessPlugin when SAFE, null when UNSAFE std::function searchParamCallback; std::function& ids)> getParamsCallback; std::function& values)> setParamsCallback; 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 server; std::thread serverThread; std::atomic running{false}; int port = 0; std::string sessionId; bool initialized = false; HelperConnection& helper; };