@sealab/mcp-server 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/PROPOSED-CHANGES-INSERTION-POINTS.md +220 -0
  2. package/SEALAB_MCP_DOCUMENTATION.md +1136 -0
  3. package/dist/client/api-client.js +44 -0
  4. package/dist/index.js +42 -0
  5. package/dist/tools/canvas.js +446 -0
  6. package/dist/tools/catalog.js +95 -0
  7. package/dist/tools/configuration-info.js +299 -0
  8. package/dist/tools/configuration.js +32 -0
  9. package/dist/tools/orders.js +1267 -0
  10. package/dist/tools/saved-settings.js +271 -0
  11. package/package.json +32 -0
  12. package/resources/tooltips/backPanel.txt +17 -0
  13. package/resources/tooltips/backPanelMaterial.txt +29 -0
  14. package/resources/tooltips/caseEdge.txt +18 -0
  15. package/resources/tooltips/caseMaterial.txt +31 -0
  16. package/resources/tooltips/depth.txt +11 -0
  17. package/resources/tooltips/drawerType.txt +12 -0
  18. package/resources/tooltips/edgeBandingType.txt +18 -0
  19. package/resources/tooltips/excludeFronts.txt +5 -0
  20. package/resources/tooltips/frontEdge.txt +18 -0
  21. package/resources/tooltips/frontMaterial.txt +35 -0
  22. package/resources/tooltips/gapBottom.txt +2 -0
  23. package/resources/tooltips/gapCenter.txt +2 -0
  24. package/resources/tooltips/gapLeft.txt +15 -0
  25. package/resources/tooltips/gapRight.txt +15 -0
  26. package/resources/tooltips/gapTop.txt +2 -0
  27. package/resources/tooltips/height.txt +6 -0
  28. package/resources/tooltips/hingePlate.txt +11 -0
  29. package/resources/tooltips/includeLegLevelers.txt +8 -0
  30. package/resources/tooltips/jointMethod.txt +7 -0
  31. package/resources/tooltips/leftCornerWidth.txt +2 -0
  32. package/resources/tooltips/numOfShelves.txt +6 -0
  33. package/resources/tooltips/positionName.txt +3 -0
  34. package/resources/tooltips/rightCornerDepth.txt +2 -0
  35. package/resources/tooltips/topDrwrHeight.txt +8 -0
  36. package/resources/tooltips/width.txt +5 -0
  37. package/src/client/api-client.ts +37 -0
  38. package/src/index.ts +52 -0
  39. package/src/tools/canvas.ts +442 -0
  40. package/src/tools/catalog.test.ts +61 -0
  41. package/src/tools/catalog.ts +80 -0
  42. package/src/tools/configuration-info.ts +274 -0
  43. package/src/tools/configuration.test.ts +43 -0
  44. package/src/tools/configuration.ts +25 -0
  45. package/src/tools/orders.test.ts +260 -0
  46. package/src/tools/orders.ts +1229 -0
  47. package/src/tools/saved-settings.ts +241 -0
  48. package/tsconfig.json +15 -0
