@robosystems/mcp 0.3.9 → 0.3.10

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.
@@ -9,7 +9,7 @@ set -e
9
9
  BRANCH_TYPE=${1:-feature}
10
10
  BRANCH_NAME=${2:-}
11
11
  BASE_BRANCH=${3:-main}
12
- UPDATE_DEPS=${4:-yes}
12
+ UPDATE_DEPS=${4:-no}
13
13
 
14
14
  # Validate branch type
15
15
  if [[ "$BRANCH_TYPE" != "feature" && "$BRANCH_TYPE" != "bugfix" && "$BRANCH_TYPE" != "hotfix" && "$BRANCH_TYPE" != "chore" && "$BRANCH_TYPE" != "refactor" ]]; then
@@ -80,7 +80,9 @@ git push -u origin $FULL_BRANCH
80
80
  echo ""
81
81
  echo "🎉 Successfully created and checked out $FULL_BRANCH"
82
82
 
83
- # Update dependencies if requested (default: yes)
83
+ # Update dependencies only when explicitly requested (default: no).
84
+ # Pass "yes" as the 4th arg to refresh deps on the new branch; otherwise
85
+ # branch creation leaves the lockfile untouched.
84
86
  if [[ "$UPDATE_DEPS" == "yes" ]]; then
85
87
  echo ""
86
88
  echo "📦 Updating dependencies..."
@@ -93,7 +95,7 @@ echo "📝 Next steps:"
93
95
  echo " 1. Make your changes and commit them"
94
96
  echo " 2. Push your changes: git push"
95
97
  echo " 3. Create a PR: gh pr create --base $BASE_BRANCH --title \"Your PR title\" --body \"Your PR description\""
96
- echo " or use: npm run pr:create"
98
+ echo " or in a Claude Code session: /create-pr"
97
99
 
98
100
  # Check if we had stashed changes and auto-apply them
99
101
  if git stash list | grep -q "Auto-stash before creating branch $FULL_BRANCH"; then
