investbuddy-mcp-server 1.0.1 → 1.0.2

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 +16 -36
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -87,30 +87,6 @@ const TOOLS = [
87
87
  required: ['holdings']
88
88
  }
89
89
  },
90
- {
91
- name: 'optimize_portfolio',
92
- description: 'Get AI-powered portfolio optimization recommendations',
93
- inputSchema: {
94
- type: 'object',
95
- properties: {
96
- holdings: {
97
- type: 'array',
98
- items: {
99
- type: 'object',
100
- properties: {
101
- symbol: { type: 'string' },
102
- shares: { type: 'number' }
103
- }
104
- }
105
- },
106
- risk_tolerance: {
107
- type: 'string',
108
- enum: ['conservative', 'moderate', 'aggressive']
109
- }
110
- },
111
- required: ['holdings', 'risk_tolerance']
112
- }
113
- },
114
90
  {
115
91
  name: 'batch_predict',
116
92
  description: 'Get predictions for multiple stocks in a single call',
@@ -129,15 +105,14 @@ const TOOLS = [
129
105
  ];
130
106
 
131
107
  /**
132
- * Map MCP tool names to API endpoints
108
+ * Map MCP tool names to API endpoints and methods
133
109
  */
134
110
  const TOOL_ENDPOINTS = {
135
- 'get_stock_prediction': '/mcp/predict',
136
- 'get_market_regime': '/mcp/market-regime',
137
- 'discover_stocks': '/mcp/discover',
138
- 'analyze_portfolio': '/mcp/analyze-portfolio',
139
- 'optimize_portfolio': '/mcp/optimize-portfolio',
140
- 'batch_predict': '/mcp/batch-predict'
111
+ 'get_stock_prediction': { path: '/mcp/predict', method: 'POST' },
112
+ 'get_market_regime': { path: '/mcp/market-regime', method: 'GET' },
113
+ 'discover_stocks': { path: '/mcp/discover', method: 'POST' },
114
+ 'analyze_portfolio': { path: '/mcp/analyze-portfolio', method: 'POST' },
115
+ 'batch_predict': { path: '/mcp/batch-predict', method: 'POST' }
141
116
  };
142
117
 
143
118
  /**
@@ -150,20 +125,23 @@ function callAPI(tool, args) {
150
125
  return reject(new Error(`Unknown tool: ${tool}`));
151
126
  }
152
127
 
153
- const data = JSON.stringify(args);
128
+ const data = endpoint.method === 'POST' ? JSON.stringify(args) : null;
154
129
 
155
130
  const options = {
156
131
  hostname: 'www.investbuddy.ai',
157
132
  port: 443,
158
- path: endpoint,
159
- method: 'POST',
133
+ path: endpoint.path,
134
+ method: endpoint.method,
160
135
  headers: {
161
136
  'Content-Type': 'application/json',
162
- 'Content-Length': data.length,
163
137
  'x-api-key': API_KEY
164
138
  }
165
139
  };
166
140
 
141
+ if (data) {
142
+ options.headers['Content-Length'] = data.length;
143
+ }
144
+
167
145
  const req = https.request(options, (res) => {
168
146
  let responseData = '';
169
147
 
@@ -185,7 +163,9 @@ function callAPI(tool, args) {
185
163
  reject(error);
186
164
  });
187
165
 
188
- req.write(data);
166
+ if (data) {
167
+ req.write(data);
168
+ }
189
169
  req.end();
190
170
  });
191
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "investbuddy-mcp-server",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Model Context Protocol server for InvestBuddy AI - Stock predictions with 79.86% accuracy",
5
5
  "main": "index.js",
6
6
  "bin": {