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.
@@ -4,5 +4,18 @@
4
4
  // build time so the MCP server, telemetry, and the install-snippet
5
5
  // generators all report the actually-published versions instead of
6
6
  // stale hardcoded constants. See #941.
7
- export const PACKAGE_VERSION = "4.0.15";
8
- export const LATEST_SCENEVIEW_RELEASE = "4.25.0";
7
+ export const PACKAGE_VERSION = "4.1.0";
8
+ export const LATEST_SCENEVIEW_RELEASE = "4.41.0";
9
+ // The pub.dev coordinate for `flutter_sceneview`, read from the plugin's
10
+ // README. Deliberately NOT LATEST_SCENEVIEW_RELEASE: pub.dev lags the SDK,
11
+ // and a caret range against an unpublished version cannot be resolved.
12
+ export const LATEST_FLUTTER_PUB_RELEASE = "4.39.0";
13
+ // Web Filament runtimes, from ../gradle/libs.versions.toml (#3173).
14
+ // FILAMENT_WEB_NPM_VERSION is the npm `filament` pin (CDN artifacts, Kotlin/JS);
15
+ // FILAMENT_WEBSITE_VERSION is the runtime vendored for sceneview.js.
16
+ export const FILAMENT_WEB_NPM_VERSION = "1.52.3";
17
+ export const FILAMENT_WEBSITE_VERSION = "1.72.1";
18
+ // SceneViewSwift node types: every `public struct *Node` under
19
+ // SceneViewSwift/Sources (#2999). Enum namespaces are not nodes.
20
+ export const IOS_NODE_TYPES = ["AnchorNode", "AugmentedImageNode", "BillboardNode", "CameraNode", "DynamicSkyNode", "FogNode", "GeometryNode", "ImageNode", "LightNode", "LineNode", "MeshNode", "ModelNode", "PathNode", "PhysicsNode", "ReflectionProbeNode", "ShapeNode", "SpatialAudioNode", "TextNode", "VideoNode", "ViewNode"];
21
+ export const IOS_NODE_TYPE_COUNT = 20;
package/dist/guides.js CHANGED
@@ -33,11 +33,11 @@ KMP shares **logic**, not **rendering**. Each platform uses its native renderer.
33
33
  - **3D rendering** via Google Filament: PBR materials, HDR environments, glTF/GLB models, post-processing.
34
34
  - **AR** via ARCore: plane detection, hit testing, anchors, cloud anchors, augmented images, depth, light estimation, point cloud.
35
35
  - **Compose-native DSL**: all nodes are \`@Composable\` functions inside \`SceneView { }\` or \`ARSceneView { }\`.
36
- - **44+ node types**: ModelNode, LightNode, AnchorNode, CameraNode, TextNode, PathNode, ViewNode, PlaneNode, SphereNode, CylinderNode, CubeNode, DynamicSkyNode, FogNode, ReflectionProbeNode, PhysicsNode, BillboardNode, LineNode, and more.
36
+ - **48+ node types**: ModelNode, LightNode, AnchorNode, CameraNode, TextNode, PathNode, ViewNode, PlaneNode, SphereNode, CylinderNode, CubeNode, DynamicSkyNode, FogNode, ReflectionProbeNode, PhysicsNode, BillboardNode, LineNode, and more.
37
37
 
38
38
  ## Apple — Alpha (SceneViewSwift)
39
39
 
40
- - **3D + AR** in SwiftUI via RealityKit — iOS 17+ / macOS 14+ / visionOS 1+
40
+ - **3D + AR** in SwiftUI via RealityKit — iOS 18+ / macOS 15+ / visionOS 2+
41
41
  - Node types: ModelNode, AnchorNode, GeometryNode, LightNode, CameraNode, ImageNode, VideoNode, PhysicsNode, AugmentedImageNode
42
42
  - PBR material system with textures
43
43
  - Swift Package Manager distribution
@@ -55,8 +55,12 @@ Shared Kotlin Multiplatform module providing:
55
55
 
56
56
  ## Upcoming
57
57
 
58
- - **v4.0.0**: SceneViewSwift stabilization, API parity with Android core nodes, KMP core XCFramework consumption
59
- - **v4.0.0**: Android XR, visionOS spatial computing, cross-framework bridges (Flutter, React Native)
58
+ - **SceneViewSwift stabilization** — API parity with the Android core nodes, KMP core consumed as an XCFramework
59
+ - **Android XR and visionOS spatial computing**
60
+ - **Cross-framework bridges** — Flutter and React Native over the same native cores
61
+
62
+ These are not tied to a version number: \`4\` is the current major line, and \`5.0.0\` is a
63
+ deliberate milestone rather than an automatic bump.
60
64
 
61
65
  ## How to Stay Updated
62
66
 
@@ -319,7 +323,7 @@ export const TROUBLESHOOTING_GUIDE = `# SceneView Troubleshooting Guide
319
323
 
