@frontmcp/adapters 1.3.0 → 1.4.1
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/esm/package.json +8 -8
- package/esm/skills/index.mjs +742 -32
- package/package.json +8 -8
- package/skills/classifier/classification-registry.d.ts +59 -0
- package/skills/classifier/classification-registry.d.ts.map +1 -0
- package/skills/classifier/openapi-classify.d.ts +67 -0
- package/skills/classifier/openapi-classify.d.ts.map +1 -0
- package/skills/classifier/render-resource-uri.d.ts +28 -0
- package/skills/classifier/render-resource-uri.d.ts.map +1 -0
- package/skills/classifier/resource-change-notification.d.ts +41 -0
- package/skills/classifier/resource-change-notification.d.ts.map +1 -0
- package/skills/deploy/deploy-manifest.schema.d.ts +448 -0
- package/skills/deploy/deploy-manifest.schema.d.ts.map +1 -0
- package/skills/harvester/op-reference.d.ts +96 -0
- package/skills/harvester/op-reference.d.ts.map +1 -0
- package/skills/index.d.ts +6 -0
- package/skills/index.d.ts.map +1 -1
- package/skills/index.js +781 -68
- package/skills/sources/filesystem-skills.source.d.ts.map +1 -1
- package/skills/sources/saas-pull.source.d.ts.map +1 -1
- package/skills/sources/static.source.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/adapters",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Adapters for the FrontMCP framework",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"homepage": "https://docs.agentfront.dev",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"node": ">=24.0.0"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@frontmcp/auth": "1.
|
|
68
|
-
"@frontmcp/di": "1.
|
|
69
|
-
"@frontmcp/
|
|
70
|
-
"@frontmcp/
|
|
67
|
+
"@frontmcp/auth": "1.4.1",
|
|
68
|
+
"@frontmcp/di": "1.4.1",
|
|
69
|
+
"@frontmcp/sdk": "1.4.1",
|
|
70
|
+
"@frontmcp/utils": "1.4.1",
|
|
71
71
|
"js-yaml": "^4.1.0",
|
|
72
|
-
"openapi
|
|
73
|
-
"
|
|
72
|
+
"mcp-from-openapi": "2.3.0",
|
|
73
|
+
"openapi-types": "^12.1.3"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@frontmcp/lazy-zod": "1.
|
|
76
|
+
"@frontmcp/lazy-zod": "1.4.1"
|
|
77
77
|
}
|
|
78
78
|
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import type { ClassifiedOperation } from './openapi-classify';
|
|
2
|
+
import { type BuildNotificationResult } from './resource-change-notification';
|
|
3
|
+
/** Snapshot view returned by `getAll()`. */
|
|
4
|
+
export interface ClassificationRegistrySnapshot {
|
|
5
|
+
toolName: string;
|
|
6
|
+
classification: ClassifiedOperation;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* In-memory registry keyed by tool name. The tool name follows the
|
|
10
|
+
* `${specId}.${operationId}` convention produced by
|
|
11
|
+
* `OperationToolFactory.operationToolName()` in `plugin-skilled-openapi`.
|
|
12
|
+
*
|
|
13
|
+
* Designed as a *storage* primitive — no protocol behaviour, no DI tokens,
|
|
14
|
+
* no decorators. The deploy pipeline owns population; the runtime
|
|
15
|
+
* dispatcher owns lookup + notification building.
|
|
16
|
+
*/
|
|
17
|
+
export declare class ClassificationRegistry {
|
|
18
|
+
private readonly byToolName;
|
|
19
|
+
/**
|
|
20
|
+
* Register (or replace) a classification for a tool name. Returns the
|
|
21
|
+
* previous classification if one existed.
|
|
22
|
+
*
|
|
23
|
+
* Useful for hot-reload: the deploy pipeline re-builds classifications
|
|
24
|
+
* from the new bundle and overwrites in place.
|
|
25
|
+
*/
|
|
26
|
+
register(toolName: string, classification: ClassifiedOperation): ClassifiedOperation | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Bulk-register an array of classifications keyed by `${specId}.${operationId}`.
|
|
29
|
+
* Returns the count of newly-added entries (existing entries are overwritten
|
|
30
|
+
* but not counted toward `added`).
|
|
31
|
+
*/
|
|
32
|
+
registerAll(classifications: ReadonlyArray<ClassifiedOperation>): {
|
|
33
|
+
added: number;
|
|
34
|
+
replaced: number;
|
|
35
|
+
};
|
|
36
|
+
/** Look up the classification for a tool. */
|
|
37
|
+
lookup(toolName: string): ClassifiedOperation | undefined;
|
|
38
|
+
/** Remove a single classification. Returns true if it was present. */
|
|
39
|
+
unregister(toolName: string): boolean;
|
|
40
|
+
/** Drop every registration; used by the loader on full re-deploy. */
|
|
41
|
+
clear(): void;
|
|
42
|
+
/** Current size — handy for tests and metrics. */
|
|
43
|
+
size(): number;
|
|
44
|
+
/** Snapshot of every (toolName, classification) pair in insertion order. */
|
|
45
|
+
getAll(): ClassificationRegistrySnapshot[];
|
|
46
|
+
/**
|
|
47
|
+
* Convenience: in one step, look up the classification for `toolName`
|
|
48
|
+
* and build the resource-change notification it should produce after a
|
|
49
|
+
* successful call with `args`. Returns `{ notification: null }` when the
|
|
50
|
+
* tool has no classification (e.g. it's not an openapi-derived tool) or
|
|
51
|
+
* when its classification has no `emit`.
|
|
52
|
+
*
|
|
53
|
+
* The dispatcher is expected to call this from a successful-call hook
|
|
54
|
+
* and forward the resulting notification through whichever notification
|
|
55
|
+
* channel the host provides.
|
|
56
|
+
*/
|
|
57
|
+
buildNotificationForCall(toolName: string, args: unknown): BuildNotificationResult;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=classification-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classification-registry.d.ts","sourceRoot":"","sources":["../../../src/skills/classifier/classification-registry.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAmC,KAAK,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAE/G,4CAA4C;AAC5C,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,mBAAmB,CAAC;CACrC;AAED;;;;;;;;GAQG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA0C;IAErE;;;;;;OAMG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,cAAc,EAAE,mBAAmB,GAAG,mBAAmB,GAAG,SAAS;IAShG;;;;OAIG;IACH,WAAW,CAAC,eAAe,EAAE,aAAa,CAAC,mBAAmB,CAAC,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE;IAarG,6CAA6C;IAC7C,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAIzD,sEAAsE;IACtE,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAIrC,qEAAqE;IACrE,KAAK,IAAI,IAAI;IAIb,kDAAkD;IAClD,IAAI,IAAI,MAAM;IAId,4EAA4E;IAC5E,MAAM,IAAI,8BAA8B,EAAE;IAQ1C;;;;;;;;;;OAUG;IACH,wBAAwB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,uBAAuB;CAKnF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP methods the classifier recognises. Anything else (HEAD, OPTIONS,
|
|
3
|
+
* TRACE) is passed through with `expose: 'tool'` and no emit.
|
|
4
|
+
*/
|
|
5
|
+
export type ClassifiableHttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
6
|
+
/** A single OpenAPI operation as fed to the classifier. */
|
|
7
|
+
export interface InputOperation {
|
|
8
|
+
operationId: string;
|
|
9
|
+
method: string;
|
|
10
|
+
path: string;
|
|
11
|
+
}
|
|
12
|
+
export type ExposeKind = 'tool' | 'resource' | 'both';
|
|
13
|
+
export interface MutationEmit {
|
|
14
|
+
/** Which MCP notification fires on a successful call. */
|
|
15
|
+
kind: 'updated' | 'listChanged';
|
|
16
|
+
/** Path template the emit URI is rendered from (e.g. `/users/{id}`). */
|
|
17
|
+
pathTemplate: string;
|
|
18
|
+
/** Fully-rendered URI template (e.g. `mcp+op://acme/users/{id}`). */
|
|
19
|
+
resourceUriTemplate: string;
|
|
20
|
+
}
|
|
21
|
+
export interface ClassifiedOperation {
|
|
22
|
+
operationId: string;
|
|
23
|
+
method: string;
|
|
24
|
+
path: string;
|
|
25
|
+
specId: string;
|
|
26
|
+
expose: ExposeKind;
|
|
27
|
+
/** Present only when the path itself is reachable as a resource. */
|
|
28
|
+
resourceUriTemplate?: string;
|
|
29
|
+
/** Present only for mutations that should fire a notification. */
|
|
30
|
+
emit?: MutationEmit;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Classify every operation in a single spec.
|
|
34
|
+
*
|
|
35
|
+
* @param specId - The spec identifier (e.g. `acme-api`). Used to build URIs.
|
|
36
|
+
* @param ops - All operations in the spec; the classifier scans the full
|
|
37
|
+
* list to decide "matching GET" for each path.
|
|
38
|
+
*/
|
|
39
|
+
export declare function classifyOperations(specId: string, ops: ReadonlyArray<InputOperation>): ClassifiedOperation[];
|
|
40
|
+
/**
|
|
41
|
+
* Classify a single operation in the context of its spec's GET path set.
|
|
42
|
+
*
|
|
43
|
+
* Exposed so callers that already have a pre-built `pathsWithGet` can reuse
|
|
44
|
+
* it instead of recomputing per call.
|
|
45
|
+
*/
|
|
46
|
+
export declare function classifyOne(specId: string, op: InputOperation, pathsWithGet: ReadonlySet<string>): ClassifiedOperation;
|
|
47
|
+
export interface ClassificationOverrideRule {
|
|
48
|
+
/**
|
|
49
|
+
* Pattern: `METHOD path-glob`. The glob uses `*` for single-segment
|
|
50
|
+
* wildcards and `**` for multi-segment. Example (avoiding literal
|
|
51
|
+
* star-slash in this docstring): `POST <STAR><STAR>/reset-password`.
|
|
52
|
+
*/
|
|
53
|
+
match: string;
|
|
54
|
+
/** Override the MCP surface. */
|
|
55
|
+
expose?: ExposeKind;
|
|
56
|
+
/** Override the emit target. `none` clears any default. */
|
|
57
|
+
emits?: 'self' | 'parent' | 'none';
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Apply manifest overrides on top of a list of already-classified ops.
|
|
61
|
+
*
|
|
62
|
+
* Rules are evaluated in declaration order; the first match wins per op.
|
|
63
|
+
* A rule with both `expose` and `emits` undefined is a no-op (rejected by
|
|
64
|
+
* the schema upstream but tolerated here for forward-compat).
|
|
65
|
+
*/
|
|
66
|
+
export declare function applyClassificationOverrides(classified: ReadonlyArray<ClassifiedOperation>, rules: ReadonlyArray<ClassificationOverrideRule>): ClassifiedOperation[];
|
|
67
|
+
//# sourceMappingURL=openapi-classify.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-classify.d.ts","sourceRoot":"","sources":["../../../src/skills/classifier/openapi-classify.ts"],"names":[],"mappings":"AAiCA;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEjF,2DAA2D;AAC3D,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,CAAC;AAEtD,MAAM,WAAW,YAAY;IAC3B,yDAAyD;IACzD,IAAI,EAAE,SAAS,GAAG,aAAa,CAAC;IAChC,wEAAwE;IACxE,YAAY,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,oEAAoE;IACpE,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,kEAAkE;IAClE,IAAI,CAAC,EAAE,YAAY,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,aAAa,CAAC,cAAc,CAAC,GAAG,mBAAmB,EAAE,CAe5G;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,cAAc,EAClB,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAChC,mBAAmB,CAsFrB;AAMD,MAAM,WAAW,0BAA0B;IACzC;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,gCAAgC;IAChC,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,MAAM,CAAC;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,aAAa,CAAC,mBAAmB,CAAC,EAC9C,KAAK,EAAE,aAAa,CAAC,0BAA0B,CAAC,GAC/C,mBAAmB,EAAE,CAWvB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Outcome of attempting to render a URI template.
|
|
3
|
+
*
|
|
4
|
+
* { ok: true, uri } — every placeholder had a value in `args`
|
|
5
|
+
* { ok: false, missing } — at least one placeholder was unresolved; `missing`
|
|
6
|
+
* lists the placeholder names in source order
|
|
7
|
+
*/
|
|
8
|
+
export type RenderResult = {
|
|
9
|
+
ok: true;
|
|
10
|
+
uri: string;
|
|
11
|
+
} | {
|
|
12
|
+
ok: false;
|
|
13
|
+
missing: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Render a URI template by substituting `{name}` placeholders from `args`.
|
|
17
|
+
*
|
|
18
|
+
* - Coerces values to strings (numbers, booleans accepted; objects rejected
|
|
19
|
+
* as missing since there's no sensible string projection).
|
|
20
|
+
* - URL-encodes each substituted value with `encodeURIComponent`.
|
|
21
|
+
* - Returns `{ ok: false, missing }` if any placeholder has no resolvable
|
|
22
|
+
* value — the caller decides whether to drop the notification or log.
|
|
23
|
+
*
|
|
24
|
+
* @param template The URI template, e.g. `mcp+op://acme/users/{id}`.
|
|
25
|
+
* @param args The call arguments object the placeholders refer to.
|
|
26
|
+
*/
|
|
27
|
+
export declare function renderResourceUri(template: string, args: unknown): RenderResult;
|
|
28
|
+
//# sourceMappingURL=render-resource-uri.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-resource-uri.d.ts","sourceRoot":"","sources":["../../../src/skills/classifier/render-resource-uri.ts"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,MAAM,MAAM,YAAY,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC;AAIxF;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,YAAY,CAoC/E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ClassifiedOperation } from './openapi-classify';
|
|
2
|
+
/**
|
|
3
|
+
* MCP `notifications/resources/updated` shape — JSON-RPC notification with
|
|
4
|
+
* the affected resource URI in params.
|
|
5
|
+
*/
|
|
6
|
+
export interface ResourceUpdatedNotification {
|
|
7
|
+
method: 'notifications/resources/updated';
|
|
8
|
+
params: {
|
|
9
|
+
uri: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* MCP `notifications/resources/list_changed` shape. The spec defines it as
|
|
14
|
+
* carrying no params; we don't synthesize extras so subscribers see the
|
|
15
|
+
* canonical event.
|
|
16
|
+
*/
|
|
17
|
+
export interface ResourcesListChangedNotification {
|
|
18
|
+
method: 'notifications/resources/list_changed';
|
|
19
|
+
params?: Record<string, never>;
|
|
20
|
+
}
|
|
21
|
+
export type ResourceChangeNotification = ResourceUpdatedNotification | ResourcesListChangedNotification;
|
|
22
|
+
/**
|
|
23
|
+
* Reason `buildResourceChangeNotification` returned `null`. Surfaced so the
|
|
24
|
+
* dispatcher can log + observe at the audit layer.
|
|
25
|
+
*/
|
|
26
|
+
export type SuppressedReason = 'no-emit' | 'unresolved-template';
|
|
27
|
+
export interface BuildNotificationResult {
|
|
28
|
+
notification: ResourceChangeNotification | null;
|
|
29
|
+
reason?: SuppressedReason;
|
|
30
|
+
/** Names of placeholders that could not be resolved, if any. */
|
|
31
|
+
missing?: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Build the resource-change notification for a successful tool call.
|
|
35
|
+
*
|
|
36
|
+
* @param classification The classified operation produced by `classifyOperations`.
|
|
37
|
+
* @param args The arguments the tool was invoked with (used to
|
|
38
|
+
* resolve URI template placeholders).
|
|
39
|
+
*/
|
|
40
|
+
export declare function buildResourceChangeNotification(classification: Pick<ClassifiedOperation, 'emit'>, args: unknown): BuildNotificationResult;
|
|
41
|
+
//# sourceMappingURL=resource-change-notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-change-notification.d.ts","sourceRoot":"","sources":["../../../src/skills/classifier/resource-change-notification.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAG9D;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,iCAAiC,CAAC;IAC1C,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CACzB;AAED;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C,MAAM,EAAE,sCAAsC,CAAC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;CAChC;AAED,MAAM,MAAM,0BAA0B,GAAG,2BAA2B,GAAG,gCAAgC,CAAC;AAExG;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,qBAAqB,CAAC;AAE1B,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,0BAA0B,GAAG,IAAI,CAAC;IAChD,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,+BAA+B,CAC7C,cAAc,EAAE,IAAI,CAAC,mBAAmB,EAAE,MAAM,CAAC,EACjD,IAAI,EAAE,OAAO,GACZ,uBAAuB,CA0BzB"}
|