@aikdna/kdna-mcp-server 0.5.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/NOTICE CHANGED
@@ -5,5 +5,11 @@ http://www.apache.org/licenses/LICENSE-2.0
5
5
 
6
6
  Copyright (c) 2026 KDNA Team
7
7
 
8
- This repository contains KDNA skill files (kdna-loader, kdna-create) and
9
- the install.sh installer. Skill files are licensed under Apache-2.0.
8
+ This package contains a local stdio Read MCP adapter for one explicitly
9
+ operator-bound KDNA asset. Its parent repository contains the kdna-loader
10
+ and kdna-creator Skill guides and explicit installers.
11
+ Skill files are licensed under Apache-2.0.
12
+
13
+ The fixed runtime archives retain their own package licenses and notices.
14
+ Synthetic native regression data and its generator are Apache-2.0 source
15
+ fixtures, excluded from the runtime package.
package/README.md CHANGED
@@ -1,228 +1,310 @@
1
- # KDNA MCP Server
2
-
3
- `@aikdna/kdna-mcp-server` is a thin stdio MCP adapter for user-approved
4
- workspace attachments. It delegates integrity, authorization, resolver, plan,
5
- and load decisions to the pinned KDNA CLI/Core runtime. A user-selected
6
- explicit file uses the official CLI through the loader Skill, not an
7
- arbitrary-path MCP tool.
8
-
9
- ## Source status
10
-
11
- The `0.5.0` source tree is a Development Preview candidate whose component tests
12
- bind the exact `@aikdna/kdna-cli@0.36.0` candidate and its single
13
- `@aikdna/kdna-core@0.21.0` runtime. Host delivery and semantic adoption pass on
14
- the OpenCode `1.18.11` ordinary-task single-Host loop
15
- (`VERIFIED_SINGLE_HOST_ORDINARY_TASK`); the Codex ordinary-task rerun remains
16
- `RECHECK_REQUIRED` pending account recovery, Creation-to-Consumption
17
- integration is `RECHECK_REQUIRED`, and real-human acceptance is `NOT_RUN`.
18
- Those two dependency versions are not yet registry releases, so this source
19
- checkpoint is not installable from npm and makes no publication claim.
20
-
21
- The retained CLI tar has one exact 32-file package allowlist and no Eval
22
- dependency, retired command source, global Store path, or bundled legacy
23
- Skill. MCP consumes that closed tar without adding another CLI capability
24
- surface.
25
-
26
- The npm registry still serves MCP `0.4.2`; that historical package is not the
27
- workspace-attachment candidate described here.
28
-
29
- ## Tool boundary
30
-
31
- | Tool | Purpose |
32
- | ------------------------ | ------------------------------------------------------------------- |
33
- | `kdna.workspace-status` | Show only approved attachments for the supplied workspace |
34
- | `kdna.workspace-resolve` | Resolve one task against that approved set |
35
- | `kdna.workspace-load` | Resolve, plan, authorize, and load only when the decision is `load` |
36
-
37
- There is no global discovery, task-to-asset matching, attachment mutation,
38
- password tool argument, or caller-supplied entitlement state. The adapter
39
- cannot attach, enable, disable, switch, roll back, or remove a workspace
40
- attachment.
41
-
42
- The candidate does not expose generic explicit-file inspect, verify, plan, or
43
- load tools. Standard Codex/OpenCode MCP clients do not supply a native,
44
- model-hidden file-selection broker, so a model-supplied path cannot prove user
45
- intent. The public loader Skill instead performs one official CLI `kdna load`
46
- after one meaningful use-once file approval; that call validates and plans
47
- internally and creates no persistent attachment.
48
-
49
- The three workspace tools are the automatic project flow because every result
50
- remains bound to the immutable root, approved attachment record, policy scope,
51
- and snapshot. Host configurations must enumerate those three exact tools and
52
- must not use a server-wide wildcard.
53
-
54
- ## Host processing consent
55
-
56
- Attachment approval makes exact workspace bytes eligible for resolution. It
57
- does **not** authorize a Host to deliver a decrypted Runtime Capsule to an
58
- unknown processor. Before the first successful load, the Host must turn one
59
- plain-language approval into a private machine document. The adapter starts
60
- with the fixed Host identity and fixed private document path:
61
-
62
- - `KDNA_MCP_HOST_ID`, the fixed Host identity;
63
- - `KDNA_MCP_HOST_PROCESSING_CONSENT_FILE`, a regular mode-`0600` document in a
64
- mode-`0700` Host-private directory.
65
-
66
- The machine document binds the exact workspace root, asset digest, attachment
67
- and scope, named remote processor, and least
68
- Capsule profile. The user sees the asset name, purpose and boundary, Host,
69
- named destination, and Allow/Decline action. The Host—not the user—handles
70
- attachment IDs, record/task/plan digests, schema versions, scope modes,
71
- approval-source values, and profile identifiers.
72
-
73
- The CLI `0.36.0` source candidate includes a low-level `kdna host-consent`
74
- broker for validating a private Host draft, interactive Allow/Decline, atomic
75
- installation, rotation, status and revocation. A real Host launcher must derive
76
- that draft from trusted attachment/LoadPlan facts; neither a user nor a model
77
- should handcraft it. The current broker terminal prompt still displays the
78
- exact digest and role/scope mechanics, so direct CLI use is an evaluator path,
79
- not yet the human-only default surface described above.
80
-
81
- The consent is reusable only inside those exact declared coordinates. Asset
82
- bytes, attachment scope, Host, destination, workspace, profile, or user-control
83
- drift requires a new meaningful approval. A Host can atomically replace the
84
- document at the same fixed private path, so a long-running MCP process accepts
85
- the newly approved coordinates without restart. A change during one load
86
- suppresses that result; the request must be retried against the new consent.
87
- Tool arguments cannot select or replace this authority. The adapter rejects an
88
- unknown destination and will not accept a remote Host's self-asserted
89
- `verified_local_only` label. Verifiable local-model processing is deferred in
90
- this source candidate; only a named processing destination is implemented.
91
- Consent files are adapter-private coordinates, not Runtime Capsule fields, and
92
- the adapter never writes a decrypted Capsule copy to disk.
93
-
94
- For an exact password-protected workspace attachment, the Host process may set
95
- `KDNA_MCP_AUTHORIZATION_FILE` to one absolute, regular, non-symlink file owned
96
- by the current user and private to that user. The adapter reads the bounded
97
- value only when the selected LoadPlan requires a password, passes it only to
98
- the pinned CLI through `load --password-stdin`, removes the coordinate from
99
- the CLI child environment, and never returns it. The caller owns creation and
100
- destruction of this process-scoped file on success, cancellation, or Host
101
- exit; do not place it in the workspace or Host configuration repository.
102
- Without a provider, a protected workspace load returns
103
- structured `authorization_required`. A wrong value returns
104
- `authorization_rejected` without echoing it. Ordinary public assets neither
105
- require nor consume the provider. `pass` is a development credential source,
106
- not a user product requirement.
107
-
108
- This authorization-file contract is a component integration boundary, not a
109
- manual user workflow. A user must not create the file, export the coordinate,
110
- or send a password through model chat. Codex and OpenCode have not yet proven
111
- a native model-hidden secret provider, so protected workspace loading in those
112
- Host guides remains deferred. The ordinary unencrypted workspace path is
113
- independent and does not consume this provider.
114
-
115
- `kdna.workspace-load` visibly returns the `load`, `ask`, `skip`, or `block`
116
- decision, exact identity/version/digest, configured scope, reason, integrity
117
- and authorization conclusions, CLI control commands, LoadPlan, and—only after
118
- a permitted load—the Runtime Capsule. When the loaded Capsule carries judgment
119
- axioms, the adoption result also includes `judgment_decision` at the top level:
120
- the rules with their `applies_when`, `does_not_apply_when`, and `failure_risk`
121
- are surfaced there so a Host can bind them as decision criteria instead of
122
- treating the projection as a mere task-direction hint.
123
-
124
- ## Candidate development
125
-
126
- The checked-in lock uses exact merged CLI and Core tarballs only for source and
127
- CI acceptance. Candidate artifacts are excluded from the published MCP pack.
128
-
129
- ```bash
130
- cd mcp-server
131
- npm ci --ignore-scripts
132
- npm test
133
- node bin/kdna-mcp.mjs
1
+ # KDNA MCP 0.8.0 — local stdio Read adapter
2
+
3
+ This local stdio MCP server (`@aikdna/kdna-mcp-server@0.8.0`) delegates native container `0.6.0` admission and scoped Read operations to the exact CLI `0.44.0` / Core `0.37.11` / Read `0.13.5` graph (`kdna.read/0.7.0-candidate`). Historical MCP `0.5.0`–`0.5.1` and CLI `0.36.x` workspace flows are superseded by this operator-bound single-asset native `0.6.0` adapter.
4
+
5
+ ## Operator-controlled startup
6
+
7
+ ```sh
8
+ node /absolute/installed/mcp-server/bin/kdna-mcp.mjs --asset /absolute/selected.kdna --allow-read
9
+ # Optional for password-protected 0.6.0 .kdna files (mode 0600 file or fd >= 3):
10
+ node /absolute/installed/mcp-server/bin/kdna-mcp.mjs --asset /absolute/selected.kdna --allow-read --password-file /absolute/passphrase.txt
134
11
  ```
135
12
 
136
- The release dependency guard intentionally rejects the candidate lock. A
137
- future registry release requires the exact CLI and Core versions to exist on
138
- the official npm registry and a freshly generated lock with no `file:`
139
- resolution before MCP publication can proceed.
140
-
141
- ## Host configuration candidate
142
-
143
- During source acceptance, configure exactly one Host with the local server
144
- entry, then test it before configuring another Host:
145
-
146
- ```json
147
- {
148
- "mcpServers": {
149
- "kdna": {
150
- "command": "node",
151
- "args": ["/absolute/path/to/kdna-skills/mcp-server/bin/kdna-mcp.mjs"],
152
- "env": {
153
- "KDNA_MCP_WORKSPACE_ROOT": "/absolute/path/to/one/project",
154
- "KDNA_MCP_HOST_ID": "one-host",
155
- "KDNA_MCP_HOST_PROCESSING_CONSENT_FILE": "/absolute/private/host/processing-consent.json"
156
- }
157
- }
158
- }
159
- }
13
+ The **OS process argv**, supplied by an actual local operator or trusted
14
+ launcher, is the sole input-selection/read-permission channel (including any
15
+ optional `--password-file <absolute-path>` or `--password-fd <fd>` for
16
+ password-protected `0.6.0` `.kdna` files). It is outside
17
+ model-controlled MCP stdin. The Host must not let model tool parameters,
18
+ initialize fields, instructions in an asset or edits to startup configuration
19
+ establish or widen this binding. A Host that lets a model launch arbitrary
20
+ commands has not established that trust boundary merely by running this server.
21
+
22
+ The operator must have selected this file for the intended task and recipient.
23
+ Existing complete authorization needs no repeated internal approval. Missing
24
+ substantive choices are resolved by the Host before startup. The server cannot
25
+ attest human identity, local-only model processing or another Host's entitlement.
26
+
27
+ One absolute canonical non-symlink regular .kdna file, up to 64 MiB, is opened
28
+ read-only, checked against its file identity and copied byte-for-byte into a
29
+ mode-0700 private temporary directory with a mode-0600 file. No ZIP or payload is
30
+ parsed by this adapter. Official CLI/Core/Read admit the private bytes. Later
31
+ replacement of the original file cannot substitute another input in this
32
+ process. Temporary copies are removed on normal EOF/cancel/signal shutdown;
33
+ uncatchable termination can leave a private local copy and needs operator cleanup.
34
+ TMPDIR chooses storage, not authority. Use a private directory controlled by the operator.
35
+
36
+ No startup arguments, or --asset without --allow-read, leaves the server
37
+ unbound; the selected path is not opened. --allow-read without --asset is an
38
+ argument error. Model tools cannot bind, reopen or choose a path. Legacy
39
+ workspace/consent/password environment values do not grant permission.
40
+
41
+ ## Runtime model and expectations
42
+
43
+ One server process serves one selected artifact for its whole lifetime.
44
+
45
+ - **One process, one asset.** A launch binds the single `--asset` file together
46
+ with the `--allow-read` permission; `kdna.cancel` or process exit closes that
47
+ binding, and only a new operator-controlled launch can select again. No tool
48
+ call can bind, reopen or switch the file mid-process.
49
+ - **`--allow-read` is the only read permission.** Without the operator-supplied
50
+ flag the server stays unbound; no tool parameter, asset instruction or
51
+ configuration edit establishes or widens it (see "Operator-controlled
52
+ startup").
53
+ - **Reads are serialized by design.** One read/inspect presentation runs at a
54
+ time. A second overlapping read is refused with `MCP_READ_BUSY` ("Wait for
55
+ the current local read or cancel it.") instead of being queued: wait for the
56
+ current result, or end it through `kdna.cancel` or the client's request
57
+ cancellation — cancelling closes the process binding.
58
+ - **Every read call carries its own budget.** `kdna.catalog`, `kdna.read`,
59
+ `kdna.expand` and `kdna.audit` each require an explicit integer
60
+ `budget_bytes` (0 through 1000000); there is no default budget, and a request
61
+ whose budget cannot hold its result is refused with a named error rather than
62
+ returning a partial view.
63
+
64
+ ## MCP transport and tools
65
+
66
+ Use newline-delimited JSON-RPC 2.0 over local stdio. Initialize with the client's
67
+ supported `protocolVersion` string, a `capabilities` object and `clientInfo`
68
+ containing string `name` and `version` fields. The adapter supports MCP
69
+ `2024-11-05` and returns that version even when a client requests a newer one,
70
+ following [MCP version negotiation](https://modelcontextprotocol.io/specification/2025-06-18/basic/lifecycle#version-negotiation).
71
+ This does not enable newer protocol features or client-offered capabilities;
72
+ the server still advertises only `tools: {}`. A client that supports the returned
73
+ version sends `notifications/initialized` before calling tools; a client that
74
+ cannot use it should disconnect. Initialization never grants file or action
75
+ permission. Malformed initialization and tool requests before readiness remain
76
+ errors.
77
+
78
+ Request `params` may contain an optional `_meta` object. Its `progressToken`,
79
+ when present, must be a string or finite number; `0` is valid. The adapter
80
+ accepts this transport metadata without emitting progress notifications and
81
+ ignores other metadata. Metadata is never forwarded into tool arguments,
82
+ operator startup binding or public Read input. This adds no permitted tool
83
+ argument or method parameter beyond request-level `_meta`.
84
+
85
+ | Tool | Arguments | Result |
86
+ | --- | --- | --- |
87
+ | kdna.binding-status | {} | Local binding state, not a public authority receipt |
88
+ | kdna.inspect | {} | Official CLI technical admission/metadata |
89
+ | kdna.catalog | budget_bytes; optional presentation | Complete public catalog within the budget |
90
+ | kdna.read | selection, budget_bytes; optional presentation | Exact selection and mandatory closure |
91
+ | kdna.expand | exactly one of handle or handle_ref, budget_bytes; optional presentation | Original issued handle passed to the same official session |
92
+ | kdna.audit | audit_ref, budget_bytes | Exact original full result of an earlier task delivery |
93
+ | kdna.cancel | {} | Closes binding and current session |
94
+
95
+ For catalog/read/expand, `presentation` is `"body"`, `"full"` or `"task"`.
96
+ Omission means `"body"` whenever the installed Read package provides the body
97
+ projection (the fixed combination below always does); on an installation
98
+ without it, omission keeps the previous `"full"` answer and an explicit
99
+ `"body"` request is refused with `MCP_MODEL_VIEW_UNAVAILABLE` instead of
100
+ quietly returning the envelope. Task presentation also requires
101
+ `view_budget_bytes`; body and full presentations reject that additional field.
102
+ These presentation options are not accepted by binding-status, inspect, audit
103
+ or cancel, and `kdna.audit` always returns the exact full result it stored.
104
+
105
+ `kdna.binding-status` reports `presentation_default` and `body_view_contract`
106
+ so a consumer can detect the installed projection instead of assuming it.
107
+
108
+ Migration note for earlier consumers: a read that used to receive the official
109
+ envelope now receives the projected body by default. Pass
110
+ `presentation: "full"` to keep the previous answer, and request `"body"`
111
+ explicitly only when the body view is what the task needs.
112
+
113
+ Selection is the exact asset_id, asset_version and either one `judgment_id` or a `judgment_ids` array (1..64 unique ids) taken from the catalog. Exactly one of the two keys must be *present*, and the present key's value must also be valid: `judgment_id: null` beside a valid `judgment_ids` is refused, not ignored, and the declared JSON schema (`oneOf`, not `anyOf`) refuses the same inputs the adapter does, so a caller that skips schema validation gets the same refusals. The adapter maps both forms to the native `judgment_ids: [...]` selection, so one call can carry the whole set instead of repeating the full audit envelope once per judgment; `judgment_ids` is additive, the single-id form is unchanged, sending both at once is refused, and the 64-item bound is a tool-surface convenience limit rather than a KDNA limit. Expansion passes the complete handle unchanged and uses its `anchor.selection`; it does not fabricate or translate a handle.
114
+
115
+ After catalog, batch the judgments actually required for the task in one exact
116
+ selection. Keep the complete successful disclosure and use it for that task;
117
+ do not fetch the same selection from the same snapshot again without a reason.
118
+ Request another selection or an issued expansion only for a real information
119
+ need. A refusal, insufficient budget or deferred item is not content already
120
+ read. No repeat-avoidance rule grants new permission or permits reading a Host
121
+ cache, private file or raw payload to bypass the supplied result.
122
+
123
+ Budget is an integer from 0 through 1000000 bytes. Request lines are bounded to
124
+ 1 MiB. Tools accept only their listed keys, never path/cwd/approved/allow_read.
125
+ One read/inspect runs at a time; overlapping work returns MCP_READ_BUSY instead
126
+ of queuing more asset reads. JSON/argument errors use JSON-RPC errors. Local
127
+ binding/process errors use an MCP_* tool error. Body presentation returns the
128
+ official Read projection of the complete result — authored content plus one
129
+ fingerprint whose `omitted`/`recovery` names what the full view restores, with
130
+ the non-selected closure members reduced behind their issued handles — as
131
+ JSON text in `content[0].text`. Full presentation returns the unchanged
132
+ official result in the same single text field. Task presentation uses the
133
+ adapter contract below in the same text field. No structuredContent or resource
134
+ field carries a second copy of the full result; the model-visible text is the
135
+ only channel and it is measurably smaller than the full result it was projected
136
+ from. Native `catalog_only` is a successful catalog result; rejected and no-body
137
+ results have `isError:true` (a rejection or no-body control is returned
138
+ verbatim rather than projected).
139
+
140
+ ## Optional task presentation and exact audit
141
+
142
+ The task contract is `kdna.mcp.task-presentation/0.1.0`, a local adapter
143
+ representation rather than a new Core/Read envelope. For example, add
144
+ `presentation: "task"` and `view_budget_bytes: 1000000` to the catalog/read/expand
145
+ arguments your task already needs. `budget_bytes` still applies to the full
146
+ official Read. The independent `view_budget_bytes` bounds the complete encoded
147
+ task view. Both are integers from 0 through 1000000; a smaller presentation
148
+ does not bypass an official Read budget or permission decision.
149
+
150
+ Read all supplied content, canonical closure nodes, roles, method
151
+ interpretations, states, diagnostics, omissions and assessment. The view keeps
152
+ asset/version, tuple, snapshot and digests. It removes only supported exact
153
+ structural duplicates through an external `content_aliases` array. Each entry
154
+ has `at`, `from`, `node_id` and `role`: the JSON pointers are relative to
155
+ `content`; a null at `at` stands for the complete object at `from`. Resolve
156
+ alias dependencies before using the content. A null with no alias remains an
157
+ original null. The adapter injects no `$ref` into authored JSON, summarizes no
158
+ author prose and does not make unread/deferred bodies into completed reads.
159
+ Necessary author content can be reconstructed from the task view itself;
160
+ audit is not required to recover omitted conditions, exceptions or sources.
161
+
162
+ The inline `verification_summary` is also required reading. It retains signature
163
+ status (including absent versus verified) and the complete signature policy,
164
+ checksum status, origin kind, verification mode/semantic status, each digest's
165
+ status and profile, the signature-policy check's basis/policy/result and
166
+ `new_signature_verification`, and the original new-verification and I/O flags.
167
+ Do not treat an absent signature, reused prior verification or unevaluated
168
+ state as a new successful check. Only long capture/section proof material and
169
+ the full receipt require audit retrieval. Unknown verification fields make the
170
+ task representation unavailable rather than being silently discarded.
171
+
172
+ Issued expansion handles become `handle_ref` values with their target, anchor,
173
+ scope and expiry. An index entry without a corresponding issued reference
174
+ says `no_reference_in_this_delivery`; this is not evidence that its body was
175
+ read. Use either the old complete `handle` or the returned `handle_ref` in
176
+ `kdna.expand`, never both. The adapter resolves a reference to the original
177
+ handle; the official Read still validates the expansion.
178
+
179
+ `audit.audit_ref` identifies the exact full result originally used to produce
180
+ that task delivery. `kdna.audit` takes only that reference and `budget_bytes`.
181
+ It returns the original result, including its original verification, receipt
182
+ and long handles. It performs no new file read, verification or authorization;
183
+ an old receipt is not a fresh grant. Audit returns JSON text only. Do not
184
+ request it automatically after every task view, or the full material will be
185
+ supplied to the model again without a task need.
186
+
187
+ References are local to this live operator binding and the same snapshot,
188
+ asset/version, tuple and Host epoch. Their monotonic lifetime is at most 60
189
+ seconds; a short handle expires no later than its original issued handle.
190
+ Cancel, process/session termination or an observed scope change invalidates
191
+ them. The store holds at most 32 audits, 256 handles and 4 MiB of combined
192
+ encoded stored results/handles. These are engineering capacity limits, not
193
+ claims about model tokens, memory overhead, fees or answer quality.
194
+
195
+ If a complete view or audit exceeds its budget, it is refused with
196
+ `MCP_TASK_VIEW_BUDGET_EXCEEDED` or `MCP_AUDIT_BUDGET_EXCEEDED`; no partial body or
197
+ automatic full fallback is sent. An unsupported official shape returns
198
+ `MCP_TASK_VIEW_UNAVAILABLE`, not a fabricated rejection. Expired or foreign
199
+ references return `MCP_REFERENCE_UNAVAILABLE`; capacity exhaustion returns
200
+ `MCP_REFERENCE_STORAGE_FULL`. Keep these adapter failures separate from an
201
+ actual official rejection. A supported refusal keeps its full original causal
202
+ result, `status: rejected` and `audit: null` in the task representation. Change
203
+ the budget, explicitly choose full, or start a new authorized session only
204
+ when the task and permission permit it.
205
+
206
+ The pinned `kdna.section-bytes-node/0.1.1-candidate` admission refusal is also
207
+ supported. Its reason, stage, diagnostic and complete input observation remain
208
+ in `official_result`, including a null snapshot. It has no author body and
209
+ issues no audit or expansion reference. Unknown contract definitions or
210
+ additional fields require an explicit full presentation; they are not guessed.
211
+
212
+ The earlier Codex CLI 0.154.0 case remains a full-presentation observation. A
213
+ separate task-presentation model turn batched three judgments in one ready read
214
+ and used them while retaining uncertainty, scope and signature-policy limits.
215
+ It made no repeated selection read, audit or expand call. Named-model audit use
216
+ and expansion remain not yet evaluated in a named Host session; engineering tests do not establish them. A
217
+ separate deliberately truncated Host display led to cancellation and stopping,
218
+ not successful continuation. These cases do not certify other Hosts or routes.
219
+ See the [Codex observations](https://github.com/aikdna/kdna-skills/blob/main/integrations/codex/README.md#observed-task-presentation-case)
220
+ and [support matrix](https://github.com/aikdna/kdna-skills/blob/main/docs/agent-support-matrix.json).
221
+
222
+ Read uses one real locally resolved CLI child process in --session --allow-read
223
+ mode. The adapter builds the public request tuple from the CLI's fixed binding;
224
+ it does not create a public snapshot, IR, identity or permission provider.
225
+ Catalog, successive selections and handles therefore share that official
226
+ process's snapshot. Keep the first complete catalog for later selections.
227
+ Inspection uses a separate real CLI inspect child and does not assert read,
228
+ writer, confirmation or action states from technical validity.
229
+
230
+ Each read has a 30-second local timeout, CLI output is bounded to 8 MiB and
231
+ stderr to 64 KiB. Cancellation, a matching notifications/cancelled requestId,
232
+ closed output or a failed session terminates the affected child; normal EOF
233
+ waits for already accepted work and closes stdin. Termination has a bounded
234
+ SIGKILL fallback for that owned child. Cancel revokes the entire binding;
235
+ reselection requires a new operator-controlled launch. Already delivered text
236
+ cannot be retracted, and cancellation is not an OS file-access trace.
237
+
238
+ The adapter opens no network endpoint and sends no network request. Stdio
239
+ delivery does not prove how another Host later processes the returned text.
240
+ Untrusted asset text never becomes a tool or shell command. Action execution,
241
+ discovery, asset-store scanning, workspace attachment mutation, decryption and
242
+ legacy load/plan-load/Runtime Capsule adaptation are absent.
243
+
244
+ ## Match the asset's reader
245
+
246
+ This adapter reads native container `0.6.0` `.kdna` assets with `kdna.read/0.7.0-candidate`.
247
+ Public `0.6.0` assets require `--asset /absolute/selected.kdna --allow-read`;
248
+ password-protected `0.6.0` assets (`kdna.envelope.aead`, `password` entitlement)
249
+ additionally require operator-supplied `--password-file /absolute/passphrase` or
250
+ `--password-fd <n>` (`n >= 3`) in process `argv` at startup. Source disclosure
251
+ and revision use the direct CLI (`source-open` / `source-pack`) on the
252
+ unencrypted plaintext source rather than MCP read tools. An unsupported
253
+ container format is not permission to convert it implicitly or read its raw payload.
254
+
255
+ ## Install and test from source
256
+
257
+ For an Agent-led task, begin with the [getting-started guide](https://github.com/aikdna/kdna-skills/blob/main/docs/GETTING_STARTED.md).
258
+ The installer requires Node.js 22 or later, npm, `bash` and `tar`. The current
259
+ CLI 0.44.0 / Core 0.37.11 / Read 0.13.5 graph was exercised with Node.js 22.22.3
260
+ and npm 10.9.8. Earlier companion graphs' runtime checks do not verify this
261
+ one on additional Node versions. The CI matrix is a set of required checks,
262
+ not evidence that every run has already passed. From `mcp-server/`:
263
+
264
+ ```sh
265
+ npm ci --offline --ignore-scripts --omit=optional --no-audit --no-fund
266
+ npm test
160
267
  ```
161
268
 
162
- Configuration location, approval policy, and shape remain Host-specific. Do
163
- not copy this entry into every installed Host automatically. The
164
- [Codex](../integrations/codex/README.md) and
165
- [OpenCode](../integrations/opencode/README.md) guides are benchmark
166
- configuration candidates; OpenCode is verified at `1.18.11` for the
167
- ordinary-task single-Host loop and Codex remains `RECHECK_REQUIRED` pending
168
- account recovery.
169
-
170
- ## Workspace flow
171
-
172
- The user creates the relationship through the CLI, outside MCP:
173
-
174
- ```bash
175
- secure-host-attachment-json | kdna attach ./judgment.kdna \
176
- --cwd ./my-project --attachment-stdin --preview
177
- secure-host-attachment-json | kdna attach ./judgment.kdna \
178
- --cwd ./my-project --attachment-stdin --yes \
179
- --consent-digest sha256:<digest-from-preview>
180
- kdna attachments --cwd ./my-project
269
+ The lock and twelve checked-in archives define the entire required dependency
270
+ graph. The runtime check verifies their SHA-256, SRI, package identity and lock
271
+ edges. All twelve required packages are installed; nine optional native entries
272
+ remain in the lock and are omitted. Pure JavaScript operation requires no native
273
+ install hook, registry substitution or global CLI fallback.
274
+
275
+ `npm test` runs the direct CLI, source MCP, fresh packed MCP, naming, runtime and
276
+ release-policy checks. The nested publication test uses npm's dry-run mode and
277
+ must stop at the release gate. Its recursion guard skips only its own nested
278
+ copy; normal test invocation must not set `KDNA_MCP_NESTED_PUBLISH_TEST`.
279
+
280
+ ## Install a packed local consumer
281
+
282
+ From a source checkout's `mcp-server/`, create a **new** sibling directory:
283
+
284
+ ```sh
285
+ node scripts/create-local-consumer.mjs ../../kdna-mcp-consumer
286
+ cd ../../kdna-mcp-consumer
287
+ npm ci --offline --ignore-scripts --omit=optional --no-audit --no-fund
288
+ node node_modules/@aikdna/kdna-mcp-server/bin/kdna-mcp.mjs --asset /absolute/selected.kdna --allow-read
181
289
  ```
182
290
 
183
- The Host's bounded stdin producer supplies identical final policy bytes to
184
- preview and confirmation. Agent/MCP guidance must not expose private role or
185
- scope in argv, and an unbound `--yes` is not consent.
186
-
187
- For each task, the Host passes its current workspace and task to
188
- `kdna.workspace-load`. The adapter passes bounded strict-UTF-8 task bytes to
189
- the official resolver over stdin and never places them in argv, environment,
190
- an incidental task file, or the attachment record. If the resolver returns
191
- `ask`, `skip`, or `block`, no plan or capsule is produced. An `ask` includes a
192
- receipt-bound one-task selection plan; after the user chooses, the Host repeats
193
- the exact task and current root with that selection so the same request can
194
- load exactly one candidate.
195
-
196
- When the process authorization file is configured, the adapter asks the
197
- official resolver to evaluate only the protected attachment's public scope
198
- while authorization remains `required`. It then obtains the ordinary
199
- pre-authorization LoadPlan and invokes the real password-verified load. Only a
200
- successful decryption upgrades the delivered adoption result to
201
- `authorization: "satisfied"` and includes a Runtime Capsule.
202
-
203
- The workspace argument must resolve inside the MCP process's mandatory
204
- `KDNA_MCP_WORKSPACE_ROOT`. That absolute root is fixed at process launch,
205
- cannot be supplied or changed by a tool call, and must not be HOME or a
206
- filesystem root, or symlink. The adapter passes the same root to every CLI status/resolver lookup,
207
- rejects sibling or parent escapes and home-level attachment authority, and
208
- selects only the nearest record inside the boundary. One load remains bound to
209
- the same exact workspace record, selected attachment, scope, and snapshot
210
- through result delivery. If any of those facts changes, the adapter returns
211
- `workspace_binding_changed` without a Runtime Capsule and does not re-resolve
212
- against another workspace.
213
-
214
- One qualified Host can complete one functional consumption loop. The current
215
- Codex+OpenCode pair is a separate portability benchmark, not a requirement for
216
- every installation. Studio product integration is deferred and must later
217
- reuse the CLI/Core state rather than introduce another attachment authority.
218
-
219
- ## Host responsibility
220
-
221
- The Host must keep adoption visible and preserve current facts, explicit user
222
- intent, law, safety policy, system instructions, and Host permissions above
223
- asset content. It must not treat output quality as authorization or use an
224
- unattached file merely because it exists.
225
-
226
- The MCP transport protocol coordinate `2024-11-05` is independent of KDNA's
227
- runtime contracts. Returning a Runtime Capsule does not claim Host execution,
228
- fabricate a receipt, or create a Judgment Trace.
291
+ The script verifies the source runtime, packs the current MCP implementation and
292
+ writes a consumer manifest, lock, archive hashes and thirteen archives. It
293
+ refuses an existing destination. Each runtime archive is an exact root `file:`
294
+ dependency, with a matching root override. This lets npm resolve dependencies
295
+ before extracting the MCP package. The MCP manifest uses exact numeric registry dependencies; this explicit companion graph supplies the same checked bytes for offline use without depending on package-relative archive lookup.
296
+
297
+ The MCP tar has twenty-one regular members: bin modules, package metadata,
298
+ README, LICENSE, NOTICE and twelve runtime archives. Tests, source tooling and
299
+ package-lock.json are excluded. The companion consumer lock is generated from
300
+ the checked source graph. The packed-consumer test installs with an empty npm
301
+ cache, then runs the same real stdio boundary suite against the installed bin.
302
+
303
+ Canonical npm publication of `@aikdna/kdna-mcp-server@0.8.0` runs exclusively via the GitHub Release workflow (`kdna-mcp-server-0.8.0`) after companion packages (`@aikdna/kdna-core@0.37.11`, `@aikdna/kdna-read@0.13.5`, `@aikdna/kdna-cli@0.44.0`) are published on the official registry. Source and installed process tests do not
304
+ establish named Host adoption, human review, authorship or Creation acceptance.
305
+
306
+ ## Native section contract boundary
307
+
308
+ The complete CLI public contract binding is pinned by SHA-256 `6c91bc8b10abdb1a0cfa23cae3904a11075200b03011d8a7e3772ea9a40ae6c8`. It identifies the native container `0.6.0` and Read `0.7.0-candidate` tuple, exact Core/Read artifacts and route contracts. CLI and Read must resolve the same fixed Core instance; a nested shadow dependency is refused. The adapter delegates native admission and retained section reads to that runtime. Preserve catalog-only status, mandatory closure, native handle origin, diagnostics, absent declarations and explicit empty states. Technical validity, Read and static declarations do not establish live Creation authority, human confirmation or action permission.
309
+
310
+ The public regression corpus is generated from synthetic authored JSON with the fixed CLI. It tests real native containers and one deliberately truncated container; no legacy component-format asset is treated as current native input.