@flowfuse/driver-kubernetes 2.31.4-f28cf74-202606161618.0 → 2.32.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.
@@ -8,7 +8,7 @@ jobs:
8
8
  publish:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
- - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
11
+ - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
12
12
  - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
13
13
  with:
14
14
  node-version: 24
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ #### 2.32.0: Release
2
+
3
+ - Sync changes to Insight support code across drivers (#383)
4
+ - feat: Add Insights support with get-features and call-tool/read-resource methods (#382)
5
+ - Bump actions/checkout from 6.0.3 to 7.0.0 (#381)
6
+ - ci: set dependabot pull request limit to 30 (#380)
7
+ - Bump ws from 8.20.1 to 8.21.0 (#379)
8
+ - Bump actions/checkout from 6.0.2 to 6.0.3 (#373)
9
+ - Bump form-data from 4.0.4 to 4.0.6 (#378)
10
+ - Bump js-yaml from 4.1.1 to 4.2.0 (#377)
11
+
1
12
  #### 2.31.3: Release
2
13
 
3
14
 
package/kubernetes.js CHANGED
@@ -29,6 +29,18 @@ let k8s
29
29
  *
30
30
  */
31
31
 
32
+ /**
33
+ * @typedef {object} accessToken
34
+ * @property {string} [scheme] - auth scheme, e.g. 'Bearer'. Basic auth is currently rejected.
35
+ * @property {string} [token] - the token value
36
+ * @property {string|string[]} [scope] - token scope(s); only tokens including `ff-expert:mcp` are honoured
37
+ *
38
+ * @typedef {object} McpEndpointSpec - Specification for an MCP endpoint. Additional properties are allowed and will be passed back in the result (for correlation purposes).
39
+ * @property {string} endpoint - The path of the MCP server e.g. '/mcp'. Should not contain the host/port; those are determined to agent/launcher
40
+ * @property {object} [headers] - extra request headers to send with every MCP HTTP request
41
+ * @property {accessToken} [accessToken] - access token; merged into `Authorization` when scoped for MCP
42
+ */
43
+
32
44
  const createDeployment = async (project, options) => {
33
45
  const stack = project.ProjectStack.properties
34
46
 
@@ -1430,6 +1442,106 @@ module.exports = {
1430
1442
  }
1431
1443
  return { state: 'okay' }
1432
1444
  },
1445
+
1446
+ // #region MCP Support
1447
+
1448
+ // MCP ROUTE: step 4 (hosted)
1449
+ // Called By: forge app (forge/containers/wrapper.js)
1450
+ // Calls To : launchers `command` endpoint in lib/admin.js
1451
+
1452
+ /**
1453
+ * Get MCP features
1454
+ * @param {Project} project - the project model instance
1455
+ * @param {Array<string|McpEndpointSpec>} endpoints - list of MCP endpoints to query.
1456
+ * Each entry may be a bare URL/path string, or an object `{ endpoint, headers?, accessToken? }`
1457
+ * @returns {Object} MCP features
1458
+ */
1459
+ getMCPFeatures: async (project, endpoints) => {
1460
+ const cachedProject = await this._projects.get(project.id)
1461
+ if (cachedProject === undefined) {
1462
+ throw new Error('Instance cannot get MCP features')
1463
+ }
1464
+ try {
1465
+ const prefix = project.safeName.match(/^[0-9]/) ? 'srv-' : ''
1466
+ const dnsUrl = `http://${prefix}${project.safeName}.${this._namespace}:2880/flowforge/command`
1467
+ const response = await got.post(dnsUrl, {
1468
+ json: {
1469
+ cmd: 'mcp:get-features',
1470
+ data: {
1471
+ endpoints
1472
+ }
1473
+ }
1474
+ }).json()
1475
+ return response
1476
+ } catch (error) {
1477
+ throw new Error(`Failed to get MCP features: ${error.message}`)
1478
+ }
1479
+ },
1480
+
1481
+ /**
1482
+ * Call MCP endpoint
1483
+ * @param {Project} project - the project model instance
1484
+ * @param {string|McpEndpointSpec} endpoint - MCP endpoint to call.
1485
+ * @param {string} name - Name of the MCP tool to call
1486
+ * @param {Object} input - Arguments to pass to the MCP tool
1487
+ * @returns {Object} MCP tool result
1488
+ */
1489
+ callMCPTool: async (project, endpoint, name, input) => {
1490
+ const cachedProject = await this._projects.get(project.id)
1491
+ if (cachedProject === undefined) {
1492
+ throw new Error('Instance cannot call MCP tool')
1493
+ }
1494
+ try {
1495
+ const prefix = project.safeName.match(/^[0-9]/) ? 'srv-' : ''
1496
+ const dnsUrl = `http://${prefix}${project.safeName}.${this._namespace}:2880/flowforge/command`
1497
+ const response = await got.post(dnsUrl, {
1498
+ json: {
1499
+ cmd: 'mcp:call-tool',
1500
+ data: {
1501
+ endpoint,
1502
+ name,
1503
+ input
1504
+ }
1505
+ }
1506
+ }).json()
1507
+ return response
1508
+ } catch (error) {
1509
+ throw new Error(`Failed to call MCP tool: ${error.message}`)
1510
+ }
1511
+ },
1512
+
1513
+ /**
1514
+ * Read MCP resource
1515
+ * @param {Project} project - the project model instance
1516
+ * @param {string|McpEndpointSpec} endpoint - MCP endpoint to call.
1517
+ * @param {string} uri - URI of the MCP resource to read
1518
+ * @returns {Object} MCP resource result
1519
+ */
1520
+ readMCPResource: async (project, endpoint, uri) => {
1521
+ const cachedProject = await this._projects.get(project.id)
1522
+ if (cachedProject === undefined) {
1523
+ throw new Error('Instance cannot read MCP resource')
1524
+ }
1525
+ try {
1526
+ const prefix = project.safeName.match(/^[0-9]/) ? 'srv-' : ''
1527
+ const dnsUrl = `http://${prefix}${project.safeName}.${this._namespace}:2880/flowforge/command`
1528
+ const response = await got.post(dnsUrl, {
1529
+ json: {
1530
+ cmd: 'mcp:read-resource',
1531
+ data: {
1532
+ endpoint,
1533
+ uri
1534
+ }
1535
+ }
1536
+ }).json()
1537
+ return response
1538
+ } catch (error) {
1539
+ throw new Error(`Failed to read MCP resource: ${error.message}`)
1540
+ }
1541
+ },
1542
+
1543
+ // #endregion MCP Support
1544
+
1433
1545
  /**
1434
1546
  * Logout Node-RED instance
1435
1547
  * @param {Project} project - the project model instance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowfuse/driver-kubernetes",
3
- "version": "2.31.4-f28cf74-202606161618.0",
3
+ "version": "2.32.0",
4
4
  "description": "Kubernetes driver for FlowFuse",
5
5
  "main": "kubernetes.js",
6
6
  "scripts": {