package/index.js CHANGED
@@ -181,6 +181,7 @@ class RoboSystemsMCPClient {
181
181
  this.primaryGraphId = graphId // Parent graph (never changes)
182
182
  this.activeGraphId = graphId // Currently active graph (can switch to workspaces)
183
183
  this.graphId = graphId // Deprecated: kept for backward compatibility
184
+ this.instructions = null // Per-graph routing guidance for the active graph (set by getTools)
184
185
  this.headers = {
185
186
  'X-API-Key': apiKey,
186
187
  'Content-Type': 'application/json',
@@ -227,6 +228,10 @@ class RoboSystemsMCPClient {
227
228
 
228
229
  const data = await response.json()
229
230
  let tools = data.tools || []
231
+ // Per-graph routing guidance for the active graph. Surfaced to the host
232
+ // via the handshake `instructions` field (primary graph) and inline in
233
+ // switch-workspace results (switched graph).
234
+ this.instructions = data.instructions ?? null
230
235
  console.error(`Got ${tools.length} tools from API`)
231
236
 
232
237
  // Add client-side workspace tools (if not already provided by server)
@@ -248,6 +253,7 @@ class RoboSystemsMCPClient {
248
253
  } catch (error) {
249
254
  console.error(`Failed to get tools: ${error.message}`)
250
255
  console.error(`Stack: ${error.stack}`)
256
+ this.instructions = null
251
257
  return []
252
258
  }
253
259
  }
@@ -895,6 +901,16 @@ class RoboSystemsMCPClient {
895
901
  const workspace = this.workspaces.get(targetGraphId)
896
902
  console.error(`Switched from ${previousGraph} to ${targetGraphId}`)
897
903
 
904
+ // The handshake `instructions` field is immutable mid-session, so surface
905
+ // the now-active graph's routing guidance inline in the switch result.
906
+ let instructions
907
+ try {
908
+ await this.getTools()
909
+ instructions = this.instructions || undefined
910
+ } catch (error) {
911
+ console.error(`Could not load instructions for ${targetGraphId}: ${error.message}`)
912
+ }
913
+
898
914
  return {
899
915
  type: 'text',
900
916
  text: JSON.stringify(
@@ -904,6 +920,7 @@ class RoboSystemsMCPClient {
904
920
  switched_to: targetGraphId,
905
921
  workspace_type: workspace.type,
906
922
  message: `Switched to ${workspace.type === 'primary' ? 'primary graph' : `workspace "${workspace.name}"`}. All operations now use this environment.`,
923
+ ...(instructions ? { instructions } : {}),
907
924
  },
908
925
  null,
909
926
  2
@@ -1163,16 +1180,43 @@ async function main() {
1163
1180
 
1164
1181
  const remoteClient = new RoboSystemsMCPClient(baseUrl, apiKey, graphId)
1165
1182
 
1183
+ // Prefetch the primary graph's tools + instructions BEFORE constructing the
1184
+ // server. The MCP `instructions` field ships in the initialize handshake and
1185
+ // is immutable afterward, so it must be present at construction time (unlike
1186
+ // tools, which are fetched lazily per ListTools request). This also serves as
1187
+ // the initial connection test.
1188
+ let primaryInstructions
1189
+ try {
1190
+ console.error('Testing API connection...')
1191
+ const tools = await remoteClient.getTools()
1192
+ const toolNames = tools.map((t) => t.name)
1193
+ console.error(`Connected successfully. Available tools: ${toolNames.join(', ')}`)
1194
+ primaryInstructions = remoteClient.instructions || undefined
1195
+ if (primaryInstructions) {
1196
+ console.error(
1197
+ `Loaded per-graph instructions for ${graphId} (${primaryInstructions.length} chars)`
1198
+ )
1199
+ }
1200
+ } catch (error) {
1201
+ console.error(`Initial connection test failed: ${error.message}`)
1202
+ // Continue anyway: ListTools retries on demand; instructions stay unset.
1203
+ }
1204
+
1205
+ const serverOptions = {
1206
+ capabilities: {
1207
+ tools: {},
1208
+ },
1209
+ }
1210
+ if (primaryInstructions) {
1211
+ serverOptions.instructions = primaryInstructions
1212
+ }
1213
+
1166
1214
  const server = new Server(
1167
1215
  {
1168
1216
  name: 'robosystems-mcp',
1169
1217
  version: PACKAGE_VERSION,
1170
1218
  },
1171
- {
1172
- capabilities: {
1173
- tools: {},
1174
- },
1175
- }
1219
+ serverOptions
1176
1220
  )
1177
1221
 
1178
1222
  // List tools handler
@@ -1218,13 +1262,8 @@ async function main() {
1218
1262
  }
1219
1263
  })
1220
1264
 
1221
- // Test connection and start server
1265
+ // Start server (connection + tools already verified during prefetch above)
1222
1266
  try {
1223
- console.error('Testing API connection...')
1224
- const tools = await remoteClient.getTools()
1225
- const toolNames = tools.map((t) => t.name)
1226
- console.error(`Connected successfully. Available tools: ${toolNames.join(', ')}`)
1227
-
1228
1267
  const transport = new StdioServerTransport()
1229
1268
  console.error('Starting MCP stdio transport...')
1230
1269
  await server.connect(transport)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/mcp",
3
- "version": "0.3.9",
3
+ "version": "0.3.10",
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",
@@ -25,8 +25,7 @@
25
25
  "test:watch": "vitest",
26
26
  "test:all": "npm run validate && npm run test",
27
27
  "feature:create": "./bin/create-feature.sh",
28
- "release:create": "./bin/create-release.sh",
29
- "pr:create": "./bin/create-pr.sh"
28
+ "release:create": "./bin/create-release.sh"
30
29
  },
31
30
  "keywords": [
32
31
  "mcp",