@kuraykaraaslan/kui-viewer
v0.9.6
Published
Browser-based IFC/BIM 3D viewer built on Three.js, web-ifc and @thatopen/fragments. Ships a vanilla TypeScript API plus an optional React subpath.
Maintainers
Readme
kui-viewer
A browser-based IFC / BIM 3D viewer built on Three.js, web-ifc and @thatopen/fragments. Ships a framework-agnostic TypeScript core plus an optional React subpath.
🔗 Live demo: kui-viewer.kuray.dev

What to try on the data layers demo (data.html): open Showcase (top-right of the map, left of the view cube) for six one-click Layer Studio recipes (normalised choropleth, bivariate, dot density, icons with heading, columns with additive blending, no-data and uncertainty) and four sample files to drop in (KML, GPX, zipped shapefile, FlatGeobuf); press 2D or F9 for the top-down view. The data are synthetic; see public/data/README.md.
Demos. Ten pages, each with a "what to try" list in docs/reference/demos.md: the BIM workflow (index.html, with the Present house tour: press Present, or Start the tour on the first-run card), geo/basemap (geo.html), data layers (data.html), digital twin (twin.html, with the Replay timeline), coordination (review.html), city context (city.html), the sketch kernel on a map (sketch.html: setbacks, booleans, repair, GeoJSON) a host application embedding <kui-viewer> over the embed protocol (host.html), the code CAD (design.html: OpenSCAD-style source rebuilt as you type) and the building designer (designer.html: a plan with live 3D; the house opens cut in half by the section box, on a lawn).
Status:
0.9.6— the public API is stabilizing but may still change before1.0.0.
What's new in 0.9.6
An object list, measuring in an embedded designer, and a live 3D view over the walls. From next-boilerplate's designer work (2026-11-08); the full list is in CHANGELOG.md. Additive API only.
- Objects — a rail button beside the Designer's opens the active level's rooms, walls, doors, windows, items, links, columns, zones, slabs, stairs and roofs in groups, with a search over their names (case, accents and the Turkish dotless ı ignored). Click a row to select and frame its piece; the eye hides or shows it; Show all brings everything back.
- Measuring in
<KuiDesigner>— the component registersKUI.Bim.Measurement(not loaded) and the package exportsBimMeasurementExtension, so a host can add a Measure button beside the designer's.
Fixes
- The live 3D view looks over the walls — framing the equipment on a level with walls looks from about 56° above the horizon and keeps the camera a metre above the highest wall top, so a room's own wall no longer hides the plant.
What's new in 0.9.5
A storey repeated up, Escape that keeps the walls, and DXF underlays on a dark page. From next-boilerplate's UI test 3 re-run 4 (2026-11-07); the full list is in CHANGELOG.md. Additive API only.
- Repeat this storey up — the designer panel's level section has a Repeat up row: type how many storeys (1 to 99) and press Repeat, and the active storey's walls, doors, windows, slabs, columns, stairs, zones and room names are copied onto the storeys above it, at its height, as one undo step. Placed items, links and roofs are not copied, so every key stays unique. An empty level already standing on it is filled; otherwise the storeys above move up. In code:
repeatLevelUp(design, levelId, { count })(the designer core and the designer kit) anduseDesigner().repeatLevelUp(count). <KuiDesigner theme>— pass your page's"light"or"dark"mode and the designer's background, ground grid, plan lines and DXF underlay follow it, live.
Fixes
- Escape keeps the walls drawn so far — in the Wall tool, Escape ends the run as Enter and a double-click do: the walls already placed stay (one undo step) and only the segment following the pointer is dropped. A second Escape puts the tool down.
- A DXF underlay's lines show on a dark page, and the grid never hides them — the underlay's ink is chosen against the colour actually behind the plan (also when a host paints the background itself), layers too faint on it (a dark grey, a dark blue) are lifted until they read, and in the plan the underlay is drawn over the ground grid (
dxfInkOn,inkDxfSvg(svg, ink, { backdrop })).
What's new in 0.9.4
Picking what lies under something, a glow for an alarm, and DXF underlays on a dark plan. From next-boilerplate's UI test 3 (2026-11-07); the full list is in CHANGELOG.md. Additive API only.
- Alt and the wheel pick what lies under something — in a stored design shown live (
<KuiDesignView>,<DesignLayer>,DesignLiveView) and on the designer's Select tool, hold Alt (Option on a Mac) and turn the wheel: a highlight walks through every item under the pointer, nearest first, and a tag by the pointer names it (Sensor 2 / 3); a click takes the highlighted one. A sensor under a canopy or a thin belt on a frame can be picked now. Without Alt the wheel zooms as before.DesignLiveView.itemsAt(x, y)is the stack itself. - A coloured glow —
overrides={{ tm: { glow: "#d1242f", pulse: true } }}draws a halo around an item, outside its footprint: it lights up on the dark theme, shades on the light one, and pulses withpulse.resolveOverrideskeeps it on the resolved override asglow, so a host can ask whether its viewer glows.
Fixes
- A DXF underlay reads on a dark plan — its black and white lines are drawn in the plan's line colour for the theme on screen (light on the dark plan), again when the theme changes; its other colours stay, and a DXF placed with an older version is redrawn the same way (
inkDxfSvg).
What's new in 0.9.3
A small 3D card names its items, and says only names. From next-boilerplate's e2e findings (2026-11-06); the full list is in CHANGELOG.md.
- Room labels apart from item labels —
roomLabelson<KuiDesignView>,<DesignLayer>andDesignLiveViewdraws the room and zone names with their areas, andlabelsnow means the item labels. Unset,roomLabelsfollowslabels, solabels roomLabels={false}names the items without the area labels that covered the building on a small card.
Changed
- The item list says a label or a name — a button of
<KuiDesignView>'s keyboard list says the item's label, else its catalogue name: never its id or its key, which stay on the button asdata-item-idanddata-item-key. - The Link tool names conveyor belts — its hint and the designer's toolbar tooltip say a link is a pipe, cable, duct or conveyor belt between two items, and what a link does with heights (a belt runs level), in English and Turkish.
What's new in 0.5.0
A stored design, live; the designer kit; links, belts and moving items. The full list is in CHANGELOG.md.
- A stored design, live —
<KuiDesignView>,<DesignLayer>andDesignLiveViewshow a design made in the designer (its document, not its exported IFC) in a viewer that only looks, its items driven by data rows the way their SCADA symbols are (liveFromRows,docs/reference/design-view.md). - The designer kit —
@kuraykaraaslan/kui-viewer/designer-kitand/designer-kit/testing: the engine API an item pack is written against (shapes, parts, the recipe contract, animation and signals, ports, anchors, belts), so packs can live outside this repository. - Links in the designer — items join through ports with pipes, hoses, cables, wires, strips, conveyors, ducts and trays, routed in 3D with computed fittings; the belt simulation carries cargo along running belts (T-joins, diverters, splits).
- Items that move and items keyed like the SCADA symbols —
running,value,status,position,speed,directionmean the same on an item as on its 2D symbol, recipes may declare how their parameters move, and every item is resizable; door styles drawn and moving like items; storeys of different heights. - The home pack's domestic SCADA items — the household, gadget, appliance and kitchen symbols of the 2D library have their 3D items in the free home pack, with
props.scadaKey.
Changed
- No source maps in the published package, and a NOTICE file is published with it.
What's new in 0.4.0
A building designer, a code CAD, and state for every extension.
- Building designer (
designer.html,<KuiDesigner>/useDesignerfor React) — draw walls, doors and windows on levels and get the rooms they make; columns, a structural grid, zones, slabs, stairs and pitched roofs over any outline (L, T, U, stepped), with hip, gable and shed forms and valleys. A catalogue of primitives and a home pack, plus glTF upload, places items. View / comment / edit permissions are enforced by the store, not the UI. Quantities with CSV, a plan sheet, IFC4 and GLB export, a walkthrough from the first door, DXF and PDF underlays, a model context (snap to the walls of an open IFC), and a plan put on the map with a georeference (IfcMapConversion), GeoJSON and a turned plan. Links (pipes, hoses, cables, wires, strips, conveyors, ducts and trays) join item ports with 3D routing, computed fittings, flow and IFC / sheet / quantity output (docs/reference/designer-links.md). Headless MCP tools draw and query designs too. Keyboard-only drawing, screen-reader announcements and Shift-drag box selection are covered by browser specs. - The house demo opens in 3D, cut in half lengthwise by the section box (not by deleting a floor), on a lawn of instanced 3D grass, under a visible roof. Click a piece to hide or isolate it (H / I); hidden pieces are view state, saved with the scene.
- Drag and drop — press on an item and drag to carry it; drag a row of the Library onto the plan or the 3D view to put the item down where it is dropped.
- Grid and Attach — switch each on or off in the Snapping row while items are carried, placed or turned; a selected item has a turning handle in the plan.
- Section box — rotatable, and on the designer page resized by grabbing its faces and edges, or moved (Move handle, or Shift while dragging); the frame and grips show only while the Section window is open. Section caps stay on the BIM page.
- Code CAD (
design.html) — OpenSCAD-compatible source rebuilt as you type: Customizer sliders and presets,text(),import()(STL, OFF, OBJ, DXF, SVG),surface()height maps, click a face to select its code; STL, 3MF and IFC export. - Sketch kernel (
sketch.html) — a planar-graph document with booleans, offsets, repair and GeoJSON, a draw / snap / edit tool layer, and a feature source for the data layers demo. - Extension state — every extension either saves its state through a typed, versioned contract or declares itself stateless; a host keeps one JSON snapshot per scene (
onExtensionStateChange/defaultExtensionState,useExtensionState). Seedocs/extension-state.md. NewuseViewerConfighook and a viewer config document for how the viewer behaves. - Plugin MCP contract — a plugin can contribute MCP tools; code CAD is the first.
Changed
- A saved extension state now restores more than before (for example the Present story, section planes and box, map basemap, data layers). A saved scene with no Present story leaves the host's own story alone.
- The designer's auto-saved design uses a versioned storage key, so a design saved by an older build does not come back over the demo.
- Every demo page's version label comes from
package.json(the shared top bar renders{{version}}).
Fixes
- Section-box grips no longer fill the screen on the plan's distant, narrow camera.
- Roofs are no longer drawn ghosted on levels that are not the active one.
- Node and pnpm are pinned and an unsupported Node fails fast (Vercel builds on Node older than 20.19 crashed in Vite).
Release notes from here on live in CHANGELOG.md.
What's new in 0.2.5
The demo now opens on a federated IFC.
- Multi-model federation — models accumulate instead of replacing each other. The left panel gives every loaded file its own show/hide, unload and zoom-to; drag-drop and the file picker both take a whole selection. Any
.ifcunderpublic/test/loads at boot. - Grid + sky by default, basemap one click away — the satellite basemap and its procedural landmark towers were site context for a map demo and scenery in the way of an IFC viewer.
MapTileExtensiontakesvisible: falseand streams nothing until the picker turns it on; the geographic anchor stays live, so enabling it needs no reload. Newmaptile:visibility-changedevent. - The property panel is actually mounted.
PropertyPanelhad always been exported and constructed by nothing — pick an element and the headline BIM feature had no UI at all. NewBimPropertiesExtension(toolbar button +PROPScommand) shows identity, Psets and Qtos, and resolves the real IFC entity name (IfcSlab) instead of web-ifc's raw type code (1529196076). - Sensor sprites render end-to-end —
IotSensorsExtensionis loaded in the demo and the mock manifest was regenerated against real GlobalIds from the demo model. It had shipped pointing at synthetic ids that matched nothing, so the layer was invisible however it was wired. - Instanced rendering + BVH in the real load path —
InstancedMesh2with geometry dedup keyed on web-ifc'sgeometryExpressID, and a per-geometryboundsTreefor O(log n) picking. Both were written and unit-tested but never constructed by the viewer, which also left visibility / isolate / ghost / selection-colouring dead in production. Measured on the sample model: 280 → 172 draw calls at identical triangle count. - Calmer lighting — white IFC surfaces were washing out to a flat cutout against a near-white sky (41.5% of rendered pixels above 230/255). The IBL was lifting the shadow side as much as the lit side; fill, key, rim and exposure all come down. Above-230 pixels now 0.8%, nothing clips, and the dark end opens up (p05 142 → 100).
Library
t()localization — every user-facing string resolves throughlibs/i18nwith the English text at the call site, so English loads no catalog and cannot miss a key. Each module carries its owndictionaries/(English generated from the call sites, translations hand-written);registerBuiltinCatalogs()+setLocale(locale)turns them on.- Federation-safe property indexes — keyed per model so a pick resolves through its GlobalId to the owning file. ExpressIDs are unique within a file, not across a federation: previously a second load wiped the first model's properties and a colliding
#42answered for the wrong model. - Sensor anchors merge per model instead of replacing the map; unload drops only that model's entries.
IfcLoadInput.urlaccepts a same-origin path (/test/a.ifcwas rejected as an invalid URL).IfcParseResult.byteSizewas always 0 — it readbuffer.byteLengthafter the buffer had been transferred to the worker and detached.
Fixes
- The selection highlight overlay is composed in parent-local space, so outlines land on the element instead of drifting with the model root.
- Section planes turn off when their panel closes; measurement snap ignores scenery; the ground-plane snap fallback respects the scene's Y-up axis.
Tooling
- CI reports coverage (Codecov, no gate — the suite still mocks the render/WASM path), fails on event-catalog drift, runs a Node 20 + 22 matrix, and cancels superseded runs.
@vitest/coverage-v8was pinned fromlatest, which had floated to a major incompatible with the pinned vitest, so--coveragecould never run.
What's new in 0.2.0
- Geo-anchored basemap — Web-Mercator projection extracted into
viewer-core/geoas the single source of truth shared by MapTile, Landmarks and LocationSearch. - Location search — type a place, geocode via Nominatim, fly there and re-anchor the basemap. Ships search history and command-line suggestions.
- Adaptive map LOD — the streamed tile zoom floats with the camera (sharper up close, fewer tiles pulled back). Refinement is settle-gated so a continuous zoom gesture rebuilds the grid once, and the outgoing zoom stays as a fallback layer so there is no placeholder flash. The anchor zoom stays fixed, so nothing geo-anchored drifts. New
lod/minZoom/maxZoomoptions. - Zoom bar fixed — it ran backwards and pinned at the far end. Right/
+now zooms in, and the range defaults to the live OrbitControls min/max distance instead of a hard-coded 1–300 m.
What's new in 0.1.2
- Section planes turn off when their panel closes — closing the "Section Planes" popup now disables every clip axis (and detaches its drag gizmo) instead of leaving the cut active with no visible control for it.
- Measurement snap no longer catches scenery — the sky dome, grid/axes helpers and clipping gizmo were real raycastable meshes; an OSNAP ray that missed the terrain/a building could land on one of them instead. They're now excluded from snapping.
- Fixed the ground-plane snap fallback — it assumed a Z-up world; this scene is Y-up, so a click that missed all geometry could resolve to a point nowhere near the visible ground. Corrected to the scene's actual up-axis.
- Area/Distance measurements no longer vanish after Enter — the toolbar's mode buttons were retaining keyboard focus after starting a command, so pressing Enter to finish a multi-point measurement (e.g. Area) re-triggered the button instead of completing the measurement, silently discarding it.
- Area measurements render a light interior fill alongside their outline, live while drawing and once completed.
What's new in 0.1.0
- World-class rendering — ACES-Filmic tone mapping, a neutral IBL environment (RoomEnvironment → PMREM), GTAO ambient occlusion + SMAA post-processing, and fat-line selection outlines. Opt out via
postprocessing: false/environment: false. - English-default UI — every label, tooltip and aria-label now ships in English (full i18n layer next).
- Working property panel — Psets/Qtos are extracted in-worker while the model is open and served after it closes.
- IoT sensor sprites resolve — the loader wires the GlobalId → element-centroid map.
- BCF — viewpoint apply restores the full multi-component selection; topics carry
AssignedTo/DueDate/Labels. - Screenshot export —
viewer.screenshot({ filename })(PNG); camera flights respectprefers-reduced-motion. - Configurable measurement units — metric / imperial / feet-inches via
setMeasurementUnits. - OSI-clean dependencies — GSAP replaced with a small dependency-free tween helper.
- Roadmap — a phased plan to world-class lives under
docs/phases/.
Features
- IFC parsing in a Web Worker via
web-ifc(single-threaded WASM), with in-worker Pset/Qto extraction - Three.js scene with orbit controls, render loop, RTC origin handling for large coordinates
- Post-processing pipeline — ACES tone mapping, IBL environment, GTAO ambient occlusion, SMAA, fat-line selection (all opt-out)
- Instanced geometry — placements sharing a geometry collapse into one
InstancedMesh2draw call; identity resolves through an instance registry - BVH-accelerated picking and selection (
three-mesh-bvh) - Multi-model federation, spatial tree, discipline detection, per-model visibility
- Property panel + spatial tree UI primitives (vanilla TS + Tailwind v4 tokens, English default)
- Measurement (distance / angle / area) with configurable units, clipping planes, BCF 2.1 import/export, IoT sensor sprites
viewer.screenshot()PNG export;prefers-reduced-motion-aware camera animation- Optional React subpath:
<KUIViewer />,ViewerProvider, hooks, headless components - Localization via
t()— English by default with no catalog to load; Turkish ships with the package, assembled from each module's owndictionaries/byregisterBuiltinCatalogs(), andsetLocale/onLocaleChangere-render subscribed React trees live viauseLocale() - Building designer (plan + live 3D, rooms, roofs, quantities, IFC / GLB export, georeference) and a code CAD, both with React wrappers or demo pages
- Typed, versioned extension state for every extension, saved as one JSON snapshot per scene
- Strict TypeScript, Zustand vanilla stores, Zod-validated DTOs at boundaries
Install
pnpm add @kuraykaraaslan/kui-viewer three zustand zod
# optional, for the React subpath:
pnpm add react react-dom
# optional, for the Vue subpath:
pnpm add vuereact and react-dom are listed as optional peerDependencies — only required if you import from @kuraykaraaslan/kui-viewer/react. vue likewise, only for @kuraykaraaslan/kui-viewer/vue:
import { KuiViewer, useSelection, useCommand } from "@kuraykaraaslan/kui-viewer/vue";
// <KuiViewer doc="doc:4711@rev3" :host="hostAdapter" v-model:selection="ids" />WASM setup (required)
The IFC parser worker loads web-ifc.wasm from /wasm/ at runtime. Copy the WASM file from web-ifc's package to your app's static folder before serving:
mkdir -p public/wasm
cp node_modules/web-ifc/web-ifc.wasm public/wasm/Or wire it into your build's prebuild/predev lifecycle. The repo's scripts/copy-wasm.mjs is a working example.
Quick start — vanilla TypeScript
import { Viewer, IfcLoaderService, FragmentsLoaderService } from "@kuraykaraaslan/kui-viewer";
import "@kuraykaraaslan/kui-viewer/styles.css";
const container = document.getElementById("viewer")!;
const viewer = new Viewer({ container });
const parsed = await IfcLoaderService.load({
kind: "url",
url: "/models/duplex.ifc",
});
const model = await FragmentsLoaderService.attach(viewer, parsed, "/models/duplex.ifc");
// later
viewer.dispose();Quick start — React
import { KUIViewer, ViewerProvider, useLoadIfc, useSelection } from "@kuraykaraaslan/kui-viewer/react";
import "@kuraykaraaslan/kui-viewer/styles.css";
function App() {
return (
<div className="h-screen w-screen">
<KUIViewer>
<ViewerProvider>
<Loader url="/models/duplex.ifc" />
<SelectionReadout />
</ViewerProvider>
</KUIViewer>
</div>
);
}
function Loader({ url }: { url: string }) {
const { load, error } = useLoadIfc();
React.useEffect(() => {
load(url).catch(() => {});
}, [load, url]);
return error ? <pre>{error.message}</pre> : null;
}
function SelectionReadout() {
const { selectedElementId, clear } = useSelection();
if (!selectedElementId) return null;
return (
<button onClick={clear}>Selected: {selectedElementId} (clear)</button>
);
}A stored design, live
<KuiDesignView> shows a design made in the designer (its document, not its exported IFC) in a viewer that only looks:
every level drawn by its recipes, no tools or panels, its items driven by data rows the way their SCADA symbols are
(running, value, position, status, speed, direction and an item's own keys), with clicks on items. Only the
items whose readings change are touched; what moves eases, what does not is redrawn once.
import { KuiDesignView } from "@kuraykaraaslan/kui-viewer/react";
<KuiDesignView
design={storedJson} // a DesignDocument or its JSON
catalog={catalog} // the packs that draw its items (memoised)
rows={rows} // memoised: [{ id: "i12", running: "on", value: "42%", status: "fault" }]
onItemClick={(id, item) => console.log(id, item.name)}
/>Labels are off by default. labels names the items; the room and zone names with their areas follow it unless roomLabels says
otherwise, so labels roomLabels={false} names the items and leaves the area labels off the building.
A host's rules show through overrides, by item key or id, without touching the design: a color (tint and outline), a highlight,
a label, a pulse and, since 0.9.4, a glow (a halo in a colour, lit on a dark theme): overrides={{ tm: { glow: "#d1242f", pulse:
true } }}. To click an item that lies under another (a sensor under a canopy), hold Alt (Option) and turn the wheel over it: a
highlight walks through what is under the pointer, nearest first, a tag names it, and a click takes the highlighted one. Without Alt the
wheel zooms.
Inside a viewer you already mount, use <DesignLayer>; without React, DesignLiveView; to map rows yourself,
liveFromRows. See docs/reference/design-view.md.
Links (pipes, cables, conveyors, ducts)
The designer joins two placed items the way a 2D SCADA diagram joins two symbols. An item declares ports (where a
pipe, hose, cable, wire, strip, conveyor, duct or tray joins it); a link runs between two ports, from a port to another link
(a tee) or to a free point. A link stores only its ends and a few waypoints: it is routed in 3D with real bends, its
fittings are computed, and it can cross storeys. A person draws it with the Link tool; a host or an agent draws it from code.
It shows the same readings as an item (running, status, speed, direction), and leaves the designer in IFC4 (with its
ports connected), GLB, the plan sheet, the quantities and the MCP tools.
import { designer } from "@kuraykaraaslan/kui-viewer/headless";
const { portOn, createDesign, addLink, layoutLevelLinks } = designer;
// an item declares portOn({ id: "out", medium: "pipe", face: "+x", size: { dn: 50 }, direction: "out", z: 0.3 }) ...
let design = createDesign();
// ... place two items, then join their ports:
const { design: next, link } = addLink(design, "l1", {
kind: "pipe", medium: "cold",
from: { kind: "port", item: "i2", port: "out" },
to: { kind: "port", item: "i3", port: "in" },
});
const routed = layoutLevelLinks(next, "l1").byId.get(link.id); // path, length, fittings, problemsFiles saved with links carry schema 7; an older build refuses them. importScene turns a 2D SCADA scene into a 3D plant.
Ports, the document functions, routing, live state, the exports and the tool are in
docs/reference/designer-links.md; the standard an item follows (ports included) is
docs/reference/designer-items.md.
Exports
| Specifier | Contents |
|---|---|
| @kuraykaraaslan/kui-viewer | Vanilla core: Viewer, IFC/fragments loaders, federation/spatial-tree stores, UI primitives, BIM domain services |
| @kuraykaraaslan/kui-viewer/react | React wrapper + hooks (useLoadIfc, useFederation, useSelection, useSpatialTree, …) and headless components |
| @kuraykaraaslan/kui-viewer/styles.css | Compiled Tailwind v4 tokens. Import once at the app root |
| @kuraykaraaslan/kui-viewer/data | The data layer engine with no three, React or DOM (browser or Node): layers store, feature sources (GeoJSON, CSV, ArcGIS REST, table join, columnar), typed filters, renderer engine, legend and colour ramps, aggregation (bins, cells, clusters, contours, point-in-polygon), the Data Document and libs/statistics. Shares one layers store with /react |
CLI tools
The package also ships five headless binaries — no browser, no DOM:
| Binary | What it does |
|---|---|
| kui-check | Model-quality gate: health checks, IDS validation, carbon/cost takeoff, COBie export — JSON/SARIF/JUnit/SVG-badge/XLSX output, real exit codes for CI |
| kui-intake | Intake gateway: checks a delivered package (folder or zip) against a versioned, inheriting PackageSpec — content-sniffed classification, sha256 manifest, IFC validation by the kui-check engines — and writes a deterministic canonical report (JSON, SARIF, JUnit). See docs/reference/intake.md |
| kui-convert | IFC → structured JSON (spatial tree, per-element properties), a glTF 2.0 binary (--glb), a PNG thumbnail from the hero pose with no GPU (--thumbnail) and a semantic search index (--search-index) |
| kui-portfolio | Ranks a directory of model report JSON files worst-first and trends each model against its previous run |
| kui-mcp | An MCP server exposing the loaded-model toolset to an AI agent host |
Since the package name doesn't match any of the bin names, npx needs
-p/--package to know which one to run without installing:
npx -y -p @kuraykaraaslan/kui-viewer <bin> [args]. With the package already
a project dependency, call the bin directly instead. Pass -h/--help to
any of them for the full flag list.
MCP server setup
kui-mcp speaks MCP over stdio and exposes real tools against a loaded IFC
model — load_model, find_elements, get_element, get_spatial_tree,
run_health, validate_ids, run_carbon_takeoff, run_cost_takeoff,
export_cobie, plus more — and a handful of guided prompts
(model_audit, qto_extraction, bcf_issue_authoring, clash_triage).
kui-mcp --review adds the pictures and reviews: render_snapshot returns a PNG of the model with no
browser and no camera argument (a deterministic hero pose frames it), analyze_review runs a whole
QA pass (health, IDS, clash and views) in one call, and there are validate_snapshot (CI baselines),
get_hero_pose, create_session_snapshot / sync_session, get_ifc_class and the photo tools
analyze_photo_camera, get_pixel_locations and render_annotated_image; export_bcf always
frames each topic with the same hero pose and attaches the rendered viewpoint image.
Mutating tools are refused unless the server is started with --allow-write,
and every designer write tool takes dryRun: true to return the diff it would
make without changing anything.
Pass --audit-log <file> to append a JSON line per tools/call (tool name,
scope, arguments, outcome, duration, and dryRun for a dry run) — an append-only record of every call to a
known tool (a call to an unknown tool, or a malformed tools/call, is answered
with a protocol error and is not logged). The flag needs a file path; without
one kui-mcp exits 2.
For hosts that connect over HTTP instead of stdio, kui-mcp --http <port>
serves JSON-RPC over POST / on 127.0.0.1. Every request needs the bearer
token (printed on stderr, or fixed with --token), the Host header must be
the server's own address (DNS-rebinding guard) and a browser Origin is
refused unless listed with --allow-origin. Binding a non-loopback --host
also requires --token and --allowed-host.
Claude Desktop — add to claude_desktop_config.json:
{
"mcpServers": {
"kui-viewer": {
"command": "npx",
"args": ["-y", "-p", "@kuraykaraaslan/kui-viewer", "kui-mcp"]
}
}
}Claude Code:
claude mcp add kui-viewer -- npx -y -p @kuraykaraaslan/kui-viewer kui-mcpAny other MCP host that spawns a stdio server: the command is
npx with args ["-y", "-p", "@kuraykaraaslan/kui-viewer", "kui-mcp"]
(or kui-mcp directly if the package is already a project dependency);
append --allow-write if the host should be allowed to call mutating tools.
HTTP hosts (a long-running server instead of a spawned process):
kui-mcp --http 7777 --token "$KUI_MCP_TOKEN" # 127.0.0.1 only
claude mcp add --transport http kui-viewer http://127.0.0.1:7777/ \
--header "Authorization: Bearer $KUI_MCP_TOKEN"Hosted deployment note. The process has no TLS and no rate limiter by design; run it behind a reverse proxy that provides both, and keep these rules:
- Token — always set
--tokenfrom a secret store (never the generated one, which changes every start). Every request is refused without it; rotate by restarting with a new value. - Bind — keep the default
127.0.0.1and let the proxy forward to it. A non-loopback--hostis refused unless--tokenand--allowed-hostare both given. - Host allowlist —
--allowed-host <public-host[:port]>for each name the proxy forwards (the proxy must pass the originalHostheader through). - Origin allowlist — browsers send
Origin; none is trusted unless listed with--allow-origin <origin>. Non-browser MCP hosts send none and need no entry. - Rate limit — enforce at the proxy (for example nginx
limit_reqper token or per IP); tool calls load and parse whole models, so cap concurrent requests too. - Writes — leave
--allow-writeoff on a shared server. Every call is recorded with--audit-log <file>.
Every recipe above runs against this exact package; the stdio ones were
exercised with a real initialize round trip, the HTTP one with curl against
the built binary.
Stack
- Three.js (r186)
- web-ifc (IFC parsing, WASM)
- @thatopen/fragments (fragment scene graph)
- three-mesh-bvh (picking acceleration)
- Zustand v5 (vanilla stores)
- Zod v4 (DTO validation)
- Tailwind CSS v4 (design tokens)
Development
pnpm install
pnpm dev # Vite playground at http://localhost:3006
pnpm build # JS + .d.ts + styles.css → dist/
pnpm test # Vitest core (node) + react (jsdom)
pnpm lint
pnpm typecheckProject layout
modules/— vanilla core (scene, renderer, viewer-core, IFC pipeline, BIM domain). React/JSX prohibited.libs/— cross-cutting utilities (env, logger,AppError,cn(), Three helpers, workers, the i18n mechanism — translation data lives in each module'sdictionaries/).react/— optional React subpath (<KUIViewer />,ViewerProvider, hooks, headless components).modules/designer/packs/— procedural item packs for the designer. Onlyhomeis published (@kuraykaraaslan/kui-viewer/packs/home); any other pack in this folder is internal: it has no subpath, is not built intodist/and is not published.src/— Vite dev playground (not bundled into the published package).docs/phases/— world-class roadmap (Phase 0–6).docs/reference/events.md— auto-generated viewer event catalog (pnpm events:catalog).docs/reference/i18n-catalog.md— auto-generated UI string catalog (pnpm i18n:catalog), one row per key with its owning directory.
License
Apache-2.0 © 2026 Kuray Karaaslan. A copy keeps the NOTICE file.
The process plant in public/samples/plant/ (the Coordination demo) is
generated by scripts/generate-plant-model.py and is covered by this
repository's licence. The other demo sample models in public/samples/ are
third-party files under CC BY 4.0, redistributed unmodified: the buildingSMART International
Simple-Scene infrastructure models (© buildingSMART International Ltd.) and
BSI (2020) "Duplex Apartment Test Files," buildingSMART International. Sources
and details are in public/samples/README.md.
They are not part of the npm package.
