Skip to main content
Glama

Marketstack MCP Server

by matteoantoci
index.ts1.35 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; import { createMarketstackClient } from './marketstackClient.js'; import { registerTools } from './tools/index.js'; // This will register all tools from sub-indices const main = async () => { const apiKey = process.env.MARKETSTACK_API_KEY; if (!apiKey) { console.error('MARKETSTACK_API_KEY environment variable is not set.'); process.exit(1); } const server = new McpServer({ name: 'mcp-marketstack', version: '1.0.0', // Starting version description: 'MCP Server exposing Marketstack financial data.', // Add authentication if needed }); // Create the Marketstack client with cache config const marketstackClient = createMarketstackClient(apiKey, { max: 500, defaultTTL: 60 * 60 * 1000 }); // Register all tools from the different API groups, passing the client registerTools(server, marketstackClient); console.log('Starting MCP Marketstack Server...'); // Use Stdio transport to connect const transport = new StdioServerTransport(); await server.connect(transport); console.log(`Server "mcp-marketstack" connected via stdio.`); }; main().catch((error) => { console.error('Failed to start MCP server:', error); process.exit(1); });

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/matteoantoci/mcp-marketstack'

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