@robosystems/mcp 0.3.10 → 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.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +88 -21
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -24,7 +24,7 @@ Add to your MCP servers configuration:
24
24
  "mcpServers": {
25
25
  "robosystems": {
26
26
  "command": "npx",
27
- "args": ["-y", "@robosystems/mcp"],
27
+ "args": ["-y", "@robosystems/mcp@latest"],
28
28
  "env": {
29
29
  "ROBOSYSTEMS_API_URL": "https://api.robosystems.ai",
30
30
  "ROBOSYSTEMS_API_KEY": "rfs...",
package/index.js CHANGED
@@ -30,6 +30,54 @@ const __dirname = dirname(__filename)
30
30
  const packageJson = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'))
31
31
  const PACKAGE_VERSION = packageJson.version
32
32
 
33
+ /**
34
+ * Numeric semver compare for the three core components ("1.2.3").
35
+ * Pre-release tags are ignored — good enough for a stale-version warning.
36
+ */
37
+ function _isNewerVersion(latest, current) {
38
+ const a = String(latest)
39
+ .split('.')
40
+ .map((n) => parseInt(n, 10) || 0)
41
+ const b = String(current)
42
+ .split('.')
43
+ .map((n) => parseInt(n, 10) || 0)
44
+ for (let i = 0; i < 3; i++) {
45
+ if (a[i] > b[i]) return true
46
+ if (a[i] < b[i]) return false
47
+ }
48
+ return false
49
+ }
50
+
51
+ /**
52
+ * Best-effort check for a newer published version. Runs once at startup, never
53
+ * blocks, and only logs to stderr. Surfaces the silent stale-install problem: a
54
+ * global `npm i -g @robosystems/mcp` can shadow `npx -y` and pin an old version
55
+ * without any error, so a published update never reaches the user.
56
+ */
57
+ async function checkForUpdate() {
58
+ try {
59
+ const controller = new AbortController()
60
+ const timer = setTimeout(() => controller.abort(), 2500)
61
+ const response = await fetch('https://registry.npmjs.org/@robosystems/mcp/latest', {
62
+ signal: controller.signal,
63
+ })
64
+ clearTimeout(timer)
65
+ if (!response.ok) return
66
+ const data = await response.json()
67
+ const latest = data?.version
68
+ if (latest && _isNewerVersion(latest, PACKAGE_VERSION)) {
69
+ console.error(
70
+ `⚠️ @robosystems/mcp ${latest} is available — you are running ${PACKAGE_VERSION}.`
71
+ )
72
+ console.error(' A global install can shadow `npx -y` and pin an old version. Update with:')
73
+ console.error(' npm i -g @robosystems/mcp@latest')
74
+ console.error(' or pin "@robosystems/mcp@latest" in your MCP config args.')
75
+ }
76
+ } catch {
77
+ // Best-effort only — never block or fail startup on the update check.
78
+ }
79
+ }
80
+
33
81
  /**
34
82
  * Simple SSE Connection Pool
35
83
  * Reuses connections for better performance
@@ -282,9 +330,9 @@ class RoboSystemsMCPClient {
282
330
  },
283
331
  subgraph_type: {
284
332
  type: 'string',
285
- enum: ['static', 'memory'],
333
+ enum: ['static', 'knowledge'],
286
334
  description:
287
- 'Type of subgraph: "static" for standard isolated workspace, "memory" for memory-enabled workspace',
335
+ 'Type of subgraph: "static" for a standard isolated workspace, "knowledge" for one seeded with the knowledge schema',
288
336
  default: 'static',
289
337
  },
290
338
  },
@@ -742,7 +790,7 @@ class RoboSystemsMCPClient {
742
790
 
743
791
  async _handleCreateWorkspace(args) {
744
792
  const { name, description, fork_parent = false, subgraph_type = 'static' } = args
745
- const validSubgraphTypes = ['static', 'memory']
793
+ const validSubgraphTypes = ['static', 'knowledge']
746
794
 
747
795
  if (!validSubgraphTypes.includes(subgraph_type)) {
748
796
  throw new Error(
@@ -762,7 +810,7 @@ class RoboSystemsMCPClient {
762
810
  method: 'POST',
763
811
  headers: { ...this.headers, Accept: 'application/json' },
764
812
  body: JSON.stringify({
765
- name: 'create-workspace',
813
+ name: 'create-subgraph',
766
814
  arguments: { name, description, fork_parent, subgraph_type },
767
815
  }),
768
816
  }
@@ -796,8 +844,9 @@ class RoboSystemsMCPClient {
796
844
  }
797
845
  }
798
846
 
799
- // Server created the workspace successfully
800
- const workspaceId = result.workspace_id
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
801
850
 
802
851
  // Track the workspace
803
852
  this.workspaces.set(workspaceId, {
@@ -941,8 +990,8 @@ class RoboSystemsMCPClient {
941
990
  method: 'POST',
942
991
  headers: { ...this.headers, Accept: 'application/json' },
943
992
  body: JSON.stringify({
944
- name: 'delete-workspace',
945
- arguments: { workspace_id, force },
993
+ name: 'delete-subgraph',
994
+ arguments: { subgraph_id: workspace_id, force },
946
995
  }),
947
996
  }
948
997
  )
@@ -1027,12 +1076,15 @@ class RoboSystemsMCPClient {
1027
1076
 
1028
1077
  async _refreshWorkspacesCache() {
1029
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.
1030
1082
  const response = await fetch(
1031
1083
  `${this.baseUrl}/v1/graphs/${this.primaryGraphId}/mcp/call-tool`,
1032
1084
  {
1033
1085
  method: 'POST',
1034
1086
  headers: { ...this.headers, Accept: 'application/json' },
1035
- body: JSON.stringify({ name: 'list-workspaces', arguments: {} }),
1087
+ body: JSON.stringify({ name: 'list-subgraphs', arguments: {} }),
1036
1088
  }
1037
1089
  )
1038
1090
 
@@ -1054,20 +1106,34 @@ class RoboSystemsMCPClient {
1054
1106
  result = data.result || data
1055
1107
  }
1056
1108
 
1057
- if (result.workspaces) {
1058
- this.workspaces.clear()
1059
- for (const ws of result.workspaces) {
1060
- this.workspaces.set(ws.workspace_id, {
1061
- type: ws.type,
1062
- name: ws.name,
1063
- description: ws.description,
1064
- parent_graph_id: ws.parent_graph_id,
1065
- created_at: ws.created_at ? new Date(ws.created_at).getTime() : Date.now(),
1066
- })
1067
- }
1109
+ if (!result.subgraphs) {
1110
+ return result
1068
1111
  }
1069
1112
 
1070
- return result
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
+ }
1071
1137
  } catch (error) {
1072
1138
  console.error(`Failed to refresh workspaces cache: ${error.message}`)
1073
1139
  return null
@@ -1174,6 +1240,7 @@ async function main() {
1174
1240
  }
1175
1241
 
1176
1242
  console.error(`RoboSystems MCP Client v${PACKAGE_VERSION}`)
1243
+ void checkForUpdate() // fire-and-forget stale-version warning (stderr only)
1177
1244
  console.error(`Connecting to ${baseUrl}`)
1178
1245
  console.error(`Primary graph: ${graphId}`)
1179
1246
  console.error(`API Key: ${apiKey.substring(0, 10)}...`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/mcp",
3
- "version": "0.3.10",
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",