sceneview-mcp 4.0.16 → 4.1.1
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.
- package/README.md +246 -62
- package/dist/analyze-project.js +4 -2
- package/dist/artifact.js +38 -13
- package/dist/debug-issue.js +101 -19
- package/dist/discover.js +106 -0
- package/dist/extra-guides.js +3 -3
- package/dist/generate-scene.js +380 -61
- package/dist/generated/llms-txt.js +1 -1
- package/dist/generated/symbols.js +1040 -22
- package/dist/generated/version.js +12 -3
- package/dist/guides.js +10 -6
- package/dist/http.js +178 -0
- package/dist/index.js +34 -139
- package/dist/issues.js +1 -1
- package/dist/migrate-code.js +5 -3
- package/dist/platform-setup.js +33 -16
- package/dist/samples.js +31 -31
- package/dist/search-models.js +1 -1
- package/dist/server.js +197 -0
- package/dist/surfaces.js +32 -0
- package/dist/telemetry.js +14 -8
- package/dist/tools/definitions.js +176 -14
- package/dist/tools/handler.js +207 -66
- package/dist/tools/index.js +4 -4
- package/dist/tools/types.js +0 -4
- package/dist/validator.js +262 -161
- package/dist/widgets.js +915 -0
- package/package.json +16 -12
- package/dist/proxy.js +0 -176
- package/dist/tiers.js +0 -138
|
@@ -4,9 +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.
|
|
8
|
-
export const LATEST_SCENEVIEW_RELEASE = "4.
|
|
7
|
+
export const PACKAGE_VERSION = "4.1.1";
|
|
8
|
+
export const LATEST_SCENEVIEW_RELEASE = "4.50.0";
|
|
9
9
|
// The pub.dev coordinate for `flutter_sceneview`, read from the plugin's
|
|
10
10
|
// README. Deliberately NOT LATEST_SCENEVIEW_RELEASE: pub.dev lags the SDK,
|
|
11
11
|
// and a caret range against an unpublished version cannot be resolved.
|
|
12
|
-
export const LATEST_FLUTTER_PUB_RELEASE = "4.
|
|
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
|
-
- **
|
|
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
|
|
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
|
-
- **
|
|
59
|
-
- **
|
|
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
|
|
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
|
|
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
|
-
*
|
|
3
|
+
* CLI entrypoint for the `sceneview-mcp` npm package.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
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
|
-
*
|
|
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 {
|
|
19
|
-
import {
|
|
20
|
-
|
|
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.
|
|
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}
|
|
39
|
-
|
|
40
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
server.
|
|
57
|
-
|
|
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:
|
|
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
|
{
|
package/dist/migrate-code.js
CHANGED
|
@@ -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
|
-
|
|
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") &&
|
|
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")) {
|
package/dist/platform-setup.js
CHANGED
|
@@ -4,8 +4,16 @@
|
|
|
4
4
|
* Setup guides for every supported SceneView platform.
|
|
5
5
|
* Consolidates Android, iOS, Web, Flutter, React Native, Desktop, and TV.
|
|
6
6
|
*/
|
|
7
|
-
import { LATEST_FLUTTER_PUB_RELEASE, LATEST_SCENEVIEW_RELEASE } from "./generated/version.js";
|
|
8
|
-
export const PLATFORM_IDS = [
|
|
7
|
+
import { IOS_NODE_TYPE_COUNT, LATEST_FLUTTER_PUB_RELEASE, LATEST_SCENEVIEW_RELEASE, } from "./generated/version.js";
|
|
8
|
+
export const PLATFORM_IDS = [
|
|
9
|
+
"android",
|
|
10
|
+
"ios",
|
|
11
|
+
"web",
|
|
12
|
+
"flutter",
|
|
13
|
+
"react-native",
|
|
14
|
+
"desktop",
|
|
15
|
+
"tv",
|
|
16
|
+
];
|
|
9
17
|
const ANDROID_3D = `## SceneView Android — 3D Setup
|
|
10
18
|
|
|
11
19
|
### 1. Gradle Dependencies
|
|
@@ -248,7 +256,7 @@ struct ContentView: View {
|
|
|
248
256
|
|
|
249
257
|
### 5. Available Node Types
|
|
250
258
|
|
|
251
|
-
SceneViewSwift provides
|
|
259
|
+
SceneViewSwift provides ${IOS_NODE_TYPE_COUNT} node types:
|
|
252
260
|
|
|
253
261
|
| Node | Purpose |
|
|
254
262
|
|------|---------|
|
|
@@ -262,11 +270,15 @@ SceneViewSwift provides 16 node types:
|
|
|
262
270
|
| \`LineNode\` | Line segments between 3D points |
|
|
263
271
|
| \`PathNode\` | Connected line paths through multiple points |
|
|
264
272
|
| \`MeshNode\` | Custom mesh geometry with vertex data |
|
|
273
|
+
| \`ShapeNode\` | 2D polygon shapes, flat or extruded |
|
|
274
|
+
| \`ViewNode\` | Placeholder plane for embedding a SwiftUI view (content not rendered yet) |
|
|
275
|
+
| \`SpatialAudioNode\` | Positional 3D audio source |
|
|
265
276
|
| \`PhysicsNode\` | Rigid-body physics (dynamic, static, kinematic) |
|
|
266
277
|
| \`DynamicSkyNode\` | Time-of-day sun simulation |
|
|
267
278
|
| \`FogNode\` | Atmospheric fog effects |
|
|
268
279
|
| \`ReflectionProbeNode\` | Local environment reflection captures |
|
|
269
280
|
| \`CameraNode\` | Programmatic camera control |
|
|
281
|
+
| \`AnchorNode\` | AR world / plane anchor for placing content |
|
|
270
282
|
| \`AugmentedImageNode\` | AR image detection and tracking (iOS only) |`;
|
|
271
283
|
const IOS_AR = `## SceneViewSwift — iOS AR Setup
|
|
272
284
|
|
|
@@ -339,16 +351,19 @@ SceneView Web uses **Filament.js** — the same rendering engine as Android, com
|
|
|
339
351
|
### 1. Install
|
|
340
352
|
|
|
341
353
|
\`\`\`bash
|
|
342
|
-
npm install
|
|
354
|
+
npm install sceneview-web
|
|
343
355
|
\`\`\`
|
|
344
356
|
|
|
345
|
-
|
|
357
|
+
The npm package is the prebuilt browser bundle (global \`sceneview\` namespace).
|
|
358
|
+
For the Kotlin API (\`io.github.sceneview.web.SceneView\`), depend on the module
|
|
359
|
+
itself from a Kotlin/JS Gradle build — \`sceneview-web\` ships on npm only and has
|
|
360
|
+
no Maven coordinate, so it cannot be resolved as a Gradle module dependency:
|
|
346
361
|
\`\`\`kotlin
|
|
347
362
|
kotlin {
|
|
348
363
|
js(IR) { browser(); binaries.executable() }
|
|
349
364
|
sourceSets {
|
|
350
365
|
jsMain.dependencies {
|
|
351
|
-
implementation("
|
|
366
|
+
implementation(project(":sceneview-web"))
|
|
352
367
|
}
|
|
353
368
|
}
|
|
354
369
|
}
|
|
@@ -486,7 +501,7 @@ class My3DScreen extends StatelessWidget {
|
|
|
486
501
|
// Android only today — the iOS path is wired but no entity resolves, so
|
|
487
502
|
// this never fires (#3045). Not the shared RealityKit hit test: React
|
|
488
503
|
// Native reaches the same hook and fires on iOS (#3086).
|
|
489
|
-
onTap: (nodeName) => print('tapped:
|
|
504
|
+
onTap: (nodeName) => print('tapped: $nodeName'),
|
|
490
505
|
);
|
|
491
506
|
}
|
|
492
507
|
}
|
|
@@ -562,10 +577,10 @@ class MyARScreen extends StatelessWidget {
|
|
|
562
577
|
Widget build(BuildContext context) {
|
|
563
578
|
return ARSceneView(
|
|
564
579
|
planeDetection: true,
|
|
565
|
-
onPlaneDetected: (planeType) => print('plane:
|
|
580
|
+
onPlaneDetected: (planeType) => print('plane: $planeType'),
|
|
566
581
|
// Android only: SceneViewSwift's ARSceneView exposes no entity
|
|
567
582
|
// hit-test hook, so on iOS this never fires (#2051).
|
|
568
|
-
onTap: (nodeName) => print('tapped:
|
|
583
|
+
onTap: (nodeName) => print('tapped: $nodeName'),
|
|
569
584
|
);
|
|
570
585
|
}
|
|
571
586
|
}
|
|
@@ -577,7 +592,7 @@ SceneView React Native uses **Fabric/Turbo** to bridge to native SceneView.
|
|
|
577
592
|
### 1. Install
|
|
578
593
|
|
|
579
594
|
\`\`\`bash
|
|
580
|
-
npm install @sceneview/react-native
|
|
595
|
+
npm install @sceneview-sdk/react-native
|
|
581
596
|
# iOS: edit ios/Podfile as in step 3 FIRST — a stock Podfile makes this
|
|
582
597
|
# \`pod install\` fail with "Unable to find a specification for 'SceneViewSwift'"
|
|
583
598
|
cd ios && pod install
|
|
@@ -611,7 +626,7 @@ pod 'SceneViewSwift',
|
|
|
611
626
|
### 4. Basic 3D Scene
|
|
612
627
|
|
|
613
628
|
\`\`\`tsx
|
|
614
|
-
import { SceneView } from '@sceneview/react-native';
|
|
629
|
+
import { SceneView } from '@sceneview-sdk/react-native';
|
|
615
630
|
|
|
616
631
|
export default function My3DScreen() {
|
|
617
632
|
return (
|
|
@@ -653,7 +668,7 @@ pod 'SceneViewSwift',
|
|
|
653
668
|
\`\`\`
|
|
654
669
|
|
|
655
670
|
\`\`\`bash
|
|
656
|
-
npm install @sceneview/react-native
|
|
671
|
+
npm install @sceneview-sdk/react-native
|
|
657
672
|
cd ios && pod install
|
|
658
673
|
\`\`\`
|
|
659
674
|
|
|
@@ -679,7 +694,7 @@ Add to \`Info.plist\`:
|
|
|
679
694
|
### 4. Basic AR Scene
|
|
680
695
|
|
|
681
696
|
\`\`\`tsx
|
|
682
|
-
import { ARSceneView } from '@sceneview/react-native';
|
|
697
|
+
import { ARSceneView } from '@sceneview-sdk/react-native';
|
|
683
698
|
|
|
684
699
|
export default function MyARScreen() {
|
|
685
700
|
return (
|
|
@@ -830,14 +845,14 @@ const SETUPS = {
|
|
|
830
845
|
android: {
|
|
831
846
|
name: "Android (Jetpack Compose)",
|
|
832
847
|
renderer: "Filament (OpenGL ES / Vulkan)",
|
|
833
|
-
status:
|
|
848
|
+
status: `Stable (v${LATEST_SCENEVIEW_RELEASE})`,
|
|
834
849
|
guide3d: ANDROID_3D,
|
|
835
850
|
guideAr: ANDROID_AR,
|
|
836
851
|
},
|
|
837
852
|
ios: {
|
|
838
853
|
name: "iOS / macOS / visionOS (SwiftUI)",
|
|
839
854
|
renderer: "RealityKit (Metal)",
|
|
840
|
-
status:
|
|
855
|
+
status: `Alpha (v${LATEST_SCENEVIEW_RELEASE})`,
|
|
841
856
|
guide3d: IOS_3D,
|
|
842
857
|
guideAr: IOS_AR,
|
|
843
858
|
},
|
|
@@ -894,5 +909,7 @@ export function listPlatforms() {
|
|
|
894
909
|
const s = SETUPS[id];
|
|
895
910
|
return `| ${s.name} | ${s.renderer} | ${s.status} | Yes | ${s.guideAr ? "Yes" : "No"} |`;
|
|
896
911
|
}).join("\n");
|
|
897
|
-
return header +
|
|
912
|
+
return (header +
|
|
913
|
+
rows +
|
|
914
|
+
"\n\nUse `get_platform_setup` with a specific platform for full setup instructions.");
|
|
898
915
|
}
|