@plurnk/plurnk-mcp 1.7.0 → 1.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/.env.defaults CHANGED
@@ -5,6 +5,15 @@
5
5
  PLURNK_MCP_CONNECT_TIMEOUT=30000
6
6
  PLURNK_MCP_REQUEST_TIMEOUT=86400000
7
7
 
8
+ # Configured servers are available to clients. Only this exact JSON-array
9
+ # subset connects and becomes model-visible by default; workspaces may override it.
10
+ PLURNK_MCP_ENABLED=[]
11
+
12
+ # Turn 0 surveys enabled tool FAMILIES (one row per server, summary = its
13
+ # one-liner). Servers named here also expand their complete tool tree into
14
+ # the turn-0 survey:
15
+ # PLURNK_MCP_EXPANDED=[]
16
+
8
17
  # Each configured server contributes its enabled `[server] (tool)` rows and server:// resources.
9
18
  #
10
19
  # Streamable HTTP:
@@ -19,3 +28,19 @@ PLURNK_MCP_REQUEST_TIMEOUT=86400000
19
28
  # PLURNK_MCP_atlas_ARGS=["/absolute/path/to/atlas-server.mjs"]
20
29
  # PLURNK_MCP_atlas_CWD=/absolute/working/directory
21
30
  # PLURNK_MCP_atlas_ENV={"TOKEN":"${ATLAS_TOKEN}"}
