@classcad/mcp 0.2.1 → 0.2.2

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.
@@ -2,7 +2,7 @@ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import { type Client, type EnginePolicy } from './client.js';
3
3
  import { type LocalWasmOptions } from './engine/wasm.js';
4
4
  import type { BridgeRegistry } from './bridge/server.js';
5
- export declare const VERSION = "0.2.1";
5
+ export declare const VERSION = "0.2.2";
6
6
  export declare const DEFAULT_WS_URL = "ws://0.0.0.0:9094/";
7
7
  export type McpServerOptions = {
8
8
  /** ClassCAD worker this instance connects to (lazily, on the first tool call). */
@@ -17,7 +17,7 @@ import { serializeTools } from './queue.js';
17
17
  import { registerAuthTool, requireSignIn, SIGN_IN_NOTE } from './tools/auth.js';
18
18
  import { authStatus } from './auth.js';
19
19
  import { attachViewer, registerViewerTool, VIEWER_NOTE } from './tools/viewer.js';
20
- export const VERSION = '0.2.1';
20
+ export const VERSION = '0.2.2';
21
21
  export const DEFAULT_WS_URL = 'ws://0.0.0.0:9094/';
22
22
  /** Builds a connected-ready MCP server: the engine client plus all tools. Nothing is opened yet. */
23
23
  export async function createMcpServer(opts) {
@@ -74,7 +74,7 @@ controls.zoomToCursor = true
74
74
  controls.screenSpacePanning = true
75
75
  controls.rotateSpeed = 0.9
76
76
 
77
- let model = null // { bodies: [{ mesh, edges, sil, cands, inverse }], bounds }
77
+ let model = null // { parts: [{ group, edges, sil, cands, normalToLocal }], box, sphere }
78
78
  let showEdges = true
79
79
  let userMoved = false
80
80
  let needsRender = true
@@ -191,7 +191,7 @@ function setModel(data) {
191
191
  }
192
192
  holder.updateMatrixWorld(true)
193
193
  const box = data.bounds ? new THREE.Box3(new THREE.Vector3(...data.bounds.min), new THREE.Vector3(...data.bounds.max)) : new THREE.Box3().setFromObject(holder)
194
- model = { parts, box }
194
+ model = { parts, box, sphere: box.getBoundingSphere(new THREE.Sphere()) }
195
195
  silDirty = true
196
196
  needsRender = true
197
197
  }
@@ -266,6 +266,22 @@ function lens() {
266
266
  camera.updateProjectionMatrix()
267
267
  }
268
268
 
269
+ // The clip planes hold the part wherever the eye has gone, after a turn, a pan or a
270
+ // zoom: its sphere along the line of sight, twice over, so lines a little off the
271
+ // faces stay too. Fixed planes cut a big part away: a ship lies further from the eye
272
+ // than any fixed depth would reach.
273
+ const sight = new THREE.Vector3()
274
+ const toCenter = new THREE.Vector3()
275
+ function clip() {
276
+ if (!model) return
277
+ const { center, radius } = model.sphere
278
+ const depth = camera.getWorldDirection(sight).dot(toCenter.subVectors(center, camera.position))
279
+ const r = radius * 2 + 1
280
+ camera.near = depth - r
281
+ camera.far = depth + r
282
+ camera.updateProjectionMatrix()
283
+ }
284
+
269
285
  function resize() {
270
286
  const w = stage.clientWidth || 1, h = stage.clientHeight || 1
271
287
  renderer.setSize(w, h, false)
@@ -304,6 +320,7 @@ function loop() {
304
320
  updateSilhouettes(false)
305
321
  }
306
322
  drawTriad()
323
+ clip()
307
324
  renderer.render(scene, camera)
308
325
  }
309
326
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classcad/mcp",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "mcpName": "io.github.awv-informatik/classcad",
5
5
  "description": "ClassCAD MCP server: build, verify and export 3D CAD parts and assemblies with the ClassCAD engine, running locally",
6
6
  "homepage": "https://classcad.ai",