Add MCP control surface (slice 1): socket server + describe/extrude

Predispose the Design tab to run under an external MCP agent. New
McpControl.{cpp,hpp} embeds a line-delimited JSON-RPC 2.0 server over a
Unix domain socket, off unless env SNAPORCA_MCP is set. Requests are
marshalled onto the wx main thread and run through the SAME CadDocument
kernel the GUI uses, via two thin DesignPanel hooks (mcp_doc /
mcp_after_change) — no parallel engine.

Slice-1 methods: describe_tools (introspection -> the bridge builds tool
schemas), describe_scene (feature tree + per-body bounding boxes), and
extrude (centred rectangle sketch -> new solid). Every op returns its
full post-state. POSIX-only; Windows compiles to a no-op.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVzKmX6Y1aEteit1HTXG4Q
This commit is contained in:
Tommaso Bianchi
2026-06-30 15:32:51 +02:00
co-authored by Claude Opus 4.8
parent 5ecb319dee
commit 4f8a0d133f
5 changed files with 297 additions and 0 deletions
+2
View File
@@ -38,6 +38,7 @@
#include "GLCanvas3D.hpp"
#include "Plater.hpp"
#include "DesignPanel.hpp"
#include "McpControl.hpp"
#include "WebViewDialog.hpp"
#include "../Utils/Process.hpp"
#include "format.hpp"
@@ -1329,6 +1330,7 @@ void MainFrame::init_tabpanel() {
// DesignCanvas reads wxGetApp().plater()->config() at construction time.
wxGetApp().plater_ = m_plater;
m_design_panel = new DesignPanel(this);
start_mcp_control_if_enabled(); // opens the MCP socket iff SNAPORCA_MCP is set
m_plater->SetBackgroundColour(*wxWHITE);
m_plater->Hide();