sceneview-mcp 4.1.2 → 4.3.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.
@@ -23,7 +23,7 @@ import { fetchAndroidDoc, formatAndroidDocsFetch, formatAndroidDocsSearch, searc
23
23
  import { formatArtifactResponse, generateArtifact, validateArtifactInput, } from "../artifact.js";
24
24
  import { autoDetectIssue, DEBUG_CATEGORIES, getDebugGuide, } from "../debug-issue.js";
25
25
  import { COLLISION_GUIDE, MATERIAL_GUIDE, MODEL_OPTIMIZATION_GUIDE, WEB_RENDERING_GUIDE, } from "../extra-guides.js";
26
- import { formatGenerateResult, generateModel } from "../generate-model.js";
26
+ import { formatGenerateResult, generateModel, } from "../generate-model.js";
27
27
  import { formatGeneratedScene, generateScene } from "../generate-scene.js";
28
28
  import { LLMS_TXT } from "../generated/llms-txt.js";
29
29
  import { IOS_NODE_TYPE_COUNT, LATEST_SCENEVIEW_RELEASE } from "../generated/version.js";
@@ -35,6 +35,7 @@ import { getPlatformSetup } from "../platform-setup.js";
35
35
  import { buildPreviewUrl, formatPreviewResponse, validatePreviewInput } from "../preview.js";
36
36
  import { getSample, SAMPLES } from "../samples.js";
37
37
  import { formatSearchResults, searchModels } from "../search-models.js";
38
+ import { buildSpatialAnswerSpec, spatialAnswerUrl } from "../spatial-answer-link.js";
38
39
  import { formatValidationReport, validateCode } from "../validator.js";
39
40
  import { WIDGET_3D_VIEWER_URI } from "../widgets.js";
40
41
  // ─── Legal disclaimer (identical to index.ts 4.0.0) ─────────────────────
@@ -87,7 +88,7 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
87
88
  ? [
88
89
  `**SPM dependency:**`,
89
90
  `\`\`\`swift`,
90
- `.package(url: "${sample.spmDependency ?? sample.dependency}", from: "${LATEST_SCENEVIEW_RELEASE}")`,
91
+ `.package(url: "${sample.spmDependency ?? sample.dependency}", exact: "4.68.0")`,
91
92
  `\`\`\``,
92
93
  ]
93
94
  : [
@@ -189,8 +190,10 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
189
190
  `\`\`\`xml`,
190
191
  `<uses-permission android:name="android.permission.CAMERA" />`,
191
192
  `<uses-feature android:name="android.hardware.camera.ar" android:required="true" />`,
193
+ `<!-- On <manifest>: xmlns:tools="http://schemas.android.com/tools" -->`,
192
194
  `<application>`,
193
- ` <meta-data android:name="com.google.ar.core" android:value="required" />`,
195
+ ` <!-- arsceneview declares "optional": tools:replace overrides it (the merge fails without it) -->`,
196
+ ` <meta-data android:name="com.google.ar.core" android:value="required" tools:replace="android:value" />`,
194
197
  `</application>`,
195
198
  `\`\`\``,
196
199
  ].join("\n"),
@@ -290,7 +293,7 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
290
293
  `\`\`\``,
291
294
  `https://github.com/sceneview/sceneview`,
292
295
  `\`\`\``,
293
- `Set version rule to **"from: ${LATEST_SCENEVIEW_RELEASE}"**.`,
296
+ `Set version rule to **"Exact Version 4.68.0"**.`,
294
297
  ``,
295
298
  `Or in Package.swift:`,
296
299
  `\`\`\`swift`,
@@ -301,7 +304,7 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
301
304
  ` name: "MyApp",`,
302
305
  ` platforms: [.iOS(.v17), .macOS(.v14), .visionOS(.v1)],`,
303
306
  ` dependencies: [`,
304
- ` .package(url: "https://github.com/sceneview/sceneview", from: "${LATEST_SCENEVIEW_RELEASE}")`,
307
+ ` .package(url: "https://github.com/sceneview/sceneview", exact: "4.68.0")`,
305
308
  ` ],`,
306
309
  ` targets: [`,
307
310
  ` .executableTarget(`,
@@ -372,7 +375,7 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
372
375
  `### 1. Add SPM Dependency`,
373
376
  ``,
374
377
  `\`\`\`swift`,
375
- `.package(url: "https://github.com/sceneview/sceneview", from: "${LATEST_SCENEVIEW_RELEASE}")`,
378
+ `.package(url: "https://github.com/sceneview/sceneview", exact: "4.68.0")`,
376
379
  `\`\`\``,
377
380
  ``,
378
381
  `### 2. Minimum Platform`,
@@ -521,7 +524,7 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
521
524
  ` directional()`,
522
525
  ` intensity(100_000.0)`,
523
526
  ` }`,
524
- ` model("models/DamagedHelmet.glb")`,
527
+ ` model("https://sceneview.github.io/models/platforms/moto_helmet_v2.glb") // Motorcycle Helmet by sayedgamal655, CC-BY 4.0`,
525
528
  ` autoRotate()`,
526
529
  ` },`,
527
530
  ` onReady = { sceneView ->`,
@@ -661,7 +664,7 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
661
664
  }
