Programmatic access: the Kernel HTTP API, MCP and the CLI
Audience. A developer who knows JS/TS, SQL, HTTP and Docker but is new to ONEWEB 6.0 and wants to call the platform from code: a script, a pipeline, an MCP client or an AI agent.
Sources (all read for this page). kernel-poc/src/http-server.js, kernel-gate.js, kernel-authz.js, kernel-auth.js, tool-args.js, mcp-server.js, mcp-token.js, provision-cli-client.js, verify-mcp-http.js, tools.js, tools/kernel.js, tools/veda.js, tools/shared.js, tools/deploy.js, tools/flow.js; cli/bin/oneweb.js, cli/lib/*.js; workbench/packages/sdk/src/kernel.ts; .mcp.json, .claude/launch.json; CLAUDE.md; part-2, part-6, part-9.
Conventions. Anything marked "(not run)" or "(not verified)" was read in source but not executed or confirmed. Nothing on this page was run against a live Kernel, and no token was requested. No secret values appear here, only the names of the vault keys that hold them. Siblings: dev-1-getting-started.md, dev-2-recipes.md, dev-3-services-directory.md, dev-5-flows-connections-expressions.md, dev-6-refusals-troubleshooting.md.
D4.1 The four doors and the one rule behind them#
Everything ONEWEB can do to a design (create an entity, add a flow step, publish, promote, deploy a release) is a typed tool in kernel-poc/src/tools/*.js. Each tool is { name, description, inputSchema, handler }. The Workbench, the CLI, Veda (the AI co-pilot) and any script you write all call the same tools. There are four ways in:
| Door | Transport | Who it authenticates as | Use it for |
|---|---|---|---|
REST tool route POST /api/tools/:name |
HTTP, JSON | a Workbench session cookie, or a bearer token | scripts, pipelines, the Workbench itself |
HTTP MCP POST /mcp |
HTTP, MCP streamable transport, stateless | bearer token for the Keycloak client oneweb-mcp only |
MCP clients (Claude Code) on this machine |
stdio MCP kernel-poc/src/mcp-server.js |
stdio, spawned by the client | nobody: sub: null, trust is the OS process spawn |
local agent sessions, offline work |
oneweb CLI cli/bin/oneweb.js |
calls the REST tool route | bearer token (service account) | deploys from a terminal or Jenkins |
The rule behind all four: a call goes through authentication, then argument validation, then authorization, then the edit-lock check, then the handler. The facade is dev-only and binds 127.0.0.1 (override with KERNEL_BIND, which makes the process print a warning). Part 2 says the same in §2.2.
Addresses and switches#
- Default port is
PORTor 4500 (http-server.js)..claude/launch.jsonruns it as thekernelentry on 4600, and the CLI andverify-mcp-http.jsboth default to 4600. A second launch entry,kernel-enforced, runs on 4611 withKERNEL_ENFORCE_BINDINGS=trueandOW_WORKBENCH_ISSUERpointed at theoneweb-buildrealm. - The examples below use
http://127.0.0.1:4600. Adjust to wherever your facade listens.
| Variable | Default | Effect (source) |
|---|---|---|
PORT |
4500 |
listen port (http-server.js) |
KERNEL_BACKEND |
pg |
pg (Postgres event store) or file (JSONL store, offline). The graph routes and deploy_start need pg |
KERNEL_BIND |
127.0.0.1 |
bind address; anything else logs a warning |
KERNEL_REQUIRE_AUTH |
true |
only the literal false turns authentication off (kernel-gate.js) |
KERNEL_ENFORCE_BINDINGS |
false |
only the literal true turns workspace-binding authorization on |
KERNEL_WORKSPACE |
workspace:default |
fallback workspace when a call names no artifact |
KERNEL_ENVIRONMENT |
dev |
the environment value a binding's condition is evaluated with |
OW_WORKBENCH_ISSUER / OW_WORKBENCH_CLIENT_ID |
http://localhost:8095/realms/oneweb / workbench |
the issuer the facade trusts for sessions and bearers |
KERNEL_BEARER_AUDIENCE / KERNEL_BEARER_CLIENTS |
oneweb-kernel / oneweb-cli,oneweb-mcp |
what a bearer token must carry |
D4.2 The call envelope#
Success and failure on POST /api/tools/:name#
The body is a JSON object of the tool's own arguments. clientId (the edit-lock id; see D4.5) and __principal are removed from the body before the handler sees it; __principal is discarded so a caller cannot assert an identity.
| Outcome | HTTP | Body (from http-server.js) |
|---|---|---|
| success | 200 | { "ok": true, "result": <whatever the handler returned> } |
| unknown tool | 404 | { "error": "unknown tool <name>" } (no ok field; checked before authentication) |
| body is not JSON | 400 | { "ok": false, "error": "the request body is not valid JSON" } |
| not signed in | 401 | { "ok": false, "error": "<tool> requires an authenticated caller. Sign in at /api/auth/login, or set KERNEL_REQUIRE_AUTH=false …" } |
| signed in, not permitted | 403 | { "ok": false, "error": "<reason>" } where the reason names the binding that nearly matched (D4.5) |
arguments do not match inputSchema |
422 | { "ok": false, "error": "'<tool>' rejected its arguments — they do not match its inputSchema: …", "problems": [ "…", … ] } |
a coded refusal (Data Studio, data-plane.js Refusal) |
422 | { "ok": false, "error": "…", "code": "<stable code>", "problems"?: […] } |
| anything else a handler or the lock check throws | 422 | { "ok": false, "error": "<message>" } |
The two other error shapes#
- The direct
/api/*routes (everything except the tool route) fail authentication with401 { "error": "unauthorized", "detail": "…" }and the binding check with403 { "error": "forbidden", "detail": "…" }. There is nookfield. - A bad bearer token is
401 { "ok": false, "error": "bearer token rejected: …" }. An issuer that does not answer is503 { "ok": false, "error": "could not verify the bearer token: …" }.
On MCP#
Results come back as MCP text content: the handler result is JSON.stringify(result, null, 2). Failures come back with isError: true and a text that starts with a prefix:
| Prefix | Meaning | Where |
|---|---|---|
UNAUTHORIZED: |
not signed in | stdio and /mcp |
FORBIDDEN: |
signed in, no binding | stdio and /mcp |
INVALID: followed by the problems as JSON |
arguments do not match the schema | /mcp only |
REJECTED: |
everything else (on stdio this also covers schema failures) | stdio and /mcp |
D4.3 Route reference#
Every route lives in http-server.js. "Gate" is the /api/ gate described in D4.4: any path starting /api/ except /api/auth/ requires an established identity (when KERNEL_REQUIRE_AUTH is on). "Binding" means that, when KERNEL_ENFORCE_BINDINGS=true, the caller also needs view on the named target. A route marked "gate only" has no binding check in the source I read.
CORS preflight (OPTIONS, any path) answers 204. Responses allow GET,POST,OPTIONS and the headers content-type, x-ow-agent. A bearer-token client does not need CORS.
Identity#
| Method and path | Auth | Purpose and shape |
|---|---|---|
GET /api/auth/login?next=<url> |
none | Starts Authorization Code + PKCE (S256) against OW_WORKBENCH_ISSUER with client workbench; scope openid profile email. 302 to Keycloak. next is honoured only if its origin is on the CORS allowlist |
GET /api/auth/callback |
none | Exchanges the code, verifies the ID token (signature, issuer, audience = client id, nonce), creates a server-side session, sets cookie ow_wb_session (HttpOnly; SameSite=Lax; Path=/, 8 h), 302 to next or the facade |
GET /api/auth/logout?next=<url> |
none | Deletes the session, clears the cookie, 302 via the issuer's end-session endpoint if discovery works |
POST /api/auth/backchannel-logout |
signature on the logout token | The issuer ends sessions; matched by sub as well as sid |
GET /api/auth/me |
none | 200 { authConfigured, session, issuer }. session is { sub, username, name, email, roles, groups } or null when nobody is signed in. 200-with-null, not 401, so a signed-out page load is not an error. Works with a bearer too |
Reads#
| Method and path | Auth | Purpose and shape |
|---|---|---|
GET /api/artifacts?kind=&appId= |
gate + binding (target appId) |
Array of artifact metadata (id, kind, name, appId, lastSeq, lifecycleStatus; see ArtifactMeta in workbench/packages/sdk/src/kernel.ts). Both filters optional; absent means unfiltered |
GET /api/artifacts/<id> |
gate + binding (that artifact) | { id, meta, spec, history }, or 404 { "error": "not found" }. ?diffFrom=<seq> returns the diff from that seq to the current one instead |
GET /api/artifact-summary?appId= |
gate + binding | One row per artifact with its last event (same data as the kernel_artifact_summary tool) |
| `GET /api/audit?artifactId=&actor=&since=&ai=true | false&limit=` | gate + binding |
GET /api/design-system/<id>/css?app=&scope=&base=1&vendor=1 |
gate only | Compiled design-system CSS (text/css); the Page designer canvas uses it |
GET /api/graph?app= |
gate + binding | App graph (nodes, edges). Postgres backend only: others get 501 |
GET /api/graph/dangling, /refresh, /recompute |
gate only | Dangling references; rebuild edges. These routes change graph tables even though they are GETs |
GET /api/graph/impact/<id> |
gate only | What depends on an artifact (impactOf) |
GET /api/graph/<id> |
gate only | An artifact's neighbours |
GET /api/tools[?prefix=a_,b_] |
gate (checked as kernel_list_artifacts) |
{ ok: true, tools: [{ name, description, inputSchema }] }; the same list MCP tools/list returns |
Tools, Veda, generation, locks#
| Method and path | Auth | Purpose and shape |
|---|---|---|
POST /api/tools/<name> |
full gate: sign-in, schema, binding, lock | The main door; envelope in D4.2 |
GET /api/veda/status |
gate only | { configured, provider, reachesNetwork, available, error } |
POST /api/veda/propose |
gate only | Body { intent, allow?, context? }. Asks the configured model for tool calls and returns them without writing: { provider, rationale, calls, targets, impact, applicable }. 400 without intent, 503 if VEDA_PROVIDER is not set |
POST /api/veda/apply |
every call is gated | Body { calls, title?, clientId? }. Re-validates the calls, gates all of them before running any, runs them in one composition, returns { ok: true, compositionId, applied, results } (422 if the proposal does not validate) |
POST /api/generate |
gate only | Body { appId }. Spawns generate-app.js into generated/<key> (path is derived, never taken from the caller). { appId, outDir, ms, …diff, output }, or 500 { error: "generation failed", exitCode, detail } |
GET /api/locks/<artifactId>?clientId= |
gate only | { held, byMe, displayName?, acquiredAt? }. clientId is returned only to its holder |
POST /api/locks/<artifactId>/<acquire|heartbeat|release> |
gate only | Body { clientId, displayName? }. Advisory in-memory locks, 45 s TTL without a heartbeat |
Process test and debug (reach past the Kernel into the BPM engine)#
| Method and path | Purpose |
|---|---|
GET /api/process/keycloak-roles |
{ roles } from the realm, 502 on failure |
POST /api/process/<processId>/deploy |
Deploys the process to the local dev engine; result is deployProcessToTarget's |
POST /api/process/<processId>/start |
Body { variables }; returns { instanceId, coords }. An undeclared variable name is refused |
POST /api/process/<taskId>/complete |
Body { variables }; returns { ok: true }. Completes as the hard-coded user workbench-debug |
GET /api/process/<instanceId>/tasks, /trace, /state, GET /api/process/<taskId>/task-variables |
Open tasks, step trace, instance variables and end state, task variables |
POST /mcp#
See D4.7.
D4.4 Authentication#
Sessions (the Workbench)#
The Workbench shell (:3000) is a different origin from the facade, so KernelClient (workbench/packages/sdk/src/kernel.ts) sends every request with credentials: "include". The flow:
- The browser opens
GET /api/auth/login?next=<shell url>; the facade redirects to Keycloak. - Keycloak returns to
/api/auth/callback; the facade verifies the ID token and creates an opaque, server-side, in-memory session (lost on restart, TTL 8 hours), settingow_wb_session. - The shell asks
GET /api/auth/meand draws a login screen whensessionisnull. callToolposts to/api/tools/<name>with{ ...args, clientId }.
The session's sub is the Keycloak username (preferred_username), not the UUID. That is what appears as the author in the audit trail. roles read only this client's resource_access entry (never every client). groups come from the token's groups claim, with and without the leading slash, and feed group bindings.
Bearer tokens (CLI, pipelines, MCP)#
A request with Authorization: Bearer <access token> is verified before any route (attachBearer in kernel-auth.js). The token must satisfy all of:
- valid signature, issuer and expiry against the same issuer as sessions;
typisBearer(an ID token is refused);- audience
oneweb-kernel(KERNEL_BEARER_AUDIENCE), which only clients given the audience mapper carry. The realm is shared with every generated app's end users, so issuer plus signature alone would admit them all; azpis inKERNEL_BEARER_CLIENTS, defaultoneweb-cli,oneweb-mcp.
The last step (the client running the helper again after a 401) is the client's behaviour: mcp-token.js only states it in a comment, and it was not checked in the client (not verified).
A bearer that fails is 401, never treated as anonymous. A valid bearer becomes the request's session (via: "bearer", clientId = the token's azp), so downstream gates read the same shape whichever door was used. A token's sub here is the service account's username, service-account-<client>.
The two Keycloak clients#
provision-cli-client.js creates (idempotently) a confidential client with service accounts on and every browser flow off, adds the oneweb-kernel audience mapper, and writes the client's id and secret to OpenBao:
node kernel-poc/src/provision-cli-client.js [--workspace workspace:default] [--env Dev] [--client oneweb-cli|oneweb-mcp]| Client | Used by | Vault keys (under kv/oneweb/<workspace>/<env>/) |
|---|---|---|
oneweb-cli |
the oneweb CLI, pipelines |
ONEWEB_CLI_CLIENT_ID, ONEWEB_CLI_CLIENT_SECRET |
oneweb-mcp |
the HTTP MCP door | ONEWEB_MCP_CLIENT_ID, ONEWEB_MCP_CLIENT_SECRET |
The key names follow the rule clientId.toUpperCase().replace(/[^A-Z0-9]+/g, "_"). The script needs an admin to run it (it reads a root token file and uses a Keycloak admin login), and it deliberately does not grant the service account anything in a workspace.
Getting a token (what the code does)#
- CLI:
ONEWEB_TOKENas given, else a client-credentials grant withONEWEB_CLIENT_IDandONEWEB_CLIENT_SECRETagainstONEWEB_ISSUER(defaulthttp://localhost:8095/realms/oneweb). - MCP:
kernel-poc/src/mcp-token.jsreads the client id and secret from OpenBao through the read-onlyhub-applyAppRole (never from an env var or a file), asks Keycloak for a client-credentials token with an 8-second timeout, and prints exactly one line:{"Authorization":"Bearer …"}. Failures go to stderr with exit 1. Options:--workspace,--env,--client; envKEYCLOAK_URL,KEYCLOAK_REALM. - Tokens live minutes (the
onewebrealm import setsaccessTokenLifespanto 300 s), so re-fetch rather than caching.
The token's realm must be the realm the facade trusts. mcp-token.js defaults to realm oneweb; the kernel-enforced launch entry trusts oneweb-build, so a token from the other realm would not verify there (inferred from source, not run).
When there is no auth#
D4.5 Authorization: verbs, scopes, bindings#
Authentication says who you are. Authorization (kernel-authz.js) says what you may do, and only runs when KERNEL_ENFORCE_BINDINGS=true.
The model. A workspace holds roles (named sets of verbs) and bindings (principal × role × optional scope × optional expiresAt × optional condition). The thirteen verbs are the enum in workspace.schema.json: view, edit, publish, promote, approveProd, manageMembers, manageConnections, deleteArtifact, runOps, readData, writeData, revealSensitive, readLogs.
Resolving a call (decide):
- Find the artifacts the call acts on: every string argument that looks like an artifact id (
page:,process:,flow:,entity:,form:,decision:,app:,bundle:,workspace:and a few more prefixes), plusappId(which becomesapp:<appId>). - Walk each one's containment chain (artifact, app, workspace). A binding scoped to an app covers everything in it.
- The workspace comes from that chain, not from an env var. Two different workspaces in one call is refused outright. A call that names no artifact falls back to
KERNEL_WORKSPACE, so it needs a workspace-wide grant. - A binding matches if its principal id is your
subor one of your groups, it is unexpired, its scope is in the chain, itsconditionholds (compiled with the one expression parser, with rootenvironment), and its role grants the verb. An unparseable expiry or condition fails closed. - A refusal says why, for example
no binding grants edit here — <role> does not grant editorno binding at all for this principal in this workspace.
Which verb a tool needs (verbFor):
- A tool in
READ_ONLY_TOOLSneedsview. The list is explicit by name, not a naming pattern. - A tool in
TOOL_VERBSneeds that verb. - Every other tool needs
edit. The default is deliberately a real permission, not an open door.
| Verb | Tools (from TOOL_VERBS) |
|---|---|
view |
the READ_ONLY_TOOLS set: kernel_list_artifacts, kernel_get_artifact, kernel_diff, kernel_audit_trail, artifact_export, flow_runs, hub_deployments, failed_items, deploy_plan, deploy_history, deploy_status, deploy_logs, decision_evaluate, workspace_who_can, secret_status, obs_* reads, and others |
edit (default) |
the long tail: entity_*, form_*, page_*, flow_*, process_*, decision_* authoring, content_*, dashboard_*, glossary_*, ds_*, kernel_import_artifact, veda_* composition tools. entity_set_field is listed explicitly as edit |
publish |
artifact_publish, app_publishes_contract |
promote |
artifact_promote_live, bundle_promote, hub_deploy, hub_undeploy, hub_rollback, decision_runtime_deploy, decision_runtime_undeploy, deploy_start, deploy_cancel, deploy_rollback |
approveProd |
bundle_execute_promotion, decision_approve |
runOps |
bundle_migrate_instances, flow_replay, hub_run, failed_item_replay, failed_item_delete |
deleteArtifact |
artifact_archive, artifact_restore |
manageMembers |
the control plane: workspace_create, workspace_add/remove_binding, workspace_add/remove_role, workspace_set_role_grants, workspace_create_builder, workspace_*_environment, app_import, app_set_workspace, app_set_identity, app_add/remove_first_admin, env_set_target, env_set_four_eyes, env_set_deploy_four_eyes, env_set_pipeline, workspace_set_residency, entity_set_residency, entity_unmark_sensitive, security_* writes |
manageConnections |
connection_create, connection_set_config, secret_set, policy_generate_key, workspace_set_environment_network, workspace_bind/unbind_connection, env_set_engine, app_set_database, app_add_database |
readData |
data_list_tables, data_describe_table, data_rows, data_query, data_search, storage_buckets, storage_list, storage_signed_link, app_database_plan |
writeData |
data_write_rows, data_apply_migration, storage_upload_link, storage_upload_done, storage_delete |
revealSensitive |
data_reveal |
This table abridges TOOL_VERBS and READ_ONLY_TOOLS, which are the source of truth. Which verbs each of the six starter roles (workspaceAdmin, appOwner, opsEngineer, riskOfficer, builder, viewer) holds is not stated here (not verified).
Environment approval roles. Separately from verbs, bundle_execute_promotion, hub_deploy and deploy_start check the environment's requiresApprovalFrom role names against the roles you hold (approvalCheck). That check also only applies when bindings are enforced. A four-eyes rule on deploys is a separate gate (deploy_plan reports it as a blocker).
D4.6 Argument validation#
tool-args.js compiles each tool's inputSchema with Ajv (2020-12, allErrors, strict: false, formats not validated) and checks every call on the REST route, on /mcp, in eval.js and in Veda's review. Order on both HTTP doors: authenticate, validate, authorize. An anonymous caller therefore learns nothing about its call's shape. Handlers called directly (scripts, tests) are not validated, so handlers keep their own checks.
Messages are one line per problem, for example <path> is missing required "<name>", <path> has an unknown property "<name>", <path> must be one of "a", "b". They never quote a value, so a rejected secret is not echoed.
Reading the schemas yourself. GET /api/tools (or MCP tools/list) returns { name, description, inputSchema } for every tool. ?prefix=entity_,flow_ narrows it. How many tools there are is deliberately not written down in CLAUDE.md; test-tool-schemas.js derives it.
D4.7 MCP#
stdio: kernel-poc/src/mcp-server.js#
The repo's own .mcp.json registers it:
{
"mcpServers": {
"oneweb-kernel": {
"command": "node",
"args": ["kernel-poc/src/mcp-server.js"],
"env": { "VEDA_MODEL": "claude-code", "KERNEL_BACKEND": "pg" }
}
}
}Properties, all from the source:
- It opens its own connection to the Kernel store (
db-config.js); it does not talk to the HTTP facade.KERNEL_BACKENDmust match the facade's, or the two write to different stores. - Principal:
{ sub: null, act: { sub: VEDA_AGENT ?? "veda", model: VEDA_MODEL ?? "unknown" }, authenticated: true, via: "stdio" }. Authentication is the process spawn. Writes are recorded withsub: nullandactnaming the agent. - It runs the schema check and, when
KERNEL_ENFORCE_BINDINGS=true, the binding check. - It does not run the edit-lock check.
HTTP: POST /mcp#
A stateless MCP streamable-HTTP endpoint on the facade (serveMcp). Same checks as the REST route, step for step: schema, bindings, locks, principal re-injected.
What it refuses, each with {"jsonrpc":"2.0","error":{"code":-32001,"message":…},"id":null}:
| Condition | Status |
|---|---|
request has an Origin header (every browser sends one; MCP clients do not) |
403 |
| no verified bearer (a Workbench cookie is not accepted) | 401 with WWW-Authenticate: Bearer realm="oneweb-kernel" |
method is not POST (no server stream, no session to end) |
405 with Allow: POST |
| body is not JSON | 400 |
A bearer whose azp is not in KERNEL_BEARER_CLIENTS is refused earlier (401). The principal is { sub: <token sub>, act: { sub: <azp>, model: "unknown" }, via: "mcp" }, so a write is attributed to service-account-oneweb-mcp with ai.agent: oneweb-mcp beside it. That is what verify-mcp-http.js --allow-writes asserts.
Setting it up#
- A person with Keycloak admin rights provisions the client:
node kernel-poc/src/provision-cli-client.js --client oneweb-mcp(needs OpenBao up;npm run vault:up). - In the Workbench, grant
service-account-oneweb-mcpa role in the workspace (only matters with bindings enforced). - Point your client at the URL and give it
mcp-token.jsas the thing that prints the header. The repo does not ship an HTTP entry, so this is a sketch of the shape Claude Code documents forheadersHelper(field names not verified against Claude Code's docs, and not run):
mcp-token.js says it prints "exactly what Claude Code's headersHelper expects" and that it must be called on every connection and after a 401. It reads credentials from OpenBao rather than from an env var because, per its header, Claude Code strips secret-looking variables before a project helper runs.
- Check it with
node kernel-poc/src/verify-mcp-http.js --url http://127.0.0.1:4600/mcp. It proves the refusals (401, 403, 405, forged token), atools/list, a read-only call, an invalid call refused asINVALID:and a client-asserted__principalbeing ignored.
MCP via the CLI#
oneweb mcp --app <app> --env <name> is a different, narrower thing: a stdio MCP server inside the CLI that exposes only an allow-list of Data Studio read tools (data_list_tables, data_describe_table, data_rows, data_query, data_er_diagram, data_api_routes, storage_buckets, storage_list, storage_signed_link), with workspaceId, environment and appRef bound from the flags and removed from the schemas the agent sees. It fetches the schemas from GET /api/tools?prefix=data_,storage_ and calls the REST tool route.
D4.8 Compositions, undo and "recorded as"#
Compositions#
A composition groups several edits into one undoable unit. Most write tools accept the optional compositionId (uuid) and compositionTitle properties.
| Tool | Arguments | Returns |
|---|---|---|
veda_begin_composition |
{ title } |
{ compositionId, title, next } |
veda_end_composition |
{ compositionId } |
records which artifacts it touched; stays undoable |
veda_undo_composition |
{ compositionId } |
{ reverted: … } |
veda_redo_composition |
{ compositionId } |
{ reapplied: … } (not a second undo; it restores each artifact to the state right after the composition's last change) |
What identity gets recorded#
prov() (tools/shared.js) builds each event's provenance from the principal the transport injected:
subandauthor(equal): the accountable principal. Never defaulted: no principal meanssub: null, "visibly unattributed". A tool-callauthorargument is honoured only if there is no real principal.act: present only when something other thansubis acting. On the REST route it comes from the caller-suppliedx-ow-agentheader ({ sub: <header>, model: VEDA_MODEL ?? "unknown" }). It asserts agency, not identity, so the worst a liar achieves is tagging their own write as AI-assisted; a request carrying only that header is still unauthenticated.ai: written only when an agent acted or a composition is involved.
| Door | sub recorded |
act |
|---|---|---|
| Workbench session | the signed-in username | none |
Bearer on /api/tools |
service-account-<client> |
none, unless x-ow-agent is sent |
/mcp |
service-account-oneweb-mcp |
{ sub: "oneweb-mcp", … } |
| stdio | null |
{ sub: VEDA_AGENT ?? "veda", model } |
You can read the result back with kernel_audit_trail (filters artifactId, actor, since, ai, limit), which returns events as { artifactId, seq, at, type, note, actor, ai }. actor: null means an event written before the Kernel had a principal.
D4.9 The oneweb CLI#
Defined in cli/bin/oneweb.js (package @oneweb/cli, bin: oneweb, Node 20+). It talks only to the facade's REST tool route (POST /api/tools/<name>) with a bearer token, so it has no door the UI does not have. It is not on npm; the generated Jenkinsfile says to install it with npm i -g <repo>/cli. The Deployment Center shows these lines (deploy-center.tsx): oneweb deploy <release> --env <env> --wait and oneweb logs <run> --release <release> --follow.
Commands exactly as oneweb help prints them:
oneweb deploy <release> --env <name> [--plan-only] [--wait] [--timeout 20m] [--trigger jenkins]
oneweb plan <release> --env <name> same as deploy --plan-only
oneweb status <run> --release <release>
oneweb logs <run> --release <release> [--follow]
oneweb cancel <run> --release <release>
oneweb rollback <run> --release <release> [--dry-run] [--wait]
oneweb history <release> [--env <name>]
oneweb whoami
oneweb jenkins template a Jenkinsfile that deploys with this CLIPlus Data Studio read-only commands (oneweb data tables|describe|rows|query|er|api, oneweb storage buckets|ls|link, oneweb mcp) and export and import (oneweb export artifact|app, oneweb import artifact|app). Their full syntax is in the CLI's --help.
- Release names.
loan-2-4becomesbundle:loan-2-4; an id that already startsbundle:is kept. - Options.
--kernel <url>orONEWEB_KERNEL_URL(defaulthttp://localhost:4600),--workspace <id>,--output text|json. - Auth.
ONEWEB_TOKEN, orONEWEB_CLIENT_ID+ONEWEB_CLIENT_SECRET[+ONEWEB_ISSUER]. - What
deploydoes.deploy_planfirst (prints the plan), thendeploy_startwith the plan'sdigestasplanDigestandtrigger(cliby default). With--waitit pollsdeploy_logsand finishes withdeploy_status. Without it, it prints the run id and a follow command. A blocked plan with--plan-onlyexits 2. - Exit codes, which a pipeline branches on:
0ok,1could not ask (usage, network, 401, malformed),2refused by the plan or environment,3not permitted (403, or an approval-role message),4the run failed,5cancelled,6--waittimed out (the run is not cancelled).
D4.10 Worked examples#
All use the bearer path. $KERNEL is http://127.0.0.1:4600. All are (not run).
Get a token (the same grant the CLI uses)#
1. List artifacts (read-only)#
2. Read one artifact and its history#
curl -s -H "Authorization: Bearer $TOKEN" "$KERNEL/api/artifacts/app%3Aloan-onboarding"
# → { "id": "app:loan-onboarding", "meta": {…}, "spec": {…}, "history": [ { seq, type, note, at, ai }, … ] }
curl -s -X POST $KERNEL/api/tools/kernel_get_artifact \
-H "Authorization: Bearer $TOKEN" -H "content-type: application/json" \
-d '{"artifactId":"app:loan-onboarding"}' # optional "atSeq": 12 for a historical spec3. The same read-only call from Node 20+ (fetch)#
This mirrors facade().call in cli/bin/oneweb.js and KernelClient.callTool in the SDK.
4. A write, with its refusals#
This example creates a flow, grouped in a composition so it can be undone (arguments from flow_create's schema and verify-mcp-http.js):
call() { curl -s -w '\n%{http_code}\n' -X POST "$KERNEL/api/tools/$1" \
-H "Authorization: Bearer $TOKEN" -H "content-type: application/json" -d "$2"; }
call veda_begin_composition '{"title":"docs probe"}'
# → {"ok":true,"result":{"compositionId":"<uuid>","title":"docs probe","next":"…"}} 200
call flow_create '{"appId":"app:docs-probe","name":"docs-probe","trigger":{"kind":"invoke"},"compositionId":"<uuid>"}'
call veda_end_composition '{"compositionId":"<uuid>"}'
call veda_undo_composition '{"compositionId":"<uuid>"}' # one step backThe refusals you can expect, with their real shapes:
# no token and auth on:
401 {"ok":false,"error":"flow_create requires an authenticated caller. Sign in at /api/auth/login, or set KERNEL_REQUIRE_AUTH=false to run this Kernel without authentication (offline/dev only — every tool becomes callable by anything that can reach the port)."}
# bad arguments (e.g. {"flowId":42} to flow_add_step); problems array lists each failure:
422 {"ok":false,"error":"'flow_add_step' rejected its arguments — they do not match its inputSchema: …","problems":["…"]}
# bindings enforced and the service account has no grant:
403 {"ok":false,"error":"no binding at all for this principal in this workspace"}
# another client holds the lock:
422 {"ok":false,"error":"flow:docs-probe is locked by <name> — refusing this write"}The exact problems strings and the 403 reason depend on the schema and the workspace; the wrapper text is from source.
D4.11 Notes and sharp edges#
For what each refusal message means and how to recover, see dev-6-refusals-troubleshooting.md. For the flow and connection tools you will most often call, see dev-5-flows-connections-expressions.md and dev-2-recipes.md. For which port each service uses, see dev-3-services-directory.md. For the generated reference of every tool, see part-9 §9.2.