@frontmcp/plugin-skilled-openapi 0.0.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/LICENSE +201 -0
- package/README.md +40 -0
- package/esm/index.mjs +1536 -0
- package/esm/package.json +60 -0
- package/executor/credential-resolver.d.ts +49 -0
- package/executor/credential-resolver.d.ts.map +1 -0
- package/executor/openapi-runtime.d.ts +33 -0
- package/executor/openapi-runtime.d.ts.map +1 -0
- package/executor/schema-cache.d.ts +30 -0
- package/executor/schema-cache.d.ts.map +1 -0
- package/executor/ssrf-guard.d.ts +16 -0
- package/executor/ssrf-guard.d.ts.map +1 -0
- package/index.d.ts +7 -0
- package/index.d.ts.map +1 -0
- package/index.js +1524 -0
- package/package.json +60 -0
- package/registry/hidden-op.registry.d.ts +52 -0
- package/registry/hidden-op.registry.d.ts.map +1 -0
- package/security/authority-guard.d.ts +34 -0
- package/security/authority-guard.d.ts.map +1 -0
- package/skilled-openapi.plugin.d.ts +24 -0
- package/skilled-openapi.plugin.d.ts.map +1 -0
- package/skilled-openapi.symbols.d.ts +25 -0
- package/skilled-openapi.symbols.d.ts.map +1 -0
- package/skilled-openapi.types.d.ts +189 -0
- package/skilled-openapi.types.d.ts.map +1 -0
- package/sync/bundle-sync.service.d.ts +87 -0
- package/sync/bundle-sync.service.d.ts.map +1 -0
- package/tools/execute-action.schema.d.ts +26 -0
- package/tools/execute-action.schema.d.ts.map +1 -0
- package/tools/execute-action.tool.d.ts +6 -0
- package/tools/execute-action.tool.d.ts.map +1 -0
- package/tools/load-skill.schema.d.ts +46 -0
- package/tools/load-skill.schema.d.ts.map +1 -0
- package/tools/load-skill.tool.d.ts +6 -0
- package/tools/load-skill.tool.d.ts.map +1 -0
- package/tools/operation-tool.factory.d.ts +60 -0
- package/tools/operation-tool.factory.d.ts.map +1 -0
- package/tools/search-skill.schema.d.ts +30 -0
- package/tools/search-skill.schema.d.ts.map +1 -0
- package/tools/search-skill.tool.d.ts +6 -0
- package/tools/search-skill.tool.d.ts.map +1 -0
package/esm/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@frontmcp/plugin-skilled-openapi",
|
|
3
|
+
"version": "1.0.4",
|
|
4
|
+
"description": "FrontMCP plugin: serve a customer's OpenAPI spec as skill bundles (signed, OpenAPI-Overlay-based) with hidden per-operation tools mediated by three meta-tools (search_skill / load_skill / execute_action).",
|
|
5
|
+
"author": "AgentFront <info@agentfront.dev>",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"mcp",
|
|
9
|
+
"frontmcp",
|
|
10
|
+
"openapi",
|
|
11
|
+
"skills",
|
|
12
|
+
"agent-skills",
|
|
13
|
+
"plugin",
|
|
14
|
+
"agentfront"
|
|
15
|
+
],
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/agentfront/frontmcp.git",
|
|
19
|
+
"directory": "plugins/plugin-skilled-openapi"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/agentfront/frontmcp/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/agentfront/frontmcp/blob/main/plugins/plugin-skilled-openapi/README.md",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"access": "public",
|
|
27
|
+
"registry": "https://registry.npmjs.org/"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"main": "../index.js",
|
|
31
|
+
"module": "./index.mjs",
|
|
32
|
+
"types": "../index.d.ts",
|
|
33
|
+
"sideEffects": false,
|
|
34
|
+
"exports": {
|
|
35
|
+
"./package.json": "../package.json",
|
|
36
|
+
".": {
|
|
37
|
+
"require": {
|
|
38
|
+
"types": "../index.d.ts",
|
|
39
|
+
"default": "../index.js"
|
|
40
|
+
},
|
|
41
|
+
"import": {
|
|
42
|
+
"types": "../index.d.ts",
|
|
43
|
+
"default": "./index.mjs"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"dependencies": {
|
|
48
|
+
"@frontmcp/adapters": "1.0.4",
|
|
49
|
+
"@frontmcp/auth": "1.0.4",
|
|
50
|
+
"@frontmcp/protocol": "1.0.4",
|
|
51
|
+
"@frontmcp/sdk": "1.0.4",
|
|
52
|
+
"@frontmcp/utils": "1.0.4"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@frontmcp/lazy-zod": "1.0.4"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"reflect-metadata": "^0.2.2"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves a `vaultRef` string from an `AuthBinding` to a credential value.
|
|
3
|
+
*
|
|
4
|
+
* In production, this would be backed by `libs/auth`'s vault. v1.2.0 OSS
|
|
5
|
+
* ships an in-memory implementation suitable for static-source / npm-source
|
|
6
|
+
* deployments and demo scenarios; SaaS-managed deployments wire their own
|
|
7
|
+
* resolver against the customer's secret manager via plugin DI overrides.
|
|
8
|
+
*
|
|
9
|
+
* Resolved credentials are scoped: the caller MUST supply a `bundleId` so
|
|
10
|
+
* the resolver can enforce per-bundle credential allowlists (planned v1.2.x
|
|
11
|
+
* feature; the interface is shaped for it now).
|
|
12
|
+
*/
|
|
13
|
+
export interface CredentialResolver {
|
|
14
|
+
/**
|
|
15
|
+
* Resolve a vault reference. Returns the credential value (e.g. an API key
|
|
16
|
+
* or bearer token). Returns undefined if the ref is unknown — callers MUST
|
|
17
|
+
* fail closed (do NOT call without credentials).
|
|
18
|
+
*/
|
|
19
|
+
resolve(ref: string, opts: {
|
|
20
|
+
bundleId: string;
|
|
21
|
+
}): Promise<string | undefined>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* In-memory resolver — values supplied at construction time. Suitable for
|
|
25
|
+
* dev / demo / single-tenant. Trailing-newline normalization is applied once
|
|
26
|
+
* at ingestion (constructor / setForBundle) so resolve() returns the stored
|
|
27
|
+
* value verbatim and never mutates an intentional secret.
|
|
28
|
+
*
|
|
29
|
+
* Bundle scoping: the constructor seeds tenant-wide credentials (the natural
|
|
30
|
+
* shape of the plugin's `credentials` option for single-tenant demos). When a
|
|
31
|
+
* bundle needs an override (e.g. a multi-tenant deployment where every bundle
|
|
32
|
+
* carries its own secret for the same `vaultRef`), call `setForBundle()`. On
|
|
33
|
+
* resolve, the per-bundle entry wins over the tenant-wide default; if neither
|
|
34
|
+
* exists the call returns undefined and the executor fails closed.
|
|
35
|
+
*/
|
|
36
|
+
export declare class MemoryCredentialResolver implements CredentialResolver {
|
|
37
|
+
private readonly defaults;
|
|
38
|
+
private readonly perBundle;
|
|
39
|
+
constructor(defaults?: Record<string, string>);
|
|
40
|
+
/**
|
|
41
|
+
* Override (or add) a credential for a specific bundle. Per-bundle entries
|
|
42
|
+
* take precedence over the tenant-wide defaults supplied to the constructor.
|
|
43
|
+
*/
|
|
44
|
+
setForBundle(bundleId: string, ref: string, value: string): void;
|
|
45
|
+
resolve(ref: string, opts: {
|
|
46
|
+
bundleId: string;
|
|
47
|
+
}): Promise<string | undefined>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=credential-resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-resolver.d.ts","sourceRoot":"","sources":["../../src/executor/credential-resolver.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAC/E;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,wBAAyB,YAAW,kBAAkB;IACjE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAsB;IAC/C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0C;gBAExD,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM;IAIjD;;;OAGG;IACH,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;IAS1D,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;CAMpF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { FrontMcpLogger } from '@frontmcp/sdk';
|
|
2
|
+
import type { HiddenOpEntry } from '../registry/hidden-op.registry';
|
|
3
|
+
import type { OutboundOptions } from '../skilled-openapi.types';
|
|
4
|
+
import type { CredentialResolver } from './credential-resolver';
|
|
5
|
+
/** Caller-supplied input. Flat keys match `mapper[].inputKey`. */
|
|
6
|
+
export type OperationInput = Record<string, unknown>;
|
|
7
|
+
export interface ExecutionResult {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
status: number;
|
|
10
|
+
data: unknown;
|
|
11
|
+
contentType?: string;
|
|
12
|
+
error?: string;
|
|
13
|
+
responseBytes: number;
|
|
14
|
+
}
|
|
15
|
+
export interface OpenApiRuntimeDeps {
|
|
16
|
+
outbound: OutboundOptions;
|
|
17
|
+
resolver: CredentialResolver;
|
|
18
|
+
allowedHosts: ReadonlySet<string>;
|
|
19
|
+
logger: FrontMcpLogger;
|
|
20
|
+
fetchImpl?: typeof fetch;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Execute one hidden operation against the customer's REST API. Returns a
|
|
24
|
+
* structured envelope; never raw-stringifies the response into model context.
|
|
25
|
+
*/
|
|
26
|
+
export declare function executeOperation(args: {
|
|
27
|
+
entry: HiddenOpEntry;
|
|
28
|
+
bundleId: string;
|
|
29
|
+
input: OperationInput;
|
|
30
|
+
callerToken?: string;
|
|
31
|
+
deps: OpenApiRuntimeDeps;
|
|
32
|
+
}): Promise<ExecutionResult>;
|
|
33
|
+
//# sourceMappingURL=openapi-runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openapi-runtime.d.ts","sourceRoot":"","sources":["../../src/executor/openapi-runtime.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAGhE,kEAAkE;AAClE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAErD,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;CACvB;AA0HD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,EAAE,cAAc,CAAC;IACvB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE;IAC3C,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,kBAAkB,CAAC;CAC1B,GAAG,OAAO,CAAC,eAAe,CAAC,CA8F3B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from '@frontmcp/lazy-zod';
|
|
2
|
+
export type CompiledSchema = z.ZodTypeAny;
|
|
3
|
+
export interface CompiledOpSchemas {
|
|
4
|
+
input: CompiledSchema;
|
|
5
|
+
output: CompiledSchema;
|
|
6
|
+
/** True when the JSON Schema couldn't be converted (we fall back to a permissive schema). */
|
|
7
|
+
inputConversionFailed: boolean;
|
|
8
|
+
outputConversionFailed: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Return compiled input/output schemas for one operation, building (and
|
|
12
|
+
* caching) on first access. Subsequent calls within the same bundleVersion
|
|
13
|
+
* return the cached pair.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getCompiledOpSchemas(args: {
|
|
16
|
+
bundleVersion: string;
|
|
17
|
+
operationId: string;
|
|
18
|
+
inputSchema: Record<string, unknown>;
|
|
19
|
+
outputSchema: Record<string, unknown>;
|
|
20
|
+
}): CompiledOpSchemas;
|
|
21
|
+
/**
|
|
22
|
+
* Test/maintenance helper: drop entries whose bundleVersion is no longer
|
|
23
|
+
* referenced by any active bundle. v1.2.0 calls this opportunistically on
|
|
24
|
+
* bundle swap; in practice the cache stays small (one entry per op per
|
|
25
|
+
* version) and the GC isn't strictly necessary.
|
|
26
|
+
*/
|
|
27
|
+
export declare function dropEntriesForBundleVersion(bundleVersion: string): number;
|
|
28
|
+
/** Reset the entire cache. Used by tests. */
|
|
29
|
+
export declare function clearCompiledSchemaCache(): void;
|
|
30
|
+
//# sourceMappingURL=schema-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-cache.d.ts","sourceRoot":"","sources":["../../src/executor/schema-cache.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AAEvC,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,UAAU,CAAC;AAE1C,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,cAAc,CAAC;IACtB,MAAM,EAAE,cAAc,CAAC;IACvB,6FAA6F;IAC7F,qBAAqB,EAAE,OAAO,CAAC;IAC/B,sBAAsB,EAAE,OAAO,CAAC;CACjC;AAmCD;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACvC,GAAG,iBAAiB,CAepB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAUzE;AAED,6CAA6C;AAC7C,wBAAgB,wBAAwB,IAAI,IAAI,CAE/C"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { OutboundOptions } from '../skilled-openapi.types';
|
|
2
|
+
export interface SsrfCheckResult {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
reason?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function isPrivateIPv4(ip: string): boolean;
|
|
7
|
+
export declare function isPrivateIPv6(ip: string): boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Validate an outbound URL against the allowlist + scheme rules + IP blocklist.
|
|
10
|
+
*
|
|
11
|
+
* @param target - The target URL (post path/query interpolation).
|
|
12
|
+
* @param allowedHosts - Set of hostnames declared by the active bundle's services.
|
|
13
|
+
* @param outbound - Plugin's outbound options (allowHttp, allowPrivateNetworks).
|
|
14
|
+
*/
|
|
15
|
+
export declare function checkOutboundUrl(target: string, allowedHosts: ReadonlySet<string>, outbound: OutboundOptions): Promise<SsrfCheckResult>;
|
|
16
|
+
//# sourceMappingURL=ssrf-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ssrf-guard.d.ts","sourceRoot":"","sources":["../../src/executor/ssrf-guard.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAEhE,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAyBD,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAQjD;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAWjD;AAID;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,EACjC,QAAQ,EAAE,eAAe,GACxB,OAAO,CAAC,eAAe,CAAC,CA2C1B"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import SkilledOpenApiPlugin from './skilled-openapi.plugin';
|
|
2
|
+
export { SkilledOpenApiPlugin };
|
|
3
|
+
export default SkilledOpenApiPlugin;
|
|
4
|
+
export { skilledOpenApiPluginOptionsSchema } from './skilled-openapi.types';
|
|
5
|
+
export type { SkilledOpenApiPluginOptions, SkilledOpenApiPluginOptionsInput, BundleSourceOptions, StaticSourceOptions, NpmSourceOptions, SaasSourceOptions, SignatureKey, OutboundOptions, } from './skilled-openapi.types';
|
|
6
|
+
export { SkilledOpenApiConfig, SkilledOpenApiCredentialResolver } from './skilled-openapi.symbols';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,CAAC;AAChC,eAAe,oBAAoB,CAAC;AAEpC,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,YAAY,EACV,2BAA2B,EAC3B,gCAAgC,EAChC,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,EACZ,eAAe,GAChB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,MAAM,2BAA2B,CAAC"}
|