RAM2118 commited on
Commit
30fff00
·
verified ·
1 Parent(s): af9a321

Sprint 1: Add McpServer.h — HTTP server interface

Browse files
Files changed (1) hide show
  1. Source/McpServer.h +36 -0
Source/McpServer.h ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #pragma once
2
+
3
+ #include <thread>
4
+ #include <atomic>
5
+ #include <string>
6
+
7
+ // Forward declare to avoid httplib.h in header (speeds up compilation)
8
+ namespace httplib { class Server; }
9
+
10
+ class McpServer
11
+ {
12
+ public:
13
+ explicit McpServer(int port = 16620);
14
+ ~McpServer();
15
+
16
+ void start();
17
+ void stop();
18
+ bool isRunning() const;
19
+ int getPort() const { return port; }
20
+
21
+ private:
22
+ void setupRoutes();
23
+ void serverThreadFunc();
24
+
25
+ // Tool handlers (return JSON string responses)
26
+ std::string handleInitialize(const std::string& requestBody);
27
+ std::string handleToolsList();
28
+ std::string handleToolsCall(const std::string& requestBody);
29
+
30
+ std::unique_ptr<httplib::Server> server;
31
+ std::thread serverThread;
32
+ std::atomic<bool> running{false};
33
+ int port;
34
+ std::string sessionId;
35
+ bool initialized = false;
36
+ };