320
324
  ### SPM Package Resolution Fails
321
325
  **Fix:**
322
- - Ensure Xcode 15.0+ (required for iOS 17 / visionOS targets).
326
+ - Ensure Xcode 16.0+ (required for the iOS 18 / visionOS 2 targets and Swift 6).
323
327
  - Clean derived data: Xcode → Product → Clean Build Folder, then File → Packages → Reset Package Caches.
324
328
  - Check the URL is exactly: \`https://github.com/sceneview/sceneview\`
325
329
 
@@ -353,7 +357,7 @@ Without this entry, the app will crash on camera access.
353
357
 
354
358
  ## 3. Minimum Platform
355
359
 
356
- AR requires **iOS 17.0+**. ARKit is not available on macOS or visionOS via \`ARSceneView\` (visionOS uses \`ARKitSession\` directly).
360
+ AR requires **iOS 18.0+**. ARKit is not available on macOS or visionOS via \`ARSceneView\` (visionOS uses \`ARKitSession\` directly).
357
361
 
358
362
  ## 4. Basic AR Template
359
363
 
package/dist/http.js ADDED
@@ -0,0 +1,178 @@
1
+ /**
2
+ * Streamable HTTP entrypoint — `sceneview-mcp --http`.
3
+ *
4
+ * This is the remote surface for hosts that cannot spawn a local process:
5
+ * the ChatGPT / Codex Plugins Directory and the OpenAI API `mcp` tool both
6
+ * require MCP's Streamable HTTP transport at a public `/mcp` URL. Deploy this
7
+ * anywhere Node runs (a VPS, a container, a PaaS) behind HTTPS and point the
8
+ * connector at `https://<host>/mcp`.
9
+ *
10
+ * Design:
11
+ *
12
+ * - **Stateless.** Every request gets a fresh `Server` + transport with
13
+ * `sessionIdGenerator: undefined`, the SDK's documented stateless pattern.
14
+ * No session store, so any number of instances can sit behind a load
15
+ * balancer with no affinity, and a crashed request leaks nothing.
16
+ * - **Everything but the local-only tools.** The server is built with
17
+ * `surface: "remote"` (`./server.ts`): `tools/list` omits the three tools
18
+ * of `./surfaces.ts` that need the caller's own third-party credentials,
19
+ * and refuses those names at call time. Every tool is free; there is
20
+ * simply no key on a shared endpoint to bill a third party to.
21
+ * - **No framework.** Node's built-in `http` module and the SDK — zero new
22
+ * runtime dependencies for the npm package.
23
+ *
24
+ * Routes:
25
+ *
26
+ * POST /mcp JSON-RPC over Streamable HTTP
27
+ * GET / DELETE /mcp 405 — the spec lets a server decline
28
+ * the standalone SSE stream, and with
29
+ * no sessions there is nothing to
30
+ * DELETE. (Left to the transport, a
31
+ * GET would hold an SSE stream — and a
32
+ * whole Server — open per request.)
33
+ * GET /health {"status":"ok","version":"…"}
34
+ * GET /.well-known/openai-apps-challenge
35
+ * OpenAI domain verification: the
36
+ * value of OPENAI_APPS_CHALLENGE_TOKEN
37
+ * as text/plain, 404 when unset
38
+ * OPTIONS * CORS preflight
39
+ * anything else 404
40
+ *
41
+ * Configuration (environment): PORT (default 3333), HOST (default
42
+ * 127.0.0.1 — bind 0.0.0.0 explicitly to expose it), and the same
43
+ * SCENEVIEW_TELEMETRY / SKETCHFAB_API_KEY / TRIPO_API_KEY knobs as stdio.
44
+ */
45
+ import { createServer as createNodeServer, } from "node:http";
46
+ import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
47
+ import { PACKAGE_VERSION } from "./generated/version.js";
48
+ import { createSceneViewServer } from "./server.js";
49
+ export const DEFAULT_PORT = 3333;
50
+ export const DEFAULT_HOST = "127.0.0.1";
51
+ export const MCP_PATH = "/mcp";
52
+ export const HEALTH_PATH = "/health";
53
+ export const OPENAI_APPS_CHALLENGE_PATH = "/.well-known/openai-apps-challenge";
54
+ export const OPENAI_APPS_CHALLENGE_ENV = "OPENAI_APPS_CHALLENGE_TOKEN";
55
+ /**
56
+ * CORS: any origin may talk to the server (browser-based MCP clients and
57
+ * the widget host both need it), with the headers MCP clients actually send
58
+ * and the one response header they need to read back.
59
+ */
60
+ export const CORS_HEADERS = {
61
+ "Access-Control-Allow-Origin": "*",
62
+ "Access-Control-Allow-Methods": "GET, POST, DELETE, OPTIONS",
63
+ "Access-Control-Allow-Headers": "Content-Type, Accept, Authorization, Mcp-Session-Id, Mcp-Protocol-Version",
64
+ "Access-Control-Expose-Headers": "Mcp-Session-Id",
65
+ "Access-Control-Max-Age": "86400",
66
+ };
67
+ function applyCors(res) {
68
+ for (const [name, value] of Object.entries(CORS_HEADERS))
69
+ res.setHeader(name, value);
70
+ }
71
+ function sendJson(res, status, body) {
72
+ res.writeHead(status, { "Content-Type": "application/json" });
73
+ res.end(JSON.stringify(body));
74
+ }
75
+ /**
76
+ * One MCP request, start to finish: fresh server, fresh transport, and both
77
+ * torn down when the response closes. Stateless per the SDK docs.
78
+ */
79
+ async function handleMcp(req, res) {
80
+ const server = createSceneViewServer({ surface: "remote" });
81
+ const transport = new StreamableHTTPServerTransport({
82
+ sessionIdGenerator: undefined,
83
+ // Plain JSON responses instead of an SSE stream per POST: simpler for
84
+ // curl and for the OpenAI connector, and there is no session to stream
85
+ // server-initiated messages on anyway.
86
+ enableJsonResponse: true,
87
+ });
88
+ res.on("close", () => {
89
+ void transport.close();
90
+ void server.close();
91
+ });
92
+ await server.connect(transport);
93
+ await transport.handleRequest(req, res);
94
+ }
95
+ /**
96
+ * The request listener, exported so tests can mount it on an ephemeral port
97
+ * and so embedders can hang it off their own `http.Server`.
98
+ */
99
+ export function createRequestListener(options = {}) {
100
+ const env = options.env ?? process.env;
101
+ return (req, res) => {
102
+ applyCors(res);
103
+ const method = req.method ?? "GET";
104
+ const path = new URL(req.url ?? "/", "http://localhost").pathname;
105
+ if (method === "OPTIONS") {
106
+ res.writeHead(204);
107
+ res.end();
108
+ return;
109
+ }
110
+ if (path === MCP_PATH) {
111
+ if (method !== "POST") {
112
+ res.writeHead(405, { Allow: "POST, OPTIONS", "Content-Type": "application/json" });
113
+ res.end(JSON.stringify({
114
+ jsonrpc: "2.0",
115
+ error: { code: -32000, message: "Method not allowed." },
116
+ id: null,
117
+ }));
118
+ return;
119
+ }
120
+ handleMcp(req, res).catch((err) => {
121
+ process.stderr.write(`[sceneview-mcp] /mcp request failed: ${String(err)}\n`);
122
+ if (!res.headersSent) {
123
+ sendJson(res, 500, {
124
+ jsonrpc: "2.0",
125
+ error: { code: -32603, message: "Internal server error" },
126
+ id: null,
127
+ });
128
+ }
129
+ else {
130
+ res.end();
131
+ }
132
+ });
133
+ return;
134
+ }
135
+ if (path === HEALTH_PATH && method === "GET") {
136
+ sendJson(res, 200, { status: "ok", version: PACKAGE_VERSION });
137
+ return;
138
+ }
139
+ if (path === OPENAI_APPS_CHALLENGE_PATH && method === "GET") {
140
+ const token = env[OPENAI_APPS_CHALLENGE_ENV];
141
+ if (!token) {
142
+ sendJson(res, 404, { error: "Not found" });
143
+ return;
144
+ }
145
+ // OpenAI's verifier expects the token and nothing else — no JSON, no
146
+ // trailing newline.
147
+ res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
148
+ res.end(token);
149
+ return;
150
+ }
151
+ sendJson(res, 404, { error: "Not found" });
152
+ };
153
+ }
154
+ /** Boots the HTTP server and resolves once it is listening. */
155
+ export function startHttpServer(options = {}) {
156
+ const env = options.env ?? process.env;
157
+ const port = options.port ?? (env.PORT ? Number(env.PORT) : DEFAULT_PORT);
158
+ const host = options.host ?? env.HOST ?? DEFAULT_HOST;
159
+ const log = options.log === undefined ? (line) => process.stderr.write(`${line}\n`) : options.log;
160
+ if (!Number.isInteger(port) || port < 0 || port > 65535) {
161
+ return Promise.reject(new Error(`[sceneview-mcp] invalid PORT: ${env.PORT}`));
162
+ }
163
+ const httpServer = createNodeServer(createRequestListener({ env }));
164
+ return new Promise((resolve, reject) => {
165
+ httpServer.once("error", reject);
166
+ httpServer.listen(port, host, () => {
167
+ httpServer.off("error", reject);
168
+ const address = httpServer.address();
169
+ const boundPort = typeof address === "object" && address ? address.port : port;
170
+ if (log && env.SCENEVIEW_MCP_QUIET !== "1") {
171
+ log(`[sceneview-mcp] v${PACKAGE_VERSION} — HTTP (remote tool surface)`);
172
+ log(`[sceneview-mcp] MCP endpoint: http://${host}:${boundPort}${MCP_PATH}`);
173
+ log(`[sceneview-mcp] Health: http://${host}:${boundPort}${HEALTH_PATH}`);
174
+ }
175
+ resolve(httpServer);
176
+ });
177
+ });
178
+ }
package/dist/index.js CHANGED
@@ -1,156 +1,51 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * stdio entrypoint for the `sceneview-mcp` npm package.
3
+ * CLI entrypoint for the `sceneview-mcp` npm package.
4
4
  *
