@robosystems/mcp 0.2.2 → 0.2.4

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 (2) hide show
  1. package/index.js +18 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -196,6 +196,7 @@ class RoboSystemsMCPClient {
196
196
 
197
197
  async getTools() {
198
198
  try {
199
+ console.error(`Fetching tools from ${this.baseUrl}/v1/${this.graphId}/mcp/tools`)
199
200
  const response = await fetch(
200
201
  `${this.baseUrl}/v1/${this.graphId}/mcp/tools`,
201
202
  {
@@ -204,13 +205,17 @@ class RoboSystemsMCPClient {
204
205
  )
205
206
 
206
207
  if (!response.ok) {
208
+ const text = await response.text()
209
+ console.error(`API returned ${response.status}: ${text}`)
207
210
  throw new Error(`HTTP ${response.status}: ${response.statusText}`)
208
211
  }
209
212
 
210
213
  const data = await response.json()
214
+ console.error(`Got ${data.tools?.length || 0} tools from API`)
211
215
  return data.tools || []
212
216
  } catch (error) {
213
217
  console.error(`Failed to get tools: ${error.message}`)
218
+ console.error(`Stack: ${error.stack}`)
214
219
  return []
215
220
  }
216
221
  }
@@ -625,11 +630,13 @@ async function main() {
625
630
 
626
631
  if (!apiKey) {
627
632
  console.error('ROBOSYSTEMS_API_KEY environment variable is required')
633
+ console.error('Please set ROBOSYSTEMS_API_KEY in your MCP configuration')
628
634
  process.exit(1)
629
635
  }
630
636
 
631
637
  console.error(`RoboSystems MCP Client v${PACKAGE_VERSION}`)
632
638
  console.error(`Connecting to ${baseUrl} for graph ${graphId}`)
639
+ console.error(`API Key: ${apiKey.substring(0, 10)}...`)
633
640
 
634
641
  const remoteClient = new RoboSystemsMCPClient(baseUrl, apiKey, graphId)
635
642
 
@@ -688,11 +695,13 @@ async function main() {
688
695
 
689
696
  // Test connection and start server
690
697
  try {
698
+ console.error('Testing API connection...')
691
699
  const tools = await remoteClient.getTools()
692
700
  const toolNames = tools.map((t) => t.name)
693
701
  console.error(`Connected successfully. Available tools: ${toolNames.join(', ')}`)
694
702
 
695
703
  const transport = new StdioServerTransport()
704
+ console.error('Starting MCP stdio transport...')
696
705
  await server.connect(transport)
697
706
 
698
707
  console.error('RoboSystems MCP server running')
@@ -733,7 +742,15 @@ export {
733
742
  }
734
743
 
735
744
  // Only run as server if this is the main module
736
- if (import.meta.url === `file://${process.argv[1]}`) {
745
+ // Check if we're being run directly (not imported)
746
+ // This works with both `node index.js` and `npx` invocations
747
+ const isMainModule =
748
+ import.meta.url === `file://${process.argv[1]}` ||
749
+ process.argv[1]?.endsWith('/mcp') || // npx binary name
750
+ process.argv[1]?.endsWith('/@robosystems/mcp') || // alternative npx name
751
+ process.argv[1]?.includes('robosystems-mcp'); // package name in path
752
+
753
+ if (isMainModule) {
737
754
  // Run the server
738
755
  main().catch((error) => {
739
756
  console.error(`Fatal error: ${error.message}`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/mcp",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "MCP client adapter for connecting AI agents to RoboSystems Financial Knowledge Graph API endpoints",
5
5
  "type": "module",
6
6
  "main": "index.js",