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 → i32 { ^ ( + 1 2 ) }",
  "filename": "main.nu",
  "emit_ll": false,
  "opt": "-O2"
}

Returns: base64-encoded wasm bytecode and compilation logs.

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.

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 (Linux, Windows, macOS) or WebAssembly
  • nurl_list_* - browse examples, stdlib, and tests
  • nurl_read_* - fetch examples, stdlib, tests, grammar, README, roadmap, and gotchas

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

TODO: add environment variables, port configuration, docker image from ghcr, etc...

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

Podman quadlet?

...

See nurlapi/README.md for environment variables and configuration.

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