5
- * This file used to be a 1 200+ line monolith that defined every tool,
6
- * its handler, and the stdio transport all at once. The tool definitions
7
- * and handler logic now live in `./tools/`, so this file is a thin
8
- * adapter that wires the library into the MCP stdio server plus the
9
- * two MCP resources (`sceneview://api`, `sceneview://known-issues`) and
10
- * the proxy dispatch for Pro-tier tools (`./proxy.ts`).
5
+ * Two transports, one server (`./server.ts`):
11
6
  *
12
- * IMPORTANT: the runtime behaviour must stay identical to v4.0.0 for
7
+ * npx sceneview-mcp stdio — Claude Desktop, Claude Code, Cursor,
8
+ * Windsurf and every other local MCP client.
9
+ * npx sceneview-mcp --http Streamable HTTP on `/mcp` — the remote surface
10
+ * for ChatGPT / Codex and the OpenAI API `mcp`
11
+ * tool (`./http.ts`).
12
+ *
13
+ * This file used to be a 1 200+ line monolith that defined every tool, its
14
+ * handler, and the stdio transport all at once. The tool definitions and
15
+ * handler logic live in `./tools/`, the `Server` wiring (resources, tool
16
+ * list/call) in `./server.ts`, so this file only picks a transport.
17
+ *
18
+ * IMPORTANT: the stdio runtime behaviour must stay identical to v4.0.0 for
13
19
  * existing npm consumers. Do not reorder checks, do not change content
