@robosystems/mcp 0.3.11 → 0.3.12
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/index.js +39 -21
- package/package.json +2 -1
package/index.js
CHANGED
|
@@ -330,9 +330,9 @@ class RoboSystemsMCPClient {
|
|
|
330
330
|
},
|
|
331
331
|
subgraph_type: {
|
|
332
332
|
type: 'string',
|
|
333
|
-
enum: ['static', '
|
|
333
|
+
enum: ['static', 'knowledge'],
|
|
334
334
|
description:
|
|
335
|
-
'Type of subgraph: "static" for standard isolated workspace, "
|
|
335
|
+
'Type of subgraph: "static" for a standard isolated workspace, "knowledge" for one seeded with the knowledge schema',
|
|
336
336
|
default: 'static',
|
|
337
337
|
},
|
|
338
338
|
},
|
|
@@ -790,7 +790,7 @@ class RoboSystemsMCPClient {
|
|
|
790
790
|
|
|
791
791
|
async _handleCreateWorkspace(args) {
|
|
792
792
|
const { name, description, fork_parent = false, subgraph_type = 'static' } = args
|
|
793
|
-
const validSubgraphTypes = ['static', '
|
|
793
|
+
const validSubgraphTypes = ['static', 'knowledge']
|
|
794
794
|
|
|
795
795
|
if (!validSubgraphTypes.includes(subgraph_type)) {
|
|
796
796
|
throw new Error(
|
|
@@ -810,7 +810,7 @@ class RoboSystemsMCPClient {
|
|
|
810
810
|
method: 'POST',
|
|
811
811
|
headers: { ...this.headers, Accept: 'application/json' },
|
|
812
812
|
body: JSON.stringify({
|
|
813
|
-
name: 'create-
|
|
813
|
+
name: 'create-subgraph',
|
|
814
814
|
arguments: { name, description, fork_parent, subgraph_type },
|
|
815
815
|
}),
|
|
816
816
|
}
|
|
@@ -844,8 +844,9 @@ class RoboSystemsMCPClient {
|
|
|
844
844
|
}
|
|
845
845
|
}
|
|
846
846
|
|
|
847
|
-
// Server created the workspace successfully
|
|
848
|
-
|
|
847
|
+
// Server created the workspace successfully (`subgraph_id` on the
|
|
848
|
+
// current server; `workspace_id` accepted for older servers)
|
|
849
|
+
const workspaceId = result.subgraph_id ?? result.workspace_id
|
|
849
850
|
|
|
850
851
|
// Track the workspace
|
|
851
852
|
this.workspaces.set(workspaceId, {
|
|
@@ -989,8 +990,8 @@ class RoboSystemsMCPClient {
|
|
|
989
990
|
method: 'POST',
|
|
990
991
|
headers: { ...this.headers, Accept: 'application/json' },
|
|
991
992
|
body: JSON.stringify({
|
|
992
|
-
name: 'delete-
|
|
993
|
-
arguments: { workspace_id, force },
|
|
993
|
+
name: 'delete-subgraph',
|
|
994
|
+
arguments: { subgraph_id: workspace_id, force },
|
|
994
995
|
}),
|
|
995
996
|
}
|
|
996
997
|
)
|
|
@@ -1075,12 +1076,15 @@ class RoboSystemsMCPClient {
|
|
|
1075
1076
|
|
|
1076
1077
|
async _refreshWorkspacesCache() {
|
|
1077
1078
|
try {
|
|
1079
|
+
// The server tool family speaks "subgraphs" (`list-subgraphs`,
|
|
1080
|
+
// `subgraphs[].subgraph_id`); this client keeps the "workspace"
|
|
1081
|
+
// vocabulary on its own surface and normalizes here.
|
|
1078
1082
|
const response = await fetch(
|
|
1079
1083
|
`${this.baseUrl}/v1/graphs/${this.primaryGraphId}/mcp/call-tool`,
|
|
1080
1084
|
{
|
|
1081
1085
|
method: 'POST',
|
|
1082
1086
|
headers: { ...this.headers, Accept: 'application/json' },
|
|
1083
|
-
body: JSON.stringify({ name: 'list-
|
|
1087
|
+
body: JSON.stringify({ name: 'list-subgraphs', arguments: {} }),
|
|
1084
1088
|
}
|
|
1085
1089
|
)
|
|
1086
1090
|
|
|
@@ -1102,20 +1106,34 @@ class RoboSystemsMCPClient {
|
|
|
1102
1106
|
result = data.result || data
|
|
1103
1107
|
}
|
|
1104
1108
|
|
|
1105
|
-
if (result.
|
|
1106
|
-
|
|
1107
|
-
for (const ws of result.workspaces) {
|
|
1108
|
-
this.workspaces.set(ws.workspace_id, {
|
|
1109
|
-
type: ws.type,
|
|
1110
|
-
name: ws.name,
|
|
1111
|
-
description: ws.description,
|
|
1112
|
-
parent_graph_id: ws.parent_graph_id,
|
|
1113
|
-
created_at: ws.created_at ? new Date(ws.created_at).getTime() : Date.now(),
|
|
1114
|
-
})
|
|
1115
|
-
}
|
|
1109
|
+
if (!result.subgraphs) {
|
|
1110
|
+
return result
|
|
1116
1111
|
}
|
|
1117
1112
|
|
|
1118
|
-
|
|
1113
|
+
const workspaces = result.subgraphs.map((sg) => ({
|
|
1114
|
+
workspace_id: sg.subgraph_id,
|
|
1115
|
+
type: sg.type === 'primary' ? 'primary' : 'workspace',
|
|
1116
|
+
name: sg.name,
|
|
1117
|
+
description: sg.description,
|
|
1118
|
+
parent_graph_id: sg.parent_graph_id,
|
|
1119
|
+
created_at: sg.created_at,
|
|
1120
|
+
}))
|
|
1121
|
+
|
|
1122
|
+
this.workspaces.clear()
|
|
1123
|
+
for (const ws of workspaces) {
|
|
1124
|
+
this.workspaces.set(ws.workspace_id, {
|
|
1125
|
+
type: ws.type,
|
|
1126
|
+
name: ws.name,
|
|
1127
|
+
description: ws.description,
|
|
1128
|
+
parent_graph_id: ws.parent_graph_id,
|
|
1129
|
+
created_at: ws.created_at ? new Date(ws.created_at).getTime() : Date.now(),
|
|
1130
|
+
})
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
return {
|
|
1134
|
+
primary_graph_id: result.primary_graph_id,
|
|
1135
|
+
workspaces,
|
|
1136
|
+
}
|
|
1119
1137
|
} catch (error) {
|
|
1120
1138
|
console.error(`Failed to refresh workspaces cache: ${error.message}`)
|
|
1121
1139
|
return null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robosystems/mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "MCP client adapter for connecting AI agents to RoboSystems Financial Knowledge Graph API endpoints with workspace support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"LICENSE"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
+
"prepare": "git config core.hooksPath .githooks || true",
|
|
17
18
|
"start": "node index.js",
|
|
18
19
|
"format": "prettier . --write",
|
|
19
20
|
"format:check": "prettier . --check",
|