Skip to content
idiapPublic

About

A workspace for PRISM repositories, skills, data sources, reports and workflows.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Lunar

Your workspace for executable knowledge

Connect skills, data and workflows. Explore their structure.
Run them with PRISM and keep the reports, artifacts and evidence together.

Getting Started Β· Watch the demo Β· Connect MCP Β· Build for Lunar

License: Apache 2.0 Run with Docker Compose Connect with MCP Powered by PRISM

Lunar connects MCP servers and PRISM packages to a workspace for skills, workflows, data and traceable results.

Lunar brings reusable instructions, connected sources, executable workflows and their results into one authenticated workspace. Bring a live MCP server or import a versioned PRISM package, then browse its skills, inspect workflow graphs and run the capabilities that have valid execution bindings.

🧩 Reusable skills πŸ”­ Visible workflows πŸŒ™ Traceable execution
Browse source instructions and resources; select capabilities for chat. Inspect PRISM graphs, typed inputs and source conversion diagnostics. Keep revision-bound run history, outputs, reports and provenance.
πŸ”Œ Connected sources πŸ“¦ Portable projects πŸ”’ Owned workspaces
Discover skills and workflows over MCP with stdio or Streamable HTTP. Import and export versioned ZIPs; prepare isolated package workers. Keep account credentials encrypted and package versions explicitly selected.

See Lunar in action

Watch the MathFormer demo in Lunar

Getting Started

This local setup runs the frontend, API and PostgreSQL with Docker. It creates a fresh workspace; an external domain repository, model API key and email service are unnecessary to open Lunar and create an account. Chat and model-backed workflows need a configured model later.

1. Install the prerequisites

  • Git and access to this repository.
  • Docker Desktop on macOS/Windows, or Docker Engine with the Compose plugin on Linux. Start Docker before continuing. On Windows, run the commands in WSL2 with Docker integration enabled.
  • uv for the startup and image-builder scripts. It manages Python automatically. Docker installs the application's Python and JavaScript dependencies itself.
  • Internet access for the initial image and dependency downloads, including Lunar's locked PRISM dependency.

Check your terminal:

git --version
uv --version
docker compose version
docker info

2. Get Lunar and configure a local workspace

git clone https://github.com/idiap/lunar.git lunar-platform
cd lunar-platform

If you already have a checkout, open a terminal in its root instead.

3. Build and start

From the repository root:

uv run --no-project scripts/build_worker_image.py
uv run start.py

The first build downloads dependencies and can take several minutes. start.py validates Docker and Compose, creates local settings if needed, builds the application and starts its three services. The worker image is used when preparing imported packages.

Open http://localhost:8080, choose Create account, create an account with a password of at least eight characters, and sign in. An empty catalog is expected on a new installation.

4. Bring your first capabilities

If you have… Next step
A running MCP server Open Packages β†’ Add MCP connection; follow Connect MCP servers.
A Lunar-compatible package ZIP Import and select it, choose Prepare runtime, then browse its skills and open Workflows to run a workflow. See loading external projects.
A repository of skills or workflow code Follow Make your skills and workflows compatible before connecting or importing it.

Add your provider credentials in AI Models before using chat or a workflow that requires a model. MCP workflows execute on their source server; imported packages execute in Lunar's prepared workers.