14
- * strings, do not touch disclaimers.
20
+ * strings, do not touch disclaimers, do not print the banner differently.
15
21
  */
16
- import { Server } from "@modelcontextprotocol/sdk/server/index.js";
17
22
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
18
- import { CallToolRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
19
- import { fetchKnownIssues } from "./issues.js";
20
- import { DEMO_WITH_SETTINGS_EXAMPLE, SKETCHFAB_STREAMING_EXAMPLE, } from "./examples.js";
21
- import { recordClientInit, recordToolCall } from "./telemetry.js";
22
- import { isProTool, getToolTier } from "./tiers.js";
23
- import { dispatchProxyToolCall, isProxyConfigured, DEFAULT_PRICING_URL, } from "./proxy.js";
24
- import { API_DOCS, TOOL_DEFINITIONS, dispatchTool, } from "./tools/index.js";
25
- import { LATEST_SCENEVIEW_RELEASE, PACKAGE_VERSION } from "./generated/version.js";
26
- // ─── v4 lite-mode startup banner ─────────────────────────────────────────────
23
+ import { PACKAGE_VERSION } from "./generated/version.js";
24
+ import { createSceneViewServer } from "./server.js";
25
+ // ─── Startup banner ──────────────────────────────────────────────────────────
27
26
  //
28
27
  // MCP servers must keep stdout clean for JSON-RPC, so we log to stderr.
29
- // Claude Desktop surfaces this in the server's "Logs" panel. The banner
30
- // tells the user which mode they're in (hosted vs free) and where to
31
- // upgrade, without blocking the transport handshake.
28
+ // Claude Desktop surfaces this in the server's "Logs" panel.
32
29
  function logStartupBanner() {
33
30
  if (process.env.SCENEVIEW_MCP_QUIET === "1")
34
31
  return;
35
- const proxied = isProxyConfigured();
36
- const mode = proxied ? "HOSTED (Pro tools → gateway)" : "LITE (free tools only)";
37
32
  const lines = [
38
- `[sceneview-mcp] v${PACKAGE_VERSION} — ${mode}`,
39
- proxied
40
- ? `[sceneview-mcp] Pro tool calls will be forwarded to the hosted gateway.`
41
- : `[sceneview-mcp] All setup, migration & docs tools are free. Pro packages (Automotive/Gaming/Healthcare/Interior) at ${DEFAULT_PRICING_URL}`,
33
+ `[sceneview-mcp] v${PACKAGE_VERSION}`,
34
+ `[sceneview-mcp] Every tool is free. No account, no API key, no telemetry ` +
35
+ `you cannot turn off (SCENEVIEW_TELEMETRY=0).`,
42
36
  ];
43
37
  for (const line of lines)
44
38
  process.stderr.write(`${line}\n`);
45
39
  }
46
- logStartupBanner();
47
- const server = new Server({ name: "sceneview-mcp", version: PACKAGE_VERSION }, { capabilities: { resources: {}, tools: {} } });
48
- // ─── Telemetry (anonymous, opt-out via SCENEVIEW_TELEMETRY=0) ────────────────
49
- //
50
- // Fire once when the client finishes the handshake. See `telemetry.ts` and
51
- // `PRIVACY.md` for what's collected and how to opt out.
52
- server.oninitialized = () => {
53
- recordClientInit(server.getClientVersion());
54
- };
55
- // ─── Resources ───────────────────────────────────────────────────────────────
56
- server.setRequestHandler(ListResourcesRequestSchema, async () => ({
57
- resources: [
58
- {
59
- uri: "sceneview://api",
60
- name: "SceneView API Reference",
61
- description: `Complete SceneView ${LATEST_SCENEVIEW_RELEASE} API — SceneView, ARSceneView, SceneScope DSL, ARSceneScope DSL, node types, resource loading, camera, gestures, math types, threading rules, and common patterns. Read this before writing any SceneView code.`,
62
- mimeType: "text/markdown",
63
- },
64
- {
65
- uri: "sceneview://known-issues",
66
- name: "SceneView Open GitHub Issues",
67
- description: "Live list of open issues from the SceneView GitHub repository. Check this before reporting a bug or when something isn't working — there may already be a known workaround.",
68
- mimeType: "text/markdown",
69
- },
70
- {
71
- uri: "examples://demo-with-settings",
72
- name: "Example — DemoScaffold v2 (full-screen scene + ModalBottomSheet)",
73
- description: "Pattern for full-screen 3D / AR scene + Material 3 ModalBottomSheet controls. The DemoScaffold v2 contract used by every demo in samples/android-demo (issue #1154, PR #1169). Read this before adding a new demo with settings.",
74
- mimeType: "text/markdown",
75
- },
76
- {
77
- uri: "examples://sketchfab-streaming",
78
- name: "Example — Stream Sketchfab CC-BY models into a SceneView demo",
79
- description: "Pattern for streaming CC-BY licensed glTF models from Sketchfab on demand instead of bundling 30 MB of GLBs in the APK. Uses SketchfabAssetResolver + SampleAssets registry + per-slug bundled fallback (Stage 2 of umbrella issue #1152). Read this before adding a streamed demo.",
80
- mimeType: "text/markdown",
81
- },
82
- ],
83
- }));
84
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
85
- switch (request.params.uri) {
86
- case "sceneview://api":
87
- return {
88
- contents: [{ uri: "sceneview://api", mimeType: "text/markdown", text: API_DOCS }],
89
- };
90
- case "sceneview://known-issues": {
91
- const issues = await fetchKnownIssues();
92
- return {
93
- contents: [{ uri: "sceneview://known-issues", mimeType: "text/markdown", text: issues }],
94
- };
95
- }
96
- case "examples://demo-with-settings":
97
- return {
98
- contents: [{
99
- uri: "examples://demo-with-settings",
100
- mimeType: "text/markdown",
101
- text: DEMO_WITH_SETTINGS_EXAMPLE,
102
- }],
103
- };
104
- case "examples://sketchfab-streaming":
105
- return {
106
- contents: [{
107
- uri: "examples://sketchfab-streaming",
108
- mimeType: "text/markdown",
109
- text: SKETCHFAB_STREAMING_EXAMPLE,
110
- }],
111
- };
112
- default:
113
- throw new Error(`Unknown resource: ${request.params.uri}`);
114
- }
115
- });
116
- // ─── Tools ───────────────────────────────────────────────────────────────────
117
- server.setRequestHandler(ListToolsRequestSchema, async () => {
118
- // v4 lite mode: we trust the gateway to enforce Pro access at call time,
119
- // so listing is purely cosmetic here. If no API key is set we still prefix
120
- // Pro tool descriptions with "[PRO]" so the AI knows an upgrade is needed
121
- // and surfaces the upsell in its responses; with a key we expose the full
122
- // list unmodified.
123
- const unlocked = isProxyConfigured();
124
- const tools = TOOL_DEFINITIONS.map((tool) => {
125
- if (unlocked || !isProTool(tool.name))
126
- return tool;
127
- return { ...tool, description: `[PRO] ${tool.description}` };
128
- });
129
- return { tools };
130
- });
131
- server.setRequestHandler(CallToolRequestSchema, async (request) => {
132
- const toolName = request.params.name;
133
- const args = request.params.arguments;
134
- // Record anonymous telemetry (fire-and-forget, non-blocking, opt-out via
135
- // SCENEVIEW_TELEMETRY=0). See `telemetry.ts` and `PRIVACY.md`.
136
- recordToolCall(toolName, getToolTier(toolName));
137
- // ── v4 lite-mode routing ─────────────────────────────────────────────────
138
- //
139
- // Free tools execute locally, same as 3.6.x. Pro tools are forwarded to
140
- // the hosted gateway at sceneview-mcp.mcp-tools-lab.workers.dev/mcp —
141
- // that's where auth, metering, and Stripe live. If no API key is set,
142
- // `dispatchProxyToolCall` returns a friendly stub that points at the
143
- // pricing page (handles the upsell itself, no separate denied-response
144
- // step needed).
145
- if (isProTool(toolName)) {
146
- const result = await dispatchProxyToolCall(toolName, args);
147
- return result;
148
- }
149
- // The dispatcher returns the narrower SceneView `ToolResult` shape, which
150
- // structurally matches the MCP SDK's `CallToolResult` but TS can't prove
151
- // it (the SDK's zod-derived type has additional optional members).
152
- const result = await dispatchTool(toolName, args);
153
- return result;
154
- });
155
- const transport = new StdioServerTransport();
156
- await server.connect(transport);
40
+ if (process.argv.includes("--http")) {
41
+ // Remote surface. Loaded lazily so the stdio path never pays for
42
+ // `node:http` + the Streamable HTTP transport it does not use.
43
+ const { startHttpServer } = await import("./http.js");
44
+ await startHttpServer();
45
+ }
46
+ else {
47
+ logStartupBanner();
48
+ const server = createSceneViewServer({ surface: "stdio" });
49
+ const transport = new StdioServerTransport();
50
+ await server.connect(transport);
51
+ }
package/dist/issues.js CHANGED
@@ -13,7 +13,7 @@ export const COMMON_ISSUES = [
13
13
  title: "rememberModelInstance returns null — model never appears",
14
14
  symptom: "Model never shows up. `rememberModelInstance` always returns `null`.",
15
15
  cause: "Either the asset path is wrong (file not in `src/main/assets/`), the GLB file is corrupt, or the code doesn't handle the null loading state. `rememberModelInstance` returns `null` while loading AND if the file fails.",
16
- solution: "1) Verify the file exists in `src/main/assets/models/`. 2) Test the GLB in https://gltf-viewer.donmccurdy.com/. 3) Add `Log.d(\"SV\", \"model: $modelInstance\")` to see if it's null vs loading. 4) Show a loading indicator while null.",
16
+ solution: '1) Verify the file exists in `src/main/assets/models/`. 2) Test the GLB in https://gltf-viewer.donmccurdy.com/. 3) Add `Log.d("SV", "model: $modelInstance")` to see if it\'s null vs loading. 4) Show a loading indicator while null.',
17
17
  category: "model-loading",
18
18
  },
