@forumone/throughline-plugin-contract 0.3.0 → 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/README.md +3 -3
- package/dist/index.d.ts +9 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp.d.ts +11 -0
- package/dist/mcp.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/auth.d.ts +0 -30
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -2
- package/dist/auth.js.map +0 -1
package/README.md
CHANGED
|
@@ -5,9 +5,9 @@ Shared type contracts every Throughline core plugin satisfies, plus the cross-pl
|
|
|
5
5
|
## What's in here
|
|
6
6
|
|
|
7
7
|
- `CorePlugin<Options>` — the Payload plugin signature every core package exports
|
|
8
|
-
- `BaseCorePluginOptions` — options every plugin accepts (`enabled`, `
|
|
9
|
-
- `McpToolDefinition`, `McpToolContext`, `McpMeta` — the MCP
|
|
10
|
-
- `
|
|
8
|
+
- `BaseCorePluginOptions` — options every plugin accepts (`enabled`, `logger`, and `routePrefix` for a plugin that serves HTTP endpoints of its own)
|
|
9
|
+
- `McpToolDefinition`, `McpToolContext`, `McpMeta` — the MCP tool surface
|
|
10
|
+
- `AuthenticatedUser` — the actor a tool handler receives
|
|
11
11
|
- `getPluginRegistry` — the runtime registry plugins use to announce themselves and check for sibling plugins
|
|
12
12
|
- `examplePlugin` — a reference implementation showing the exact shape every future plugin follows
|
|
13
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -7,9 +7,15 @@ export interface BaseCorePluginOptions {
|
|
|
7
7
|
/** Enable or disable the plugin without removing it from the config. Defaults to `true`. */
|
|
8
8
|
enabled?: boolean;
|
|
9
9
|
/**
|
|
10
|
-
* Route prefix the plugin mounts its
|
|
11
|
-
*
|
|
12
|
-
*
|
|
10
|
+
* Route prefix the plugin mounts its HTTP endpoints under. Defaults to a
|
|
11
|
+
* plugin-specific value (e.g. `/api/publishing`). Override to avoid
|
|
12
|
+
* collisions or to expose under a different path.
|
|
13
|
+
*
|
|
14
|
+
* MCP is not among those endpoints any more: tools reach a client through
|
|
15
|
+
* the host's `@payloadcms/plugin-mcp`, on one `/api/mcp`. A plugin serving
|
|
16
|
+
* no HTTP endpoints of its own omits this option rather than accepting one
|
|
17
|
+
* it cannot honour — see `auditQueryPlugin`, `componentsPlugin` and
|
|
18
|
+
* `integrationsPlugin`.
|
|
13
19
|
*/
|
|
14
20
|
routePrefix?: string;
|
|
15
21
|
/** Logger used for plugin diagnostics. Falls back to a console logger if omitted. */
|
|
@@ -27,6 +33,5 @@ export interface Logger {
|
|
|
27
33
|
*/
|
|
28
34
|
export type CorePlugin<Options extends BaseCorePluginOptions = BaseCorePluginOptions> = (options: Options) => Plugin;
|
|
29
35
|
export * from './mcp.js';
|
|
30
|
-
export * from './auth.js';
|
|
31
36
|
export * from './registry.js';
|
|
32
37
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,4FAA4F;IAC5F,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAErC;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,4FAA4F;IAC5F,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IACnE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IAClE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;IAClE,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAA;CACpE;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,qBAAqB,GAAG,qBAAqB,IAAI,CACtF,OAAO,EAAE,OAAO,KACb,MAAM,CAAA;AAEX,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA"}
|
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAwCA,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA"}
|
package/dist/mcp.d.ts
CHANGED
|
@@ -16,6 +16,17 @@ export interface McpToolDefinition<Input extends z.ZodType = z.ZodType, Output =
|
|
|
16
16
|
* Declared on the consequential tools — the ones that write, publish or
|
|
17
17
|
* decide. A tool with no `requiredScope` is callable by any authenticated
|
|
18
18
|
* key, which is the right default for a read.
|
|
19
|
+
*
|
|
20
|
+
* **Nothing enforces this today.** The per-server JSON-RPC handler that read
|
|
21
|
+
* it is gone, and `@payloadcms/plugin-mcp` gates on per-key checkboxes it
|
|
22
|
+
* generates at config time instead — which this suite cannot fill, because
|
|
23
|
+
* every tool is built at `onInit`. So a key that authenticates reaches every
|
|
24
|
+
* collected tool.
|
|
25
|
+
*
|
|
26
|
+
* Kept, rather than deleted with its enforcer, because this is the tool → scope
|
|
27
|
+
* mapping those checkboxes need: it is the input to restoring gating, not a
|
|
28
|
+
* leftover. Deleting it would mean re-deriving eleven declarations by hand.
|
|
29
|
+
* Tracked as #78.
|
|
19
30
|
*/
|
|
20
31
|
requiredScope?: string;
|
|
21
32
|
/** Handler invoked with validated input plus per-request context. */
|
package/dist/mcp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IACtF,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ,uFAAuF;IACvF,WAAW,EAAE,MAAM,CAAA;IACnB,4FAA4F;IAC5F,WAAW,EAAE,KAAK,CAAA;IAClB
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../src/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAC5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,KAAK,SAAS,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IACtF,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAA;IACZ,uFAAuF;IACvF,WAAW,EAAE,MAAM,CAAA;IACnB,4FAA4F;IAC5F,WAAW,EAAE,KAAK,CAAA;IAClB;;;;;;;;;;;;;;;;;OAiBG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,qEAAqE;IACrE,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAC7E;AAED,MAAM,WAAW,cAAc;IAC7B,gEAAgE;IAChE,IAAI,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAC9B,6CAA6C;IAC7C,UAAU,EAAE,MAAM,CAAA;IAClB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,6BAA6B;IAC7B,MAAM,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,MAAM,EAAE,MAAM,EAAE,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB"}
|
package/package.json
CHANGED
package/dist/auth.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AuthenticatedUser } from './mcp.js';
|
|
2
|
-
/**
|
|
3
|
-
* Validates an incoming MCP request and resolves the caller's identity.
|
|
4
|
-
* Plugins accept an optional `authenticator` option; if omitted they fall
|
|
5
|
-
* back to the default Payload bearer-token authenticator.
|
|
6
|
-
*/
|
|
7
|
-
export interface McpAuthenticator {
|
|
8
|
-
/**
|
|
9
|
-
* Inspects the `Authorization` header on the request and returns an
|
|
10
|
-
* {@link McpAuthResult} if the token is valid, or `null` otherwise.
|
|
11
|
-
*/
|
|
12
|
-
authenticate(request: Request): Promise<McpAuthResult | null>;
|
|
13
|
-
}
|
|
14
|
-
export interface McpAuthResult {
|
|
15
|
-
user: AuthenticatedUser;
|
|
16
|
-
apiKeyName: string;
|
|
17
|
-
apiKeyId: string;
|
|
18
|
-
/**
|
|
19
|
-
* What this key was granted, from the key record. A tool declaring a
|
|
20
|
-
* `requiredScope` is refused — and hidden from `tools/list` — unless it is
|
|
21
|
-
* named here.
|
|
22
|
-
*
|
|
23
|
-
* Optional so an authenticator predating scopes still type-checks; absent is
|
|
24
|
-
* read as "no scopes", which refuses every scoped tool rather than allowing
|
|
25
|
-
* them. A key that cannot say what it may do may not do the consequential
|
|
26
|
-
* things.
|
|
27
|
-
*/
|
|
28
|
-
scopes?: string[];
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=auth.d.ts.map
|
package/dist/auth.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAA;AAEjD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAA;CAC9D;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAA;IACvB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;CAClB"}
|
package/dist/auth.js
DELETED
package/dist/auth.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":""}
|