fix(mcp): use local sqlite scene storage

This commit is contained in:
Aymeric Rabot
2026-04-24 13:32:04 -07:00
parent 06d00566f0
commit b3d1f663f6
119 changed files with 1086 additions and 23694 deletions
+2 -2
View File
@@ -41,8 +41,8 @@ export function registerCreateWall(server: McpServer, bridge: SceneBridge): void
}
const wall = WallNode.parse({
start,
end,
start: start as [number, number],
end: end as [number, number],
...(thickness !== undefined ? { thickness } : {}),
...(height !== undefined ? { height } : {}),
})
+1 -1
View File
@@ -84,7 +84,7 @@ export function registerPlaceItem(server: McpServer, bridge: SceneBridge): void
: {}
const item = ItemNode.parse({
position,
position: position as [number, number, number],
rotation: [0, rotation ?? 0, 0],
asset: baseAsset,
...wallExtras,
@@ -21,7 +21,7 @@ export function parseToolText(content: StoredTextContent[]): Record<string, unkn
* `expectedVersion`.
*/
export class InMemorySceneStore implements SceneStore {
readonly backend = 'filesystem' as const
readonly backend = 'sqlite' as const
private readonly data = new Map<string, SceneWithGraph>()
private idCounter = 0
+7 -3
View File
@@ -8,11 +8,15 @@ import { z } from 'zod'
/** A node identifier — non-empty string. The core uses `${prefix}_${nanoid}`. */
export const NodeIdSchema = z.string().min(1)
/** 2D point as [x, z] (floor plane). Matches core's tuple convention. */
export const Vec2Schema = z.tuple([z.number(), z.number()])
/**
* 2D point as [x, z] (floor plane). Use array length constraints instead of
* `z.tuple()` so MCP hosts that only accept JSON Schema's common `items` shape
* can register the tools.
*/
export const Vec2Schema = z.array(z.number()).min(2).max(2)
/** 3D point as [x, y, z]. */
export const Vec3Schema = z.tuple([z.number(), z.number(), z.number()])
export const Vec3Schema = z.array(z.number()).min(3).max(3)
/**
* A single patch operation. Union of create / update / delete.
+1 -1
View File
@@ -41,7 +41,7 @@ export function registerSetZone(server: McpServer, bridge: SceneBridge): void {
const zone = ZoneNode.parse({
name: label,
polygon,
polygon: polygon as Array<[number, number]>,
metadata: properties ?? {},
})
const id = bridge.createNode(zone, levelId as AnyNodeId)