NURL

Playground and APIs

Live Playground, API and NURL MCP endpoint.

NURL has an official online playground where you can run NURL code directly in your browser. The same site gives HTTP APIs and an MCP server to integrate with AI assistants.

Go to play.nurl-lang.org

Write NURL code in a web editor, run and build programs, download native binaries, browse examples, and share your code.

Security & Availability

  • The hosted playground is unauthenticated and public — do not send secrets
  • Build logs may be recorded; assume source code is logged
  • For production or sensitive work, self-host
  • Build endpoints sandbox compilation with container-level isolation
  • Artifacts expire automatically (default: 1 hour)

API Stability

  • The tool and resource catalog tracks the main branch
  • Breaking changes to tool signatures are announced in CHANGELOG.md

The playground runs in your browser. It uses a WASI shim to run WebAssembly after compilation. There is no server-side execution.

HTTP API Endpoints

The playground server exposes the following endpoints:

Playground & Documentation

  • GET / - playground UI with editor, examples and build tools
  • GET /docs - Swagger UI showing all available endpoints
  • GET /openapi.json - OpenAPI 3.1 schema for programmatic discovery

Compilation

WebAssembly (browser execution)

POST /build_wasm
Content-Type: application/json

{
  "source": "@ main → i { ^ + 1 2 }",
  "filename": "main.nu",
  "emit_ll": false,
  "opt": "-O2"
}

Returns: base64-encoded wasm bytecode and compilation logs.

Diagnostics

Every build endpoint answers with stderr (the whole log, each stage in order) and nurlc_errors: one {file, line, col, severity, message} per compiler diagnostic — front end, lint and borrow checker alike — named by the filename you sent, plus a fix (insert_line, text) when the cure is one import line to add.

Linux (x86_64 ELF)

POST /build

Compiles to native x86_64 binary with static linking. Returns build logs and temporary download URLs.

Windows (x86_64 .exe)

POST /build_windows

Cross-compiles via mingw-w64. FFI functions like canvas and audio are rejected.

macOS (x86_64 Mach-O)

POST /build_macos

Cross-compiles via zig cc, linking only libSystem. These are unsigned binaries. Clear the quarantine attribute before you run them.

Cross-platform targets

POST /build_target

{
  "source": "...",
  "target": "linux-arm64-musl"
}

Supported targets:

  • linux-x64-musl, linux-arm64-musl, linux-riscv64-musl (fully static)
  • linux-arm64-gnu (dynamic glibc)
  • macos-x64, macos-arm64 (Mach-O, Apple Silicon native)

Canvas, audio, and HTTP are unsupported on these targets.

Bootable Unikernel (x86_64 PVH / AArch64 QEMU virt)

POST /build_unikernel

{
  "source": "@ main → i { ( nurl_print `hello from guest\\n` ) ^ 0 }",
  "arch": "x86_64",
  "boot": true
}

Builds a freestanding unikernel image (x86_64 or aarch64), optionally baking in files via files and booting it under QEMU (boot: true) to return guest serial output.

Resources & Examples

  • GET /examples - list all bundled examples
  • GET /examples/{name} - fetch a specific example
  • GET /grammar - NURL grammar (rendered)
  • GET /readme - project README (rendered)
  • GET /targets - list available compilation targets
  • GET /download/{build_id}/{filename} - download a compiled binary (expires after 1 hour)

Health & Diagnostics

  • GET /health - liveness check; reports if the compiler is available

MCP Server Integration

The playground has a public Model Context Protocol endpoint. It lets AI assistants build and inspect NURL code.

https://play.nurl-lang.org/mcp

Add to Claude Code

claude mcp add --transport http nurl https://play.nurl-lang.org/mcp

Add to Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "nurl": {
      "url": "http-sse://play.nurl-lang.org/mcp"
    }
  }
}

Available Tools & Resources

Tools:

  • nurl_build_* - compile to native (nurl_build_native, with run=true to execute it; nurl_build_windows, nurl_build_macos), WebAssembly (nurl_build_wasm), cross-targets (nurl_build_target), or a bootable unikernel (nurl_build_unikernel); every result carries the located nurlc_errors
  • nurl_api / nurl_grep - a stdlib module's or a registry package's API surface (package= opens with its module index, module= picks modules), declaration search, and ranked search across stdlib, examples, tests and the registry
  • nurl_docs - the docs/ tree and formal/ (the memory-safety proof and its probe table), by section, outline or query
  • nurl_list_* / nurl_read_* - browse and read examples, stdlib modules, tests, grammar, README, and the roadmap (by heading: outline, section, query)
  • nurl_changelog - the release notes

Resources (nurl:// URIs):

  • nurl://grammar - language grammar
  • nurl://readme - README
  • nurl://stdlib/<path> - standard library modules
  • nurl://example/<name> - examples
  • nurl://test/<name> - test files

Prompt:

  • nurl_coding_assistant - compact grammar + canonical examples to ground smaller models

Self-Hosting nurlapi

Docker

# From repository root
docker build -f nurlapi/Dockerfile -t nurl-api:dev .
docker run --rm -p 8000:8000 nurl-api:dev
# → http://localhost:8000/
# → http://localhost:8000/docs
# → http://localhost:8000/mcp

Binary

./nurl.sh nurlapi/main.nu nurlapi/nurlapi
./nurlapi/nurlapi   # listens on 0.0.0.0:8000

Environment variables

VariableDefaultPurpose
PORT / NURL_PORT8000HTTP listen port
NURLAPI_WORKERS8HTTP server worker thread/fiber count
NURL_ALLOW_RUN0Enable native host code execution endpoints (1 to allow)
NURLAPI_RATE_LIMIT60Per-IP requests per minute on build endpoints
NURL_API_URLhttp://localhost:8000Public base URL advertised in download links and MCP
NURLC_PATH/opt/nurl/build/nurlcPath to the nurlc compiler binary
NURL_WORK_ROOT/opt/nurlWorking directory for temporary build artifacts
NURL_DOWNLOAD_TTL_SEC3600Seconds before compiled download artifacts expire

See nurlapi/README.md for full container and deployment details.

Compiler-in-WebAssembly

You can compile the NURL compiler itself to WebAssembly. This makes an offline, embeddable nurlc.wasm:

./startdev.sh        # start the API container
./buildwasm.sh       # → ./nurlc.wasm
./wasmnurl.sh examples/showcase.nu  # run with wasmtime

The bootstrapped compiler runs on any WASI host: wasmtime, wasmer, Node.js, or a browser. It produces byte-identical IR to the native compiler, serving as a faithful cross-ABI regression check.

Last updated on

On this page