@houtini/fmp-mcp 1.0.0
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/HANDOVER.md +627 -0
- package/LICENSE +21 -0
- package/README.md +240 -0
- package/build/index.d.ts +9 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +302 -0
- package/build/index.js.map +1 -0
- package/package.json +40 -0
- package/src/index.ts +342 -0
- package/test-server.js +34 -0
- package/tsconfig.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# Financial Modeling Prep MCP Server
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server providing access to Financial Modeling Prep's comprehensive financial data API. Get real-time stock quotes, company fundamentals, financial statements, and market news directly in Claude Desktop.
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/js/@houtini%2Ffmp-mcp)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Real-time Market Data**: Live stock quotes with price, volume, and market metrics
|
|
11
|
+
- **Company Information**: Detailed profiles including industry, sector, and key executives
|
|
12
|
+
- **Financial Statements**: Income statements, balance sheets, and cash flow statements
|
|
13
|
+
- **Symbol Search**: Find companies by name or ticker across global exchanges
|
|
14
|
+
- **Stock News**: Latest news articles and market sentiment for specific symbols
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
### Prerequisites
|
|
19
|
+
|
|
20
|
+
- [Claude Desktop](https://claude.ai/download)
|
|
21
|
+
- Node.js 18 or higher
|
|
22
|
+
- Financial Modeling Prep API key ([Get one here](https://financialmodelingprep.com/developer/docs))
|
|
23
|
+
|
|
24
|
+
### Quick Start with NPX
|
|
25
|
+
|
|
26
|
+
Add to your Claude Desktop configuration file:
|
|
27
|
+
|
|
28
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
29
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"mcpServers": {
|
|
34
|
+
"financial-modeling-prep": {
|
|
35
|
+
"command": "npx",
|
|
36
|
+
"args": [
|
|
37
|
+
"-y",
|
|
38
|
+
"@houtini/fmp-mcp"
|
|
39
|
+
],
|
|
40
|
+
"env": {
|
|
41
|
+
"FMP_API_KEY": "your_api_key_here"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Replace `your_api_key_here` with your actual API key from Financial Modeling Prep.
|
|
49
|
+
|
|
50
|
+
**Important**: Restart Claude Desktop completely after updating the configuration.
|
|
51
|
+
|
|
52
|
+
## Available Tools
|
|
53
|
+
|
|
54
|
+
### `get_quote`
|
|
55
|
+
Get real-time stock quote data.
|
|
56
|
+
|
|
57
|
+
**Parameters:**
|
|
58
|
+
- `symbol` (required): Stock ticker symbol (e.g., AAPL, TSLA, MSFT)
|
|
59
|
+
|
|
60
|
+
**Returns:** Current price, volume, market cap, P/E ratio, day high/low, and more.
|
|
61
|
+
|
|
62
|
+
### `search_symbol`
|
|
63
|
+
Search for stock symbols by company name or ticker.
|
|
64
|
+
|
|
65
|
+
**Parameters:**
|
|
66
|
+
- `query` (required): Search query (company name or partial ticker)
|
|
67
|
+
|
|
68
|
+
**Returns:** Matching symbols with company names and exchange information.
|
|
69
|
+
|
|
70
|
+
### `get_company_profile`
|
|
71
|
+
Get detailed company profile and fundamental data.
|
|
72
|
+
|
|
73
|
+
**Parameters:**
|
|
74
|
+
- `symbol` (required): Stock ticker symbol
|
|
75
|
+
|
|
76
|
+
**Returns:** Company description, industry, sector, CEO, employee count, headquarters, website, and key financial metrics.
|
|
77
|
+
|
|
78
|
+
### `get_income_statement`
|
|
79
|
+
Retrieve company income statement data.
|
|
80
|
+
|
|
81
|
+
**Parameters:**
|
|
82
|
+
- `symbol` (required): Stock ticker symbol
|
|
83
|
+
- `period` (optional): "annual" or "quarter" (default: "annual")
|
|
84
|
+
- `limit` (optional): Number of periods to return (default: 5)
|
|
85
|
+
|
|
86
|
+
**Returns:** Revenue, expenses, net income, EPS, and other profitability metrics.
|
|
87
|
+
|
|
88
|
+
### `get_balance_sheet`
|
|
89
|
+
Retrieve company balance sheet data.
|
|
90
|
+
|
|
91
|
+
**Parameters:**
|
|
92
|
+
- `symbol` (required): Stock ticker symbol
|
|
93
|
+
- `period` (optional): "annual" or "quarter" (default: "annual")
|
|
94
|
+
- `limit` (optional): Number of periods to return (default: 5)
|
|
95
|
+
|
|
96
|
+
**Returns:** Assets, liabilities, shareholder equity, and detailed line items.
|
|
97
|
+
|
|
98
|
+
### `get_cash_flow`
|
|
99
|
+
Retrieve company cash flow statement data.
|
|
100
|
+
|
|
101
|
+
**Parameters:**
|
|
102
|
+
- `symbol` (required): Stock ticker symbol
|
|
103
|
+
- `period` (optional): "annual" or "quarter" (default: "annual")
|
|
104
|
+
- `limit` (optional): Number of periods to return (default: 5)
|
|
105
|
+
|
|
106
|
+
**Returns:** Operating cash flow, investing activities, financing activities, and free cash flow.
|
|
107
|
+
|
|
108
|
+
### `get_stock_news`
|
|
109
|
+
Get latest news articles for a stock.
|
|
110
|
+
|
|
111
|
+
**Parameters:**
|
|
112
|
+
- `symbol` (required): Stock ticker symbol
|
|
113
|
+
- `limit` (optional): Number of articles to return (default: 10)
|
|
114
|
+
|
|
115
|
+
**Returns:** News headlines, publication dates, URLs, and article summaries.
|
|
116
|
+
|
|
117
|
+
## Usage Examples
|
|
118
|
+
|
|
119
|
+
Once installed, you can interact with the MCP server directly through Claude Desktop:
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Get a quote for Apple stock
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
Show me Tesla's quarterly income statements for the last 8 quarters
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Compare the P/E ratios of Microsoft and Google
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
Search for semiconductor companies
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
Get recent news about NVIDIA
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## API Rate Limits
|
|
142
|
+
|
|
143
|
+
Financial Modeling Prep offers different pricing tiers:
|
|
144
|
+
|
|
145
|
+
- **Free Tier**: 250 requests/day
|
|
146
|
+
- **Starter**: 500 requests/day
|
|
147
|
+
- **Professional**: 1,000+ requests/day
|
|
148
|
+
|
|
149
|
+
See [FMP Pricing](https://financialmodelingprep.com/developer/docs/pricing) for current plans and limits.
|
|
150
|
+
|
|
151
|
+
## Development
|
|
152
|
+
|
|
153
|
+
### Local Installation
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
git clone https://github.com/yourusername/fmp-mcp.git
|
|
157
|
+
cd fmp-mcp
|
|
158
|
+
npm install
|
|
159
|
+
npm run build
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Claude Desktop Configuration for Local Development
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"mcpServers": {
|
|
167
|
+
"financial-modeling-prep": {
|
|
168
|
+
"command": "node",
|
|
169
|
+
"args": [
|
|
170
|
+
"C:\\path\\to\\fmp-mcp\\build\\index.js"
|
|
171
|
+
],
|
|
172
|
+
"env": {
|
|
173
|
+
"FMP_API_KEY": "your_api_key_here"
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Building
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
npm run build
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Output goes to the `build/` directory.
|
|
187
|
+
|
|
188
|
+
## API Coverage
|
|
189
|
+
|
|
190
|
+
This MCP server implements 7 core endpoints from the Financial Modeling Prep API:
|
|
191
|
+
|
|
192
|
+
- Stock Quote
|
|
193
|
+
- Symbol Search
|
|
194
|
+
- Company Profile
|
|
195
|
+
- Income Statement
|
|
196
|
+
- Balance Sheet
|
|
197
|
+
- Cash Flow Statement
|
|
198
|
+
- Stock News
|
|
199
|
+
|
|
200
|
+
For the complete API reference, see the [FMP Developer Documentation](https://site.financialmodelingprep.com/developer/docs).
|
|
201
|
+
|
|
202
|
+
## Troubleshooting
|
|
203
|
+
|
|
204
|
+
### MCP Server Not Appearing in Claude Desktop
|
|
205
|
+
|
|
206
|
+
1. Verify your `claude_desktop_config.json` syntax is valid JSON
|
|
207
|
+
2. Check that the `FMP_API_KEY` environment variable is set
|
|
208
|
+
3. Restart Claude Desktop completely (quit from system tray/menu bar)
|
|
209
|
+
4. Check Claude Desktop logs for error messages
|
|
210
|
+
|
|
211
|
+
### API Authentication Errors
|
|
212
|
+
|
|
213
|
+
If you see `403 Forbidden` errors:
|
|
214
|
+
- Verify your API key is correct
|
|
215
|
+
- Check you haven't exceeded your rate limit
|
|
216
|
+
- Ensure your API key has the required permissions
|
|
217
|
+
|
|
218
|
+
### Tool Execution Failures
|
|
219
|
+
|
|
220
|
+
- Verify the stock symbol exists (use `search_symbol` first)
|
|
221
|
+
- Check your internet connection
|
|
222
|
+
- Verify FMP API is operational at [status.financialmodelingprep.com](https://financialmodelingprep.com)
|
|
223
|
+
|
|
224
|
+
## Contributing
|
|
225
|
+
|
|
226
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
231
|
+
|
|
232
|
+
## Resources
|
|
233
|
+
|
|
234
|
+
- [Financial Modeling Prep API](https://financialmodelingprep.com)
|
|
235
|
+
- [MCP Documentation](https://modelcontextprotocol.io)
|
|
236
|
+
- [Claude Desktop](https://claude.ai/download)
|
|
237
|
+
|
|
238
|
+
## Acknowledgments
|
|
239
|
+
|
|
240
|
+
Built with the [Model Context Protocol SDK](https://github.com/modelcontextprotocol/sdk) by Anthropic.
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Financial Modeling Prep MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Stdio-based Model Context Protocol server for Financial Modeling Prep API.
|
|
6
|
+
* Provides real-time financial data, stock quotes, company fundamentals, and market insights.
|
|
7
|
+
*/
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG"}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Financial Modeling Prep MCP Server
|
|
4
|
+
*
|
|
5
|
+
* Stdio-based Model Context Protocol server for Financial Modeling Prep API.
|
|
6
|
+
* Provides real-time financial data, stock quotes, company fundamentals, and market insights.
|
|
7
|
+
*/
|
|
8
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
9
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
10
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
11
|
+
const FMP_API_KEY = process.env.FMP_API_KEY;
|
|
12
|
+
const FMP_BASE_URL = 'https://financialmodelingprep.com/stable';
|
|
13
|
+
if (!FMP_API_KEY) {
|
|
14
|
+
console.error('Error: FMP_API_KEY environment variable is required');
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Helper function to make FMP API requests
|
|
19
|
+
*/
|
|
20
|
+
async function fetchFMP(endpoint) {
|
|
21
|
+
const url = `${FMP_BASE_URL}${endpoint}${endpoint.includes('?') ? '&' : '?'}apikey=${FMP_API_KEY}`;
|
|
22
|
+
const response = await fetch(url);
|
|
23
|
+
if (!response.ok) {
|
|
24
|
+
throw new Error(`FMP API error: ${response.status} ${response.statusText}`);
|
|
25
|
+
}
|
|
26
|
+
return response.json();
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Define available tools
|
|
30
|
+
*/
|
|
31
|
+
const TOOLS = [
|
|
32
|
+
{
|
|
33
|
+
name: 'get_quote',
|
|
34
|
+
description: 'Get real-time stock quote for a symbol (e.g., AAPL, TSLA, MSFT)',
|
|
35
|
+
inputSchema: {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
symbol: {
|
|
39
|
+
type: 'string',
|
|
40
|
+
description: 'Stock ticker symbol (e.g., AAPL)',
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
required: ['symbol'],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'search_symbol',
|
|
48
|
+
description: 'Search for stock symbols by company name or ticker',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {
|
|
52
|
+
query: {
|
|
53
|
+
type: 'string',
|
|
54
|
+
description: 'Search query (company name or ticker)',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
required: ['query'],
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'get_company_profile',
|
|
62
|
+
description: 'Get detailed company profile information including description, industry, sector, CEO, and more',
|
|
63
|
+
inputSchema: {
|
|
64
|
+
type: 'object',
|
|
65
|
+
properties: {
|
|
66
|
+
symbol: {
|
|
67
|
+
type: 'string',
|
|
68
|
+
description: 'Stock ticker symbol',
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
required: ['symbol'],
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
name: 'get_income_statement',
|
|
76
|
+
description: 'Get company income statement (annual or quarterly)',
|
|
77
|
+
inputSchema: {
|
|
78
|
+
type: 'object',
|
|
79
|
+
properties: {
|
|
80
|
+
symbol: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
description: 'Stock ticker symbol',
|
|
83
|
+
},
|
|
84
|
+
period: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
description: 'Period type (annual or quarter)',
|
|
87
|
+
enum: ['annual', 'quarter'],
|
|
88
|
+
},
|
|
89
|
+
limit: {
|
|
90
|
+
type: 'number',
|
|
91
|
+
description: 'Number of periods to return (default: 5)',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
required: ['symbol'],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: 'get_balance_sheet',
|
|
99
|
+
description: 'Get company balance sheet statement (annual or quarterly)',
|
|
100
|
+
inputSchema: {
|
|
101
|
+
type: 'object',
|
|
102
|
+
properties: {
|
|
103
|
+
symbol: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
description: 'Stock ticker symbol',
|
|
106
|
+
},
|
|
107
|
+
period: {
|
|
108
|
+
type: 'string',
|
|
109
|
+
description: 'Period type (annual or quarter)',
|
|
110
|
+
enum: ['annual', 'quarter'],
|
|
111
|
+
},
|
|
112
|
+
limit: {
|
|
113
|
+
type: 'number',
|
|
114
|
+
description: 'Number of periods to return (default: 5)',
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
required: ['symbol'],
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
name: 'get_cash_flow',
|
|
122
|
+
description: 'Get company cash flow statement (annual or quarterly)',
|
|
123
|
+
inputSchema: {
|
|
124
|
+
type: 'object',
|
|
125
|
+
properties: {
|
|
126
|
+
symbol: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
description: 'Stock ticker symbol',
|
|
129
|
+
},
|
|
130
|
+
period: {
|
|
131
|
+
type: 'string',
|
|
132
|
+
description: 'Period type (annual or quarter)',
|
|
133
|
+
enum: ['annual', 'quarter'],
|
|
134
|
+
},
|
|
135
|
+
limit: {
|
|
136
|
+
type: 'number',
|
|
137
|
+
description: 'Number of periods to return (default: 5)',
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
required: ['symbol'],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
name: 'get_stock_news',
|
|
145
|
+
description: 'Get latest news articles for a stock symbol',
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
symbol: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
description: 'Stock ticker symbol',
|
|
152
|
+
},
|
|
153
|
+
limit: {
|
|
154
|
+
type: 'number',
|
|
155
|
+
description: 'Number of articles to return (default: 10)',
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
required: ['symbol'],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
/**
|
|
163
|
+
* Create and configure the MCP server
|
|
164
|
+
*/
|
|
165
|
+
const server = new Server({
|
|
166
|
+
name: 'fmp-mcp-server',
|
|
167
|
+
version: '1.0.0',
|
|
168
|
+
}, {
|
|
169
|
+
capabilities: {
|
|
170
|
+
tools: {},
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
/**
|
|
174
|
+
* Handler for listing available tools
|
|
175
|
+
*/
|
|
176
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
177
|
+
return {
|
|
178
|
+
tools: TOOLS,
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
/**
|
|
182
|
+
* Handler for tool execution
|
|
183
|
+
*/
|
|
184
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
185
|
+
const { name, arguments: args } = request.params;
|
|
186
|
+
try {
|
|
187
|
+
switch (name) {
|
|
188
|
+
case 'get_quote': {
|
|
189
|
+
const { symbol } = args;
|
|
190
|
+
const data = await fetchFMP(`/quote?symbol=${symbol.toUpperCase()}`);
|
|
191
|
+
return {
|
|
192
|
+
content: [
|
|
193
|
+
{
|
|
194
|
+
type: 'text',
|
|
195
|
+
text: JSON.stringify(data, null, 2),
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
case 'search_symbol': {
|
|
201
|
+
const { query } = args;
|
|
202
|
+
const data = await fetchFMP(`/search-symbol?query=${encodeURIComponent(query)}&limit=10`);
|
|
203
|
+
return {
|
|
204
|
+
content: [
|
|
205
|
+
{
|
|
206
|
+
type: 'text',
|
|
207
|
+
text: JSON.stringify(data, null, 2),
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
case 'get_company_profile': {
|
|
213
|
+
const { symbol } = args;
|
|
214
|
+
const data = await fetchFMP(`/profile?symbol=${symbol.toUpperCase()}`);
|
|
215
|
+
return {
|
|
216
|
+
content: [
|
|
217
|
+
{
|
|
218
|
+
type: 'text',
|
|
219
|
+
text: JSON.stringify(data, null, 2),
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
case 'get_income_statement': {
|
|
225
|
+
const { symbol, period = 'annual', limit = 5 } = args;
|
|
226
|
+
const data = await fetchFMP(`/income-statement?symbol=${symbol.toUpperCase()}&period=${period}&limit=${limit}`);
|
|
227
|
+
return {
|
|
228
|
+
content: [
|
|
229
|
+
{
|
|
230
|
+
type: 'text',
|
|
231
|
+
text: JSON.stringify(data, null, 2),
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
case 'get_balance_sheet': {
|
|
237
|
+
const { symbol, period = 'annual', limit = 5 } = args;
|
|
238
|
+
const data = await fetchFMP(`/balance-sheet-statement?symbol=${symbol.toUpperCase()}&period=${period}&limit=${limit}`);
|
|
239
|
+
return {
|
|
240
|
+
content: [
|
|
241
|
+
{
|
|
242
|
+
type: 'text',
|
|
243
|
+
text: JSON.stringify(data, null, 2),
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
case 'get_cash_flow': {
|
|
249
|
+
const { symbol, period = 'annual', limit = 5 } = args;
|
|
250
|
+
const data = await fetchFMP(`/cash-flow-statement?symbol=${symbol.toUpperCase()}&period=${period}&limit=${limit}`);
|
|
251
|
+
return {
|
|
252
|
+
content: [
|
|
253
|
+
{
|
|
254
|
+
type: 'text',
|
|
255
|
+
text: JSON.stringify(data, null, 2),
|
|
256
|
+
},
|
|
257
|
+
],
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
case 'get_stock_news': {
|
|
261
|
+
const { symbol, limit = 10 } = args;
|
|
262
|
+
const data = await fetchFMP(`/stock_news?tickers=${symbol.toUpperCase()}&limit=${limit}`);
|
|
263
|
+
return {
|
|
264
|
+
content: [
|
|
265
|
+
{
|
|
266
|
+
type: 'text',
|
|
267
|
+
text: JSON.stringify(data, null, 2),
|
|
268
|
+
},
|
|
269
|
+
],
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
default:
|
|
273
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
278
|
+
return {
|
|
279
|
+
content: [
|
|
280
|
+
{
|
|
281
|
+
type: 'text',
|
|
282
|
+
text: `Error: ${errorMessage}`,
|
|
283
|
+
},
|
|
284
|
+
],
|
|
285
|
+
isError: true,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
/**
|
|
290
|
+
* Start the server
|
|
291
|
+
*/
|
|
292
|
+
async function main() {
|
|
293
|
+
const transport = new StdioServerTransport();
|
|
294
|
+
await server.connect(transport);
|
|
295
|
+
// Log to stderr so it doesn't interfere with stdio protocol
|
|
296
|
+
console.error('FMP MCP Server running on stdio');
|
|
297
|
+
}
|
|
298
|
+
main().catch((error) => {
|
|
299
|
+
console.error('Fatal error:', error);
|
|
300
|
+
process.exit(1);
|
|
301
|
+
});
|
|
302
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAE5C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;AAC5C,MAAM,YAAY,GAAG,0CAA0C,CAAC;AAEhE,IAAI,CAAC,WAAW,EAAE,CAAC;IACjB,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACrE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,QAAQ,CAAC,QAAgB;IACtC,MAAM,GAAG,GAAG,GAAG,YAAY,GAAG,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,UAAU,WAAW,EAAE,CAAC;IAEnG,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;IAElC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;IAC9E,CAAC;IAED,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,KAAK,GAAW;IACpB;QACE,IAAI,EAAE,WAAW;QACjB,WAAW,EAAE,iEAAiE;QAC9E,WAAW,EA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SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,4DAA4D;IAC5D,OAAO,CAAC,KAAK,CAAC,iCAAiC,CAAC,CAAC;AACnD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@houtini/fmp-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Model Context Protocol (MCP) server for Financial Modeling Prep API - stdio transport for Claude Desktop integration",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fmp-mcp": "./build/index.js"
|
|
8
|
+
},
|
|
9
|
+
"main": "./build/index.js",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsc --watch"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"mcp",
|
|
16
|
+
"financial-modeling-prep",
|
|
17
|
+
"fmp",
|
|
18
|
+
"stock-market",
|
|
19
|
+
"financial-data",
|
|
20
|
+
"model-context-protocol",
|
|
21
|
+
"claude",
|
|
22
|
+
"ai-tools"
|
|
23
|
+
],
|
|
24
|
+
"author": "Houtini AI",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/houtini-ai/fmp-mcp.git"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.0.4"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@types/node": "^22.19.3",
|
|
35
|
+
"typescript": "^5.9.3"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|