31#include <unordered_map>
107 std::function<
bool(
const wxString &,
bool)> setVisible)
119 wxSocketBase *socket =
nullptr;
121 long contentLength = -1;
122 std::size_t bodyStart = 0;
123 bool badRequest =
false;
126 void Start(
int port);
128 void OnServerEvent(wxSocketEvent &event);
129 void OnClientEvent(wxSocketEvent &event);
132 void PumpConnection(wxSocketBase *socket, Connection &conn);
135 bool TryParseHeaders(Connection &conn, std::string &method,
137 std::unordered_map<std::string, std::string> &headers);
138 void HandleRequest(Connection &conn,
const std::string &method,
139 const std::string &path,
140 const std::unordered_map<std::string, std::string> &headers,
141 const std::string &body);
144 std::string HandleJsonRpc(
const std::string &requestBody);
145 void SendResponse(Connection &conn,
int status,
const char *statusText,
146 const std::string &contentType,
const std::string &body);
147 void CloseConnection(wxSocketBase *socket);
151 static bool OriginAllowed(
const std::string &origin);
154 std::unique_ptr<wxSocketServer> m_server;
155 std::unordered_map<wxSocketBase *, std::unique_ptr<Connection>> m_connections;
156 int m_listeningPort = -1;
The configuration storage for the current worksheet.
Definition: Configuration.h:100
A minimal, opt-in MCP (Model Context Protocol) server exposing the current worksheet as read-only con...
Definition: McpServer.h:81
void SetConnectionCheck(std::function< bool()> isConnected)
Plugs in a live "is Maxima actually connected right now" query – see McpTools::SetConnectionCheck() f...
Definition: McpServer.h:97
void ReconcileWithConfig(const Configuration &config)
Starts/stops listening to match the current configuration. Call this once after construction and agai...
Definition: McpServer.cpp:61
void SetSidebarAccess(std::function< std::vector< McpSidebarInfo >()> list, std::function< bool(const wxString &, bool)> setVisible)
Plugs in access to the dockable sidebars, for list_sidebars/ show_sidebar/hide_sidebar – see McpTools...
Definition: McpServer.h:106
A "variables" sidepane.
Definition: VariablesPane.h:45
The canvas that contains the spreadsheet the whole program is about.
Definition: Worksheet.h:118