@jini-ai/mcp 0.4.2 → 0.4.3
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 +1 -0
- package/dist/agent-install/chrome-devtools.d.ts +4 -0
- package/dist/agent-install/chrome-devtools.js +7 -0
- package/dist/agent-install/index.d.ts +1 -0
- package/dist/agent-install/index.js +1 -0
- package/dist/bin/serve.js +6 -2
- package/dist/federation/bootstrap.d.ts +18 -0
- package/dist/federation/bootstrap.js +4 -4
- package/dist/federation/presets.d.ts +16 -17
- package/dist/federation/presets.js +35 -28
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/resources/site-guide-resource.d.ts +15 -0
- package/dist/server/resources/site-guide-resource.js +25 -0
- package/package.json +5 -5
- package/dist/core/oauth.d.ts +0 -274
- package/dist/core/oauth.js +0 -667
- package/dist/core/secure-write.d.ts +0 -17
- package/dist/core/secure-write.js +0 -72
package/README.md
CHANGED
|
@@ -58,6 +58,7 @@ engine nor retries a challenged request automatically.
|
|
|
58
58
|
returning a discriminated `InstallPlan` (`CliInstallPlan` | `JsonInstallPlan` | `ManualInstallPlan`),
|
|
59
59
|
and `applyJsonInstall` / `removeJsonInstall` to execute the JSON-file variant. Plus
|
|
60
60
|
`buildMcpInstallPayload` for the install-info payload a UI renders.
|
|
61
|
+
For an explicit UI check, pass `CHROME_DEVTOOLS_MCP_PRESET` to `planAgentInstall` with `ctx.serverName: "chrome-devtools"`; it pins 1.10.1 and disables usage statistics and CrUX. See the [on-demand recipe](../diagnostics/docs/ui-performance-check.md).
|
|
61
62
|
|
|
62
63
|
**Client-side runtime helpers** — `extractRelativeRefs`, `isTextualMime`.
|
|
63
64
|
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Explicit on-demand launch preset; importing it never registers or launches a browser. */
|
|
2
|
+
export const CHROME_DEVTOOLS_MCP_PRESET = {
|
|
3
|
+
command: 'npx',
|
|
4
|
+
args: ['-y', 'chrome-devtools-mcp@1.10.1', '--no-usage-statistics', '--no-performance-crux'],
|
|
5
|
+
env: {},
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=chrome-devtools.js.map
|
package/dist/bin/serve.js
CHANGED
|
@@ -7,6 +7,7 @@ import { TOOL_CATALOG_TOOLS } from '../server/tools/tool-catalog-tools.js';
|
|
|
7
7
|
import { COMPONENT_CATALOG_TOOLS } from '../server/tools/component-catalog-tools.js';
|
|
8
8
|
import { createExecuteDelegatedToolTool, createExecuteReadonlyDelegatedToolTool } from '../server/tools/delegated-tool.js';
|
|
9
9
|
import { KERNEL_RESOURCES } from '../server/resources/active-resource.js';
|
|
10
|
+
import { createSiteGuideResource } from '../server/resources/site-guide-resource.js';
|
|
10
11
|
/** The one run this process is scoped to for its entire lifetime. Set by the spawning daemon, never by the MCP client. */
|
|
11
12
|
export const RUN_ID_ENV_VAR = 'JINI_RUN_ID';
|
|
12
13
|
/** Checked (only) when resolving the daemon HTTP base URL — see `resolveDaemonUrl`'s own docs; matches the CLI entry point's identically-named constant. */
|
|
@@ -40,7 +41,10 @@ const SERVER_NAME = 'jini-mcp';
|
|
|
40
41
|
const SERVER_VERSION = '0.0.0';
|
|
41
42
|
const INSTRUCTIONS = 'Tools proxying this host\'s Jini daemon over loopback HTTP, scoped to the run that spawned this MCP server process. ' +
|
|
42
43
|
'Use execute_delegated_tool to invoke a Jini-registered tool (never an agent-vendor-specific tool name) against that run — ' +
|
|
43
|
-
'every call is routed through the daemon\'s deny-by-default ToolExecutor gate.'
|
|
44
|
+
'every call is routed through the daemon\'s deny-by-default ToolExecutor gate. ' +
|
|
45
|
+
'When the host provides site_guide, consult jini://site-guide or call site_guide with operation overview ' +
|
|
46
|
+
'through execute_readonly_delegated_tool; follow with explain for the relevant topic ids. ' +
|
|
47
|
+
'If the host does not provide site_guide, report that availability gap.';
|
|
44
48
|
// Keep the bin's environment-only assembly here; a general CLI resolver would introduce a
|
|
45
49
|
// runtime dependency on another shell. No discovery/default URL is selected for a run child.
|
|
46
50
|
async function resolveDaemonUrlDefault(_required, options) {
|
|
@@ -120,7 +124,7 @@ export async function serve(_requiredArgs, deps = {}) {
|
|
|
120
124
|
: undefined;
|
|
121
125
|
const requiredArgs = { name: SERVER_NAME, version: SERVER_VERSION, tools, resolveBaseUrl };
|
|
122
126
|
const serverOptions = {
|
|
123
|
-
resources: KERNEL_RESOURCES,
|
|
127
|
+
resources: [...KERNEL_RESOURCES, createSiteGuideResource({ runId }, delegatedGatewayOptions)],
|
|
124
128
|
instructions: INSTRUCTIONS,
|
|
125
129
|
...(authHeaders !== undefined ? { authHeaders } : {}),
|
|
126
130
|
...(deps.fetchImpl !== undefined ? { fetchImpl: deps.fetchImpl } : {}),
|
|
@@ -2,6 +2,7 @@ import { type Logger } from "@jini-ai/core/primitives";
|
|
|
2
2
|
import type { ToolRegistry } from "@jini-ai/core";
|
|
3
3
|
import type { ResolvedFederatedConnection } from "./config.js";
|
|
4
4
|
import type { McpSessionPort } from "./ports.js";
|
|
5
|
+
import { type FederatedMcpPresetRegistry } from "./presets.js";
|
|
5
6
|
import { type FederationDeps } from "./registrations.js";
|
|
6
7
|
import type { FederatedAdmissionReport } from "./trust.js";
|
|
7
8
|
export interface AttachFederatedToolsResult {
|
|
@@ -74,6 +75,7 @@ export interface AttachFederatedToolsResult {
|
|
|
74
75
|
* @complexity O(c · t) in connections and their advertised tools.
|
|
75
76
|
*/
|
|
76
77
|
export interface AttachFederatedMcpToolsParams {
|
|
78
|
+
readonly presetRegistry?: FederatedMcpPresetRegistry;
|
|
77
79
|
registry: ToolRegistry;
|
|
78
80
|
deps: FederationDeps;
|
|
79
81
|
connections?: readonly ResolvedFederatedConnection[] | undefined;
|
|
@@ -97,4 +99,20 @@ export interface AttachFederatedMcpToolsParams {
|
|
|
97
99
|
export type AttachFederatedMcpToolsRequiredArgs = Pick<AttachFederatedMcpToolsParams, "registry" | "deps" | "connect">;
|
|
98
100
|
export type AttachFederatedMcpToolsOptions = Omit<AttachFederatedMcpToolsParams, "registry" | "deps" | "connect">;
|
|
99
101
|
export declare function attachFederatedMcpTools(requiredArgs: AttachFederatedMcpToolsRequiredArgs, optionalArgs?: AttachFederatedMcpToolsOptions): Promise<AttachFederatedToolsResult>;
|
|
102
|
+
/**
|
|
103
|
+
* Asks every registered preset for a connection, in registration order.
|
|
104
|
+
*
|
|
105
|
+
* Errors are isolated PER PRESET rather than abandoning the whole resolution pass: an enabled-but-
|
|
106
|
+
* invalid Supabase config must not also disable a correctly-configured second vendor that happens to
|
|
107
|
+
* be registered after it. Each failure is loud — the operator meant to have that connection and does
|
|
108
|
+
* not — and still non-fatal, because host app's own assistant is unaffected either way.
|
|
109
|
+
*
|
|
110
|
+
* A preset that declines (`null`) is silent: "not configured" is the expected default state, and
|
|
111
|
+
* logging it every boot would train operators to ignore this channel.
|
|
112
|
+
*/
|
|
113
|
+
export declare function resolveFederatedMcpPresets({ env, logger, registry }: {
|
|
114
|
+
env: NodeJS.ProcessEnv;
|
|
115
|
+
logger: Pick<Logger, "warn">;
|
|
116
|
+
registry: FederatedMcpPresetRegistry;
|
|
117
|
+
}, _optional?: {}): ResolvedFederatedConnection[];
|
|
100
118
|
//# sourceMappingURL=bootstrap.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createConsoleLogger } from "@jini-ai/core/primitives";
|
|
2
|
-
import {
|
|
2
|
+
import { defaultFederatedMcpPresetRegistry } from "./presets.js";
|
|
3
3
|
import { federateSession } from "./registrations.js";
|
|
4
4
|
/**
|
|
5
5
|
* @file The composition root for outbound MCP federation: the one function
|
|
@@ -56,7 +56,7 @@ function withPresetOrigin(connection) {
|
|
|
56
56
|
function resolveFederationAttachInputs(params) {
|
|
57
57
|
const logger = params.logger ?? consoleLogger;
|
|
58
58
|
const connect = params.connect;
|
|
59
|
-
const presetConnections = params.connections ??
|
|
59
|
+
const presetConnections = params.connections ?? resolveFederatedMcpPresets({ env: params.env ?? process.env, logger, registry: params.presetRegistry ?? defaultFederatedMcpPresetRegistry });
|
|
60
60
|
const connections = [
|
|
61
61
|
...presetConnections.map((connection) => ({ connection: withPresetOrigin(connection), isPreset: true })),
|
|
62
62
|
...(params.extraConnections ?? []).map((connection) => ({ connection, isPreset: false })),
|
|
@@ -162,9 +162,9 @@ async function attachOneFederatedConnection(params) {
|
|
|
162
162
|
* A preset that declines (`null`) is silent: "not configured" is the expected default state, and
|
|
163
163
|
* logging it every boot would train operators to ignore this channel.
|
|
164
164
|
*/
|
|
165
|
-
function
|
|
165
|
+
export function resolveFederatedMcpPresets({ env, logger, registry }, _optional = {}) {
|
|
166
166
|
const connections = [];
|
|
167
|
-
for (const preset of
|
|
167
|
+
for (const preset of registry.list({})) {
|
|
168
168
|
try {
|
|
169
169
|
const connection = preset.resolve({ env: env });
|
|
170
170
|
if (connection)
|
|
@@ -44,23 +44,22 @@ export interface FederatedMcpPreset {
|
|
|
44
44
|
readonly presetId: string;
|
|
45
45
|
readonly resolve: FederatedMcpPresetResolver;
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
* preserved
|
|
56
|
-
*/
|
|
57
|
-
export declare function
|
|
47
|
+
export interface FederatedMcpPresetRegistry {
|
|
48
|
+
register(required: {
|
|
49
|
+
preset: FederatedMcpPreset;
|
|
50
|
+
}, optional?: Record<string, never>): void;
|
|
51
|
+
list(required: Record<string, never>, optional?: Record<string, never>): readonly FederatedMcpPreset[];
|
|
52
|
+
reset(required: Record<string, never>, optional?: Record<string, never>): void;
|
|
53
|
+
}
|
|
54
|
+
/** Each host owns one ordered registry. Replacement retains order; snapshots cannot mutate it.
|
|
55
|
+
* The preserved reset rationale below describes the legacy module registry; reset now clears
|
|
56
|
+
* only this instance. The published default registry is a compatibility adapter. */
|
|
57
|
+
export declare function createFederatedMcpPresetRegistry(_required: Record<string, never>, _optional?: Record<string, never>): FederatedMcpPresetRegistry;
|
|
58
|
+
/** Compatibility owner for published callers; hosts inject their own instance at boot. */
|
|
59
|
+
export declare const defaultFederatedMcpPresetRegistry: FederatedMcpPresetRegistry;
|
|
60
|
+
export declare function registerFederatedMcpPreset(required: {
|
|
58
61
|
preset: FederatedMcpPreset;
|
|
59
|
-
}): void;
|
|
60
|
-
/** Registration order. `bootstrap.ts` resolves in this order, and that order decides which
|
|
61
|
-
* connection claims a contested tool id first (R1). */
|
|
62
|
+
}, optional?: {}): void;
|
|
62
63
|
export declare function listFederatedMcpPresets(): readonly FederatedMcpPreset[];
|
|
63
|
-
|
|
64
|
-
* `resetPageHeadRegistry`, though that one is no longer test-only — see its own doc). */
|
|
65
|
-
export declare function resetFederatedMcpPresetsForTests(_required: Record<string, never>): void;
|
|
64
|
+
export declare function resetFederatedMcpPresetsForTests(required: Record<string, never>): void;
|
|
66
65
|
//# sourceMappingURL=presets.d.ts.map
|
|
@@ -1,30 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
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
|
-
|
|
1
|
+
/** Each host owns one ordered registry. Replacement retains order; snapshots cannot mutate it.
|
|
2
|
+
* The preserved reset rationale below describes the legacy module registry; reset now clears
|
|
3
|
+
* only this instance. The published default registry is a compatibility adapter. */
|
|
4
|
+
export function createFederatedMcpPresetRegistry(_required, _optional = {}) {
|
|
5
|
+
let presets = [];
|
|
6
|
+
return {
|
|
7
|
+
/**
|
|
8
|
+
* Registers a preset, called once at composition-root boot by the preset's own module.
|
|
9
|
+
*
|
|
10
|
+
* Re-registering the same `presetId` REPLACES the earlier entry rather than appending. Unlike a
|
|
11
|
+
* `<head>` contributor, a duplicate here would resolve to two connections with the same
|
|
12
|
+
* `connectionId`, and `trust.ts` R1's collision assertion would then drop the second one whole —
|
|
13
|
+
* producing a confusing "registered, then refused for shadowing itself" log for what is really just
|
|
14
|
+
* a module imported from two places. Last registration wins, and registration order is otherwise
|
|
15
|
+
* preserved so a replacement does not silently reorder connections.
|
|
16
|
+
*/
|
|
17
|
+
register({ preset }) {
|
|
18
|
+
const existing = presets.findIndex(candidate => candidate.presetId === preset.presetId);
|
|
19
|
+
if (existing >= 0)
|
|
20
|
+
presets[existing] = preset;
|
|
21
|
+
else
|
|
22
|
+
presets.push(preset);
|
|
23
|
+
},
|
|
24
|
+
/** Registration order. `bootstrap.ts` resolves in this order, and that order decides which
|
|
25
|
+
* connection claims a contested tool id first (R1). */
|
|
26
|
+
list: () => Object.freeze(presets.slice()),
|
|
27
|
+
/** Test-only reset of the module-level registry (mirrors `page-head.ts`'s
|
|
28
|
+
* `resetPageHeadRegistry`, though that one is no longer test-only — see its own doc). */
|
|
29
|
+
reset: () => { presets = []; },
|
|
30
|
+
};
|
|
29
31
|
}
|
|
32
|
+
/** Compatibility owner for published callers; hosts inject their own instance at boot. */
|
|
33
|
+
export const defaultFederatedMcpPresetRegistry = createFederatedMcpPresetRegistry({});
|
|
34
|
+
export function registerFederatedMcpPreset(required, optional = {}) { defaultFederatedMcpPresetRegistry.register(required, optional); }
|
|
35
|
+
export function listFederatedMcpPresets() { return defaultFederatedMcpPresetRegistry.list({}); }
|
|
36
|
+
export function resetFederatedMcpPresetsForTests(required) { defaultFederatedMcpPresetRegistry.reset(required); }
|
|
30
37
|
//# sourceMappingURL=presets.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -14,13 +14,13 @@ export type { BuildMcpInstallPayloadInputs, McpInstallPayload } from './core/ind
|
|
|
14
14
|
export { createMcpIdleExitController, extractRelativeRefs, isTextualMime, } from './client/index.js';
|
|
15
15
|
export { cancelRunTool, createMcpToolServer, daemonCallOptions, errorResult, getActiveContextTool, getDaemonJson, getRunTool, listAgentsTool, okResult, postDaemonJson, requireString, RUN_TOOLS, startRunTool, toolsToList, buildToolIndex, handleToolCall, DaemonResponseTooLargeError, } from './server/index.js';
|
|
16
16
|
export type { DaemonRequestOptions, McpServerLike, McpToolContext, McpToolDef, McpToolServerHandle, McpToolServerOptions, McpTransportLike, } from './server/index.js';
|
|
17
|
-
export { activeContextResource, buildResourceIndex, handleResourceRead, KERNEL_RESOURCES, resourcesToList, } from './server/index.js';
|
|
17
|
+
export { activeContextResource, createSiteGuideResource, buildResourceIndex, handleResourceRead, KERNEL_RESOURCES, resourcesToList, } from './server/index.js';
|
|
18
18
|
export type { McpResourceDef, McpResourceReadResult } from './server/index.js';
|
|
19
19
|
export { searchToolsTool, describeToolTool, TOOL_CATALOG_TOOLS } from './server/index.js';
|
|
20
20
|
export { searchComponentsTool, describeComponentTool, COMPONENT_CATALOG_TOOLS } from './server/index.js';
|
|
21
21
|
export { createExecuteDelegatedToolTool, createExecuteReadonlyDelegatedToolTool, DEFAULT_DELEGATED_TOOL_TIMEOUT_MS, } from './server/index.js';
|
|
22
22
|
export type { CreateExecuteDelegatedToolToolOptions } from './server/index.js';
|
|
23
|
-
export { AGENT_SLUGS, isAgentSlug, planAgentInstall, applyJsonInstall, removeJsonInstall, } from './agent-install/index.js';
|
|
23
|
+
export { CHROME_DEVTOOLS_MCP_PRESET, AGENT_SLUGS, isAgentSlug, planAgentInstall, applyJsonInstall, removeJsonInstall, } from './agent-install/index.js';
|
|
24
24
|
export type { AgentSlug, McpLaunchSpec, PlanContext, CliInstallPlan, JsonInstallPlan, ManualInstallPlan, InstallPlan, } from './agent-install/index.js';
|
|
25
25
|
export type { McpConfigFilesystemPort } from './core/config.js';
|
|
26
26
|
export type { McpTokenClockOptions, McpTokenStoreOptions } from './core/tokens.js';
|
package/dist/index.js
CHANGED
|
@@ -16,7 +16,7 @@ export { createMcpIdleExitController, extractRelativeRefs, isTextualMime, } from
|
|
|
16
16
|
// ── server: the generic MCP tool-hosting mechanism + kernel-run tool defs ───
|
|
17
17
|
export { cancelRunTool, createMcpToolServer, daemonCallOptions, errorResult, getActiveContextTool, getDaemonJson, getRunTool, listAgentsTool, okResult, postDaemonJson, requireString, RUN_TOOLS, startRunTool, toolsToList, buildToolIndex, handleToolCall, DaemonResponseTooLargeError, } from './server/index.js';
|
|
18
18
|
// ── server: the generic MCP resource surface + kernel resource defs ────────
|
|
19
|
-
export { activeContextResource, buildResourceIndex, handleResourceRead, KERNEL_RESOURCES, resourcesToList, } from './server/index.js';
|
|
19
|
+
export { activeContextResource, createSiteGuideResource, buildResourceIndex, handleResourceRead, KERNEL_RESOURCES, resourcesToList, } from './server/index.js';
|
|
20
20
|
// ── server: the tool-catalog discovery defs (search_tools / describe_tool) ──
|
|
21
21
|
export { searchToolsTool, describeToolTool, TOOL_CATALOG_TOOLS } from './server/index.js';
|
|
22
22
|
// ── server: the component-catalog discovery defs (search_components / describe_component) ──
|
|
@@ -24,6 +24,6 @@ export { searchComponentsTool, describeComponentTool, COMPONENT_CATALOG_TOOLS }
|
|
|
24
24
|
// ── server: gap 3's MCP-callback delegated-tool-execution def ──────────────
|
|
25
25
|
export { createExecuteDelegatedToolTool, createExecuteReadonlyDelegatedToolTool, DEFAULT_DELEGATED_TOOL_TIMEOUT_MS, } from './server/index.js';
|
|
26
26
|
// ── agent-install: register an MCP server into external agents ──────────────
|
|
27
|
-
export { AGENT_SLUGS, isAgentSlug, planAgentInstall, applyJsonInstall, removeJsonInstall, } from './agent-install/index.js';
|
|
27
|
+
export { CHROME_DEVTOOLS_MCP_PRESET, AGENT_SLUGS, isAgentSlug, planAgentInstall, applyJsonInstall, removeJsonInstall, } from './agent-install/index.js';
|
|
28
28
|
export { DaemonHttpError } from './server/daemon-client.js';
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
package/dist/server/index.d.ts
CHANGED
|
@@ -19,4 +19,5 @@ export * from './tools/delegated-tool.js';
|
|
|
19
19
|
export * from './tools/tool-catalog-tools.js';
|
|
20
20
|
export * from './tools/component-catalog-tools.js';
|
|
21
21
|
export * from './resources/active-resource.js';
|
|
22
|
+
export * from './resources/site-guide-resource.js';
|
|
22
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/server/index.js
CHANGED
|
@@ -19,4 +19,5 @@ export * from './tools/delegated-tool.js';
|
|
|
19
19
|
export * from './tools/tool-catalog-tools.js';
|
|
20
20
|
export * from './tools/component-catalog-tools.js';
|
|
21
21
|
export * from './resources/active-resource.js';
|
|
22
|
+
export * from './resources/site-guide-resource.js';
|
|
22
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { McpResourceDef } from '../resource-protocol.js';
|
|
2
|
+
import { type CreateExecuteDelegatedToolToolOptions } from '../tools/delegated-tool.js';
|
|
3
|
+
/** Expose a host's learning tool as an attachable resource through the EXISTING read-only gateway.
|
|
4
|
+
* The run identity is host-bound; bearer headers, cancellation and authorization follow the same
|
|
5
|
+
* path as tools/call. No direct registry read or privileged principal is introduced.
|
|
6
|
+
* @param input - The spawning run id, never supplied by the MCP client.
|
|
7
|
+
* @returns jini://site-guide, with a fresh permission-scoped overview on every read.
|
|
8
|
+
* @throws When the host lacks site_guide, authorization denies, or execution does not complete.
|
|
9
|
+
* @complexity O(1) plus one delegated read and result serialization.
|
|
10
|
+
* @example createSiteGuideResource({ runId });
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSiteGuideResource(input: {
|
|
13
|
+
readonly runId: string;
|
|
14
|
+
}, options?: CreateExecuteDelegatedToolToolOptions): McpResourceDef;
|
|
15
|
+
//# sourceMappingURL=site-guide-resource.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createExecuteReadonlyDelegatedToolTool } from '../tools/delegated-tool.js';
|
|
2
|
+
/** Expose a host's learning tool as an attachable resource through the EXISTING read-only gateway.
|
|
3
|
+
* The run identity is host-bound; bearer headers, cancellation and authorization follow the same
|
|
4
|
+
* path as tools/call. No direct registry read or privileged principal is introduced.
|
|
5
|
+
* @param input - The spawning run id, never supplied by the MCP client.
|
|
6
|
+
* @returns jini://site-guide, with a fresh permission-scoped overview on every read.
|
|
7
|
+
* @throws When the host lacks site_guide, authorization denies, or execution does not complete.
|
|
8
|
+
* @complexity O(1) plus one delegated read and result serialization.
|
|
9
|
+
* @example createSiteGuideResource({ runId });
|
|
10
|
+
*/
|
|
11
|
+
export function createSiteGuideResource(input, options = {}) {
|
|
12
|
+
const gateway = createExecuteReadonlyDelegatedToolTool(input, options);
|
|
13
|
+
return {
|
|
14
|
+
uri: 'jini://site-guide', name: 'How this site works', mimeType: 'application/json',
|
|
15
|
+
description: 'Permission-filtered building blocks and live facts for the site hosting this run. Consult before planning or building; use site_guide explain through the delegated gateway for details.',
|
|
16
|
+
read: async ({ ctx }) => {
|
|
17
|
+
const result = await gateway.handler({ args: { toolId: 'site_guide', input: { operation: 'overview' } }, ctx });
|
|
18
|
+
if (typeof result !== 'object' || result === null || !('status' in result) || result.status !== 'completed' || !('output' in result)) {
|
|
19
|
+
throw new Error('site_guide resource read did not complete. Use the delegated tool result to inspect authorization or availability.');
|
|
20
|
+
}
|
|
21
|
+
return { text: JSON.stringify(result.output, null, 2) };
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=site-guide-resource.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/mcp",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Model Context Protocol adapters: server config schema and IO, an MCP client, and agent-side MCP server installation.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -83,11 +83,11 @@
|
|
|
83
83
|
"registry": "https://registry.npmjs.org"
|
|
84
84
|
},
|
|
85
85
|
"dependencies": {
|
|
86
|
-
"@jini-ai/core": "^0.4.
|
|
86
|
+
"@jini-ai/core": "^0.4.3"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
89
|
"@cfworker/json-schema": "^4.1.1",
|
|
90
|
-
"@jini-ai/platform": "^0.5.
|
|
90
|
+
"@jini-ai/platform": "^0.5.3",
|
|
91
91
|
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependenciesMeta": {
|
|
@@ -104,8 +104,8 @@
|
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@cfworker/json-schema": "^4.1.1",
|
|
106
106
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
107
|
-
"@jini-ai/core": "^0.4.
|
|
108
|
-
"@jini-ai/platform": "^0.5.
|
|
107
|
+
"@jini-ai/core": "^0.4.3",
|
|
108
|
+
"@jini-ai/platform": "^0.5.3"
|
|
109
109
|
},
|
|
110
110
|
"scripts": {
|
|
111
111
|
"build": "tsc -p tsconfig.json && chmod +x dist/bin/serve.js",
|