pi-mcp-adapter 3.0.0 → 3.2.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 +56 -0
- package/OAUTH.md +7 -7
- package/README.md +53 -5
- package/cli.js +17 -15
- package/commands.ts +15 -3
- package/config.ts +51 -44
- package/direct-tools.ts +4 -3
- package/dist/config.d.ts +1 -1
- package/dist/config.js +53 -47
- package/dist/config.js.map +1 -1
- package/dist/mcp-callback-server.js +1 -2
- package/dist/mcp-callback-server.js.map +1 -1
- package/dist/mcp-oauth-provider.d.ts +2 -1
- package/dist/mcp-oauth-provider.js +5 -2
- package/dist/mcp-oauth-provider.js.map +1 -1
- package/dist/metadata-cache.js +4 -1
- package/dist/metadata-cache.js.map +1 -1
- package/dist/state.d.ts +2 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +4 -1
- package/dist/utils.js.map +1 -1
- package/failure-backoff.ts +11 -0
- package/host-managed.ts +547 -0
- package/index.ts +24 -27
- package/init.ts +18 -10
- package/mcp-callback-server.ts +1 -1
- package/mcp-code.ts +2 -2
- package/mcp-oauth-provider.ts +5 -2
- package/mcp-panel.ts +7 -6
- package/mcp-script-wasm.ts +18 -1
- package/mcp-script-worker.mjs +9 -2
- package/mcp-setup-panel.ts +18 -4
- package/metadata-cache.ts +4 -1
- package/namespace-tools.ts +22 -2
- package/package.json +9 -2
- package/project-server-trust.ts +47 -8
- package/proxy-modes.ts +9 -10
- package/search-ranking.ts +1 -1
- package/semantic-search.ts +6 -5
- package/state.ts +2 -1
- package/tool-approval.ts +11 -6
- package/tool-parameters.ts +11 -0
- package/utils.ts +5 -1
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
|
|
3
|
+
// OMP remaps `typebox` to a host shim that historically lacked Type.Unsafe.
|
|
4
|
+
// Prefer Unsafe when present (real TypeBox / fixed OMP shim); otherwise pass
|
|
5
|
+
// the normalized JSON Schema through as a plain object so toolWireSchema and
|
|
6
|
+
// validateToolArguments still treat it as JSON Schema.
|
|
7
|
+
export function toToolParameters(schema: Record<string, unknown>): unknown {
|
|
8
|
+
return typeof (Type as { Unsafe?: (value: never) => unknown }).Unsafe === "function"
|
|
9
|
+
? (Type as { Unsafe: (value: never) => unknown }).Unsafe(schema as never)
|
|
10
|
+
: schema;
|
|
11
|
+
}
|
package/utils.ts
CHANGED
|
@@ -6,8 +6,12 @@ import { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node
|
|
|
6
6
|
import stripJsonComments from "strip-json-comments";
|
|
7
7
|
import type { McpConfig, ServerEntry } from "./types.ts";
|
|
8
8
|
|
|
9
|
+
export function stripUtf8Bom(raw: string): string {
|
|
10
|
+
return raw.charCodeAt(0) === 0xfeff ? raw.slice(1) : raw;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
export function parseJsonWithComments(raw: string): unknown {
|
|
10
|
-
return JSON.parse(stripJsonComments(raw, { trailingCommas: true }));
|
|
14
|
+
return JSON.parse(stripJsonComments(stripUtf8Bom(raw), { trailingCommas: true }));
|
|
11
15
|
}
|
|
12
16
|
|
|
13
17
|
/** Resolve a candidate only when its real path stays within the real root. */
|