19
19
  {
@@ -162,13 +162,14 @@ export function migrateCode(code) {
162
162
  // Apply each rule
163
163
  for (const rule of MIGRATION_RULES) {
164
164
  const pattern = new RegExp(rule.pattern.source, rule.pattern.flags);
165
- let match;
166
165
  const localMatches = [];
167
166
  // Collect matches first
168
- while ((match = pattern.exec(result)) !== null) {
167
+ let match = pattern.exec(result);
168
+ while (match !== null) {
169
169
  localMatches.push({ index: match.index, match: match[0] });
170
170
  if (rule.once)
171
171
  break;
172
+ match = pattern.exec(result);
172
173
  }
173
174
  if (localMatches.length > 0) {
174
175
  // Compute line numbers from original positions
@@ -210,7 +211,8 @@ export function migrateCode(code) {
210
211
  if (code.includes("ArFragment")) {
211
212
  warnings.push("`ArFragment` is the old Android View-based AR component. In 3.0, use the `ARSceneView` composable in Jetpack Compose instead.");
212
213
  }
213
- if (code.includes("Dispatchers.IO") && (code.includes("modelLoader") || code.includes("materialLoader"))) {
214
+ if (code.includes("Dispatchers.IO") &&
215
+ (code.includes("modelLoader") || code.includes("materialLoader"))) {
214
216
  warnings.push("**CRITICAL**: Filament calls (modelLoader, materialLoader) on `Dispatchers.IO` will cause SIGABRT. Use `Dispatchers.Main` or `rememberModelInstance` in composables.");
215
217
  }
216
218
  if (code.includes("setRenderable")) {