sceneview-mcp 4.0.15 → 4.1.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.
@@ -21,7 +21,7 @@ const DEBUG_GUIDES = {
21
21
 
22
22
  1. **Is \`rememberModelInstance\` returning null?**
23
23
  - It returns \`null\` while loading AND if the file fails to load.
24
- - Add a log: \`Log.d("SV", "model: \$modelInstance")\`
24
+ - Add a log: \`Log.d("SV", "model: $modelInstance")\`
25
25
  - Show a loading indicator while null.
26
26
 
27
27
  2. **Is the asset path correct?**
@@ -146,7 +146,7 @@ fun DebugModelViewer() {
146
146
 
147
147
  5. **Objects not appearing on tap?**
148
148
  - Is \`onTouchEvent\` wired up?
149
- - Is \`hitResult\` null? Log it: \`Log.d("AR", "hitResult: \$hitResult")\`
149
+ - Is \`hitResult\` null? Log it: \`Log.d("AR", "hitResult: $hitResult")\`
150
150
  - Are you creating an anchor? \`hitResult.createAnchor()\` must be called.
151
151
  - Is the model loaded? Check \`rememberModelInstance\` is not null.
152
152
 
@@ -526,7 +526,7 @@ SceneView(
526
526
 
527
527
  ### SPM Package Resolution Fails
528
528
 
529
- - Require Xcode 15.0+ (iOS 17 / visionOS targets).
529
+ - Require Xcode 16.0+ (iOS 18 / visionOS 2 targets, Swift 6).
530
530
  - Clean: Xcode > Product > Clean Build Folder.
531
531
  - Reset packages: File > Packages > Reset Package Caches.
532
532
  - URL must be exactly: \`https://github.com/sceneview/sceneview\`
@@ -602,7 +602,7 @@ SceneView(
602
602
  instance.animator?.let { animator ->
603
603
  Log.d("SV", "Animation count: \${animator.animationCount}")
604
604
  for (i in 0 until animator.animationCount) {
605
- Log.d("SV", "Animation \$i: \${animator.getAnimationName(i)}")
605
+ Log.d("SV", "Animation $i: \${animator.getAnimationName(i)}")
606
606
  }
607
607
  }
608
608
  }
@@ -664,10 +664,21 @@ export function getDebugGuide(category) {
664
664
  export function autoDetectIssue(description) {
665
665
  const lower = description.toLowerCase();
666
666
  // Threading issues → crash category (very common, check early)
667
- if (lower.includes("wrong thread") || lower.includes("off main thread") || lower.includes("dispatchers.io") || lower.includes("background thread")) {
667
+ if (lower.includes("wrong thread") ||
668
+ lower.includes("off main thread") ||
669
+ lower.includes("dispatchers.io") ||
670
+ lower.includes("background thread")) {
668
671
  return "crash";
669
672
  }
670
- if (lower.includes("not showing") || lower.includes("invisible") || lower.includes("can't see") || lower.includes("model doesn't appear") || lower.includes("model not visible") || lower.includes("nothing shows up") || lower.includes("model is null") || lower.includes("remembermodelinstance returns null") || lower.includes("no model")) {
673
+ if (lower.includes("not showing") ||
674
+ lower.includes("invisible") ||
675
+ lower.includes("can't see") ||
676
+ lower.includes("model doesn't appear") ||
677
+ lower.includes("model not visible") ||
678
+ lower.includes("nothing shows up") ||
679
+ lower.includes("model is null") ||
680
+ lower.includes("remembermodelinstance returns null") ||
681
+ lower.includes("no model")) {
671
682
  return "model-not-showing";
672
683
  }
673
684
  // AR-not-working catches "the AR camera feed is dark" and the half-dozen
@@ -687,10 +698,10 @@ export function autoDetectIssue(description) {
687
698
  // false-positives on "the orbit camera in my 3D scene renders a black
688
699
  // background" (a 3D-only issue that should route to model-not-showing
689
700
  // or material). Caught by the #940 follow-up review.
690
- const hasArContext = /\b(ar|arscene|arsceneview|arcore|arkit|arcore)\b/.test(lower)
691
- || lower.includes("augmented reality");
692
- const arBlackHints = (hasArContext && /\b(black|dark|dimmed)\b/.test(lower))
693
- || /\b(ar|arscene|arsceneview|arcore)\b.*\b(black|dark|dimmed)\b/.test(lower);
701
+ const hasArContext = /\b(ar|arscene|arsceneview|arcore|arkit|arcore)\b/.test(lower) ||
702
+ lower.includes("augmented reality");
703
+ const arBlackHints = (hasArContext && /\b(black|dark|dimmed)\b/.test(lower)) ||
704
+ /\b(ar|arscene|arsceneview|arcore)\b.*\b(black|dark|dimmed)\b/.test(lower);
694
705
  if (lower.includes("ar not") ||
695
706
  lower.includes("ar doesn't") ||
696
707
  lower.includes("arcore") ||
@@ -703,31 +714,102 @@ export function autoDetectIssue(description) {
703
714
  arBlackHints) {
704
715
  return "ar-not-working";
705
716
  }
706
- if (lower.includes("crash") || lower.includes("sigabrt") || lower.includes("native crash") || lower.includes("fatal") || lower.includes("exception") || lower.includes("destroy") || lower.includes("double free") || lower.includes("segfault") || (lower.includes("oom") && !lower.includes("zoom")) || lower.includes("out of memory") || lower.includes("nullpointerexception") || lower.includes("npe")) {
717
+ if (lower.includes("crash") ||
718
+ lower.includes("sigabrt") ||
719
+ lower.includes("native crash") ||
720
+ lower.includes("fatal") ||
721
+ lower.includes("exception") ||
722
+ lower.includes("destroy") ||
723
+ lower.includes("double free") ||
724
+ lower.includes("segfault") ||
725
+ (lower.includes("oom") && !lower.includes("zoom")) ||
726
+ lower.includes("out of memory") ||
727
+ lower.includes("nullpointerexception") ||
728
+ lower.includes("npe")) {
707
729
  return "crash";
708
730
  }
709
- if (lower.includes("slow") || lower.includes("fps") || lower.includes("lag") || lower.includes("jank") || lower.includes("performance") || lower.includes("memory") || lower.includes("stuttering") || lower.includes("frame drop") || lower.includes("choppy") || lower.includes("battery drain")) {
731
+ if (lower.includes("slow") ||
732
+ lower.includes("fps") ||
733
+ lower.includes("lag") ||
734
+ lower.includes("jank") ||
735
+ lower.includes("performance") ||
736
+ lower.includes("memory") ||
737
+ lower.includes("stuttering") ||
738
+ lower.includes("frame drop") ||
739
+ lower.includes("choppy") ||
740
+ lower.includes("battery drain")) {
710
741
  return "performance";
711
742
  }
712
- if (lower.includes("build") || lower.includes("gradle") || lower.includes("compile") || lower.includes("dependency") || lower.includes("cannot resolve") || lower.includes("duplicate class") || lower.includes("java version") || lower.includes("agp") || lower.includes("version mismatch") || lower.includes("unresolved reference")) {
743
+ if (lower.includes("build") ||
744
+ lower.includes("gradle") ||
745
+ lower.includes("compile") ||
746
+ lower.includes("dependency") ||
747
+ lower.includes("cannot resolve") ||
748
+ lower.includes("duplicate class") ||
749
+ lower.includes("java version") ||
750
+ lower.includes("agp") ||
751
+ lower.includes("version mismatch") ||
752
+ lower.includes("unresolved reference")) {
713
753
  return "build-error";
714
754
  }
715
- if (lower.includes("black screen") || lower.includes("blank") || lower.includes("nothing renders") || lower.includes("no rendering") || lower.includes("screen is black") || lower.includes("empty screen")) {
755
+ if (lower.includes("black screen") ||
756
+ lower.includes("blank") ||
757
+ lower.includes("nothing renders") ||
758
+ lower.includes("no rendering") ||
759
+ lower.includes("screen is black") ||
760
+ lower.includes("empty screen")) {
716
761
  return "black-screen";
717
762
  }
718
- if (lower.includes("material") || lower.includes("texture") || lower.includes("white model") || lower.includes("untextured") || lower.includes("pink model") || lower.includes("filamat") || lower.includes("transparent") || lower.includes("alpha")) {
763
+ if (lower.includes("material") ||
764
+ lower.includes("texture") ||
765
+ lower.includes("white model") ||
766
+ lower.includes("untextured") ||
767
+ lower.includes("pink model") ||
768
+ lower.includes("filamat") ||
769
+ lower.includes("transparent") ||
770
+ lower.includes("alpha")) {
719
771
  return "material";
720
772
  }
721
- if (lower.includes("animation") || lower.includes("animate") || lower.includes("morph") || lower.includes("bone") || lower.includes("skeleton") || lower.includes("keyframe") || lower.includes("animator")) {
773
+ if (lower.includes("animation") ||
774
+ lower.includes("animate") ||
775
+ lower.includes("morph") ||
776
+ lower.includes("bone") ||
777
+ lower.includes("skeleton") ||
778
+ lower.includes("keyframe") ||
779
+ lower.includes("animator")) {
722
780
  return "animation";
723
781
  }
724
- if (lower.includes("dark") || lower.includes("bright") || lower.includes("light") || lower.includes("shadow") || lower.includes("overexposed") || lower.includes("hdr") || lower.includes("environment") || lower.includes("ibl")) {
782
+ if (lower.includes("dark") ||
783
+ lower.includes("bright") ||
784
+ lower.includes("light") ||
785
+ lower.includes("shadow") ||
786
+ lower.includes("overexposed") ||
787
+ lower.includes("hdr") ||
788
+ lower.includes("environment") ||
789
+ lower.includes("ibl")) {
725
790
  return "lighting";
726
791
  }
727
- if (lower.includes("touch") || lower.includes("gesture") || lower.includes("tap") || lower.includes("drag") || lower.includes("rotate") || lower.includes("interact") || lower.includes("click") || lower.includes("select") || lower.includes("pinch") || lower.includes("zoom")) {
792
+ if (lower.includes("touch") ||
793
+ lower.includes("gesture") ||
794
+ lower.includes("tap") ||
795
+ lower.includes("drag") ||
796
+ lower.includes("rotate") ||
797
+ lower.includes("interact") ||
798
+ lower.includes("click") ||
799
+ lower.includes("select") ||
800
+ lower.includes("pinch") ||
801
+ lower.includes("zoom")) {
728
802
  return "gestures";
729
803
  }
730
- if (lower.includes("ios") || lower.includes("swift") || lower.includes("xcode") || lower.includes("spm") || lower.includes("realitykit") || lower.includes("usdz") || lower.includes("visionos") || lower.includes("macos") || lower.includes("apple")) {
804
+ if (lower.includes("ios") ||
805
+ lower.includes("swift") ||
806
+ lower.includes("xcode") ||
807
+ lower.includes("spm") ||
808
+ lower.includes("realitykit") ||
809
+ lower.includes("usdz") ||
810
+ lower.includes("visionos") ||
811
+ lower.includes("macos") ||
812
+ lower.includes("apple")) {
731
813
  return "ios";
732
814
  }
733
815
  return null;
@@ -0,0 +1,106 @@
1
+ /**
2
+ * `server/discover` — handshake-free discovery (MCP 2026-07-28).
3
+ *
4
+ * The 2026-07-28 revision introduced `server/discover`: one request a client
5
+ * MAY send **before** `initialize`, with no session and no negotiated version,
6
+ * which answers "who are you, what can you do, and which protocol revisions
7
+ * can you actually serve?". It is a `CacheableResult`, so the answer carries
8
+ * its own cache hints (`ttlMs`, `cacheScope`) and must stay stable inside that
9
+ * TTL.
10
+ *
11
+ * Two things are worth stating plainly, because they drove the design here
12
+ * (see issue #3349):
13
+ *
14
+ * 1. **We do not serve 2026-07-28.** `@modelcontextprotocol/sdk` 1.30.0 — the
15
+ * newest published release — tops out at `2025-11-25`
16
+ * (`SUPPORTED_PROTOCOL_VERSIONS`) and ships no `server/discover` at all.
17
+ * So `supportedVersions` below is read straight from the SDK rather than
18
+ * hardcoded: it advertises exactly what the handshake will really settle
19
+ * on, never a revision we cannot honour. Announcing a revision we don't
20
+ * serve would be the actual bug.
21
+ *
22
+ * 2. **Answering it anyway is still correct and useful.** `server/discover`
23
+ * is how a 2026-07-28-aware client learns, in one round trip, that this
24
+ * server speaks `2025-11-25` — the alternative is a `-32601 Method not
25
+ * found` that tells the client nothing and leaves it guessing. The method
26
+ * is cheap, purely informational, and requires no SDK upgrade.
27
+ *
28
+ * TODO(#3349): when `@modelcontextprotocol/sdk` ships 2026-07-28 support
29
+ * (result envelope with `resultType`, per-request `_meta` version negotiation,
30
+ * `subscriptions/listen`), bump the SDK and drop `SUPPORTED_PROTOCOL_VERSIONS`
31
+ * here for whatever the new release exposes. This file needs no other change:
32
+ * the advertised list is derived, not written down.
33
+ */
34
+ import { RequestSchema, SUPPORTED_PROTOCOL_VERSIONS } from "@modelcontextprotocol/sdk/types.js";
35
+ import { z } from "zod";
36
+ import { PACKAGE_VERSION } from "./generated/version.js";
37
+ import { UI_EXTENSION_ID, uiExtensionSettings } from "./widgets.js";
38
+ /** JSON-RPC method name defined by MCP 2026-07-28. */
39
+ export const DISCOVER_METHOD = "server/discover";
40
+ /**
41
+ * Zod schema for the incoming request, in the shape the SDK's
42
+ * `setRequestHandler` expects (a `method` literal it can route on).
43
+ */
44
+ export const DiscoverRequestSchema = RequestSchema.extend({
45
+ method: z.literal(DISCOVER_METHOD),
46
+ });
47
+ /**
48
+ * Server capabilities, declared once and shared between the `Server`
49
+ * constructor and `server/discover` so the two can never drift apart.
50
+ *
51
+ * `extensions` carries the MCP Apps declaration (#3192). The server has shipped
52
+ * the widget resource, its `text/html;profile=mcp-app` mime type and the
53
+ * `_meta.ui.resourceUri` pointers on tool declarations for several releases —
54
+ * but never named the extension, so a host that follows the negotiation rules
55
+ * had nothing to switch on. The extension *framework* is versioned into
56
+ * 2026-07-28, yet the `ext-apps` spec advertises the very same capability over
57
+ * `protocolVersion: "2024-11-05"` in its own example: a party declares what it
58
+ * supports, and a peer that does not know the key ignores it. So this is
59
+ * additive on every revision we serve, and does not wait on an SDK bump.
60
+ */
61
+ export const SERVER_CAPABILITIES = {
62
+ resources: {},
63
+ tools: {},
64
+ extensions: { [UI_EXTENSION_ID]: uiExtensionSettings() },
65
+ };
66
+ /** Server identity, likewise shared with the `Server` constructor. */
67
+ export const SERVER_INFO = { name: "sceneview-mcp", version: PACKAGE_VERSION };
68
+ /**
69
+ * How long a client may cache the discover answer. Everything in it —
70
+ * identity, capabilities, the SDK's revision list — is fixed at build time and
71
+ * cannot change while the process lives, so an hour is conservative rather
72
+ * than optimistic.
73
+ */
74
+ export const DISCOVER_TTL_MS = 3_600_000;
75
+ /**
76
+ * Natural-language guidance, mirrored from the package description. Kept short
77
+ * on purpose: per the spec it should not duplicate tool descriptions.
78
+ */
79
+ const DISCOVER_INSTRUCTIONS = "SceneView MCP — the full SceneView SDK (Android/Compose + Filament, iOS/SwiftUI + RealityKit, AR via ARCore/ARKit) " +
80
+ "as tools and resources, so an AI writes correct, compilable SceneView code. Read the `sceneview://api` resource " +
81
+ "before writing any SceneView code.";
82
+ /**
83
+ * Builds the `DiscoverResult`.
84
+ *
85
+ * Every field is derived from a build-time constant, which is what makes the
86
+ * result stable across calls inside its TTL — a requirement, since a client
87
+ * that caches for `ttlMs` would otherwise be handed a moving target.
88
+ *
89
+ * `cacheScope` is `"public"`: nothing here is user-specific. The payload is
90
+ * identical whether or not a Pro API key is configured (the key only affects
91
+ * how individual tool *calls* are routed, never identity or capabilities), so
92
+ * a shared proxy may serve one cached copy to everyone.
93
+ */
94
+ export function buildDiscoverResult() {
95
+ return {
96
+ resultType: "complete",
97
+ ttlMs: DISCOVER_TTL_MS,
98
+ cacheScope: "public",
99
+ // Copied so a caller mutating the array cannot corrupt the SDK's constant
100
+ // — and so two successive calls stay `deepEqual` rather than aliased.
101
+ supportedVersions: [...SUPPORTED_PROTOCOL_VERSIONS],
102
+ capabilities: { ...SERVER_CAPABILITIES },
103
+ serverInfo: { ...SERVER_INFO },
104
+ instructions: DISCOVER_INSTRUCTIONS,
105
+ };
106
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Material, collision, model optimization, and web rendering guides.
5
5
  */
6
- import { LATEST_SCENEVIEW_RELEASE } from "./generated/version.js";
6
+ import { FILAMENT_WEB_NPM_VERSION, FILAMENT_WEBSITE_VERSION, LATEST_SCENEVIEW_RELEASE, } from "./generated/version.js";
7
7
  // ─── Material Guide ─────────────────────────────────────────────────────────
8
8
  export const MATERIAL_GUIDE = `# SceneView Material & Shader Guide
9
9
 
@@ -407,7 +407,7 @@ export const WEB_RENDERING_GUIDE = `# SceneView Web Rendering Guide (Filament.js
407
407
 
408
408
  ## Architecture
409
409
 
410
- SceneView Web uses **Filament.js v1.70.2** — Google's Filament engine compiled to WebAssembly. This is the **same PBR rendering engine** as SceneView Android, ensuring visual parity.
410
+ SceneView Web uses **Filament.js v${FILAMENT_WEBSITE_VERSION}** (the runtime vendored with \`sceneview.js\`; the Kotlin/JS build pins the npm \`filament\` package at v${FILAMENT_WEB_NPM_VERSION}) — Google's Filament engine compiled to WebAssembly. This is the **same PBR rendering engine** as SceneView Android, ensuring visual parity.
411
411
 
412
412
  \`\`\`
413
413
  Browser → WebGL2 → Filament.js (WASM) → GPU
@@ -518,7 +518,7 @@ camera {
518
518
 
519
519
  | Feature | SceneView (Filament.js) | model-viewer |
520
520
  |---------|------------------------|--------------|
521
- | **Engine** | Filament v1.70.2 WASM | Filament WASM (same engine) |
521
+ | **Engine** | Filament v${FILAMENT_WEBSITE_VERSION} WASM | Filament WASM (same engine) |
522
522
  | **Bundle size** | ~215KB JS + 3.3MB WASM | ~800 KB (subset) |
523
523
  | **Procedural geometry** | Yes (cubes, spheres, etc.) | No |
524
524
  | **Custom materials** | Yes (full Filament API) | Limited |