@workopilot/pluginapi-sdk 0.1.2 → 0.1.3

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 CHANGED
@@ -53,6 +53,21 @@ PluginHandler
53
53
  PluginHandlerInput
54
54
  PluginRequest
55
55
  PluginContext
56
+
57
+ ### MCP Tool
58
+
59
+ Plugins can optionally export an MCP tool array from the module named by `plugin.json.mcp.toolsExport` (default: `mcpTools`):
60
+
61
+ ```json
62
+ {
63
+ "appCode": "my-app",
64
+ "mcp": {
65
+ "toolsExport": "mcpTools"
66
+ }
67
+ }
68
+ ```
69
+
70
+ Each tool uses `McpToolDefinition`, provides a JSON Schema `inputSchema`, and receives the same `ctx.currentUser`, database capability, logger, and request headers as an HTTP handler. The host owns MCP transport, authentication, and appCode grouping.
56
71
  ```
57
72
 
58
73
  Handlers receive:
package/dist/index.d.ts CHANGED
@@ -3,13 +3,18 @@ export interface PluginManifest {
3
3
  name: string;
4
4
  version: string;
5
5
  entry: string;
6
+ appCode?: string;
6
7
  routes: PluginRoute[];
8
+ mcp?: McpManifest;
7
9
  }
8
10
  export interface PluginRoute {
9
11
  method: PluginRouteMethod;
10
12
  path: string;
11
13
  handler: string;
12
14
  }
15
+ export interface McpManifest {
16
+ toolsExport?: string;
17
+ }
13
18
  export type QueryParam = string | number | boolean | Date | null;
14
19
  export interface DatabaseWriteResult {
15
20
  affectedRows: number;
@@ -54,3 +59,17 @@ export interface PluginHandlerInput {
54
59
  ctx: PluginContext;
55
60
  }
56
61
  export type PluginHandler = (input: PluginHandlerInput) => Promise<unknown> | unknown;
62
+ export type McpJsonSchema = Record<string, unknown>;
63
+ export interface McpToolDefinition {
64
+ name: string;
65
+ description: string;
66
+ inputSchema: McpJsonSchema;
67
+ handler: McpToolHandler;
68
+ }
69
+ export interface McpToolHandlerInput {
70
+ arguments: Record<string, unknown>;
71
+ request: PluginRequest;
72
+ ctx: PluginContext;
73
+ signal: AbortSignal;
74
+ }
75
+ export type McpToolHandler = (input: McpToolHandlerInput) => Promise<unknown> | unknown;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@workopilot/pluginapi-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Workopilot plugin API SDK for database-capability plugins",
5
5
  "keywords": [
6
6
  "wiseai",