Troubleshooting and stopping Lunar
  • Docker unavailable: start Docker Desktop/the daemon and retry docker info.
  • Port 8080 already used: change both PORT and PUBLIC_BASE_URL in app/.env (for example, 8090 and http://localhost:8090), then rerun uv run start.py.
  • Storage mount fails: verify the absolute path exists and Docker Desktop shares it.
  • PRISM revision unavailable: confirm GitHub access. If you have a local PRISM checkout containing the exact pinned commit, set LUNAR_PRISM_REPOSITORY=/absolute/path/to/prism and run uv run start.py; this builds both backend and worker from the committed revision. A sibling ../prism checkout is detected automatically. See the operator guide.
  • The page loads while the API is still starting: wait a moment and retry the health check. Inspect backend logs if it keeps failing.
docker compose --env-file app/.env -f app/docker-compose.yml logs --tail=100 backend
docker compose --env-file app/.env -f app/docker-compose.yml down

Ordinary down preserves the database volume and package files. Start again with uv run start.py. Back up the database, package storage and secrets using the backup and restore procedure.

Connect MCP servers

MCP (Model Context Protocol) lets Lunar discover a server's published skills and workflow contracts. A server needs a supported catalog interface as well as a transport; an arbitrary MCP tool list alone does not provide a Lunar skill catalog.

Add a connection

  1. Install the source project's dependencies using its own instructions.
  2. Open Packages β†’ Add MCP connection in Lunar.
  3. Give it a name. In Project, choose skills for the unified catalog described below. Compatibility adapters also exist for mathformer, bioagents, abducer, ruler, causal-agents and mechformer; their available catalogs depend on the server revision.
  4. Choose the transport and enter the fields below. Click Add connection.
  5. Wait for Catalog ready, then browse Skills and Workflows. Open a workflow to inspect its graph, availability and input schema before running it.
Field Streamable HTTP Local process (stdio)
Start the server Start it separately and keep it running. Lunar starts and manages the configured process.
Address / command MCP endpoint, e.g. https://your-server.example/mcp; use the server's actual route. Command, e.g. /opt/project/.venv/bin/python.
Arguments β€” JSON array, e.g. ["scripts/mcp_server.py"]; no shell command string.
Working directory β€” Absolute project directory visible to the backend.
Credentials Optional Bearer token field. Environment overrides as JSON, e.g. {"SERVICE_TOKEN":"your-token"}.

When Lunar runs in Docker: stdio paths resolve inside the backend container. A host checkout and its host virtual environment are not automatically available there. Use an HTTP server for a project running on your computer, or explicitly install/mount its runtime into the backend environment.

On Docker Desktop, a host service commonly uses http://host.docker.internal:PORT/mcp from the container. localhost refers to the backend container itself. The source server must accept the Docker host route and allow that hostname in any origin/host protection settings. Linux Docker Engine needs an appropriate host-gateway mapping or a reachable host/service address. Use the source project's documented bind and authentication settings.

Credentials are encrypted separately from catalog content. Synchronization reads source assets and validates their digests; adding a connection does not execute its workflows. After publishing changes, restart a server that freezes its snapshot at startup and click Refresh in Lunar to create a new catalog revision.

Run a connected workflow

Open the workflow's Runs tab, enter its schema-defined inputs, and run it if it is qualified for execution. Runs pin the exact source revision and retain outputs, errors and provenance. An inspection-only workflow displays its missing bindings or unsupported semantics. A converted graph by itself does not establish runnability.

For chat, select the source capabilities you want available for the turn. Chat uses the same checked execution boundary as the workflow UI. Cancelling stops Lunar's wait and closes its client session; whether remote work stops depends on the MCP server.

For project-specific launch boundaries, asset protocols and execution rules, see MCP source contracts.

Connect an MCP client to Lunar

Lunar also exposes its own MCP server. To use it from an external client:

  1. Sign in and select the package version you want the client to use, if applicable.
  2. Open Home β†’ Connect your MCP client to Lunar.
  3. Choose Streamable HTTP in the client and copy the URL shown by Lunar; preserve its package-version query parameter when present.
  4. Configure bearer authentication using the displayed LUNAR_MCP_TOKEN environment variable name and private value. Set it in the client's launch environment and restart the client so it can read the variable.

Home also provides a ready-to-copy terminal command. Treat the token as a credential and use a URL reachable from the client machine; localhost only reaches that machine.

Make your skills and workflows compatible

Choose live MCP when the source server owns execution, or a PRISM package when you want a portable project with an isolated Lunar worker. Both preserve source identity and versioned evidence.

1. Publish instruction skills

Keep each skill in its own directory with a UTF-8 SKILL.md and YAML frontmatter:

skills/
└── explain-result/
    β”œβ”€β”€ SKILL.md
    └── references/
        └── interpretation.md
---
name: explain-result
description: Explain a result using the supplied evidence and domain references.
---
Read the supplied result and references/interpretation.md.
Explain the conclusion, evidence and remaining uncertainty.

Use a valid lowercase hyphenated skill name matching its directory. Keep scripts and references inside the skill directory and publish their exact bytes. Instructions and scripts supplied as assets do not grant permission to execute those scripts.

For a new MCP integration, expose these tools:

Tool Required behavior
list_skills() Return schema_version: "agent-skills.mcp/v1" and all skill rows, including workflow skills. Each row has name, description, skill_md_path and files containing every skill-local path with its SHA-256 digest.
read_agent_asset(path) Return {path, content, encoding, sha256} from the same frozen snapshot. Encoding is text or base64. Only declared source-relative paths may be read.
read_agent_assets(paths) (optional) Return {assets: [...]} for up to 64 distinct paths per request.

The catalog envelope looks like this (replace the digest with the file's actual SHA-256 hex digest, and include one files entry for every local resource):

{
  "schema_version": "agent-skills.mcp/v1",
  "skills": [{
    "name": "explain-result",
    "description": "Explain a result using the supplied evidence and domain references.",
    "skill_md_path": "skills/explain-result/SKILL.md",
    "files": [
      {"path": "skills/explain-result/SKILL.md", "sha256": "<64-character-hex-digest>"},
      {"path": "skills/explain-result/references/interpretation.md", "sha256": "<64-character-hex-digest>"}
    ]
  }]
}

Generate hashes from the published file bytes. Include the complete resource closure, keep names/descriptions consistent with frontmatter, and reject paths outside the snapshot. Source changes must produce a new coherent snapshot; mixing old manifests with new bytes fails synchronization. See the unified catalog contract and asset snapshot helper for implementation details.

2. Declare workflow skills and runtime bindings

For the unified catalog, a skill whose name ends in -workflow must include an actual prism-workflow/v1 declaration named workflow.yaml. It appears in both Skills and Workflows.

skills/
└── analyze-workflow/
    β”œβ”€β”€ SKILL.md
    β”œβ”€β”€ workflow.yaml      # PRISM declaration: ports, stages, wiring, contracts
    β”œβ”€β”€ runtime.json       # Separate MCP execution binding
    └── references/        # Child declarations and required resources

The declaration must preserve the original workflow's typed ports, dependencies, branches, loops, conditions, failure behavior and completion rules. Publish every referenced child declaration, including unselected branches and recursive calls. Keep implementation code outside the workflow YAML.

Every unified workflow skill also needs runtime.json beside workflow.yaml. If its declared execution tool is unavailable, it remains inspection-only:

Field Meaning
schema Exactly agent-skills.prism-runtime/v1.
workflow_id The root workflow declaration's id.
workflows Source-relative paths of every declaration in the finite invocation graph.
tool The advertised MCP execution tool, such as run_workflow.
revision An immutable, server-owned runtime fingerprint.
input_schema, output_schema Self-contained JSON Schemas for the exact public named ports; require every declared port and set additionalProperties: false.

Lunar calls the execution tool with {workflow_id, inputs, revision}. The source server must reject stale fingerprints, validate the complete binding graph, perform the real stages and return a receipt containing:

{
  "schema": "agent-skills.prism-result/v1",
  "workflow_id": "analyze",
  "revision": "immutable-runtime-fingerprint",
  "status": "complete",
  "outputs": {},
  "execution_performed": true
}

This illustrates the receipt envelope; outputs must contain the actual declared outputs and satisfy output_schema. Return native evidence with the receipt. Use exhausted or error for those outcomes; they cannot become successful outputs. Lunar validates declarations, interfaces and receipts; the server owns correct execution of its implementation. Follow the full runtime binding contract.

Existing project adapters can also expose workflow-skill/v1 descriptors with the source-owned asset interface. Their schemas, typed MCP bindings and source-owned PRISM extension are documented in MCP source contracts. Those descriptors are a separate format from the unified prism-workflow/v1 declaration.

3. Alternatively, export a portable PRISM package

A package ZIP carries the project's repository resources, skills, data sources and runtime declarations. Lunar accepts a compatible ZIP rather than a Git URL or raw checkout. Use the vendored repository-to-PRISM converter and the step-by-step loading guide to:

  1. Inventory every source workflow, executable skill, data source and associated report.
  2. Preserve source control flow and bind operations to their real implementations.
  3. Register executable PRISM entrypoints with # lunar-runtime: metadata, typed schemas, prepare/execute/verify hooks and evidence contracts.
  4. Export one deterministic ZIP with prism-export.json; verify two exports are byte-identical and run the package validator.
  5. Import, Prepare runtime, and run every exported workflow with representative inputs. Verify persisted run evidence and inspect its rendered results.

Workflows associated with source reports must return a real prism.reporting.report.Report and pass the report compatibility checks. See the package format for archive structure.

4. Verify compatibility before calling it runnable

Check Evidence to inspect
Discovery Complete catalog, exact asset hashes, valid frontmatter and no missing references.
Structure Valid workflow declarations, typed wiring and preserved source control flow.
Runtime Advertised tool/worker bindings, matching revision and valid input/output schemas.
Execution A representative real run, correct terminal state, native evidence and provenance.
Presentation Workflow graph, run form, results and any report work in Lunar's UI.

Unsupported semantics stay inspection-only with diagnostics. Never replace human approvals, retries, missing native operations or exhausted loops with a successful placeholder. Graph conversion and schema validation do not establish scientific validity.

Documentation and development

Guide What it covers
Installation and operations Deployment, model credentials, backups, local development and verification.
Unified MCP skills Preferred skill catalog and remote workflow execution protocol.
MCP source contracts Project adapters, transport boundaries and conversion/runtime semantics.
Loading external projects Repository conversion, package import and acceptance checks.
Package format Versioned archive manifest and resource layout.
Workflow normalization Source-owned normalization and validation tools.
Planner Internal planning module and its contracts.

For Python development, use Python 3.12 or 3.13 and the locked uv environment; this is separate from the host-only setup scripts' Python requirement. See local development and verification for frontend checks and opt-in database/end-to-end gates.

License

Lunar is developed at the Idiap Research Institute, Neuro-symbolic AI Group, and licensed under Apache-2.0, with per-file REUSE metadata and contributor attribution. Separately licensed bundled code retains its own attribution; see dependency disclosures and license texts.

About

A workspace for PRISM repositories, skills, data sources, reports and workflows.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages