@jini-ai/mcp 0.3.3 → 0.4.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 +151 -0
- package/README.md +97 -22
- package/dist/agent-install/install.d.ts +20 -4
- package/dist/agent-install/install.js +11 -11
- package/dist/bin/serve.d.ts +25 -13
- package/dist/bin/serve.js +42 -21
- package/dist/client/client.d.ts +28 -8
- package/dist/client/client.js +25 -21
- package/dist/core/config.d.ts +57 -18
- package/dist/core/config.js +76 -48
- package/dist/core/index.d.ts +1 -2
- package/dist/core/index.js +1 -2
- package/dist/core/install-info.d.ts +4 -1
- package/dist/core/install-info.js +5 -5
- package/dist/core/tokens.d.ts +39 -13
- package/dist/core/tokens.js +54 -24
- package/dist/federation/adapter.http.d.ts +67 -0
- package/dist/federation/adapter.http.js +414 -0
- package/dist/federation/approvals/call-confirmation.d.ts +23 -0
- package/dist/federation/approvals/call-confirmation.js +124 -0
- package/dist/federation/approvals/index.d.ts +4 -0
- package/dist/federation/approvals/index.js +4 -0
- package/dist/federation/approvals/ports.d.ts +107 -0
- package/dist/federation/approvals/ports.js +2 -0
- package/dist/federation/approvals/revocation.d.ts +61 -0
- package/dist/federation/approvals/revocation.js +52 -0
- package/dist/federation/bootstrap.d.ts +100 -0
- package/dist/federation/bootstrap.js +182 -0
- package/dist/federation/config.d.ts +68 -0
- package/dist/federation/config.js +40 -0
- package/dist/federation/index.d.ts +14 -0
- package/dist/federation/index.js +14 -0
- package/dist/federation/mcp-protocol.d.ts +115 -0
- package/dist/federation/mcp-protocol.js +151 -0
- package/dist/federation/messages.d.ts +54 -0
- package/dist/federation/messages.js +35 -0
- package/dist/federation/ports.d.ts +287 -0
- package/dist/federation/ports.js +5 -0
- package/dist/federation/presets.d.ts +66 -0
- package/dist/federation/presets.js +30 -0
- package/dist/federation/refusal-notice.d.ts +198 -0
- package/dist/federation/refusal-notice.js +193 -0
- package/dist/federation/registrations.d.ts +171 -0
- package/dist/federation/registrations.js +181 -0
- package/dist/federation/reload.d.ts +112 -0
- package/dist/federation/reload.js +110 -0
- package/dist/federation/stdio/adapter.stdio.d.ts +157 -0
- package/dist/federation/stdio/adapter.stdio.js +526 -0
- package/dist/federation/stdio/default-connect.d.ts +29 -0
- package/dist/federation/stdio/default-connect.js +92 -0
- package/dist/federation/stdio/index.d.ts +4 -0
- package/dist/federation/stdio/index.js +4 -0
- package/dist/federation/stdio/stdio-launch-resolver.d.ts +139 -0
- package/dist/federation/stdio/stdio-launch-resolver.js +227 -0
- package/dist/federation/testing/adapter.memory.d.ts +177 -0
- package/dist/federation/testing/adapter.memory.js +189 -0
- package/dist/federation/testing/index.d.ts +3 -0
- package/dist/federation/testing/index.js +3 -0
- package/dist/federation/testing/tool-approvals.memory.d.ts +27 -0
- package/dist/federation/testing/tool-approvals.memory.js +38 -0
- package/dist/federation/tool-approvals.d.ts +97 -0
- package/dist/federation/tool-approvals.js +42 -0
- package/dist/federation/trust.d.ts +471 -0
- package/dist/federation/trust.js +707 -0
- package/dist/index.d.ts +175 -2
- package/dist/index.js +172 -2
- package/dist/server/daemon-client.d.ts +16 -4
- package/dist/server/daemon-client.js +41 -19
- package/dist/server/ports.d.ts +9 -0
- package/dist/server/ports.js +2 -0
- package/dist/server/resource-protocol.d.ts +14 -4
- package/dist/server/resource-protocol.js +6 -6
- package/dist/server/resources/active-resource.js +3 -3
- package/dist/server/sdk-transport.d.ts +11 -0
- package/dist/server/sdk-transport.js +31 -0
- package/dist/server/tool-protocol.d.ts +31 -9
- package/dist/server/tool-protocol.js +20 -18
- package/dist/server/tool-server.d.ts +60 -43
- package/dist/server/tool-server.js +51 -27
- package/dist/server/tools/component-catalog-tools.js +7 -7
- package/dist/server/tools/delegated-tool.d.ts +7 -4
- package/dist/server/tools/delegated-tool.js +14 -15
- package/dist/server/tools/run-tools.js +15 -15
- package/dist/server/tools/tool-catalog-tools.js +7 -7
- package/dist/tools/ask-choice/index.d.ts +123 -0
- package/dist/tools/ask-choice/index.js +98 -0
- package/dist/tools/ask-choice/pending.d.ts +11 -0
- package/dist/tools/ask-choice/pending.js +34 -0
- package/dist/tools/ask-choice/question.d.ts +16 -0
- package/dist/tools/ask-choice/question.js +60 -0
- package/dist/tools/ask-choice/schema.d.ts +91 -0
- package/dist/tools/ask-choice/schema.js +27 -0
- package/dist/tools/ask-choice/types.d.ts +106 -0
- package/dist/tools/ask-choice/types.js +2 -0
- package/package.json +43 -5
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** Model input schema. Callback correlation params are carried by the rendered form only. */
|
|
2
|
+
export declare const ASK_CHOICE_INPUT_SCHEMA: {
|
|
3
|
+
readonly type: "object";
|
|
4
|
+
readonly additionalProperties: false;
|
|
5
|
+
readonly required: readonly ["title"];
|
|
6
|
+
readonly anyOf: readonly [{
|
|
7
|
+
readonly required: readonly ["singleSelect"];
|
|
8
|
+
}, {
|
|
9
|
+
readonly required: readonly ["multiSelect"];
|
|
10
|
+
}];
|
|
11
|
+
readonly properties: {
|
|
12
|
+
readonly title: {
|
|
13
|
+
readonly type: "string";
|
|
14
|
+
};
|
|
15
|
+
readonly description: {
|
|
16
|
+
readonly type: "string";
|
|
17
|
+
};
|
|
18
|
+
readonly submitLabel: {
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
};
|
|
21
|
+
readonly singleSelect: {
|
|
22
|
+
readonly type: "object";
|
|
23
|
+
readonly additionalProperties: false;
|
|
24
|
+
readonly required: readonly ["label", "options"];
|
|
25
|
+
readonly properties: {
|
|
26
|
+
readonly label: {
|
|
27
|
+
readonly type: "string";
|
|
28
|
+
};
|
|
29
|
+
readonly options: {
|
|
30
|
+
readonly type: "array";
|
|
31
|
+
readonly minItems: 1;
|
|
32
|
+
readonly items: {
|
|
33
|
+
readonly type: "object";
|
|
34
|
+
readonly additionalProperties: false;
|
|
35
|
+
readonly required: readonly ["value", "label"];
|
|
36
|
+
readonly properties: {
|
|
37
|
+
readonly value: {
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
};
|
|
40
|
+
readonly label: {
|
|
41
|
+
readonly type: "string";
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
readonly multiSelect: {
|
|
49
|
+
readonly properties: {
|
|
50
|
+
readonly hint: {
|
|
51
|
+
readonly type: "string";
|
|
52
|
+
};
|
|
53
|
+
readonly label: {
|
|
54
|
+
readonly type: "string";
|
|
55
|
+
};
|
|
56
|
+
readonly options: {
|
|
57
|
+
readonly type: "array";
|
|
58
|
+
readonly minItems: 1;
|
|
59
|
+
readonly items: {
|
|
60
|
+
readonly type: "object";
|
|
61
|
+
readonly additionalProperties: false;
|
|
62
|
+
readonly required: readonly ["value", "label"];
|
|
63
|
+
readonly properties: {
|
|
64
|
+
readonly value: {
|
|
65
|
+
readonly type: "string";
|
|
66
|
+
};
|
|
67
|
+
readonly label: {
|
|
68
|
+
readonly type: "string";
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
readonly type: "object";
|
|
75
|
+
readonly additionalProperties: false;
|
|
76
|
+
readonly required: readonly ["label", "options"];
|
|
77
|
+
};
|
|
78
|
+
readonly choice: {
|
|
79
|
+
readonly type: "string";
|
|
80
|
+
readonly description: "Set by the rendered form; never by the model.";
|
|
81
|
+
};
|
|
82
|
+
readonly selections: {
|
|
83
|
+
readonly type: "array";
|
|
84
|
+
readonly items: {
|
|
85
|
+
readonly type: "string";
|
|
86
|
+
};
|
|
87
|
+
readonly description: "Set by the rendered form; never by the model.";
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const optionSchema = {
|
|
2
|
+
type: 'object', additionalProperties: false, required: ['value', 'label'],
|
|
3
|
+
properties: { value: { type: 'string' }, label: { type: 'string' } },
|
|
4
|
+
};
|
|
5
|
+
const selectSchema = {
|
|
6
|
+
type: 'object', additionalProperties: false, required: ['label', 'options'],
|
|
7
|
+
properties: {
|
|
8
|
+
label: { type: 'string' },
|
|
9
|
+
options: { type: 'array', minItems: 1, items: optionSchema },
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
/** Model input schema. Callback correlation params are carried by the rendered form only. */
|
|
13
|
+
export const ASK_CHOICE_INPUT_SCHEMA = {
|
|
14
|
+
type: 'object', additionalProperties: false, required: ['title'],
|
|
15
|
+
anyOf: [{ required: ['singleSelect'] }, { required: ['multiSelect'] }],
|
|
16
|
+
properties: {
|
|
17
|
+
title: { type: 'string' }, description: { type: 'string' }, submitLabel: { type: 'string' },
|
|
18
|
+
singleSelect: selectSchema,
|
|
19
|
+
multiSelect: {
|
|
20
|
+
...selectSchema,
|
|
21
|
+
properties: { ...selectSchema.properties, hint: { type: 'string' } },
|
|
22
|
+
},
|
|
23
|
+
choice: { type: 'string', description: 'Set by the rendered form; never by the model.' },
|
|
24
|
+
selections: { type: 'array', items: { type: 'string' }, description: 'Set by the rendered form; never by the model.' },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/** Product-neutral question content; rendering and copy belong to the host. */
|
|
2
|
+
export interface AskChoiceSelect {
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly hint?: string;
|
|
5
|
+
readonly options: ReadonlyArray<{
|
|
6
|
+
value: string;
|
|
7
|
+
label: string;
|
|
8
|
+
}>;
|
|
9
|
+
}
|
|
10
|
+
export interface AskChoiceQuestion {
|
|
11
|
+
readonly title: string;
|
|
12
|
+
readonly description?: string;
|
|
13
|
+
readonly submitLabel?: string;
|
|
14
|
+
readonly singleSelect?: AskChoiceSelect;
|
|
15
|
+
readonly multiSelect?: AskChoiceSelect;
|
|
16
|
+
}
|
|
17
|
+
export interface AskChoiceMessages {
|
|
18
|
+
readonly pending: string;
|
|
19
|
+
readonly forgedAnswer: string;
|
|
20
|
+
readonly submitted: string;
|
|
21
|
+
readonly typed: string;
|
|
22
|
+
readonly noAnswer: string;
|
|
23
|
+
readonly cancelled: string;
|
|
24
|
+
readonly expired: string;
|
|
25
|
+
readonly abandoned: string;
|
|
26
|
+
}
|
|
27
|
+
export type AskChoiceMessage = {
|
|
28
|
+
status: 'received';
|
|
29
|
+
params: Record<string, unknown>;
|
|
30
|
+
} | {
|
|
31
|
+
status: 'expired' | 'abandoned';
|
|
32
|
+
};
|
|
33
|
+
export interface AskChoiceEmission {
|
|
34
|
+
channel: 'mcp-ui';
|
|
35
|
+
payload: {
|
|
36
|
+
resource: unknown;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export type AskChoiceEmitter = (args: {
|
|
40
|
+
emission: AskChoiceEmission;
|
|
41
|
+
}) => Promise<void>;
|
|
42
|
+
/** The host owns correlation, principal binding, buffering, and expiry of live exchanges. */
|
|
43
|
+
export interface AskChoiceExchange {
|
|
44
|
+
readonly id: string;
|
|
45
|
+
send(args: {
|
|
46
|
+
emission: AskChoiceEmission;
|
|
47
|
+
}): Promise<void>;
|
|
48
|
+
receive(args: Record<string, never>): Promise<AskChoiceMessage>;
|
|
49
|
+
close(args: Record<string, never>): void;
|
|
50
|
+
}
|
|
51
|
+
export interface AskChoiceExchangeStore {
|
|
52
|
+
open(args: {
|
|
53
|
+
toolId: string;
|
|
54
|
+
principalId: string;
|
|
55
|
+
emit: AskChoiceEmitter;
|
|
56
|
+
}): AskChoiceExchange;
|
|
57
|
+
}
|
|
58
|
+
/** Redeem consumes before checking binding, time, and offered options; rejection is fail-closed. */
|
|
59
|
+
export interface AskChoicePendingStore {
|
|
60
|
+
mint(args: {
|
|
61
|
+
principalId: string;
|
|
62
|
+
question: AskChoiceQuestion;
|
|
63
|
+
}): string;
|
|
64
|
+
redeem(args: {
|
|
65
|
+
ticket: string | undefined;
|
|
66
|
+
principalId: string;
|
|
67
|
+
params: Record<string, unknown>;
|
|
68
|
+
}): boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface AskChoiceCall {
|
|
71
|
+
principalId: string;
|
|
72
|
+
input: unknown;
|
|
73
|
+
signal: AbortSignal;
|
|
74
|
+
emitSurface?: AskChoiceEmitter;
|
|
75
|
+
}
|
|
76
|
+
/** Authorization is invoked before either displaying a question or redeeming its answer. */
|
|
77
|
+
export interface AskChoicePolicy {
|
|
78
|
+
authorize(args: {
|
|
79
|
+
ctx: AskChoiceCall;
|
|
80
|
+
toolId: string;
|
|
81
|
+
}): void | Promise<void>;
|
|
82
|
+
inputError(args: {
|
|
83
|
+
message: string;
|
|
84
|
+
}): Error;
|
|
85
|
+
shapeError(args: {
|
|
86
|
+
message: string;
|
|
87
|
+
toolId: string;
|
|
88
|
+
inputSchema: Readonly<Record<string, unknown>>;
|
|
89
|
+
}): Error;
|
|
90
|
+
}
|
|
91
|
+
export interface AskChoiceForm {
|
|
92
|
+
toolName: string;
|
|
93
|
+
principalId: string;
|
|
94
|
+
question: AskChoiceQuestion;
|
|
95
|
+
baseParams: Record<string, unknown>;
|
|
96
|
+
cancelParams?: Record<string, unknown>;
|
|
97
|
+
}
|
|
98
|
+
/** The host supplies resource identity, labels, field presentation, app metadata, and result encoding. */
|
|
99
|
+
export interface AskChoicePresentation {
|
|
100
|
+
render(args: Omit<AskChoiceForm, 'cancelParams'>, options?: Pick<AskChoiceForm, 'cancelParams'>): unknown;
|
|
101
|
+
buildResult(args: {
|
|
102
|
+
modelText: string;
|
|
103
|
+
ui: unknown;
|
|
104
|
+
}): Record<string, unknown>;
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/mcp",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
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": {
|
|
@@ -11,7 +11,16 @@
|
|
|
11
11
|
"jini": {
|
|
12
12
|
"domain": "integration",
|
|
13
13
|
"kind": "protocol-adapter",
|
|
14
|
-
"runtime": "node"
|
|
14
|
+
"runtime": "node",
|
|
15
|
+
"entries": {
|
|
16
|
+
".": "node",
|
|
17
|
+
"./bin": "node",
|
|
18
|
+
"./tools/ask-choice": "universal",
|
|
19
|
+
"./federation": "node",
|
|
20
|
+
"./federation/approvals": "node",
|
|
21
|
+
"./federation/stdio": "node",
|
|
22
|
+
"./federation/testing": "universal"
|
|
23
|
+
}
|
|
15
24
|
},
|
|
16
25
|
"type": "module",
|
|
17
26
|
"sideEffects": false,
|
|
@@ -23,7 +32,34 @@
|
|
|
23
32
|
"import": "./dist/index.js",
|
|
24
33
|
"default": "./dist/index.js"
|
|
25
34
|
},
|
|
35
|
+
"./tools/ask-choice": {
|
|
36
|
+
"types": "./dist/tools/ask-choice/index.d.ts",
|
|
37
|
+
"import": "./dist/tools/ask-choice/index.js",
|
|
38
|
+
"default": "./dist/tools/ask-choice/index.js"
|
|
39
|
+
},
|
|
40
|
+
"./federation": {
|
|
41
|
+
"types": "./dist/federation/index.d.ts",
|
|
42
|
+
"import": "./dist/federation/index.js",
|
|
43
|
+
"default": "./dist/federation/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./federation/approvals": {
|
|
46
|
+
"types": "./dist/federation/approvals/index.d.ts",
|
|
47
|
+
"import": "./dist/federation/approvals/index.js",
|
|
48
|
+
"default": "./dist/federation/approvals/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./federation/stdio": {
|
|
51
|
+
"types": "./dist/federation/stdio/index.d.ts",
|
|
52
|
+
"import": "./dist/federation/stdio/index.js",
|
|
53
|
+
"default": "./dist/federation/stdio/index.js"
|
|
54
|
+
},
|
|
55
|
+
"./federation/testing": {
|
|
56
|
+
"types": "./dist/federation/testing/index.d.ts",
|
|
57
|
+
"import": "./dist/federation/testing/index.js",
|
|
58
|
+
"default": "./dist/federation/testing/index.js"
|
|
59
|
+
},
|
|
26
60
|
"./bin": {
|
|
61
|
+
"types": "./dist/bin/serve.d.ts",
|
|
62
|
+
"import": "./dist/bin/serve.js",
|
|
27
63
|
"default": "./dist/bin/serve.js"
|
|
28
64
|
}
|
|
29
65
|
},
|
|
@@ -32,6 +68,9 @@
|
|
|
32
68
|
},
|
|
33
69
|
"files": [
|
|
34
70
|
"dist",
|
|
71
|
+
"README.md",
|
|
72
|
+
"CHANGELOG.md",
|
|
73
|
+
"LICENSE",
|
|
35
74
|
"!dist/**/*.test.js",
|
|
36
75
|
"!dist/**/*.test.d.ts",
|
|
37
76
|
"!dist/**/*.test.js.map",
|
|
@@ -46,9 +85,8 @@
|
|
|
46
85
|
"dependencies": {
|
|
47
86
|
"@cfworker/json-schema": "^4.1.1",
|
|
48
87
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
49
|
-
"
|
|
50
|
-
"@jini-ai/
|
|
51
|
-
"@jini-ai/platform": "0.3.0"
|
|
88
|
+
"@jini-ai/core": "0.4.0",
|
|
89
|
+
"@jini-ai/platform": "0.5.0"
|
|
52
90
|
},
|
|
53
91
|
"scripts": {
|
|
54
92
|
"build": "tsc -p tsconfig.json && chmod +x dist/bin/serve.js",
|