662
665
  // ── list_platforms ────────────────────────────────────────────────────────
663
666
  case "list_platforms": {
664
- // All `version:` and `dependency:` fields use `LATEST_SCENEVIEW_RELEASE`
667
+ // Maintained `version:` and `dependency:` fields use `LATEST_SCENEVIEW_RELEASE`
665
668
  // explicitly so each platform row renders the actually-current SDK
666
669
  // version. Pre-fix these were double-quoted strings with a literal
667
670
  // `${LATEST_SCENEVIEW_RELEASE}` substring that never interpolated —
@@ -706,8 +709,8 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
706
709
  platform: "iOS",
707
710
  renderer: "RealityKit",
708
711
  framework: "SwiftUI",
709
- status: "Alpha",
710
- version: LATEST_SCENEVIEW_RELEASE,
712
+ status: "End of life at 4.68.0",
713
+ version: "4.68.0",
711
714
  dependency: "SceneViewSwift (SPM)",
712
715
  features: ["3D", "AR (ARKit)", `${IOS_NODE_TYPE_COUNT} node types`, "USDZ models"],
713
716
  },
@@ -715,8 +718,8 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
715
718
  platform: "macOS",
716
719
  renderer: "RealityKit",
717
720
  framework: "SwiftUI",
718
- status: "Alpha",
719
- version: LATEST_SCENEVIEW_RELEASE,
721
+ status: "End of life at 4.68.0",
722
+ version: "4.68.0",
720
723
  dependency: "SceneViewSwift (SPM)",
721
724
  features: ["3D", "Orbit camera", "USDZ models"],
722
725
  },
@@ -724,8 +727,8 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
724
727
  platform: "visionOS",
725
728
  renderer: "RealityKit",
726
729
  framework: "SwiftUI",
727
- status: "Alpha",
728
- version: LATEST_SCENEVIEW_RELEASE,
730
+ status: "End of life at 4.68.0",
731
+ version: "4.68.0",
729
732
  dependency: "SceneViewSwift (SPM)",
730
733
  features: ["3D", "Immersive spaces", "Hand tracking (planned)"],
731
734
  },
@@ -751,9 +754,18 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
751
754
  platform: "Flutter",
752
755
  renderer: "Filament / RealityKit",
753
756
  framework: "PlatformView",
754
- status: "Alpha",
755
- version: LATEST_SCENEVIEW_RELEASE,
756
- dependency: "flutter pub: flutter_sceneview (git ref until first publish, #2735)",
757
+ status: "End of life at 4.68.0",
758
+ version: "4.68.0",
759
+ dependency: "flutter_sceneview (4.68.0)",
760
+ features: ["3D", "AR", "Android + iOS bridge"],
761
+ },
762
+ {
763
+ platform: "React Native",
764
+ renderer: "Filament / RealityKit",
765
+ framework: "Fabric",
766
+ status: "End of life at 4.68.0",
767
+ version: "4.68.0",
768
+ dependency: "@sceneview-sdk/react-native@4.68.0",
757
769
  features: ["3D", "AR", "Android + iOS bridge"],
758
770
  },
759
771
  ];
@@ -842,6 +854,7 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
842
854
  prompt: args?.prompt,
843
855
  imageUrl: args?.imageUrl,
844
856
  quality: args?.quality,
857
+ provider: args?.provider,
845
858
  });
846
859
  const genText = formatGenerateResult(genResult);
847
860
  return {
@@ -912,6 +925,40 @@ export async function dispatchTool(toolName, args, _ctx = {}) {
912
925
  isError: docResult.ok ? undefined : true,
913
926
  };
914
927
  }
