MCP Server Guide
The HoloScript MCP (Model Context Protocol) server enables AI agents to generate, validate, and manipulate HoloScript code.
Overview
The MCP server provides tools that AI assistants (Claude, GPT, Cursor) can use to:
- Generate HoloScript from natural language
- Validate code for errors
- Suggest appropriate VR traits
- Explain code in plain English
- Parse and analyze HoloScript files
Quick Start (Hosted — No Install)
A live MCP server is available at https://mcp.holoscript.net. Use it directly from any MCP client:
# Verify it's running
curl https://mcp.holoscript.net/healthFor Claude Desktop (remote)
Add to Claude config (~/.claude/settings.json or Claude Desktop settings):
{
"mcpServers": {
"holoscript": {
"url": "https://mcp.holoscript.net/mcp"
}
}
}For VS Code + Copilot (remote)
Add to .vscode/mcp.json:
{
"mcpServers": {
"holoscript": {
"url": "https://mcp.holoscript.net/mcp"
}
}
}For Cursor (remote)
Add to Cursor settings or .cursor/mcp.json:
{
"mcpServers": {
"holoscript": {
"url": "https://mcp.holoscript.net/mcp"
}
}
}Local Installation (Alternative)
If you prefer running the server locally:
For Claude Desktop
- Install the server:
npm install -g @holoscript/mcp-server- Add to Claude config:
{
"mcpServers": {
"holoscript": {
"command": "npx",
"args": ["@holoscript/mcp-server"]
}
}
}- Restart Claude Desktop
For VS Code + Copilot
Add to .vscode/mcp.json:
{
"mcpServers": {
"holoscript": {
"command": "npx",
"args": ["@holoscript/mcp-server"]
}
}
}For Cursor
Add to Cursor settings or .cursor/mcp.json:
{
"mcpServers": {
"holoscript": {
"command": "npx",
"args": ["@holoscript/mcp-server"]
}
}
}Available Tools
The MCP server exposes tools organized in categories. Verify current inventory via:
curl https://mcp.holoscript.net/healthgenerate_object
Generate a HoloScript object from a natural language description.
Input:
{
"description": "a glowing blue composition that can be grabbed and thrown",
"format": "hsplus"
}Output:
composition glowing_composition {
@grabbable
@throwable
@glowing
position: [0, 1.5, -2]
color: "#0088ff"
glow_intensity: 1.5
on_grab: {
this.glow_intensity = 2.5
}
on_release: {
this.glow_intensity = 1.5
}
}generate_scene
Generate a complete .holo composition from a description.
Input:
{
"description": "A medieval marketplace with NPC vendors selling potions and weapons",
"format": "holo"
}Output: A complete composition with environment, templates, objects, and logic.
validate_holoscript
Check code for syntax errors and semantic issues.
Input:
{
"code": "composition test { @grabbble position: [0, 1, 0] }",
"format": "hsplus"
}Output:
{
"valid": false,
"errors": [
{
"line": 1,
"message": "Unknown trait '@grabbble'. Did you mean '@grabbable'?",
"severity": "error"
}
],
"warnings": []
}suggest_traits
Get appropriate VR traits for an object or use case.
Input:
{
"description": "a sword the player can pick up and use as a weapon"
}Output:
{
"traits": [
{ "name": "@grabbable", "reason": "Player needs to pick up the sword" },
{ "name": "@holdable", "reason": "Sword stays in hand during combat" },
{ "name": "@physics", "reason": "Realistic sword physics when dropped" },
{ "name": "@collidable", "reason": "Detect hits on enemies" },
{ "name": "@spatial_audio", "reason": "Sword swing and impact sounds" }
]
}explain_code
Get a plain English explanation of HoloScript code.
Input:
{
"code": "composition portal { @trigger @glowing on_trigger_enter(player) { teleport(player, destination) } }"
}Output:
This code creates a glowing portal object:
1. The portal uses @trigger to detect when objects enter it
2. It glows visually with @glowing
3. When a player enters the trigger zone, they are teleported to a destination
This is commonly used for level transitions or fast travel points.list_traits
List all available VR traits with descriptions.
Output:
{
"categories": {
"interaction": ["@grabbable", "@throwable", "@clickable", ...],
"physics": ["@collidable", "@physics", "@rigid", ...],
"visual": ["@glowing", "@emissive", "@animated", ...],
"networking": ["@networked", "@synced", "@persistent", ...],
...
}
}explain_trait
Get detailed documentation for a specific trait.
Input:
{
"trait": "grabbable"
}Output:
{
"name": "@grabbable",
"description": "Makes an object pickable with hands or controllers",
"category": "interaction",
"parameters": {
"snap_to_hand": { "type": "boolean", "default": false },
"haptic_on_grab": { "type": "number", "default": 0, "range": [0, 1] },
"two_handed": { "type": "boolean", "default": false }
},
"events": ["on_grab", "on_release", "on_grab_start", "on_grab_end"],
"example": "@grabbable(snap_to_hand: true, haptic_on_grab: 0.5)"
}get_syntax_reference
Get syntax reference for HoloScript constructs.
Input:
{
"topic": "composition"
}Output: Detailed syntax documentation with examples.
parse_hs
Parse .hs or .hsplus code and return the AST.
Input:
{
"code": "composition ball { position: [0, 1, 0] }"
}Output: Abstract Syntax Tree representation.
parse_holo
Parse .holo composition code and return the AST.
Codebase Intelligence Tools
These tools let AI agents understand the TypeScript codebase structure before editing it. They use a cache-first strategy — the first absorb builds ~/.holoscript/graph-cache.json (24h TTL), and subsequent calls return in ~21ms.
holo_graph_status
Check the current cache state before absorbing.
Input: {} (no parameters)
Output:
{
"fresh": true,
"cacheAgeMs": 45000,
"cacheAgeFriendly": "45 seconds",
"rootDir": "packages/core",
"hint": "Cache is fresh. Use holo_absorb_repo without force to reuse (~21ms).",
"sessionProvenance": "disk-cache"
}holo_absorb_repo
Scan a codebase package and build the knowledge graph. Uses disk cache by default.
Input:
{
"rootDir": "packages/core",
"force": false
}force: false(default) — returns in ~21ms from cache if < 24h old and rootDir matchesforce: true— fresh scan (~3-10s) — only use whenholo_graph_statussays stale
Output:
{
"cached": true,
"cacheAge": "2 minutes",
"message": "Returned cached graph for packages/core (2 minutes old). Use force: true to rescan.",
"stats": { "files": 847, "symbols": 12432 }
}holo_query_codebase
Query the absorbed codebase graph with a natural language question. Auto-loads disk cache if needed.
Input:
{
"query": "What classes implement the Compiler interface?"
}Output: Relevant symbols, their relationships, and file locations. Includes cacheNote field showing cache source.
holo_impact_analysis
Find the blast radius — everything that would break if you change a symbol.
Input:
{
"symbol": "R3FCompiler"
}Output:
{
"symbol": "R3FCompiler",
"directDependents": ["CompilerRegistry", "compile_holoscript"],
"transitiveDependents": [...],
"riskLevel": "HIGH",
"cacheNote": "[auto-loaded from disk cache, 5m old, rootDir: packages/core]"
}holo_detect_changes
Compare two git references to see what changed structurally. Always performs a fresh analysis.
Input:
{
"before": "HEAD~1",
"after": "HEAD",
"rootDir": "packages/core"
}holo_semantic_search
Semantic similarity search over the absorbed graph. Requires Ollama running locally.
Input:
{
"query": "material shader compilation pipeline",
"topK": 5
}holo_ask_codebase
Ask a natural language question about the codebase. Requires Ollama running locally.
Input:
{
"question": "How does the WebGPU compiler handle material properties?"
}Recommended Agent Workflow for TypeScript Refactoring
1. holo_graph_status({})
→ If fresh: skip to step 3
2. holo_absorb_repo({ rootDir: "packages/core" })
→ Uses cache if < 24h old (~21ms)
→ Pass force: true only if graph_status said stale
3. holo_impact_analysis({ symbol: "ClassToChange" })
→ Understand what breaks before editing
4. Edit code → pnpm test
5. holo_detect_changes({ before: "HEAD~1", after: "HEAD" })
→ Verify only intended changes occurredGenerate a Complete VR Game Level
User: Create a VR escape room with puzzles
AI uses: generate_scene
Output: Complete .holo file with rooms, puzzles, triggers, and logicDebug Code Issues
User: Why doesn't this work? [code]
AI uses: validate_holoscript
Output: Specific error messages with suggestionsLearn Best Practices
User: What traits should I use for a basketball?
AI uses: suggest_traits
Output: @grabbable, @throwable, @physics with reasoningRunning Standalone
You can run the MCP server directly for testing:
npx @holoscript/mcp-server --port 8080Then connect via HTTP or stdio.
API Reference
The MCP server implements the Model Context Protocol specification.
All tools are exposed via:
- stdio (default) - For Claude Desktop, Cursor
- HTTP - With
--portflag
Troubleshooting
Server Not Found
# Reinstall globally
npm install -g @holoscript/mcp-server
# Or use npx (no install needed)
npx @holoscript/mcp-serverTools Not Appearing
- Restart your AI client
- Check the config path is correct
- Verify with:
npx @holoscript/mcp-server --test
Slow Responses
The first request may be slow as the parser initializes. Subsequent requests are fast.