@@ -0,0 +1,220 @@
1
+ # Proposed MCP Changes — Insertion Point Accuracy & Bi-Directional Sync
2
+
3
+ **Date**: 2026-03-27
4
+ **Author**: Openclaw integration review
5
+ **Status**: DRAFT — for review and implementation at a later date
6
+ **Priority**: High — blocks accurate coordinate round-tripping between Openclaw agent and Sealab platform
7
+
8
+ ---
9
+
10
+ ## Context
11
+
12
+ The Openclaw proposal engine extracts cabinet insertion points from architectural drawings and submits them to the Sealab MCP via `create_order` / `create_saved_cart`. The Sealab drawing tool allows users to interactively adjust these positions. Currently there is no formal mechanism to:
13
+
14
+ 1. Confirm that submitted coordinates were received and stored correctly
15
+ 2. Read back modified coordinates and propagate changes to the Openclaw database
16
+ 3. Handle the coordinate space conversion (bottom-left → center X) in a way that is explicit and auditable
17
+
18
+ ---
19
+
20
+ ## Proposed Change 1: Add Coordinate Acknowledgment to Order Response
21
+
22
+ ### Current Behavior
23
+ `POST /orders` returns the created order with articles, but does not echo back the stored coordinates in a normalized form.
24
+
25
+ ### Proposed Behavior
26
+ The order creation response should include a `coordinates` field confirming what was stored:
27
+
28
+ ```json
29
+ {
30
+ "orderId": "ORD-123",
31
+ "articles": [...],
32
+ "coordinates": [
33
+ {
34
+ "positionName": "UFAS.B1",
35
+ "stored_x_center": 15.0,
36
+ "stored_y_center": 12.0,
37
+ "stored_z": 0,
38
+ "stored_rotation": 0,
39
+ "input_x_bottomleft": 0.0,
40
+ "input_z_height": 0,
41
+ "conversion_applied": "center_x = input_x + width/2 = 0.0 + 30/2 = 15.0"
42
+ }
43
+ ]
44
+ }
45
+ ```
46
+
47
+ ### Why
48
+ This allows the Openclaw agent to verify that the coordinate conversion was applied correctly at submission time, without requiring a separate `get_cabinet_coordinates` call.
49
+
50
+ ### Files to Modify
51
+ - `src/tools/orders.ts` — Add coordinate echo to `createOrder` and `createSavedCart` response handlers
52
+
53
+ ---
54
+
55
+ ## Proposed Change 2: Add `last_modified_at` Timestamp to Canvas Coordinates
56
+
57
+ ### Current Behavior
58
+ `GET /canvas/{orderId}/coordinates` returns position, x, y, z, rotation — but no timestamp indicating when the coordinates were last changed.
59
+
60
+ ### Proposed Behavior
61
+ Each coordinate entry should include a `lastModifiedAt` ISO timestamp:
62
+
63
+ ```json
64
+ {
65
+ "positionName": "UFAS.B1",
66
+ "x": 15.0,
67
+ "y": 12.0,
68
+ "z": 0,
69
+ "rotation": 0,
70
+ "lastModifiedAt": "2026-03-27T14:30:00Z"
71
+ }
72
+ ```
73
+
74
+ ### Why
75
+ The Openclaw sync module needs to determine whether a coordinate was modified since the last sync. Without timestamps, the only option is full-diff comparison, which cannot distinguish "user intentionally set it back to the original value" from "no change."
76
+
77
+ ### Files to Modify
78
+ - `src/tools/canvas.ts` — Add `lastModifiedAt` to `CoordinateItemSchema`
79
+ - Backend API: Ensure the `/canvas/{orderId}/coordinates` endpoint populates timestamps
80
+
81
+ ---
82
+
83
+ ## Proposed Change 3: Add Coordinate Diff Endpoint
84
+
85
+ ### Current Behavior
86
+ To detect changes, the Openclaw agent must:
87
+ 1. Call `get_cabinet_coordinates`
88
+ 2. Compare every value against its local state
89
+ 3. Compute diffs manually
90
+
91
+ ### Proposed Behavior
92
+ Add a new tool `diff_cabinet_coordinates` that accepts the agent's current known coordinates and returns only the differences:
93
+
94
+ ```typescript
95
+ const DiffCabinetCoordinatesSchema = z.object({
96
+ orderId: z.string(),
97
+ knownCoordinates: z.array(z.object({
98
+ positionName: z.string(),
99
+ x: z.number(),
100
+ y: z.number(),
101
+ z: z.number(),
102
+ rotation: z.number(),
103
+ lastSyncedAt: z.string().optional(),
104
+ })),
105
+ });
106
+ ```
107
+
108
+ Response:
109
+ ```json
110
+ {
111
+ "changed": [
112
+ {
113
+ "positionName": "UFAS.B3",
114
+ "field": "x",
115
+ "old_value": 45.0,
116
+ "new_value": 46.5,
117
+ "changed_at": "2026-03-27T15:00:00Z"
118
+ }
119
+ ],
120
+ "added": [],
121
+ "removed": [],
122
+ "unchanged_count": 7
123
+ }
124
+ ```
125
+
126
+ ### Why
127
+ Reduces token cost and network overhead for the sync module. Instead of transferring all coordinates and diffing locally, the MCP does the comparison server-side.
128
+
129
+ ### Files to Modify
130
+ - `src/tools/canvas.ts` — Add `diff_cabinet_coordinates` tool
131
+ - `src/index.ts` — Register new tool
132
+
133
+ ---
134
+
135
+ ## Proposed Change 4: Support Batch Coordinate Read Across Multiple Orders
136
+
137
+ ### Current Behavior
138
+ `get_cabinet_coordinates` works for one order at a time. For 24 orders, the agent must make 24 sequential calls.
139
+
140
+ ### Proposed Behavior
141
+ Add `get_cabinet_coordinates_batch`:
142
+
143
+ ```typescript
144
+ const GetBatchCoordinatesSchema = z.object({
145
+ orderIds: z.array(z.string()).max(50),
146
+ });
147
+ ```
148
+
149
+ Response: Map of orderId → coordinates array.
150
+
151
+ ### Why
152
+ The Openclaw system manages 24+ orders per project. Batch retrieval reduces API calls from 24 to 1 during sync.
153
+
154
+ ### Files to Modify
155
+ - `src/tools/canvas.ts` — Add batch retrieval tool
156
+ - `src/index.ts` — Register new tool
157
+
158
+ ---
159
+
160
+ ## Proposed Change 5: Document the Coordinate Convention in orders.ts
161
+
162
+ ### Current Issue
163
+ The `ArticleItemSchema` comments (lines 230-235) describe x, z, y conventions but do not explicitly state:
164
+ - That `x` is wall-local (not kitchen-local)
165
+ - How `x` relates to the canvas center X
166
+ - That the server performs the bottom-left → center conversion
167
+
168
+ ### Proposed Enhancement
169
+ Add a detailed JSDoc block above the insertion point fields:
170
+
171
+ ```typescript
172
+ /**
173
+ * INSERTION POINT COORDINATE CONVENTION
174
+ *
175
+ * Input (order creation):
176
+ * x = bottom-left corner X from left wall edge (wall-local cumulative position)
177
+ * z = height from floor (0 for base cabinets)
178
+ * y = NOT provided — server computes as depth/2
179
+ * rotation = degrees (0, 90, 180, 270)
180
+ *
181
+ * Storage (canvas):
182
+ * x = center X = input_x + (width / 2)
183
+ * y = depth / 2
184
+ * z = input_z (unchanged)
185
+ * rotation = unchanged
186
+ *
187
+ * Round-trip:
188
+ * When reading from get_cabinet_coordinates, x is center X.
189
+ * When writing to update_cabinet_coordinates, x must be center X.
190
+ * When creating new orders, x must be bottom-left corner X.
191
+ *
192
+ * For multi-wall kitchens:
193
+ * x is ALWAYS relative to the wall the cabinet is on, not kitchen-global.
194
+ * The rotation field identifies which wall (0=south, 90=east, 180=north, 270=west).
195
+ */
196
+ ```
197
+
198
+ ### Files to Modify
199
+ - `src/tools/orders.ts` — Add documentation block above line 230
200
+
201
+ ---
202
+
203
+ ## Implementation Priority
204
+
205
+ | Change | Impact | Effort | Priority |
206
+ |--------|--------|--------|----------|
207
+ | 5. Document conventions | High (prevents bugs) | Low | P0 — do first |
208
+ | 1. Coordinate acknowledgment | Medium (verification) | Medium | P1 |
209
+ | 2. Timestamps on coordinates | High (sync correctness) | Medium | P1 |
210
+ | 3. Diff endpoint | Medium (efficiency) | Medium | P2 |
211
+ | 4. Batch read | Low (convenience) | Low | P2 |
212
+
213
+ ---
214
+
215
+ ## Notes
216
+
217
+ - None of these changes break existing API contracts — all are additive
218
+ - Change 5 (documentation) can be done immediately with zero risk
219
+ - Changes 1-4 require backend API modifications in addition to MCP tool changes
220
+ - The Openclaw sync module will be built to work without changes 3-4 initially (using individual `get_cabinet_coordinates` calls), but will benefit from them once available