31
+ #
32
+ # npx (installed-on-demand executables) — the documented Brave Search fixture,
33
+ # demo-tier only; credentials stay one ${NAME} reference in the operator env:
34
+ # PLURNK_MCP_BRAVE=npx
35
+ # PLURNK_MCP_BRAVE_ARGS=["-y","@brave/brave-search-mcp-server@2.1.0"]
36
+ # PLURNK_MCP_BRAVE_ENV={"BRAVE_API_KEY":"${BRAVE_API_KEY}"}
37
+ # PLURNK_MCP_BRAVE_TOOLS=["brave_web_search","brave_news_search"]
38
+ # PLURNK_MCP_BRAVE_READ=["brave_web_search","brave_news_search"]
39
+ #
40
+ # _SUMMARY companions are fallbacks only — declare one when the server's own
41
+ # summary metadata is missing, confusing, or garbage. The family row can carry
42
+ # its flagship invocation form directly:
43
+ # PLURNK_MCP_BRAVE_SUMMARY=EXEC [brave] (brave_web_search) <!-- Retrieve web results -->
44
+ # PLURNK_MCP_BRAVE_BRAVE_WEB_SEARCH_SUMMARY=General web search.
45
+ #
46
+ # Then list it above to make it model-visible, e.g. PLURNK_MCP_ENABLED=["brave"].
package/README.md CHANGED
@@ -5,16 +5,21 @@ module for [Plurnk](https://github.com/plurnk/plurnk-service). It projects
5
5
  trusted MCP servers through Plurnk's existing executor, resource, proposal,
6
6
  entry, Problem, lifecycle, and AG-UI contracts.
7
7
 
8
- The module accepts only protocol revision `2026-07-28`. A legacy endpoint is
9
- rejected with a `protocol-revision-unsupported` Problem that names the required
10
- revision and `server/discover`; Plurnk does not negotiate a downgrade.
11
-
12
- ## Attach a server
13
-
14
- Service environment variables provide optional defaults for every workspace.
15
- Users can also attach, replace, reconnect, or detach a server in one workspace
16
- without restarting the daemon. An existing AG-UI connection sends the ordinary
17
- management-action form under `forwardedProps.plurnk.action`:
8
+ The module's own wire authority is protocol revision `2026-07-28`
9
+ ({§mcp-authority}). Connection setup negotiates-and-degrades: a server that
10
+ offers the pinned revision and `server/discover` gets the complete extension
11
+ wire; a server the SDK negotiated below the pin is an ordinary MCP peer that
12
+ serves its standard surface at its own negotiated revision. Plurnk does not
13
+ downgrade its own extension wire, but it does not reject an older supported
14
+ revision.
15
+
16
+ ## Manage workspace servers
17
+
18
+ Service environment variables provide available servers for every workspace;
19
+ `PLURNK_MCP_ENABLED` selects the exact cold-enabled subset. Users can add,
20
+ enable, disable, or remove workspace servers without restarting the daemon. An
21
+ existing AG-UI connection sends the ordinary management-action form under
22
+ `forwardedProps.plurnk.action`:
18
23
 
19
24
  ```json
20
25
  {
@@ -22,11 +27,10 @@ management-action form under `forwardedProps.plurnk.action`:
22
27
  "plurnk": {
23
28
  "workspace": "example",
24
29
  "action": {
25
- "kind": "workspace.mcp.attach",
26
- "server": {
27
- "name": "project",
28
- "transport": "stdio",
29
- "command": "/opt/mcp/current-server",
30
+ "kind": "workspace.mcp.add",
31
+ "alias": "project",
32
+ "target": "/opt/mcp/current-server",
33
+ "options": {
30
34
  "args": ["--stdio"],
31
35
  "env": { "PROJECT_TOKEN": "${PROJECT_TOKEN}" },
32
36
  "tools": ["issue_read", "issue_write"],
@@ -46,20 +50,69 @@ Available workspace actions are:
46
50
 
47
51
  | Action | Parameters |
48
52
  |---|---|
49
- | `workspace.mcp.list` | none |
50
- | `workspace.mcp.attach` | `server` definition |
51
- | `workspace.mcp.replace` | `server` definition with the existing name |
52
- | `workspace.mcp.detach` | `name` |
53
- | `workspace.mcp.reconnect` | `name` |
54
- | `workspace.mcp.oauth.complete` | `name`, complete `callbackUrl` |
53
+ | `workspace.mcp.list` | optional client `overlay` |
54
+ | `workspace.mcp.add` | `alias`, `target`; optional `options` |
55
+ | `workspace.mcp.enable` | `alias`; optional client `overlay` and explicit `options` |
56
+ | `workspace.mcp.disable` | `alias` |
57
+ | `workspace.mcp.remove` | `alias` |
58
+ | `workspace.mcp.oauth.complete` | `alias`, complete `callbackUrl` |
55
59
  | `workspace.mcp.complete` | `server`, completion `ref` and `argument`; optional `context` |
56
60
 
57
61
  The owning [specification](./SPEC.md) defines the complete action and server
58
62
  definition contracts.
59
63
 
64
+ Client and project configuration can specialize a cold service definition
65
+ without copying it or restarting the daemon. For example, a service catalog
66
+ can provide the executable while one project's `.env` supplies its identity:
67
+
68
+ ```text
69
+ # $XDG_CONFIG_HOME/plurnk/.env, read by the service
70
+ PLURNK_MCP_GITEA=/usr/local/bin/possumtech-gitea-mcp
71
+ PLURNK_MCP_ENABLED=[]
72
+
73
+ # <project>/.env, read by the client
74
+ PLURNK_MCP_GITEA_ARGS=["plurnk_pk"]
75
+ ```
76
+
77
+ The client carries its raw declarations while listing and enabling. Listing is
78
+ inert. `/mcp enable gitea` (or `plurnk mcp enable gitea` in a named workspace)
79
+ composes service, durable workspace, client, and optional command-file fields
80
+ in that order, prepares the connection, then persists the complete unexpanded
81
+ workspace specialization. Arrays and maps replace rather than append or merge.
82
+
83
+ ## Demo fixtures
84
+
85
+ Web discovery is an ordinary MCP attachment ({§web-search-retrieval}); the demo
86
+ tier exercises search through a documented fixture rather than an owned
87
+ runtime. Two service-owned definitions are permitted to participate in demos
88
+ of MCP and model behavior — Gitea (above) and Brave Search:
89
+
90
+ ```text
91
+ # $XDG_CONFIG_HOME/plurnk/.env, read by the service — demo fixtures; never default-enabled
92
+ PLURNK_MCP_BRAVE=npx
93
+ PLURNK_MCP_BRAVE_ARGS=["-y","@brave/brave-search-mcp-server@2.1.0"]
94
+ PLURNK_MCP_BRAVE_ENV={"BRAVE_API_KEY":"${BRAVE_API_KEY}"}
95
+ PLURNK_MCP_BRAVE_TOOLS=["brave_web_search","brave_news_search"]
96
+ PLURNK_MCP_BRAVE_READ=["brave_web_search","brave_news_search"]
97
+ PLURNK_MCP_ENABLED=[]
98
+ ```
99
+
100
+ The credential is one symbolic reference — the authoritative `BRAVE_API_KEY`
101
+ environment value is expanded only while preparing the connection, never
102
+ copied. The fixture admits exactly the web/news search tools and classifies
103
+ them read-only; the rest of the vendor catalog is not admitted.
104
+
105
+ **Pinned release and revision.** `@brave/brave-search-mcp-server@2.1.0`
106
+ (stdio) pins `@modelcontextprotocol/sdk@1.29.0`, whose latest protocol
107
+ revision is `2025-11-25` and which does not implement `server/discover`. The
108
+ host negotiates-and-degrades ({§mcp-authority}), so the fixture connects at
109
+ `2025-11-25` with the standard tool surface — verified live: the demo story
110
+ `{§web-search-retrieval}` researched through the real Brave MCP tool and
111
+ answered from it.
112
+
60
113
  ## Service defaults
61
114
 
62
- One `PLURNK_MCP_<server>` variable declares each default server. Its suffix
115
+ One `PLURNK_MCP_<server>` variable declares each available server. Its suffix
63
116
  case-folds to an `[a-z][a-z0-9-]*` executor and URI-authority name.
64
117
 
65
118
  Streamable HTTP:
@@ -69,6 +122,7 @@ PLURNK_MCP_github=https://example.test/mcp
69
122
  PLURNK_MCP_github_BEARER=${GITHUB_TOKEN}
70
123
  PLURNK_MCP_github_TOOLS=["issue_read","issue_search"]
71
124
  PLURNK_MCP_github_READ=["issue_read","issue_search"]
125
+ PLURNK_MCP_ENABLED=["github"]
72
126
  ```
73
127
 
74
128
  Stdio:
@@ -98,8 +152,8 @@ Portable timeouts and complete examples live in [`.env.defaults`](./.env.default
98
152
 
99
153
  | MCP surface | Plurnk surface |
100
154
  |---|---|
101
- | Enabled tool | Exact Registered Tools row and `## EXEC0 [server] (tool)` |
102
- | Tool schemas | `worker://plurnk/docs/<server>.md` |
155
+ | Server tools | `worker://plurnk/tools/<server>.md` family summary |
156
+ | Enabled tool | Exact `worker://plurnk/tools/<server>/<encoded-tool>.md` document and `## EXEC0 [server] (tool)` |
103
157
  | Resource catalog | `server:///` or `server:///resources` |
104
158
  | Resource | `server:///resources/<encoded-uri>` through ordinary `FIND` and `READ` |
105
159
  | Prompt catalog | `server:///prompts` |
@@ -119,7 +173,7 @@ client.
119
173
  ## Authorization
120
174
 
121
175
  HTTP definitions support bearer references, client credentials, and
122
- interactive OAuth. Stdio never receives OAuth. Interactive attachment returns
176
+ interactive OAuth. Stdio never receives OAuth. Interactive add or enable returns
123
177
  `{ "status": 202, "authorization": { "url": "..." } }` without publishing a
124
178
  partial server. After the user completes that URL, the client submits its
125
179
  complete callback URL through `workspace.mcp.oauth.complete`. PKCE, issuer and
package/SPEC.md CHANGED
@@ -9,23 +9,34 @@ executor, resource, proposal, entry, Problem, and lifecycle contracts.
9
9
 
10
10
  ## §mcp-authority Protocol authority
11
11
 
12
- The only accepted revision is `2026-07-28`, specification commit
12
+ The host's own wire authority is revision `2026-07-28`, specification commit
13
13
  `5f5440bb26a62e2cf3440b92da5a667efa03b267`. The implementation exact-pins
14
14
  `@modelcontextprotocol/client@2.0.0`. SDK exports are not protocol authority:
15
15
  that package deliberately retains legacy and deprecated API shapes. It owns
16
16
  core negotiation and transport; this package owns only exact-pinned extension
17
17
  wire that the SDK does not yet implement.
18
18
 
19
- The optional Tasks authority is the official `experimental-ext-tasks` contract
20
- at commit `2c1425d9a288b9b1f489430fe1e00bb392b47e48`. Its absence from the current
21
- SDK runtime does not revive that SDK's retained 2025 Tasks vocabulary.
19
+ Connection setup negotiates-and-degrades. A server that negotiates the pinned
20
+ revision and offers `server/discover` is a **modern** peer: it gets the complete
21
+ extension wire (the `_meta` envelope, `resultType`, the Tasks extension) and its
22
+ discover result is the identity and capability source. A server the SDK
23
+ negotiated below the pin is an ordinary MCP peer: it serves the standard
24
+ tool/resource/prompt surface from its `initialize` result at its negotiated
25
+ revision, and the host applies no envelope, discover, or Tasks requirements to
26
+ it. There is no rejection for offering an older supported revision and no
27
+ protocol downgrade of the host's own extension wire: modern peers and legacy
28
+ peers simply carry different surfaces.
22
29
 
23
- Every request carries the modern `_meta` envelope. Connection setup verifies
24
- `server/discover` at the pinned revision before publishing any runtime or
25
- scheme. There is no protocol downgrade or legacy fallback.
30
+ The optional Tasks authority is the official `experimental-ext-tasks` contract
31
+ at commit `2c1425d9a288b9b1f489430fe1e00bb392b47e48`. It is negotiated
32
+ per-connection and absent from a legacy peer.
26
33
 
27
34
  ## §mcp-core-matrix Core capability matrix
28
35
 
36
+ The accountable capability matrix lives in `capabilityMatrix.ts`
37
+ ({§mcp-capability-matrix}); this section states the core surface contract the
38
+ matrix rows cite.
39
+
29
40
  | Surface | Upstream contract | Plurnk host disposition |
30
41
  |---|---|---|
31
42
  | Base | JSON-RPC 2.0; per-request protocol, identity, and capability metadata; every result has `resultType` | Require the modern envelope and preserve protocol results and errors without reconstructing them |
@@ -58,6 +69,26 @@ Polling honors each current `pollIntervalMs` under the one owning operation
58
69
  deadline. Task input keys are fulfilled at most once, in one atomic client
59
70
  interaction per observed input set. A completed Task is validated as the
60
71
  originating tool result; a failed Task preserves its JSON-RPC error.
72
+ Handle ownership and the restart journey are bounded in {§tasks-lifetime}.
73
+
74
+ ## §tasks-lifetime Tasks lifetime and re-run
75
+
76
+ Task handles are owned in-process by the connection and operation that created
77
+ them; Plurnk deliberately declines durable task-handle recovery. A durable
78
+ handle would need a persisted scheduler and a home for a result whose owning
79
+ operation does not outlive the daemon; the ordinary Plurnk journey is that a
80
+ restart re-runs the operation, which drives a fresh task. The server's own
81
+ persistence of task state is respected only within one connection lifetime;
82
+ nothing task-shaped is written to SQLite and no MCP sidecar lifecycle exists.
83
+
84
+ | Boundary | Behaviour |
85
+ |---|---|
86
+ | Client disconnect | The daemon-owned operation and its task keep running; the client reattaches to the operation, not the task. |
87
+ | Daemon restart | The connection and every in-flight task handle die with it; the tool call fails like any interrupted operation, the loop re-runs, and the tool call creates a fresh task. |
88
+ | Workspace reattachment | The attachment reconstructs from its durable definition; in-flight tasks on the replaced connection are abandoned, not resumed. |
89
+ | Expiry | The owning operation deadline bounds polling; a non-converging task fails at the standard round bound and is cancelled. |
90
+ | Cancellation | Owner abort cancels the task before settling; the handle is then terminal. |
91
+ | Already terminal | Terminal results and errors are consumed by the drive loop; a completed or failed task is never re-polled or re-resumed. |
61
92
 
62
93
  ## §mcp-exclusions Removed, deprecated, and excluded surfaces
63
94
 
@@ -71,9 +102,29 @@ originating tool result; a failed Task preserves its JSON-RPC error.
71
102
  | Removed | `resources/subscribe`, `resources/unsubscribe`, SSE resumption and `Last-Event-ID` | Use `subscriptions/listen`; reissue a lost request with a new ID |
72
103
  | Removed | Legacy Tasks `tasks/list`, `tasks/result`, and task-augmentation request fields | Use only the negotiated final Tasks extension |
73
104
  | Excluded | Other official, experimental, or private extensions | Require a separately owned contract before negotiation |
74
- | Excluded | Legacy revisions and dual-era operation | Pin `2026-07-28`; never probe-and-fallback |
105
+ | Excluded | Dual-era operation | Modern peers and legacy peers carry different surfaces; the host never mixes the two on one connection |
75
106
  | Excluded | MCP server and authorization-server roles | This package is the host/client only |
76
107
 
108
+ ## §mcp-capability-matrix Accountable capability matrix
109
+
110
+ `capabilityMatrix.ts` is the one accountable support matrix: one row per core
111
+ surface, official extension, or explicitly selected experimental candidate,
112
+ carrying authority, disposition (supported, partial, excluded, deferred),
113
+ advertisement, interactivity, and evidence citations. Rows are "supported"
114
+ only when every layer their owning contract includes has real coverage; a row
115
+ cannot claim support merely because the direct SDK or conformance path passes.
116
+ Every evidence citation must resolve through a named specification tag or a
117
+ named composed test.
118
+
119
+ The static wire advertisement is derived from the matrix by construction
120
+ (`staticClientCapabilities`): an extension reaches the wire only because its
121
+ row says `always`, and a `conditional` extension is added only by its owning
122
+ connection logic ({§oauth-client-credentials}). The matrix unit tests enforce
123
+ unique identities, no excluded row advertising, supported rows citing evidence,
124
+ composed coverage for interactive advertised rows, and exact reconciliation
125
+ between the matrix and the derived advertisement. Official required
126
+ conformance stays a separate named gate, never folded into a matrix row.
127
+
77
128
  ## §mcp-transports Transport bindings
78
129
 
79
130
  | Binding | Contract |
@@ -81,6 +132,11 @@ originating tool result; a failed Task preserves its JSON-RPC error.
81
132
  | stdio | Spawn one exact executable with an explicit argument array and no shell; newline-delimited JSON-RPC is the only stdout/stdin traffic; stderr is diagnostic; shutdown closes stdin, waits, then terminates if necessary |
82
133
  | Streamable HTTP | Send one POST per request or notification; accept JSON or SSE responses; close the response stream to cancel; never open the removed general GET stream |
83
134
 
135
+ §mcp-stdio-process-ownership A stdio connection owns the complete process group
136
+ created for its server. Ordinary closure forwards stdin EOF and permits a
137
+ bounded graceful exit; an expired shutdown bound or disappearance of the host
138
+ process forcibly terminates the group, including descendants.
139
+
84
140
  Every HTTP request carries matching `MCP-Protocol-Version` and `Mcp-Method`
85
141
  headers. Named requests also carry `Mcp-Name`; declared primitive tool
86
142
  parameters carry validated `Mcp-Param-*` headers. Header names compare
@@ -108,11 +164,23 @@ originating distinction in its canonical Problem/result path.
108
164
 
109
165
  ## §mcp-configuration Configuration
110
166
 
111
- Two inputs produce one effective definition per workspace. Service environment
112
- variables are convenience defaults instantiated independently for every
113
- workspace. The workspace's durable attachment map may add a server, replace a
114
- default, or retain a tombstone that suppresses a default after detach. Neither
115
- source expands the model-facing namespace with a second discovery surface.
167
+ Service configuration and workspace state produce one available set and one
168
+ enabled subset per workspace. Every `PLURNK_MCP_<server>` declares an available
169
+ service-owned definition. `PLURNK_MCP_ENABLED` names the exact subset enabled
170
+ when a workspace has no override. Workspace state may positively override a
171
+ service definition's enabledness or own an added definition and its enabledness.
172
+ Disabled definitions remain client-visible but contribute no connection,
173
+ Registry, documentation, or resource authority.
174
+
175
+ §mcp-hydration-isolation **Cold endpoint failure is capability-local.** Invalid
176
+ service configuration or durable state fails admission, but an enabled server
177
+ that cannot connect or complete discovery during workspace hydration remains
178
+ enabled and client-visible as `unavailable`. It publishes no runtime, tools,
179
+ resources, or documentation and cannot prevent other capabilities or the daemon
180
+ from starting. Enabling that already-enabled alias is an explicit reconnect
181
+ attempt; failure preserves the unavailable snapshot, while success atomically
182
+ replaces it. Interactive add and enable mutations continue to reject an
183
+ unavailable candidate without changing durable state.
116
184
 
117
185
  | Variable | Contract |
118
186
  |---|---|
@@ -124,6 +192,10 @@ source expands the model-facing namespace with a second discovery surface.
124
192
  | `PLURNK_MCP_<server>_HEADERS` | JSON string map for supplementary HTTP headers |
125
193
  | `PLURNK_MCP_<server>_TOOLS` | Optional JSON array of exact enabled tool names; absent enables all listed server tools, while `[]` enables none |
126
194
  | `PLURNK_MCP_<server>_READ` | JSON string array forming an exact subset of enabled tools that the operator classifies as read-only; every other enabled tool retains the conservative `host` effect |
195
+ | `PLURNK_MCP_<server>_SUMMARY` | Authored one-line server orientation ({§mcp-summary-derivation}) |
196
+ | `PLURNK_MCP_<server>_<tool>_SUMMARY` | Authored one-line tool orientation; tool names fold the same way and may contain underscores |
197
+ | `PLURNK_MCP_ENABLED` | JSON array of exact configured server aliases enabled by default; absent or `[]` enables none |
198
+ | `PLURNK_MCP_EXPANDED` | JSON array subset of enabled servers whose complete tool tree also expands into the turn-0 tools survey ({§tools-resource-materialization}); absent or `[]` expands none |
127
199
  | `PLURNK_MCP_CONNECT_TIMEOUT` | Positive integer milliseconds |
128
200
  | `PLURNK_MCP_REQUEST_TIMEOUT` | Positive integer milliseconds |
129
201
 
@@ -135,9 +207,22 @@ executable string even when its path contains whitespace; arguments never hide
135
207
  inside it. Bearer authentication and a case-insensitive `Authorization` entry
136
208
  in `_HEADERS` are mutually exclusive.
137
209
 
210
+ §mcp-summary-derivation **Every orientation line derives from authored
211
+ metadata — never a container template.** The runtime declaration's summary
212
+ resolves in order: the `_SUMMARY` companion, the server's own
213
+ `serverInfo.description`, its display `title` (both spec metadata — a title
214
+ like "Chrome DevTools MCP server" is already a one-liner), the first sentence
215
+ of its `instructions` essay, then a factual tool-name list. Each tool's one-liner
216
+ resolves: its `_<server>_<tool>_SUMMARY` companion, `annotations.title`, the
217
+ first sentence of its `description` (capped), then the tool name. The family
218
+ doc's Summary section and the survey row carry the server one-liner; the tool
219
+ doc's Summary section IS the invocation form
220
+ `EXEC [server] (tool) <!-- one-liner -->`, so the discovery row teaches the
221
+ call ({§tools-resource-materialization}). Summary companions expand `${NAME}`
222
+ references like every other companion.
223
+
138
224
  §mcp-definition-wire The contracts-owned `McpServerDefinition` JSON Schema is
139
- the one workspace action and durable-state shape. It is a closed discriminated
140
- union:
225
+ the normalized durable definition shape. It is a closed discriminated union:
141
226
 
142
227
  | Transport / authorization | Required definition | Optional definition |
143
228
  |---|---|---|
@@ -147,7 +232,7 @@ union:
147
232
  | `http` + interactive OAuth / CIMD preferred | above plus `authorization: { type: "oauth", redirectUrl, clientMetadataUrl }` | `scope`; DCR remains the server-advertised fallback when CIMD is unavailable |
148
233
  | `http` + interactive OAuth / pre-registered | above plus `authorization: { type: "oauth", redirectUrl, clientId, clientSecret: "${NAME}" }` | `scope` |
149
234
  | `http` + interactive OAuth / DCR fallback only | above plus `authorization: { type: "oauth", redirectUrl }` | `scope` |
150
- | `http` + client credentials | above plus `authorization: { type: "client-credentials", clientId, clientSecret: "${NAME}" }` | `scope` |
235
+ | `http` + client credentials | above plus `authorization: { type: "client-credentials", clientId, clientSecret: "${NAME}" }` | `scope`; `issuer` binds the credential to its authorization server ({§oauth-client-credentials}) |
151
236
 
152
237
  `tools` absent enables the complete listed set; `[]` enables none. `read` is an
153
238
  exact subset of the enabled set. A credential field is one complete symbolic
@@ -159,6 +244,27 @@ discovery state, and authorization callback state remain process-memory
159
244
  credentials; a restart reconstructs the attachment as authorization-required
160
245
  instead of writing secrets into SQLite.
161
246
 
247
+ The contracts-owned `McpServerOptions` schema is the closed supplement accepted
248
+ by `workspace.mcp.add` and customized enable. It may contain `args`, `cwd`,
249
+ `env`, `headers`, `authorization`, `tools`, and `read`; it cannot repeat alias,
250
+ target, or transport. An absolute HTTP(S) target selects Streamable HTTP. Every
251
+ other target is one exact stdio executable. The normalized definition rejects
252
+ transport-inapplicable options before any connection work.
253
+
254
+ §mcp-configuration-cascade MCP server configuration has one field-wise
255
+ precedence order: service environment, durable workspace specialization,
256
+ client configuration overlay, then explicit action options. Arrays and maps
257
+ replace their lower value instead of appending or merging. A client-supplied
258
+ target replaces the complete lower definition before its companion variables
259
+ apply; a companion without a client target specializes the lower definition.
260
+ The contracts-owned `{§mcp-configuration-overlay}` is parsed by the same owner
261
+ and path as service environment declarations. It carries no service controls,
262
+ does not activate a server, and is never persisted as raw environment syntax.
263
+ A successful customized enable persists one complete, normalized, unexpanded
264
+ workspace definition. Thus later enablement needs neither the originating
265
+ client nor its configuration file, and symbolic credentials remain resolvable
266
+ only by the service at connection preparation.
267
+
162
268
  ### §mcp-management-actions Workspace management
163
269
 
164
270
  Every action below declares `scope: "workspace"` under
@@ -167,12 +273,12 @@ workspace identifier in params.
167
273
 
168
274
  | Action | Parameters | Result / effect |
169
275
  |---|---|---|
170
- | `workspace.mcp.list` | none | Sorted effective server summaries: name, source, transport, connection/authorization state, negotiated identity/capabilities, enabled tools, and read subset. No credential values. |
171
- | `workspace.mcp.attach` | `server: McpServerDefinition` | Adds a name absent from the effective workspace. Preparation completes before publication. |
172
- | `workspace.mcp.replace` | `server: McpServerDefinition` | Replaces one effective definition under the same name; absence is 404. |
173
- | `workspace.mcp.detach` | `name` | Removes a workspace attachment or writes a tombstone for a service default, then removes its exact Registry, docs, and resource authority. |
174
- | `workspace.mcp.reconnect` | `name` | Builds a fresh connection from the existing unexpanded definition and atomically replaces the old connection after successful preparation. |
175
- | `workspace.mcp.oauth.complete` | `name`, `callbackUrl` | State- and issuer-validates one pending interactive callback through the SDK, completes connection preparation, then performs the originally requested attach, replace, or reconnect. |
276
+ | `workspace.mcp.list` | optional `overlay: McpConfigurationOverlay` | Sorted available server summaries: alias, source, target, transport, enabledness, connection/authorization/unavailable state, unavailable Problem, negotiated identity/capabilities, enabled tools, and read subset. A client-only definition is shown disabled with source `client`; carrying configuration neither connects nor persists it. No credential values. |
277
+ | `workspace.mcp.add` | `alias`, `target`; optional `options: McpServerOptions` | Adds and enables a workspace-owned alias absent from the available set. Preparation completes before publication. |
278
+ | `workspace.mcp.enable` | `alias`; optional `overlay: McpConfigurationOverlay`, `options: McpServerOptions` | Resolves the alias through {§mcp-configuration-cascade} and enables it for this workspace. A definition differing from the service baseline becomes the durable workspace specialization. Successful preparation precedes persistence and capability publication. Already connected with the same definition is a no-op; already enabled but unavailable retries preparation. |
279
+ | `workspace.mcp.disable` | `alias` | Disables an available alias, retaining it for client discovery while removing its connection and complete model-facing capability set. Already disabled is a no-op. |
280
+ | `workspace.mcp.remove` | `alias` | Removes a workspace specialization. A same-named service definition is revealed disabled; a workspace-only alias disappears. Service definitions without a specialization reject removal and direct the client to disable them. |
281
+ | `workspace.mcp.oauth.complete` | `alias`, `callbackUrl` | State- and issuer-validates one pending interactive callback through the SDK, completes connection preparation, then performs the originally requested add or enable. |
176
282
  | `workspace.mcp.complete` | `server`, `ref`, `argument`; optional `context` | Requests negotiated prompt/resource-template argument completion for a client-owned interaction. |
177
283
 
178
284
  Expected preparation failures cross the action boundary as MCP-management
@@ -180,26 +286,98 @@ Problems rather than generic AG-UI failures:
180
286
 
181
287
  | Endpoint condition | Problem |
182
288
  |---|---|
183
- | Definitively does not offer pinned `2026-07-28` through `server/discover` | `502 protocol-revision-unsupported`, non-retryable; names the server, required revision and method, and directs the operator to upgrade or replace the legacy endpoint |
184
- | Cannot connect or complete current discovery/catalog preparation | `502 server-unavailable`, retryable; names the server and transport without exposing credentials |
289
+ | Cannot connect or complete discovery/catalog preparation at the negotiated revision | `502 server-unavailable`, retryable; names the server and transport without exposing credentials |
290
+ | Client-credentials grant rejected by the authorization server | `502 oauth-client-credentials-failed`, non-retryable; names the server and client id, never the secret ({§oauth-client-credentials}) |
185
291
 
186
292
  Interactive preparation returns a successful pending result shaped as
187
293
  `{ status: 202, authorization: { url } }`; it publishes no candidate runtime.
188
- The action owner retains one pending candidate per `(workspace, name)` and a
189
- new request cancels and replaces it. Unrelated workspace changes remain
190
- authoritative while authorization is pending; drift of the same server fails
191
- completion with a conflict instead of replaying a stale workspace snapshot.
192
- `oauth.complete` accepts the complete
294
+ The action owner retains one pending candidate per `(workspace, alias)` and a
295
+ new request cancels and replaces it ({§oauth-lifetime}). Unrelated workspace
296
+ changes remain authoritative while authorization is pending; drift of the same
297
+ server fails completion with a conflict instead of replaying a stale workspace
298
+ snapshot. `oauth.complete` accepts the complete
193
299
  callback URL so state, `code`, and `iss` remain one parsing unit. A missing,
194
300
  expired, mismatched, or replayed callback fails without exposing attacker-owned
195
301
  OAuth error text. It completes either pending hydration or the originally
196
- requested attach, replace, or reconnect. There is no callback HTTP endpoint,
197
- authority-root resource, or MCP-specific AG-UI route.
302
+ requested add or enable.
303
+
304
+ ## §oauth-lifetime Interactive OAuth lifetime and reauthorization
305
+
306
+ Interactive OAuth state is deliberately ephemeral and process-memory: client
307
+ registration data, access and refresh tokens, the PKCE verifier, and pending
308
+ state live only in the owning connection or pending candidate. Nothing
309
+ OAuth-secret is written to SQLite; the durable workspace state holds only the
310
+ unexpanded definition ({§mcp-configuration}). There is no callback HTTP
311
+ listener, authority-root resource, or daemon-side browser side channel: the
312
+ client returns the complete callback URL through `workspace.mcp.oauth.complete`
313
+ so `state`, `code`, and `iss` remain one parsing unit. Reauthorization after a
314
+ daemon restart is the intended journey, documented here rather than presented
315
+ as an accidental failure.
316
+
317
+ | Journey point | Behaviour |
318
+ |---|---|
319
+ | Pending authorization | One pending candidate per `(workspace, alias)`; a new add or customized enable cancels and replaces it. A callback from a superseded attempt fails state validation instead of cross-completing. |
320
+ | Client disconnect | Does not touch the pending candidate; it can still be completed, or replaced by a fresh request. |
321
+ | Daemon restart during pending | The candidate is lost: nothing was durable, no attachment publishes, and `oauth.complete` answers `404 oauth-not-pending`. Start authorization again. |
322
+ | Daemon restart after authorization | The durable definition rehydrates but tokens are gone; the attachment publishes `authorization-required` and enable returns a fresh `{ status: 202, authorization: { url } }`. The operator reauthorizes. |
323
+ | Token expiry | An expired access token surfaces as one unauthorized response; the SDK re-acquires via `refresh_token` when one was issued, otherwise re-enters interactive authorization. |
324
+ | Refresh | Happens only against the issuer bound during the original authorization; the refreshed token replaces the in-memory token. |
325
+ | Workspace disable/remove | Closes the attachment and clears its pending candidate; no durable secret deletion is needed because nothing secret is durable. |
326
+ | Server replacement | Completion compares the pending candidate's expected definition with the current one; drift of the same server fails `409 oauth-target-conflict` instead of replaying a stale snapshot. |
327
+ | Cross-authorization protection | Candidates are keyed by `(workspace, alias)`; callback state, PKCE, and issuer are validated by the SDK against the attempt that created them, so no other workspace, alias, or attempt can complete this authorization. |
328
+
329
+ ## §oauth-client-credentials Client-credentials grant adoption
330
+
331
+ The `client-credentials` arm of `McpServerDefinition.authorization` adopts the
332
+ official `io.modelcontextprotocol/oauth-client-credentials` extension's
333
+ client-secret form faithfully: an MCP connection whose definition holds a
334
+ client-credentials grant advertises the extension capability in
335
+ `clientCapabilities.extensions`; connections without one never claim it. The
336
+ grant uses `client_secret_basic` authentication with `grant_type
337
+ client_credentials`. Scope from the definition's optional `scope` is passed to
338
+ the token request. The credential itself is one complete symbolic environment
339
+ reference (`clientSecret: "${NAME}"`), expanded only while preparing the
340
+ connection; it is never stored in SQLite, logged, or echoed in Problems.
341
+
342
+ | Aspect | Behaviour |
343
+ |---|---|
344
+ | Issuer binding | The definition's optional `issuer` is passed as the SDK provider's `expectedIssuer`, stamping the credential with its authorization server so SEP-2352 issuer checks refuse to send it elsewhere. Absent, the SDK's legacy no-binding behaviour applies. |
345
+ | Token lifetime | Token refresh is 401-triggered by the SDK client: an expired access token surfaces as one unauthorized response, the provider re-fetches with the stored credential, and the request is retried. Proactive expiry scheduling is a client-internal optimization, not a wire requirement; Plurnk does not wrap the SDK with its own scheduler. |
346
+ | Rotation | `clientSecret` resolution happens per connection preparation, so rotating the operator environment value takes effect on the next preparation of the server. |
347
+ | Errors | A rejected grant crosses the action boundary as `502 oauth-client-credentials-failed`, non-retryable, naming the server and client id only; SDK OAuth error text is never echoed. Other connection failures keep the generic `server-unavailable` allocation. |
348
+
349
+ Static credentials authorize application principals (service attachments, CI,
350
+ daemons), not human users. Private-key JWT and static JWT assertions for
351
+ client authentication are a declared non-goal; the specification permits a
352
+ secret-only client and Plurnk declines the assertion arms. The interactive
353
+ OAuth arm is the human-principal path ({§mcp-management-actions}); bearer
354
+ remains the private-service/legacy transport credential.
355
+
356
+ ## §mcp-ema-deferral Enterprise-managed authorization deferral
357
+
358
+ Plurnk does not advertise or implement
359
+ `io.modelcontextprotocol/enterprise-managed-authorization`. The SDK supplies
360
+ the wire steps (ID-JAG acquisition via RFC 8693 and the RFC 7523 JWT bearer
361
+ grant); the extension's remaining responsibilities are enterprise deployment
362
+ policy, not open-source host mechanics:
363
+
364
+ | Responsibility | Ownership |
365
+ |---|---|
366
+ | Capability advertisement, ID-JAG and access-token exchange, scope-error handling | Public protocol responsibilities the SDK host could own |
367
+ | SSO acquisition of the identity assertion (ID token or SAML) | Presumes a user session the headless daemon does not own |
368
+ | Saving the identity assertion for later use | Durable identity material; conflicts with the credential policy — secrets have one owner, the operator environment, and never a durable store |
369
+ | IdP endpoint and client registration configuration | Organization-owned; Plurnk has no org-level configuration seam |
370
+
371
+ The conformance client declines the enterprise scenarios, the capability
372
+ matrix keeps the extension non-advertised ({§mcp-capability-matrix}), and the
373
+ extension stays separate from core OAuth and client-credentials reporting.
374
+ Re-evaluate when an organization-owned configuration owner exists and a
375
+ decision on durable identity material is ratified.
198
376
 
199
377
  ## §mcp-setup Atomic lifecycle
200
378
 
201
- For each workspace, hydration resolves service defaults against the durable
202
- attachment/tombstone map, opens and discovers every effective connection,
379
+ For each workspace, hydration resolves service defaults and durable positive
380
+ workspace state, opens and discovers only enabled connections,
203
381
  lists the negotiated catalogs, applies enabled/effect policy, builds each exact
204
382
  tool Registry and resource facet, and submits one complete owner snapshot to
205
383
  {§module-workspace-capabilities}. A configured tool absent from the server, a
@@ -207,8 +385,9 @@ duplicate remote name, an enabled name not representable as a Plurnk target,
207
385
  or a `read` name outside the enabled set fails that workspace hydration. No
208
386
  partial namespace is published and every acquired candidate closes.
209
387
 
210
- Attach, replace, and reconnect prepare the candidate while the old snapshot
211
- remains authoritative, then commit only at {§module-workspace-quiescence}. The
388
+ Add and enable prepare the candidate while the old snapshot remains
389
+ authoritative, then commit only at {§module-workspace-quiescence}. Disable and
390
+ remove commit the complete reduced snapshot at the same boundary. The
212
391
  old connection rejects replacement while it owns an active protocol request,
213
392
  MRTR exchange, or Task. Cache/list-change watches are infrastructure and close
214
393
  with the old connection after the new snapshot commits. A failed candidate or
@@ -246,27 +425,62 @@ pending client-owned interaction exactly as proposal review does. MRTR round
246
425
  limits, request timeout, cancellation, and Task terminal state are one
247
426
  operation lifecycle; none becomes a hidden retry loop.
248
427
 
428
+ ## §mcp-result-content Passive result content
429
+
430
+ Every passive content variant the modern revision defines — text, image,
431
+ audio, resource links, and embedded text/blob resources — is preserved
432
+ losslessly into the EXEC channel as one JSON value
433
+ ({§json-result-rendering}), the durable evidence path. Plurnk does not claim
434
+ first-class client rendering of non-text variants and adds no MCP-only media
435
+ envelopes: presentation is a client concern over ordinary typed
436
+ entries/resources, and a text-only client degrades by rendering the JSON. A
437
+ standalone `blob` content block is not a modern `tools/call` content member
438
+ (blobs ride inside embedded blob resources) and is rejected as
439
+ protocol-invalid. Size limits and MIME trust remain ordinary channel and
440
+ entry policy, not MCP-specific rules.
441
+
442
+ ## §mcp-apps-exclusion MCP Apps exclusion
443
+
444
+ Plurnk does not advertise or implement MCP Apps. An Apps host must sandbox
445
+ render third-party HTML/JavaScript, enforce CSP and `_meta.ui` permissions,
446
+ mediate a `postMessage` JSON-RPC `ui/` dialect, proxy app-initiated tool
447
+ calls with consent, and own teardown. No Plurnk client can enforce that
448
+ sandbox today (terminal and Neovim cannot), the daemon is not a second
449
+ application platform, and AG-UI has no standard Apps projection — inventing
450
+ a private event stream to carry Apps is rejected. Tool descriptions carrying
451
+ `_meta.ui` metadata project into Plurnk without it: model-facing summaries
452
+ derive only from name, description, title, and input schema, and no UI
453
+ resource is fetched or preloaded. The capability matrix keeps the extension
454
+ non-advertised ({§mcp-capability-matrix}). Re-evaluate only when a
455
+ sandbox-capable client exists and a standard AG-UI projection is agreed;
456
+ even then the capability would be per-client-advertised, never daemon-wide.
457
+
249
458
  ## §mcp-model-projection Model-facing projection
250
459
 
251
460
  | MCP surface | Plurnk surface |
252
461
  |---|---|
253
- | Server | One registered executor family and matching resource scheme |
254
- | Enabled tool | One exact Registered Tools row and `## EXEC0 [<server>] (<tool>)` call |
255
- | Enabled tool details | `worker://plurnk/docs/<server>.md` through the standard kernel documentation surface |
462
+ | Server | One registered executor family, `worker://plurnk/tools/<server>.md`, and matching resource scheme |
463
+ | Enabled tool | One annotated call in the compact family document plus one exact `worker://plurnk/tools/<server>/<encoded-tool>.md` input-contract document |
464
+ | Tool survey | Ordinary FIND summary metadata from the standard executable-tool resource tree |
256
465
  | Resource catalog | `<server>:///` and `<server>:///resources` |
257
466
  | Resources | `<server>:///resources` and encoded resource-URI descendants |
258
467
  | Prompts | `<server>:///prompts` and encoded prompt-name descendants |
259
468
 
260
469
  §mcp-tool-presentation One canonical enabled-tool snapshot owns every
261
470
  model-facing and executable consequence. Each enabled remote tool becomes one
262
- exact target in {§executor-tool-registry}. Its Registered Tools row carries the
263
- remote description, requiredness derived from the input schema, and a
264
- deterministic one-line JSON-shaped signature: quoted property names, `?` on
265
- optional properties, primitive type words, and literal unions—never fabricated
266
- argument data. The snapshot's standard kernel document contains each enabled
267
- tool's description and exact input/output JSON Schemas. Disabled names appear
268
- in neither surface, and there is no MCP-specific FIND, READ, authority-root, or
269
- other model discovery mechanism for tools.
471
+ exact target in {§executor-tool-registry}. Its standard
472
+ {§executor-tool-document} carries the normalized remote description as Summary,
473
+ requiredness derived from the input schema, and a deterministic one-line
474
+ JSON-shaped invocation signature: quoted property names, `?` on optional
475
+ properties, primitive type words, and literal unions—never fabricated argument
476
+ data. The compact family document projects those same facts into annotated,
477
+ copyable EXEC headings; each exact child additionally projects property-level
478
+ input descriptions and standard constraints such as defaults, formats, ranges,
479
+ lengths, and patterns. A missing remote description receives a deterministic
480
+ server-and-tool summary rather than an invented capability claim. Output schemas
481
+ do not enter model teaching; the returned value remains ordinary evidence. Disabled names
482
+ appear in neither discovery nor admission, and there is no MCP-specific FIND,
483
+ READ, authority-root, or other model discovery mechanism for tools.
270
484
 
271
485
  Core validates the exact target and the selected tool's invocation before
272
486
  effect admission. `McpExecutor.run()` independently rejects a target outside