Explanation
CLI, API, and MCP interfaces
The same runtime semantics are exposed to humans, local API clients, and agent tooling.
Linkar has three interface layers:
- CLI
- local HTTP API
- stdio MCP server
They are meant to expose the same runtime model, not three different products.
CLI semantics
The CLI is intentionally thin.
Important commands:
linkar run ...linkar render ...linkar collect ...linkar test ...linkar inspect run ...linkar project ...linkar pack ...linkar config pack ...linkar config author ...linkar completion ...
Key behavior:
runalways executesrenderalways stages only- render-mode templates reuse the visible project bundle on
run; pass--refreshto rerender first collectrecords outputs after manual executionproject latestreturns the newest matching recorded run without making you scan full historyproject remove-runcan detach or delete recorded runsproject prunecan collapse older duplicate-path history while keeping the newest visible runproject prune --keep Nkeeps more than one recent run per visible path when you want shallow history instead of a single survivorconfig authorstores reusable author defaults for new projects
Execution command output contract:
- default human output is rich when a terminal supports it
- default plain stdout is the primary workspace or run directory path
--format jsonand--format yamlare the stable structured forms forrun,render,collect, andtest
If you want the end-to-end mental model first, read Project lifecycle before the more detailed
runtime pages.
Run references accepted across collect, inspect run, project view, and project remove-run are:
- instance ids such as
fastqc_001 - unique template ids within a project such as
fastqc - run directory paths
.linkar/meta.jsonpaths
Help and shell completion
The main CLI and dynamic template subcommands use the same Rich help style.
Shell completion supports:
linkar completion bash
linkar completion zsh
linkar completion fish
linkar completion install bash
linkar completion install zsh
linkar completion install fish
completion install is the side-effecting path. The plain shell commands only print completion
code.
Existing projects can also manage their own stored author metadata without reinitializing:
linkar project author show
linkar project author set --name "Project Owner" --email "owner@example.org"
linkar project author clear
Local API
The local HTTP server is not a separate orchestration layer. It is a thin JSON wrapper around the same core semantics:
linkar serve --port 8000 --api-token local-dev:read,resolve,execute
Start discovery with:
curl -H 'Authorization: Bearer local-dev' http://127.0.0.1:8000/v1
curl -H 'Authorization: Bearer local-dev' http://127.0.0.1:8000/v1/schema
Recommended v1 routes:
GET /v1GET /v1/schemaGET /v1/projects/currentGET /v1/projects/current/runsGET /v1/projects/current/runs/latestGET /v1/projects/current/assetsGET /v1/templatesGET /v1/templates/{template_id}POST /v1/templates/{template_id}:resolvePOST /v1/templates/{template_id}:runPOST /v1/templates/{template_id}:renderPOST /v1/templates/{template_id}:testGET /v1/runs/{run_ref}POST /v1/runs:collectGET /v1/runs/{run_ref}/outputsGET /v1/runs/{run_ref}/statusGET /v1/runs/{run_ref}/runtime
Important conventions:
- collection responses expose
itemsandcount - detail responses expose a
kindfield :resolvereturns provenance, warnings, confirmation metadata, and a short-livedresolve_tokenwhen the plan is ready:runcan still accept direct params, but the preferred v1 pattern isresolve -> confirm -> run
Legacy unversioned routes still exist for backward compatibility, but new clients should prefer /v1/....
MCP
The MCP server exposes the same runtime to agent clients:
linkar mcp serve
Representative MCP tools:
linkar_list_templateslinkar_describe_templatelinkar_resolvelinkar_runlinkar_renderlinkar_collectlinkar_testlinkar_inspect_runlinkar_get_run_outputslinkar_get_run_runtime
For Codex-style clients, the main advantage of MCP is that it exposes small explicit tools instead of forcing the client to wrap shell commands or raw HTTP itself.
If linkar is already installed, a typical Codex setup looks like:
codex mcp add linkar -- linkar mcp serve
If you are working from a repo checkout instead:
codex mcp add linkar \
--env PYTHONPATH=/path/to/linkar/src \
-- python3 -m linkar.mcp_server
Then verify it with:
codex mcp list
codex mcp get linkar
The product value here is consistency: humans and agents are using the same underlying contract.