@fitchmultz/pi-mcp-adapter 7.1.0 → 8.0.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/CHANGELOG.md +27 -0
- package/OAUTH.md +3 -3
- package/README.md +26 -17
- package/dist/app-bridge.bundle.js +13 -13
- package/dist/direct-tools.js +6 -5
- package/dist/error-signal.d.ts +3 -5
- package/dist/error-signal.js +3 -5
- package/dist/index.js +6 -23
- package/dist/init.js +0 -1
- package/dist/lifecycle.d.ts +0 -4
- package/dist/lifecycle.js +1 -14
- package/dist/mcp-auth-flow.d.ts +3 -9
- package/dist/mcp-auth-flow.js +4 -43
- package/dist/mcp-code.js +0 -1
- package/dist/mcp-output-guard.d.ts +5 -0
- package/dist/mcp-output-guard.js +55 -1
- package/dist/proxy-modes.d.ts +1 -1
- package/dist/proxy-modes.js +89 -9
- package/dist/runtime-owner.d.ts +0 -4
- package/dist/runtime-owner.js +5 -18
- package/dist/server-manager.d.ts +2 -9
- package/dist/server-manager.js +9 -100
- package/dist/tool-loader.d.ts +6 -21
- package/dist/tool-loader.js +76 -61
- package/dist/tool-registrar.d.ts +11 -0
- package/dist/tool-registrar.js +23 -0
- package/dist/types.d.ts +5 -0
- package/dist/ui-message-history.d.ts +11 -0
- package/dist/ui-message-history.js +81 -0
- package/dist/ui-server.js +17 -10
- package/dist/ui-session.js +3 -2
- package/package.json +12 -12
- package/dist/checkpoint.d.ts +0 -18
- package/dist/checkpoint.js +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [8.0.0] - 2026-10-01
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Require Pi 1.0.0 and qualify the exact official SDK/CLI cohort; live installations are not changed.
|
|
15
|
+
- Typed MCP tools expose native schemas, complete namespace instructions, annotations, bounded structured output and result-level failures. Human content, private raw capture, output/readback artifacts, cancellation and no-replay ownership remain separate.
|
|
16
|
+
- Restore the selection journal backward to the first valid snapshot, preserving legacy/incomplete recovery, pins, restrictions, lazy startup and enable-first permissions. Keep this journal for the official initial SDK-resume gap.
|
|
17
|
+
- Save MCP App messages privately on disk. Small retrievals stay inline; large histories stream to existing paged output references. Failed persistence/delivery remains recoverable, with no new retention caps.
|
|
18
|
+
- Reject App messages/context updates whose authenticated upload finishes after completion, and refuse incomplete history delivery before draining accepted sessions.
|
|
19
|
+
- Report and document the owner-accepted failed-storage boundary: unsaved in-memory App history is lost on reload/process exit; no second recovery store is added. Normal private disk history and failed-delivery recovery remain protected.
|
|
20
|
+
- Remove retired fork checkpoint/metadata APIs. Preserve actual transport/OAuth/sampling/elicitation/capture shutdown ownership and move their independent lifetime tests out of the retired checkpoint suite.
|
|
21
|
+
|
|
22
|
+
## [7.1.1] - 2026-10-01
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
|
|
26
|
+
- Update MCP Apps to 2.0.3 in the adapter and interactive visualizer, keeping their dependency graphs aligned.
|
|
27
|
+
- Qualify development against official Pi 0.99.2 and the current maintained fork, keeping host peers wildcard and the declared Pi/Node floors unchanged.
|
|
28
|
+
- Update development validation to Vitest 5.0.3 and npm 12.2.0.
|
|
29
|
+
- Use current public Pi tool activation and request-boundary scheduling APIs, preserving authentication, approval, and checkpoint barriers.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- Keep development TypeBox aligned with the official Pi baseline and block standalone updates that load a second version during source startup.
|
|
34
|
+
- Upgrade the split MCP client, core, and server SDKs together to 2.2.0 in the adapter and interactive visualizer. Native discovery now retains changing catalog pages that reuse an opaque cursor instead of silently dropping later tools.
|
|
35
|
+
- Bound native catalog walks, including automatic refreshes, to 1,024 pages and reject oversized or nonterminating catalogs without publishing partial results.
|
|
36
|
+
|
|
10
37
|
## [7.1.0] - 2026-09-27
|
|
11
38
|
|
|
12
39
|
### Changed
|
package/OAUTH.md
CHANGED
|
@@ -327,7 +327,7 @@ Persistent OAuth entries are stored in service `fitch-mcp-adapter.oauth`, with t
|
|
|
327
327
|
|
|
328
328
|
The adapter fails closed when the OS credential store is unavailable. On headless Linux, configure an unlocked Secret Service-compatible keyring before using persistent OAuth; the adapter does not silently fall back to plaintext token files.
|
|
329
329
|
|
|
330
|
-
|
|
330
|
+
Final runtime shutdown joins owned SDK operations, including background GET/reconnect provider work and cancellation tails. Per-server cancellation stays prompt; closing the runtime waits for actual provider promises, not just the cancelled public request. Granted scopes and issuer bindings remain in the native OS credential store. Active browser flows and callback memory are not serialized, and no operation is replayed to recover them. Hosts must preserve and unlock the actual private credential store on replacement compute; a Linux kernel keyring alone does not prove persistent Secret Service storage.
|
|
331
331
|
|
|
332
332
|
On Linux, if credential access fails because Pi inherited a revoked session keyring, the adapter makes one best-effort retry through `keyctl session - node <packaged helper>`. This lets explicit re-authentication write fresh credentials from a new session keyring without restarting a long-lived tmux or server process. The recovery path requires `keyctl` and `node` on `PATH`; missing, locked, or otherwise unavailable credential stores still fail closed.
|
|
333
333
|
|
|
@@ -413,7 +413,7 @@ The OAuth implementation uses the following modules:
|
|
|
413
413
|
|
|
414
414
|
## Issuer compatibility
|
|
415
415
|
|
|
416
|
-
SDK
|
|
416
|
+
SDK v2 checks that authorization-server metadata returns the issuer advertised by discovery. Some providers advertise a path-scoped issuer but return the origin instead. If the provider cannot be corrected, explicitly opt out for that server only:
|
|
417
417
|
|
|
418
418
|
```json
|
|
419
419
|
{
|
|
@@ -431,7 +431,7 @@ The default remains strict, including when `protocolVersion` is `"legacy"`. The
|
|
|
431
431
|
|
|
432
432
|
## SDK Integration
|
|
433
433
|
|
|
434
|
-
The implementation uses the official split MCP SDK v2 client and OAuth APIs.
|
|
434
|
+
The implementation uses the official split MCP SDK v2 client and OAuth APIs. MCP Apps also uses this split SDK graph; SDK v1 is not a runtime dependency:
|
|
435
435
|
|
|
436
436
|
```typescript
|
|
437
437
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/client"
|
package/README.md
CHANGED
|
@@ -20,13 +20,15 @@ The MCP ecosystem has useful databases, browsers, and APIs. This adapter keeps t
|
|
|
20
20
|
|
|
21
21
|
## Pi release qualification
|
|
22
22
|
|
|
23
|
-
The
|
|
23
|
+
The supported Pi baseline is official **1.0.0**; host peers remain wildcard. Older Pi releases are not supported. `npm run check:compat` verifies the installed SDK and CLI identity, builds and typechecks, runs Vitest and memory-only OAuth tests, then loads a packed consumer through the native SDK and CLI.
|
|
24
24
|
|
|
25
25
|
GitHub CI runs that contract on Node 24 against both official Pi and the maintained fork through the shared Pi compatibility automation, including fresh Git and npm installations loaded by the real Pi CLI. A second job checks lockfile registry hosts, published type declarations, the built interactive visualizer, and MCP protocol conformance. These checks use local MCP fixtures and disposable agent directories, never live credentials or paid providers.
|
|
26
26
|
|
|
27
|
+
Keep the development TypeBox pin aligned with the official Pi baseline's dependency, updating it only with that cohort. Standalone TypeBox updates are disabled: a second version in source installs adds measurable startup cost. Published peers remain optional wildcard dependencies, and qualification selects each host's actual TypeBox version.
|
|
28
|
+
|
|
27
29
|
## Install
|
|
28
30
|
|
|
29
|
-
Requires Pi 0.
|
|
31
|
+
Requires Pi 1.0.0 or later and Node.js 24 or later.
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
34
|
pi install npm:@fitchmultz/pi-mcp-adapter
|
|
@@ -34,6 +36,13 @@ pi install npm:@fitchmultz/pi-mcp-adapter
|
|
|
34
36
|
|
|
35
37
|
Or install from Git: `pi install git:github.com/fitchmultz/pi-mcp-adapter`.
|
|
36
38
|
|
|
39
|
+
On **Android/Termux**, Git/source installs and type checks require an Android-native
|
|
40
|
+
TypeScript 7 compiler as `tsgo` on `PATH`. The [Fold development environment](https://github.com/fitchmultz/fold-dev-environment)
|
|
41
|
+
provides a pinned native build (validated with `7.1.0-dev.20260904.1`). npm's TypeScript
|
|
42
|
+
package has no Android binary, and its Linux binary probes a syscall Android blocks.
|
|
43
|
+
macOS/Linux use the package-local pinned compiler. Published precompiled packages
|
|
44
|
+
do not need a compiler at runtime.
|
|
45
|
+
|
|
37
46
|
Restart Pi after installation. Existing v4 users should migrate first.
|
|
38
47
|
|
|
39
48
|
### Upgrading from v5
|
|
@@ -226,17 +235,11 @@ Supplying `beforeExecute` marks the adapter's tools `executionMode: "sequential"
|
|
|
226
235
|
|
|
227
236
|
The two callbacks serve different boundaries: `beforeExecute` saves completed workspace writes; `onToolCall` captures the resolved operation and its raw outcome. The host owns `pi.appendEntry()` and the awaited checkpoint of that same native JSONL. Exclude `signal`, serialize thrown errors explicitly, redact sensitive checkpoint bytes, and honor the signal and session/attempt fence. `pi.appendEntry()` alone only persists locally; `pi.events.emit()` is not an awaited barrier. Custom entries do not enter model context automatically: the host must provide truthful recovered results or readback instructions when resuming. The adapter stores no separate transcript or receipts, does not replay scripts, and does not invent provider operation keys.
|
|
228
237
|
|
|
229
|
-
###
|
|
230
|
-
|
|
231
|
-
On hosts that emit the optional awaited `session_checkpoint` event, the adapter can acknowledge an **idle, stateless Streamable HTTP** runtime with its **default sampling and elicitation capabilities intact**. Older Pi hosts continue normally and never invoke this hook. The host still owns native session capture, coherent filesystem capture, private credential retention, and commit-before-sleep.
|
|
232
|
-
|
|
233
|
-
Sampling/elicitation handlers are owned through their actual UI/model/handler promises. A pending handler returns a named veto; after it finishes, an otherwise reconstructible runtime can qualify. Cancelling an SDK response or closing a transport does not discard an unfinished handler: connection cleanup drains those callbacks. Native sends that outlive per-server cancellation remain owned and veto readiness; final shutdown joins them. SDK-generated callback replies remain owned through HTTP/auth completion even after the handler returns. Unfinished callbacks also prevent automatic idle closure. Configured `beforeExecute`/`onToolCall` hooks likewise do not block idle checkpoints. Their underlying promises stay counted even if the caller's abortable wait has ended. Callbacks must return/await their work and persist any logical state they need on resume; arbitrary unreturned detached work and closure memory are not serialized.
|
|
238
|
+
### Runtime shutdown and replacement
|
|
234
239
|
|
|
235
|
-
|
|
240
|
+
Pi 1.0 owns session replacement and emits `session_shutdown`. The adapter aborts outgoing activity before awaiting cleanup, closes owned connections, health watchers, OAuth callbacks and UI servers, and reports persistence/cleanup failures. Actual sampling/elicitation and native send/auth tails remain owned through settlement, even when a public request has already been cancelled. Unfinished callbacks prevent idle connection closure; final shutdown joins transport work. Pending `beforeExecute`/`onToolCall` promises prevent a clean-shutdown success claim. No detached work is declared finished merely because the agent settled.
|
|
236
241
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
`session_shutdown` separately performs best-effort cleanup and propagates persistence/cleanup failures through the host's ordinary extension error contract. A host callback still running after cleanup also prevents clean-shutdown success. A clean-exit host must not infer success after a failed handler. No callback/process memory recovery is promised.
|
|
242
|
+
The retired fork `session_checkpoint`/`acquireCheckpoint` APIs are no longer used. Host-supplied `beforeExecute` and raw `onToolCall` capture remain supported; the host still owns durable effect receipts and coherent workspace/session capture. No callback/process-memory recovery or automatic operation replay is promised.
|
|
240
243
|
|
|
241
244
|
### Runtime status snapshots
|
|
242
245
|
|
|
@@ -258,7 +261,9 @@ In the configuration examples below, `30000` is illustrative only. If `requestTi
|
|
|
258
261
|
|
|
259
262
|
### Transport compatibility
|
|
260
263
|
|
|
261
|
-
The adapter uses official split MCP SDK 2.
|
|
264
|
+
The adapter uses official split MCP SDK 2.2.0. HTTP connections automatically negotiate protocol `2026-07-28` and fall back to older revisions using the SDK's native rules. The SDK generates protocol metadata, method/name headers, and schema-driven `Mcp-Param-*` headers. Modern HTTP supports streamed POST responses without opening a legacy standalone GET stream. Deprecated SSE is tried only when the Streamable HTTP handshake rejects the endpoint with HTTP 404, 405, 406, or 415—not after a timeout, network failure, or authentication failure.
|
|
265
|
+
|
|
266
|
+
Native catalog discovery follows changing pages even when their opaque cursor repeats. Catalogs exceeding 1,024 pages fail explicitly instead of publishing a partial list or walking indefinitely; this also bounds automatic catalog refreshes.
|
|
262
267
|
|
|
263
268
|
For known legacy servers, set `protocolVersion: "legacy"`. This is also the workaround for servers that answer `server/discover` with an HTTP 200 JSON-RPC error whose `id` is `null`: SDK 2.0.0 cannot negotiate that response. The adapter reports the native failure rather than inventing authentication guidance or overriding the SDK's fallback classifier. Stdio and Unix sockets remain legacy by default. Explicit `"auto"` on native stdio uses the SDK's disposable probe process before starting the session process.
|
|
264
269
|
|
|
@@ -643,9 +648,9 @@ URL mode is advertised only in TUI mode. The adapter displays the requesting ser
|
|
|
643
648
|
|
|
644
649
|
Cached eligible schemas and the full gateway/script definitions register inactive; only pins and tools selected for the current branch are active. Legacy resource pins keep the gateway eager. Allowed gateway/script tools also stay eager when the host excludes the loader, so restricted hosts remain usable. The adapter persists canonical `{ server, tool }` selections and enabled gateway/script features in native Pi session entries and restores them across resume, reload, branch navigation, and working-directory changes. Host tool allowlists remain binding. Manual deselection survives reload. Loaded schemas remain available rather than unloading each turn; activation changes declarations and can invalidate the prompt-cache prefix.
|
|
645
650
|
|
|
646
|
-
|
|
651
|
+
Both official Pi and the maintained fork use public tool registration and active-tool APIs. Discovered tools retain their flat prefixed names, with `mcp_<server>` namespace metadata for grouping. Always use the exact name returned by discovery rather than constructing names. Inactive tools are not exposed through deferred/codemode execution; loading them still requires the same allowlist and selection checks.
|
|
647
652
|
|
|
648
|
-
|
|
653
|
+
Tool execution uses Pi's public request-boundary scheduling, not retired native async or pending-call APIs. Configured approval, MCP App UI consent, and the `beforeExecute` sequential checkpoint barrier remain binding. This is separate from local `mcp_script` orchestration.
|
|
649
654
|
|
|
650
655
|
Add `directTools` to pin frequently used tools into the initial active set:
|
|
651
656
|
|
|
@@ -741,7 +746,7 @@ Run `/mcp` to see known tools, pinned counts, resource counts, and connection st
|
|
|
741
746
|
|
|
742
747
|
### MCP UI Integration
|
|
743
748
|
|
|
744
|
-
MCP servers can ship interactive UIs via [MCP Apps](https://github.com/modelcontextprotocol/ext-apps). The adapter uses MCP Apps 2.0.
|
|
749
|
+
MCP servers can ship interactive UIs via [MCP Apps](https://github.com/modelcontextprotocol/ext-apps). The adapter uses MCP Apps 2.0.3. When you call a tool that has a UI resource, the adapter opens it in a native macOS window via [Glimpse](https://github.com/hazat/glimpse) if available, otherwise falls back to the browser.
|
|
745
750
|
|
|
746
751
|
**How it works:**
|
|
747
752
|
|
|
@@ -772,7 +777,11 @@ MCP servers can ship interactive UIs via [MCP Apps](https://github.com/modelcont
|
|
|
772
777
|
mcp({ action: "ui-messages" })
|
|
773
778
|
```
|
|
774
779
|
|
|
775
|
-
Returns
|
|
780
|
+
Returns completed UI sessions (the last ten), grouped in the existing prompt → intent → context → notification order. Prompt handoffs are also normalized into intents. Prompts, intents and notifications are saved in private disk history as they arrive; context updates and SSE replay retain their existing bounds. Small retrievals keep the original inline content/details. Large retrievals return `resultRef` for the complete grouped output and `historyRefs` for original JSONL events; use `read-result` with `offset`/`limit` to page them without rerunning UI actions. Plain output pages are streamed without loading the entire artifact into memory.
|
|
781
|
+
|
|
782
|
+
Retrieval drains only the sessions included in a usable inline/file receipt; read/write failure leaves them available for retry. History-write failure is explicitly reported, and unsaved events remain recoverable in the current instance's memory. **If normal storage fails and you then reload or exit, that unsaved tail is lost.** There is deliberately no session-journal rescue or alternate recovery file. Retrieve the pending messages before reloading or exiting when possible; do not treat the warning as a durable receipt. This rare failed-storage boundary does not change normal disk-history persistence or failed-delivery recovery. Files use private directory/file permissions and the existing output-directory lifetime: receipts remain readable after draining or UI closure, and are not deleted automatically. Remove artifacts only when you no longer need recovery. New sessions completed during retrieval are not cleared.
|
|
783
|
+
|
|
784
|
+
Messages and context updates are accepted only while the UI is open. An upload finishing after completion is rejected before it can invoke callbacks or alter history. Retrieval verifies the accepted history prefix's byte and event counts; truncated history remains pending recovery instead of being delivered and cleared.
|
|
776
785
|
|
|
777
786
|
**Browser controls:**
|
|
778
787
|
|
|
@@ -876,7 +885,7 @@ In interactive sessions, you can also authenticate from `/mcp` with `ctrl+a` or
|
|
|
876
885
|
|
|
877
886
|
### MCP output schemas
|
|
878
887
|
|
|
879
|
-
Advertised tool `outputSchema` values support JSON Schema draft-07 and 2020-12. Unstamped schemas use the SDK's 2020-12 default. Returned `structuredContent` is validated against the advertised schema for both proxy and direct-tool calls. Any JSON structured value—including `null`, `false`, and `0`—is rendered as text, including alongside non-empty content or images. The raw result remains available for script reduction and saved-result readback.
|
|
888
|
+
Advertised tool `outputSchema` values support JSON Schema draft-07 and 2020-12. Unstamped schemas use the SDK's 2020-12 default. Returned `structuredContent` is validated against the advertised schema for both proxy and direct-tool calls. Typed direct tools also expose that schema and bounded `structuredContent` to native Pi composition. Human text/images remain complementary. Oversized, absent, or not-run structured results return an `mcpAdapter` receipt (`omitted`, optional `resultRef`/`error`) instead of fabricating a server-schema value. Only the protocol's structured field is exposed: private details and `_meta` are not copied. Native content-only result-hook redaction drops structured output, as intended. Any JSON structured value—including `null`, `false`, and `0`—is rendered as text, including alongside non-empty content or images. The raw result remains available for script reduction and saved-result readback.
|
|
880
889
|
|
|
881
890
|
## How It Works
|
|
882
891
|
|