@baasix/baasix 0.1.27 → 0.1.29

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.
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * MCPService - Model Context Protocol Server for Baasix
3
3
  *
4
- * This service provides MCP tools that directly call Baasix services,
5
- * eliminating HTTP round-trips and providing better performance.
4
+ * This service provides MCP tools that call Baasix HTTP routes internally,
5
+ * ensuring all route-level validation, permission checks, and cache
6
+ * invalidation are applied consistently.
6
7
  *
7
8
  * Enable via environment variable: MCP_ENABLED=true
8
9
  * Access at: http://localhost:8056/mcp (or custom MCP_PATH)
@@ -13,10 +14,10 @@
13
14
  */
14
15
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
15
16
  /**
16
- * MCPAccountability mirrors the shape built by the auth middleware,
17
- * so that ItemsService.isAdministrator() works correctly.
17
+ * MCPAccountability mirrors the shape built by the auth middleware.
18
+ * Used for session management and passed as bearer token for route calls.
18
19
  *
19
- * Shape: { user: { id, email, isAdmin, role, ... }, role: { id, name, isTenantSpecific }, permissions[], tenant, ipaddress }
20
+ * Shape: { user: { id, email, isAdmin, role, ... }, role: { id, name, isTenantSpecific }, permissions[], tenant, ipaddress, token }
20
21
  */
21
22
  interface MCPAccountability {
22
23
  user: {
@@ -37,6 +38,7 @@ interface MCPAccountability {
37
38
  permissions: any[];
38
39
  tenant: string | number | null;
39
40
  ipaddress: string;
41
+ token?: string;
40
42
  }
41
43
  /**
42
44
  * Store accountability info for an MCP session
@@ -1 +1 @@
1
- {"version":3,"file":"MCPService.d.ts","sourceRoot":"","sources":["../../baasix/services/MCPService.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAWpE;;;;;GAKG;AACH,UAAU,iBAAiB;IACzB,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QACpB,KAAK,CAA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