@hypersoniclabs/helix-mcp 0.2.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.
@@ -0,0 +1,137 @@
1
+ # HELIX Instant — World Project Recipe
2
+
3
+ Follow this recipe exactly to generate a **publishable HELIX Instant world**. A world is a static web app (Vite-built) that runs sandboxed in the HELIX portal and talks to the platform only through `@hypersoniclabs/helix-sdk`.
4
+
5
+ ## Project layout
6
+
7
+ ```
8
+ my-world/
9
+ ├── package.json
10
+ ├── vite.config.ts
11
+ ├── index.html
12
+ ├── public/
13
+ │ └── helix.json ← the manifest; lands at dist/ root on build
14
+ └── src/
15
+ └── main.ts
16
+ ```
17
+
18
+ ## package.json
19
+
20
+ ```json
21
+ {
22
+ "name": "my-world",
23
+ "private": true,
24
+ "type": "module",
25
+ "scripts": {
26
+ "dev": "vite",
27
+ "build": "vite build"
28
+ },
29
+ "dependencies": {
30
+ "@hypersoniclabs/helix-sdk": "^0.1.0",
31
+ "three": "^0.172.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/three": "^0.172.0",
35
+ "typescript": "~5.7.3",
36
+ "vite": "^6.0.0"
37
+ }
38
+ }
39
+ ```
40
+
41
+ Three.js is the usual choice but any web stack works — the only hard requirements are the manifest, the SDK, and a static `dist/` output.
42
+
43
+ ## vite.config.ts — `base: './'` is REQUIRED
44
+
45
+ ```ts
46
+ import { defineConfig } from 'vite';
47
+
48
+ // base './' makes asset URLs relative so the bundle loads from any CDN path.
49
+ export default defineConfig({
50
+ base: './',
51
+ build: { target: 'es2022' },
52
+ });
53
+ ```
54
+
55
+ ## public/helix.json — the manifest
56
+
57
+ ```json
58
+ {
59
+ "helixVersion": "0.1",
60
+ "title": "My World",
61
+ "slug": "my-world",
62
+ "entry": "index.html",
63
+ "maxPlayers": 1,
64
+ "permissions": ["auth.profile"],
65
+ "supportsMobile": true,
66
+ "requiresAuth": false,
67
+ "contentRating": "everyone"
68
+ }
69
+ ```
70
+
71
+ Rules that commonly bite:
72
+ - `slug`: 3–50 chars, lowercase letters/digits/hyphens, no leading/trailing hyphen, **globally unique**. Pick something distinctive.
73
+ - `entry` must exist in the built output and be an `.html` file.
74
+ - Only declare permissions you use; `auth.profile` is the only one in v0.1.
75
+ - Read `helix://docs/manifest` for every field and the bundle limits.
76
+
77
+ ## index.html
78
+
79
+ ```html
80
+ <!doctype html>
81
+ <html lang="en">
82
+ <head>
83
+ <meta charset="utf-8" />
84
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
85
+ <title>My World</title>
86
+ <style>html, body { margin: 0; height: 100%; overflow: hidden; background: #0a0a12; }</style>
87
+ </head>
88
+ <body>
89
+ <script type="module" src="/src/main.ts"></script>
90
+ </body>
91
+ </html>
92
+ ```
93
+
94
+ ## src/main.ts — SDK integration pattern
95
+
96
+ ```ts
97
+ import * as THREE from 'three';
98
+ import { Helix } from '@hypersoniclabs/helix-sdk';
99
+ import type { HelixUser } from '@hypersoniclabs/helix-sdk'; // type-only import — required
100
+
101
+ // 1. Build your scene/game first so the world renders even without identity.
102
+
103
+ // 2. Initialize the SDK once, early:
104
+ const { embedded, user } = await Helix.init();
105
+
106
+ // 3. Use identity as an enhancement:
107
+ if (user) {
108
+ // greet the player: user.username, user.displayName, user.id (stable save key)
109
+ }
110
+
111
+ // 4. React to login/logout while running:
112
+ Helix.auth.onAuthChanged((nextUser: HelixUser | null) => {
113
+ // update HUD / game state — fires on overlay login AND logout
114
+ });
115
+
116
+ // 5. Offer login at a natural moment (never required to render):
117
+ // try { await Helix.auth.requestLogin(); } catch { /* player declined — fine */ }
118
+ ```
119
+
120
+ Hard-won specifics:
121
+ - `import type { HelixUser }` — it is a type-only export; a value import breaks the build.
122
+ - The world MUST run standalone (`npm run dev` with no shell): `embedded` is false there and identity APIs return null. Never block rendering on identity unless the manifest sets `requiresAuth: true`.
123
+ - Never render your own login form — call `Helix.auth.requestLogin()` and the portal overlays the real one.
124
+
125
+ ## Build, validate, publish
126
+
127
+ ```bash
128
+ npm install
129
+ npm run build # → dist/ (contains helix.json, index.html, assets/)
130
+ ```
131
+
132
+ Then use the MCP tools, in order:
133
+ 1. `validate_world` with the **absolute path to `dist/`** — fix every reported problem.
134
+ 2. `whoami` — confirm a creator login exists (if not, the human must run `helix login`).
135
+ 3. `publish_world` with the same dist path — returns the public play URL.
136
+
137
+ Budget: ≤ 200 files, ≤ 25 MB per file, ≤ 50 MB total. Allowed types include html/js/css/json/wasm, images (png/jpg/webp/svg/ktx2), models (glb/gltf/bin), audio (mp3/ogg/wav), fonts.
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "@hypersoniclabs/helix-mcp",
3
+ "version": "0.2.1",
4
+ "description": "HELIX Instant MCP server — gives AI coding agents the platform contract: world recipes, manifest schema, validation, catalog discovery, and publishing.",
5
+ "type": "commonjs",
6
+ "main": "dist/server.js",
7
+ "bin": {
8
+ "helix-mcp": "dist/server.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "docs"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc -p tsconfig.build.json",
16
+ "lint": "eslint \"src/**/*.ts\"",
17
+ "test": "node scripts/smoke.mjs"
18
+ },
19
+ "dependencies": {
20
+ "@hypersoniclabs/helix-cli": "^0.1.0",
21
+ "@modelcontextprotocol/sdk": "^1.12.0",
22
+ "zod": "^3.24.0"
23
+ },
24
+ "devDependencies": {
25
+ "@types/node": "^22.10.0",
26
+ "typescript": "~5.7.3"
27
+ },
28
+ "license": "UNLICENSED",
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "registry": "https://registry.npmjs.org"
32
+ }
33
+ }