Skip to main content
Glama

Financial Modeling Prep MCP Server

Apache 2.0
17
59
  • Linux
  • Apple
cot.tsโ€ข3.59 kB
import { z } from "zod"; import { COTClient } from "../api/cot/COTClient.js"; import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; /** * Register all COT-related tools with the MCP server * @param server The MCP server instance * @param accessToken The Financial Modeling Prep API access token (optional when using lazy loading) */ export function registerCOTTools(server: McpServer, accessToken?: string): void { const cotClient = new COTClient(accessToken); server.tool( "getCOTReports", "Access comprehensive Commitment of Traders (COT) reports with the FMP COT Report API. This API provides detailed information about long and short positions across various sectors, helping you assess market sentiment and track positions in commodities, indices, and financial instruments.", { symbol: z.string().describe("Commodity symbol"), from: z .string() .optional() .describe("Optional start date (YYYY-MM-DD)"), to: z .string() .optional() .describe("Optional end date (YYYY-MM-DD)"), }, async ({ symbol, from, to }) => { try { const results = await cotClient.getReports(symbol, from, to); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } } ); server.tool( "getCOTAnalysis", "Gain in-depth insights into market sentiment with the FMP COT Report Analysis API. Analyze the Commitment of Traders (COT) reports for a specific date range to evaluate market dynamics, sentiment, and potential reversals across various sectors.", { symbol: z.string().describe("Commodity symbol"), from: z .string() .optional() .describe("Optional start date (YYYY-MM-DD)"), to: z .string() .optional() .describe("Optional end date (YYYY-MM-DD)"), }, async ({ symbol, from, to }) => { try { const results = await cotClient.getAnalysis(symbol, from, to); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } } ); server.tool("getCOTList", "Access a comprehensive list of available Commitment of Traders (COT) reports by commodity or futures contract using the FMP COT Report List API. This API provides an overview of different market segments, allowing users to retrieve and explore COT reports for a wide variety of commodities and financial instruments.", {}, async () => { try { const results = await cotClient.getList(); return { content: [{ type: "text", text: JSON.stringify(results, null, 2) }], }; } catch (error) { return { content: [ { type: "text", text: `Error: ${ error instanceof Error ? error.message : String(error) }`, }, ], isError: true, }; } }); }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/imbenrabi/Financial-Modeling-Prep-MCP-Server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server