@fitchmultz/pi-mcp-adapter 6.0.0 → 7.1.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 +33 -0
- package/OAUTH.md +1 -1
- package/README.md +27 -18
- package/dist/app-bridge.bundle.js +14 -14
- package/dist/config.js +41 -16
- package/dist/direct-tools.js +1 -1
- package/dist/gateway-arguments.d.ts +1 -1
- package/dist/index.js +38 -59
- package/dist/lifecycle.d.ts +2 -2
- package/dist/lifecycle.js +2 -2
- package/dist/mcp-auth-flow.js +2 -2
- package/dist/mcp-auth.d.ts +1 -1
- package/dist/mcp-auth.js +3 -3
- package/dist/mcp-code.d.ts +6 -6
- package/dist/mcp-code.js +11 -10
- package/dist/mcp-oauth-provider.d.ts +5 -5
- package/dist/mcp-oauth-provider.js +5 -5
- package/dist/mcp-output-guard.d.ts +1 -1
- package/dist/mcp-output-guard.js +1 -1
- package/dist/mcp-panel.d.ts +2 -2
- package/dist/mcp-panel.js +2 -2
- package/dist/mcp-setup-panel.d.ts +5 -4
- package/dist/mcp-setup-panel.js +15 -7
- package/dist/mcp-trace.d.ts +1 -1
- package/dist/mcp-trace.js +1 -1
- package/dist/npx-resolver.js +8 -4
- package/dist/proxy-modes.d.ts +2 -2
- package/dist/proxy-modes.js +20 -19
- package/dist/sampling-handler.js +1 -0
- package/dist/search-ranking.js +6 -2
- package/dist/server-manager.d.ts +2 -2
- package/dist/server-manager.js +44 -27
- package/dist/session-recovery.d.ts +7 -4
- package/dist/session-recovery.js +76 -10
- package/dist/tool-loader.d.ts +7 -2
- package/dist/tool-loader.js +56 -5
- package/dist/tool-metadata.d.ts +43 -43
- package/dist/tool-result-renderer.d.ts +3 -3
- package/dist/tool-result-renderer.js +3 -3
- package/dist/ui-resource-handler.d.ts +2 -2
- package/dist/ui-resource-handler.js +2 -2
- package/dist/ui-server.js +5 -4
- package/dist/ui-stream-types.d.ts +8 -8
- package/dist/unix-socket-transport.d.ts +1 -1
- package/dist/unix-socket-transport.js +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +14 -0
- package/package.json +34 -98
- package/skills/mcp-scripting/SKILL.md +2 -0
- package/abort.ts +0 -34
- package/agent-dir.ts +0 -24
- package/app-bridge.bundle.js +0 -109
- package/banner.png +0 -0
- package/checkpoint.ts +0 -55
- package/commands.ts +0 -622
- package/config.ts +0 -1204
- package/consent-manager.ts +0 -25
- package/direct-tools.ts +0 -75
- package/elicitation-handler.ts +0 -349
- package/error-signal.ts +0 -21
- package/gateway-arguments.ts +0 -73
- package/glimpse-ui.ts +0 -80
- package/host-html-template.ts +0 -456
- package/index.ts +0 -767
- package/init.ts +0 -613
- package/legacy-migration.ts +0 -47
- package/lifecycle.ts +0 -165
- package/logger.ts +0 -127
- package/mcp-auth-flow.ts +0 -975
- package/mcp-auth.ts +0 -793
- package/mcp-callback-server.ts +0 -450
- package/mcp-code.ts +0 -412
- package/mcp-keyring-helper.cjs +0 -89
- package/mcp-oauth-provider.ts +0 -774
- package/mcp-output-guard.ts +0 -530
- package/mcp-panel.ts +0 -907
- package/mcp-script-worker.mjs +0 -131
- package/mcp-setup-panel.ts +0 -666
- package/mcp-status.ts +0 -110
- package/mcp-trace.ts +0 -295
- package/metadata-cache.ts +0 -271
- package/npx-resolver.ts +0 -488
- package/onboarding-state.ts +0 -58
- package/panel-keys.ts +0 -37
- package/prompts.ts +0 -337
- package/proxy-modes.ts +0 -1109
- package/resource-tools.ts +0 -52
- package/runtime-owner.ts +0 -123
- package/sampling-handler.ts +0 -276
- package/scripts/build-app-bridge.mjs +0 -15
- package/scripts/build.mjs +0 -132
- package/scripts/prepare.mjs +0 -103
- package/search-ranking.ts +0 -132
- package/server-manager.ts +0 -1320
- package/session-recovery.ts +0 -316
- package/state.ts +0 -64
- package/tool-approval.ts +0 -78
- package/tool-loader.ts +0 -153
- package/tool-metadata.ts +0 -240
- package/tool-registrar.ts +0 -74
- package/tool-result-renderer.ts +0 -294
- package/tsconfig.build.json +0 -13
- package/tsconfig.json +0 -16
- package/types.ts +0 -785
- package/ui-resource-handler.ts +0 -249
- package/ui-server.ts +0 -808
- package/ui-session.ts +0 -568
- package/ui-stream-types.ts +0 -89
- package/ui-tool-visibility.ts +0 -25
- package/unix-socket-transport.ts +0 -85
- package/utils.ts +0 -307
package/package.json
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fitchmultz/pi-mcp-adapter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"description": "Fitch's independently maintained MCP adapter for Pi coding agent",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
|
-
"
|
|
11
|
-
"default": "./index.ts"
|
|
10
|
+
"default": "./dist/index.js"
|
|
12
11
|
},
|
|
13
12
|
"./types": {
|
|
14
13
|
"types": "./dist/types.d.ts",
|
|
15
|
-
"
|
|
16
|
-
"default": "./types.ts"
|
|
14
|
+
"default": "./dist/types.js"
|
|
17
15
|
}
|
|
18
16
|
},
|
|
19
17
|
"license": "MIT",
|
|
20
18
|
"author": "Mitch Fultz",
|
|
21
|
-
"contributors": [
|
|
19
|
+
"contributors": [
|
|
20
|
+
"Nico Bailon"
|
|
21
|
+
],
|
|
22
22
|
"homepage": "https://github.com/fitchmultz/pi-mcp-adapter",
|
|
23
23
|
"bugs": "https://github.com/fitchmultz/pi-mcp-adapter/issues",
|
|
24
|
-
"publishConfig": {
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
25
27
|
"engines": {
|
|
26
|
-
"node": ">=
|
|
28
|
+
"node": ">=24.0.0"
|
|
27
29
|
},
|
|
28
30
|
"bin": {
|
|
29
31
|
"fitch-mcp-adapter": "cli.js"
|
|
@@ -34,11 +36,9 @@
|
|
|
34
36
|
"prepare": "node ./scripts/prepare.mjs",
|
|
35
37
|
"check:compat": "node scripts/compat-host.mjs && npm run build && npm run typecheck && vitest run --exclude __tests__/interactive-visualizer-server.test.ts && npm run test:oauth && node scripts/compat-package-smoke.mjs",
|
|
36
38
|
"typecheck": "tsc --noEmit",
|
|
37
|
-
"test": "vitest run",
|
|
39
|
+
"test": "vitest run && npm run test:oauth",
|
|
38
40
|
"test:watch": "vitest",
|
|
39
|
-
"test:
|
|
40
|
-
"test:oauth": "PI_MCP_ADAPTER_TEST_AUTH_STORE=memory node --import tsx --test --test-concurrency=1 mcp-auth.test.ts mcp-auth-flow.test.ts mcp-callback-server.test.ts mcp-oauth-provider.test.ts",
|
|
41
|
-
"test:oauth-provider": "PI_MCP_ADAPTER_TEST_AUTH_STORE=memory node --import tsx --test mcp-oauth-provider.test.ts",
|
|
41
|
+
"test:oauth": "PI_MCP_ADAPTER_TEST_AUTH_STORE=memory node --test --test-concurrency=1 mcp-auth.test.ts mcp-auth-flow.test.ts mcp-callback-server.test.ts mcp-oauth-provider.test.ts",
|
|
42
42
|
"test:conformance": "bash conformance/run.sh"
|
|
43
43
|
},
|
|
44
44
|
"repository": {
|
|
@@ -67,94 +67,31 @@
|
|
|
67
67
|
},
|
|
68
68
|
"files": [
|
|
69
69
|
"dist",
|
|
70
|
-
"docs/client-metadata.json",
|
|
71
|
-
"scripts/build.mjs",
|
|
72
|
-
"scripts/build-app-bridge.mjs",
|
|
73
|
-
"scripts/prepare.mjs",
|
|
74
|
-
"tsconfig.build.json",
|
|
75
|
-
"tsconfig.json",
|
|
76
70
|
"cli.js",
|
|
77
|
-
"agent-dir.ts",
|
|
78
|
-
"legacy-migration.ts",
|
|
79
|
-
"index.ts",
|
|
80
|
-
"tool-loader.ts",
|
|
81
|
-
"gateway-arguments.ts",
|
|
82
|
-
"error-signal.ts",
|
|
83
|
-
"state.ts",
|
|
84
|
-
"utils.ts",
|
|
85
|
-
"abort.ts",
|
|
86
|
-
"runtime-owner.ts",
|
|
87
|
-
"checkpoint.ts",
|
|
88
|
-
"tool-metadata.ts",
|
|
89
|
-
"search-ranking.ts",
|
|
90
|
-
"tool-approval.ts",
|
|
91
|
-
"init.ts",
|
|
92
|
-
"ui-session.ts",
|
|
93
|
-
"proxy-modes.ts",
|
|
94
|
-
"direct-tools.ts",
|
|
95
|
-
"commands.ts",
|
|
96
|
-
"prompts.ts",
|
|
97
|
-
"onboarding-state.ts",
|
|
98
|
-
"mcp-setup-panel.ts",
|
|
99
|
-
"types.ts",
|
|
100
|
-
"ui-stream-types.ts",
|
|
101
|
-
"ui-tool-visibility.ts",
|
|
102
|
-
"config.ts",
|
|
103
|
-
"server-manager.ts",
|
|
104
|
-
"unix-socket-transport.ts",
|
|
105
|
-
"session-recovery.ts",
|
|
106
|
-
"sampling-handler.ts",
|
|
107
|
-
"elicitation-handler.ts",
|
|
108
|
-
"tool-registrar.ts",
|
|
109
|
-
"tool-result-renderer.ts",
|
|
110
|
-
"mcp-output-guard.ts",
|
|
111
|
-
"mcp-code.ts",
|
|
112
|
-
"mcp-script-worker.mjs",
|
|
113
|
-
"resource-tools.ts",
|
|
114
|
-
"lifecycle.ts",
|
|
115
|
-
"mcp-status.ts",
|
|
116
|
-
"metadata-cache.ts",
|
|
117
|
-
"host-html-template.ts",
|
|
118
|
-
"ui-resource-handler.ts",
|
|
119
|
-
"consent-manager.ts",
|
|
120
|
-
"ui-server.ts",
|
|
121
|
-
"glimpse-ui.ts",
|
|
122
|
-
"npx-resolver.ts",
|
|
123
|
-
"mcp-auth.ts",
|
|
124
|
-
"mcp-keyring-helper.cjs",
|
|
125
|
-
"mcp-oauth-provider.ts",
|
|
126
|
-
"mcp-callback-server.ts",
|
|
127
|
-
"mcp-auth-flow.ts",
|
|
128
|
-
"mcp-panel.ts",
|
|
129
|
-
"panel-keys.ts",
|
|
130
|
-
"mcp-trace.ts",
|
|
131
|
-
"logger.ts",
|
|
132
|
-
"app-bridge.bundle.js",
|
|
133
|
-
"banner.png",
|
|
134
71
|
"skills",
|
|
72
|
+
"docs/client-metadata.json",
|
|
135
73
|
"README.md",
|
|
136
74
|
"OAUTH.md",
|
|
137
75
|
"CHANGELOG.md",
|
|
138
76
|
"LICENSE"
|
|
139
77
|
],
|
|
140
78
|
"dependencies": {
|
|
141
|
-
"@modelcontextprotocol/client": "2.
|
|
142
|
-
"@modelcontextprotocol/core": "2.
|
|
79
|
+
"@modelcontextprotocol/client": "2.1.0",
|
|
80
|
+
"@modelcontextprotocol/core": "2.1.0",
|
|
143
81
|
"@modelcontextprotocol/ext-apps": "2.0.0",
|
|
144
|
-
"@napi-rs/keyring": "
|
|
145
|
-
"cross-spawn": "
|
|
146
|
-
"minisearch": "
|
|
147
|
-
"open": "
|
|
148
|
-
"smol-toml": "
|
|
149
|
-
"strip-json-comments": "
|
|
150
|
-
"zod": "
|
|
82
|
+
"@napi-rs/keyring": "2.1.0",
|
|
83
|
+
"cross-spawn": "7.0.6",
|
|
84
|
+
"minisearch": "7.2.0",
|
|
85
|
+
"open": "11.0.4",
|
|
86
|
+
"smol-toml": "1.9.0",
|
|
87
|
+
"strip-json-comments": "5.0.3",
|
|
88
|
+
"zod": "4.6.5"
|
|
151
89
|
},
|
|
152
90
|
"peerDependencies": {
|
|
153
91
|
"@earendil-works/pi-ai": "*",
|
|
154
92
|
"@earendil-works/pi-coding-agent": "*",
|
|
155
93
|
"@earendil-works/pi-tui": "*",
|
|
156
|
-
"typebox": "*"
|
|
157
|
-
"zod": "^4.6.5"
|
|
94
|
+
"typebox": "*"
|
|
158
95
|
},
|
|
159
96
|
"peerDependenciesMeta": {
|
|
160
97
|
"@earendil-works/pi-ai": {
|
|
@@ -171,17 +108,16 @@
|
|
|
171
108
|
}
|
|
172
109
|
},
|
|
173
110
|
"devDependencies": {
|
|
174
|
-
"@earendil-works/pi-ai": "0.87.
|
|
175
|
-
"@earendil-works/pi-coding-agent": "0.87.
|
|
176
|
-
"@earendil-works/pi-tui": "0.87.
|
|
177
|
-
"@modelcontextprotocol/
|
|
178
|
-
"@modelcontextprotocol/server": "2.0.0",
|
|
111
|
+
"@earendil-works/pi-ai": "0.87.1",
|
|
112
|
+
"@earendil-works/pi-coding-agent": "0.87.1",
|
|
113
|
+
"@earendil-works/pi-tui": "0.87.1",
|
|
114
|
+
"@modelcontextprotocol/server": "2.1.0",
|
|
179
115
|
"@types/cross-spawn": "6.0.6",
|
|
180
|
-
"@types/node": "
|
|
181
|
-
"esbuild": "
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
|
|
186
|
-
|
|
116
|
+
"@types/node": "24.19.0",
|
|
117
|
+
"esbuild": "0.28.2",
|
|
118
|
+
"typebox": "1.3.34",
|
|
119
|
+
"typescript": "7.0.2",
|
|
120
|
+
"vitest": "5.0.2"
|
|
121
|
+
},
|
|
122
|
+
"packageManager": "npm@12.1.0"
|
|
187
123
|
}
|
|
@@ -7,6 +7,8 @@ description: Write mcp_script JavaScript for discovering, inspecting, and callin
|
|
|
7
7
|
|
|
8
8
|
Use `mcp_script` for MCP calls with loops, filtering, chaining, fan-out, or other logic between calls. Pass ordinary JavaScript as its `code` argument. For a single call, use an already loaded typed tool. Use `mcp_search({ query, server?, limit?, offset? })` to discover and load typed tools for the next request, or explicit `mcp` actions for gateway-only workflows. Discovery never executes a search hit.
|
|
9
9
|
|
|
10
|
+
If `mcp_script` is inactive, first call `mcp_search({ enable: ["script"] })`. For gateway actions, load `mcp` with `mcp_search({ enable: ["gateway"] })`. Enable both in one call when needed. Enabling does not connect to a server or run an integration action; selections stay active for the session/branch. Hosts permitting only one gateway without the loader keep that tool eager.
|
|
11
|
+
|
|
10
12
|
## Discover, inspect, then call
|
|
11
13
|
|
|
12
14
|
```js
|
package/abort.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export function throwIfAborted(signal?: AbortSignal): void {
|
|
2
|
-
if (!signal?.aborted) return;
|
|
3
|
-
throw signal.reason instanceof Error ? signal.reason : new Error(String(signal.reason ?? "MCP request aborted"));
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export async function abortable<T>(promise: Promise<T>, signal?: AbortSignal): Promise<T> {
|
|
7
|
-
if (!signal) return promise;
|
|
8
|
-
throwIfAborted(signal);
|
|
9
|
-
return await new Promise<T>((resolve, reject) => {
|
|
10
|
-
let settled = false;
|
|
11
|
-
const cleanup = () => signal.removeEventListener("abort", onAbort);
|
|
12
|
-
const onAbort = () => {
|
|
13
|
-
if (settled) return;
|
|
14
|
-
settled = true;
|
|
15
|
-
cleanup();
|
|
16
|
-
reject(signal.reason instanceof Error ? signal.reason : new Error(String(signal.reason ?? "MCP request aborted")));
|
|
17
|
-
};
|
|
18
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
19
|
-
promise.then(
|
|
20
|
-
value => {
|
|
21
|
-
if (settled) return;
|
|
22
|
-
settled = true;
|
|
23
|
-
cleanup();
|
|
24
|
-
resolve(value);
|
|
25
|
-
},
|
|
26
|
-
error => {
|
|
27
|
-
if (settled) return;
|
|
28
|
-
settled = true;
|
|
29
|
-
cleanup();
|
|
30
|
-
reject(error);
|
|
31
|
-
},
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
}
|
package/agent-dir.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
|
|
4
|
-
export function getAgentDir(): string {
|
|
5
|
-
const configured = process.env.PI_CODING_AGENT_DIR?.trim();
|
|
6
|
-
if (!configured) {
|
|
7
|
-
return join(homedir(), ".pi", "agent");
|
|
8
|
-
}
|
|
9
|
-
if (configured === "~") {
|
|
10
|
-
return homedir();
|
|
11
|
-
}
|
|
12
|
-
if (configured.startsWith("~/")) {
|
|
13
|
-
return resolve(homedir(), configured.slice(2));
|
|
14
|
-
}
|
|
15
|
-
return resolve(configured);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function getAgentPath(...segments: string[]): string {
|
|
19
|
-
return join(getAgentDir(), ...segments);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getAdapterPath(...segments: string[]): string {
|
|
23
|
-
return getAgentPath("fitch-mcp-adapter", ...segments);
|
|
24
|
-
}
|