@aikdna/kdna-mcp-server 0.4.2 → 0.5.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/README.md +204 -104
- package/bin/kdna-mcp.mjs +1259 -227
- package/package.json +13 -11
package/README.md
CHANGED
|
@@ -1,128 +1,228 @@
|
|
|
1
1
|
# KDNA MCP Server
|
|
2
2
|
|
|
3
|
-
`@aikdna/kdna-mcp-server`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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.
|
|
36
128
|
|
|
37
129
|
```bash
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
### Configure in your MCP client
|
|
43
|
-
|
|
44
|
-
**Claude App / Claude Code (`claude_desktop_config.json`):**
|
|
45
|
-
|
|
46
|
-
```json
|
|
47
|
-
{
|
|
48
|
-
"mcpServers": {
|
|
49
|
-
"kdna": {
|
|
50
|
-
"command": "npx",
|
|
51
|
-
"args": ["-y", "@aikdna/kdna-mcp-server"]
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
130
|
+
cd mcp-server
|
|
131
|
+
npm ci --ignore-scripts
|
|
132
|
+
npm test
|
|
133
|
+
node bin/kdna-mcp.mjs
|
|
55
134
|
```
|
|
56
135
|
|
|
57
|
-
|
|
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.
|
|
58
140
|
|
|
59
|
-
|
|
60
|
-
{
|
|
61
|
-
"mcpServers": {
|
|
62
|
-
"kdna": {
|
|
63
|
-
"command": "npx",
|
|
64
|
-
"args": ["-y", "@aikdna/kdna-mcp-server"]
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
141
|
+
## Host configuration candidate
|
|
69
142
|
|
|
70
|
-
|
|
143
|
+
During source acceptance, configure exactly one Host with the local server
|
|
144
|
+
entry, then test it before configuring another Host:
|
|
71
145
|
|
|
72
146
|
```json
|
|
73
147
|
{
|
|
74
148
|
"mcpServers": {
|
|
75
149
|
"kdna": {
|
|
76
|
-
"command": "
|
|
77
|
-
"args": ["
|
|
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
|
+
}
|
|
78
157
|
}
|
|
79
158
|
}
|
|
80
159
|
}
|
|
81
160
|
```
|
|
82
161
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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.
|
|
90
169
|
|
|
91
|
-
|
|
92
|
-
`~/.kdna/packages`. Explicit local roots can be provided when a user keeps
|
|
93
|
-
assets elsewhere.
|
|
170
|
+
## Workspace flow
|
|
94
171
|
|
|
95
|
-
|
|
172
|
+
The user creates the relationship through the CLI, outside MCP:
|
|
96
173
|
|
|
97
174
|
```bash
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
|
105
181
|
```
|
|
106
|
-
# Client calls kdna.available-local { root: "./dist" }
|
|
107
|
-
# Client calls kdna.verify { assetPath: "./dist/writing.kdna" }
|
|
108
|
-
# Client calls kdna.plan-load { assetPath: "./dist/writing.kdna" }
|
|
109
|
-
# Or kdna.plan-load { assetPath: "./dist/writing.kdna", entitlementStatus: "active" }
|
|
110
|
-
# Client calls kdna.load { assetPath: "./dist/writing.kdna", profile: "compact" }
|
|
111
|
-
# Agent consumes only the returned Runtime Capsule context
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
In the 0.4.2 source checkpoint, the returned Capsule uses
|
|
115
|
-
`type: "kdna.runtime-capsule"` and
|
|
116
|
-
`contract_version: "0.1.0"`. The KDNA Agent Host protocol has the independent
|
|
117
|
-
coordinate `protocol_version: "0.1.0"`; it is not the MCP transport's
|
|
118
|
-
`protocolVersion`. This bridge does not execute an Agent Host and therefore
|
|
119
|
-
does not create or claim a Host receipt or Judgment Trace. A consuming Host
|
|
120
|
-
must use Core's correlated runtime-contract APIs for that boundary.
|
|
121
|
-
|
|
122
|
-
## Relationship to kdna-loader skill
|
|
123
|
-
|
|
124
|
-
The MCP server and kdna-loader skill are complementary:
|
|
125
|
-
- **kdna-loader** = agents that can run CLI commands (Codex, Claude Code, OpenCode, Cursor)
|
|
126
|
-
- **MCP server** = any MCP-compatible runtime (including the above, plus custom agents)
|
|
127
182
|
|
|
128
|
-
|
|
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.
|