@flowfuse/driver-docker 2.31.3 → 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.
- package/.github/dependabot.yml +1 -0
- package/.github/workflows/build.yml +1 -1
- package/.github/workflows/release-publish.yml +1 -1
- package/CHANGELOG.md +10 -0
- package/docker.js +103 -0
- package/package.json +1 -1
package/.github/dependabot.yml
CHANGED
|
@@ -10,7 +10,7 @@ jobs:
|
|
|
10
10
|
build:
|
|
11
11
|
runs-on: ubuntu-latest
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
13
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
14
14
|
- name: Use Node.js 24
|
|
15
15
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
16
16
|
with:
|
|
@@ -8,7 +8,7 @@ jobs:
|
|
|
8
8
|
publish:
|
|
9
9
|
runs-on: ubuntu-latest
|
|
10
10
|
steps:
|
|
11
|
-
- uses: actions/checkout@
|
|
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,13 @@
|
|
|
1
|
+
#### 2.32.0: Release
|
|
2
|
+
|
|
3
|
+
- feat: Add Insights support with get-features and call-tool/read-resource methods (#226)
|
|
4
|
+
- Bump actions/checkout from 6.0.3 to 7.0.0 (#225)
|
|
5
|
+
- ci: set dependabot pull request limit to 30 (#224)
|
|
6
|
+
- Bump js-yaml from 4.1.1 to 4.2.0 (#223)
|
|
7
|
+
- Bump form-data from 4.0.4 to 4.0.6 (#222)
|
|
8
|
+
- Bump actions/checkout from 6.0.2 to 6.0.3 (#217)
|
|
9
|
+
- Bump @grpc/grpc-js from 1.13.2 to 1.14.4 (#220)
|
|
10
|
+
|
|
1
11
|
#### 2.31.3: Release
|
|
2
12
|
|
|
3
13
|
|
package/docker.js
CHANGED
|
@@ -3,6 +3,18 @@ const FormData = require('form-data')
|
|
|
3
3
|
const Docker = require('dockerode')
|
|
4
4
|
const { WebSocket } = require('ws')
|
|
5
5
|
|
|
6
|
+
/**
|
|
7
|
+
* @typedef {object} accessToken
|
|
8
|
+
* @property {string} [scheme] - auth scheme, e.g. 'Bearer'. Basic auth is currently rejected.
|
|
9
|
+
* @property {string} [token] - the token value
|
|
10
|
+
* @property {string|string[]} [scope] - token scope(s); only tokens including `ff-expert:mcp` are honoured
|
|
11
|
+
*
|
|
12
|
+
* @typedef {object} McpEndpointSpec - Specification for an MCP endpoint. Additional properties are allowed and will be passed back in the result (for correlation purposes).
|
|
13
|
+
* @property {string} endpoint - The path of the MCP server e.g. '/mcp'. Should not contain the host/port; those are determined to agent/launcher
|
|
14
|
+
* @property {object} [headers] - extra request headers to send with every MCP HTTP request
|
|
15
|
+
* @property {accessToken} [accessToken] - access token; merged into `Authorization` when scoped for MCP
|
|
16
|
+
*/
|
|
17
|
+
|
|
6
18
|
const createContainer = async (project, domain) => {
|
|
7
19
|
const stack = project.ProjectStack.properties
|
|
8
20
|
const contOptions = {
|
|
@@ -635,6 +647,97 @@ module.exports = {
|
|
|
635
647
|
}
|
|
636
648
|
})
|
|
637
649
|
},
|
|
650
|
+
|
|
651
|
+
// #region MCP Support
|
|
652
|
+
|
|
653
|
+
// MCP ROUTE: step 4 (hosted)
|
|
654
|
+
// Called By: forge app (forge/containers/wrapper.js)
|
|
655
|
+
// Calls To : launchers `command` endpoint in lib/admin.js
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Get MCP features
|
|
659
|
+
* @param {Project} project - the project model instance
|
|
660
|
+
* @param {Array<string|McpEndpointSpec>} endpoints - list of MCP endpoints to query.
|
|
661
|
+
* Each entry may be a bare URL/path string, or an object `{ endpoint, headers?, accessToken? }`
|
|
662
|
+
* @returns {Object} MCP features
|
|
663
|
+
*/
|
|
664
|
+
getMCPFeatures: async (project, endpoints) => {
|
|
665
|
+
if (this._projects[project.id] === undefined) {
|
|
666
|
+
throw new Error('Instance cannot get MCP features')
|
|
667
|
+
}
|
|
668
|
+
try {
|
|
669
|
+
const response = await got.post('http://' + project.id + ':2880/flowforge/command', {
|
|
670
|
+
json: {
|
|
671
|
+
cmd: 'mcp:get-features',
|
|
672
|
+
data: {
|
|
673
|
+
endpoints
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
}).json()
|
|
677
|
+
return response
|
|
678
|
+
} catch (error) {
|
|
679
|
+
throw new Error(`Failed to get MCP features: ${error.message}`)
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
|
|
683
|
+
/**
|
|
684
|
+
* Call MCP endpoint
|
|
685
|
+
* @param {Project} project - the project model instance
|
|
686
|
+
* @param {string|McpEndpointSpec} endpoint - MCP endpoint to call.
|
|
687
|
+
* @param {string} name - Name of the MCP tool to call
|
|
688
|
+
* @param {Object} input - Arguments to pass to the MCP tool
|
|
689
|
+
* @returns {Object} MCP tool result
|
|
690
|
+
*/
|
|
691
|
+
callMCPTool: async (project, endpoint, name, input) => {
|
|
692
|
+
if (this._projects[project.id] === undefined) {
|
|
693
|
+
throw new Error('Instance cannot call MCP tool')
|
|
694
|
+
}
|
|
695
|
+
try {
|
|
696
|
+
const response = await got.post('http://' + project.id + ':2880/flowforge/command', {
|
|
697
|
+
json: {
|
|
698
|
+
cmd: 'mcp:call-tool',
|
|
699
|
+
data: {
|
|
700
|
+
endpoint,
|
|
701
|
+
name,
|
|
702
|
+
input
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
}).json()
|
|
706
|
+
return response
|
|
707
|
+
} catch (error) {
|
|
708
|
+
throw new Error(`Failed to call MCP tool: ${error.message}`)
|
|
709
|
+
}
|
|
710
|
+
},
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Read MCP resource
|
|
714
|
+
* @param {Project} project - the project model instance
|
|
715
|
+
* @param {string|McpEndpointSpec} endpoint - MCP endpoint to call.
|
|
716
|
+
* @param {string} uri - URI of the MCP resource to read
|
|
717
|
+
* @returns {Object} MCP resource result
|
|
718
|
+
*/
|
|
719
|
+
readMCPResource: async (project, endpoint, uri) => {
|
|
720
|
+
if (this._projects[project.id] === undefined) {
|
|
721
|
+
throw new Error('Instance cannot read MCP resource')
|
|
722
|
+
}
|
|
723
|
+
try {
|
|
724
|
+
const response = await got.post('http://' + project.id + ':2880/flowforge/command', {
|
|
725
|
+
json: {
|
|
726
|
+
cmd: 'mcp:read-resource',
|
|
727
|
+
data: {
|
|
728
|
+
endpoint,
|
|
729
|
+
uri
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}).json()
|
|
733
|
+
return response
|
|
734
|
+
} catch (error) {
|
|
735
|
+
throw new Error(`Failed to read MCP resource: ${error.message}`)
|
|
736
|
+
}
|
|
737
|
+
},
|
|
738
|
+
|
|
739
|
+
// #endregion MCP Support
|
|
740
|
+
|
|
638
741
|
/**
|
|
639
742
|
* Logout Node-RED instance
|
|
640
743
|
* @param {Project} project - the project model instance
|