@decocms/bindings 1.2.1 → 1.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/bindings",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "check": "tsc --noEmit",
@@ -58,13 +58,17 @@ export interface PluginRenderHeaderProps {
58
58
  * Client plugins are separate from server plugins to avoid bundling
59
59
  * server code into the client bundle.
60
60
  */
61
- export interface ClientPlugin<TBinding extends Binder> {
61
+ export interface ClientPlugin<TBinding extends Binder = Binder> {
62
62
  id: string;
63
63
  /**
64
64
  * Short description of the plugin shown in the settings UI.
65
65
  */
66
66
  description?: string;
67
- binding: TBinding;
67
+ /**
68
+ * Binding schema used to filter compatible connections.
69
+ * Omit for plugins that manage their own connection (e.g. self MCP).
70
+ */
71
+ binding?: TBinding;
68
72
  setup?: PluginSetup;
69
73
  /**
70
74
  * Optional custom layout component for this plugin.
@@ -16,15 +16,45 @@ import type { Hono } from "hono";
16
16
  import type { Kysely } from "kysely";
17
17
 
18
18
  /**
19
- * Tool definition compatible with MCP tools.
20
- * This is a simplified type - the actual implementation uses the full ToolDefinition from mesh.
19
+ * Subset of MeshContext exposed to server plugin tool handlers.
20
+ *
21
+ * Plugins receive the full MeshContext at runtime but should only depend on
22
+ * these properties. This keeps the plugin contract stable and avoids coupling
23
+ * plugins to Mesh internals (db, vault, tracer, etc.).
24
+ */
25
+ export interface ServerPluginToolContext {
26
+ organization: { id: string } | null;
27
+ access: { check: () => Promise<void> };
28
+ auth: {
29
+ user?: { id: string; email?: string; name?: string };
30
+ };
31
+ /** Kysely database instance for direct queries. */
32
+ db: Kysely<unknown>;
33
+ createMCPProxy: (connectionId: string) => Promise<{
34
+ callTool: (args: {
35
+ name: string;
36
+ arguments?: Record<string, unknown>;
37
+ }) => Promise<{
38
+ isError?: boolean;
39
+ content?: Array<{ type?: string; text?: string }>;
40
+ structuredContent?: unknown;
41
+ }>;
42
+ listTools: () => Promise<{
43
+ tools: Array<{ name: string; description?: string }>;
44
+ }>;
45
+ close?: () => Promise<void>;
46
+ }>;
47
+ }
48
+
49
+ /**
50
+ * Tool definition for server plugins.
21
51
  */
22
52
  export interface ServerPluginToolDefinition {
23
53
  name: string;
24
54
  description?: string;
25
55
  inputSchema: unknown;
26
56
  outputSchema?: unknown;
27
- handler: (input: unknown, ctx: unknown) => Promise<unknown>;
57
+ handler: (input: unknown, ctx: ServerPluginToolContext) => Promise<unknown>;
28
58
  }
29
59
 
30
60
  /**