928
+ case "show_in_space": {
929
+ try {
930
+ const spec = buildSpatialAnswerSpec({
931
+ widthCm: args?.widthCm,
932
+ heightCm: args?.heightCm,
933
+ depthCm: args?.depthCm,
934
+ label: args?.label,
935
+ placement: args?.placement,
936
+ dimensionSource: args?.dimensionSource,
937
+ });
938
+ const url = spatialAnswerUrl(spec);
939
+ const sizeCm = [args.widthCm, args.heightCm, args.depthCm];
940
+ return {
941
+ content: [
942
+ {
943
+ type: "text",
944
+ text: `${spec.label}: ${sizeCm.join(" × ")} cm — ${url}\nOpens at real scale in the SceneView app on Android; without the app, the page shows the size.`,
945
+ },
946
+ ],
947
+ structuredContent: { url, label: spec.label, sizeCm, placement: spec.placement },
948
+ };
949
+ }
950
+ catch (error) {
951
+ return {
952
+ isError: true,
953
+ content: [
954
+ {
955
+ type: "text",
956
+ text: `show_in_space: ${error instanceof Error ? error.message : String(error)}`,
957
+ },
958
+ ],
959
+ };
960
+ }
961
+ }
915
962
  // ── view_3d_model (MCP Apps widget) ──────────────────────────────────────
916
963
  //
917
964
  // Returns nothing the model must reason about beyond a one-line summary:
package/dist/validator.js CHANGED
@@ -57,7 +57,7 @@ const RULES = [
57
57
  issues.push({
58
58
  severity: "warning",
59
59
  rule: "ar/node-not-anchor",
60
- message: "Manually setting `worldPosition` inside an AR scene causes drift — ARCore remaps coordinates during tracking and plain nodes don't compensate. Use `AnchorNode(anchor = hitResult.createAnchor())` instead.",
60
+ message: "Manually setting `worldPosition` inside an AR scene causes drift — ARCore remaps coordinates during tracking and plain nodes don't compensate. Use `AnchorNode(anchor = anchor)` instead, with `anchor` from `createAnchorOrNull()` on an in-polygon ARCore plane hit (`latestFrame?.hitTest(event)` in `onSingleTapConfirmed`).",
61
61
  line,
62
62
  });
63
63
  });
@@ -194,7 +194,7 @@ const RULES = [
194
194
  issues.push({
195
195
  severity: "error",
196
196
  rule: "ar/anchor-node-missing-anchor",
197
- message: "`AnchorNode()` requires an `anchor` from a hit result. Use `AnchorNode(anchor = hitResult.createAnchor())` inside `onTouchEvent` or `onSessionUpdated`.",
197
+ message: "`AnchorNode()` requires an `anchor`. Create it on a confirmed tap — `onGestureListener = rememberOnGestureListener(onSingleTapConfirmed = { event, node -> if (node == null) latestFrame?.hitTest(event)?.firstOrNull { (it.trackable as? Plane)?.isPoseInPolygon(it.hitPose) == true }?.createAnchorOrNull()?.let { anchor = it } })` — then declare `anchor?.let { AnchorNode(anchor = it) { … } }`.",
198
198
  line,
199
199
  });
200
200
  });
package/dist/widgets.js CHANGED
@@ -813,7 +813,12 @@ export const WIDGET_3D_VIEWER_HTML = `<!DOCTYPE html>
813
813
 
814
814
  function startWith(data, url) {
815
815
  if (viewer && typeof viewer.loadModel === "function") {
816
- viewer.loadModel(url).then(function () { reveal(data); }).catch(fail);
816
+ viewer.loadModel(url).then(function () { reveal(data); }).catch(function (err) {
817
+ // sceneview.js rejects a load that a later loadModel() replaced with an
818
+ // AbortError: the later render() owns the viewer, so this is not a failure.
819
+ if (err && err.name === "AbortError") return;
820
+ fail(err);
821
+ });
817
822
  return;
818
823
  }
819
824
  SceneView.modelViewer(canvas, url, {
@@ -834,6 +839,8 @@ export const WIDGET_3D_VIEWER_HTML = `<!DOCTYPE html>
834
839
  rendered = data;
835
840
  pending = null;
836
841
  loader.hidden = true;
842
+ // An error an earlier payload left must not sit over the model that loaded.
843
+ errorEl.hidden = true;
837
844
  canvas.style.opacity = "1";
838
845
  if (data.autoRotate === false && viewer && viewer.setAutoRotate) {
839
846
  viewer.setAutoRotate(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceneview-mcp",
3
- "version": "4.1.2",
3
+ "version": "4.3.0",
4
4
  "mcpName": "io.github.sceneview/mcp",
5
5
  "description": "MCP server for SceneView — cross-platform 3D & AR SDK for Android and iOS. Gives your AI coding assistant the full SceneView SDK so it writes correct, compilable code.",
6
6
  "keywords": [
@@ -75,7 +75,7 @@
75
75
  "@modelcontextprotocol/sdk": "^1.29.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@biomejs/biome": "^2.5.14",
78
+ "@biomejs/biome": "2.6.7",
79
79
  "@types/node": "^26.6.2",
80
80
  "tsx": "^4.0.0",
81
81
  "typescript": "^7.0.2",