Skip to main content
Glama

Marketstack MCP Server

by matteoantoci

Marketstack MCP 服务器

模型上下文协议 (MCP) 服务器将各种 Marketstack API 端点公开为 MCP 工具,提供对金融数据的访问,包括日终数据、盘中数据、拆股数据、股息数据、股票代码、交易所数据、货币数据、时区数据、债券数据和 ETF 数据。该服务器简化了将 Marketstack 数据集成到兼容 MCP 的代理和系统中的过程。

先决条件

  • Node.js(建议使用 v18 或更高版本)
  • npm(Node.js 附带)
  • Marketstack API 密钥
  • (可选)兼容 MCP 的客户端或运行器(例如 VSCode 扩展、CLI)

设置

  1. 克隆存储库或确保您位于项目目录中。
  2. 安装依赖项:
    npm install
  3. 配置:
    • https://marketstack.com/获取 Marketstack API 密钥。
    • 通过 MCP 运行器的设置配置MARKETSTACK_API_KEY环境变量。这是与 MCP 客户端无缝集成的推荐方法。通过 MCP 运行器运行时,请避免为此目的使用.env文件。

构建和运行

  1. 构建服务器:
    npm run build
    这将创建一个包含已编译 JavaScript 代码的build目录。
  2. 运行服务器:
    npm run start
    或直接:
    node build/index.js
  3. **通过 MCP 运行器:**配置您的 MCP 客户端,使用 stdio 传输运行服务器。MCP 设置条目示例(将/path/to/mcp-marketstack调整为您的实际路径,并将YOUR_API_KEY_HERE替换为您的实际密钥):
    "marketstack": { "transportType": "stdio", "command": "node", "args": [ "/path/to/mcp-marketstack/build/index.js" ], "env": { "MARKETSTACK_API_KEY": "YOUR_API_KEY_HERE" } // ... other optional settings ... }

可用工具

服务器将 Marketstack API 端点公开为不同的 MCP 工具,按功能分类:

  • 市场数据
  • 参考数据
  • 金融工具

通过自省连接到服务器的 MCP 代理可以自动发现每个工具的详细输入模式和描述。

项目结构

该项目采用模块化结构:

. ├── src/ │ ├── index.ts # Server entry point │ ├── marketstackClient.ts # Centralized API client with caching │ ├── cacheConfig.ts # Cache TTL configurations │ └── tools/ │ ├── index.ts # Registers all tool categories │ ├── marketData/ # Market Data tools │ │ └── ... │ ├── referenceData/ # Reference Data tools │ │ └── ... │ ├── financialInstruments/ # Financial Instruments tools │ │ └── ... │ └── wrapToolHandler.ts # Wrapper for tool handlers ├── memory-bank/ # Project documentation │ └── ... ├── package.json # Project dependencies and scripts ├── tsconfig.json # TypeScript configuration ├── eslint.config.js # ESLint configuration ├── .prettierrc # Prettier configuration ├── LICENSE # Project license └── README.md # This file

缓存

服务器在内存中实现了“最近最少使用”(LRU)缓存,用于缓存工具响应。这有助于减少对 Marketstack API 的冗余调用,从而提高性能并遵守速率限制。

  • **机制:**缓存根据工具名称和输入参数存储响应。
  • **可配置的 TTL:**每个工具的缓存数据都有一个可配置的生存时间 (TTL),定义在src/cacheConfig.ts中。这允许根据每个 Marketstack 端点提供的数据的更新频率设置不同的缓存持续时间。

许可

本项目遵循自由软件基金会发布的 GNU 通用公共许可证,许可证版本为 3,或(根据您的选择)更高版本。详情请参阅LICENSE文件。

贡献

欢迎贡献代码!请遵循标准的 fork-and-pull 请求工作流程。

支持

如有问题或疑问,请在 GitHub 存储库上打开问题。

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

将各种 Marketstack API 端点作为 MCP 工具公开,提供对金融市场数据的访问,包括 EOD、日内、拆分、股息、股票代码、交易所和其他财务信息。

  1. 先决条件
    1. 设置
      1. 构建和运行
        1. 可用工具
          1. 项目结构
            1. 缓存
              1. 许可
                1. 贡献
                  1. 支持

                    Related MCP Servers

                    • A
                      security
                      A
                      license
                      A
                      quality
                      MCP server that provides AI assistants access to stock market data including financial statements, stock prices, and market news through a Model Context Protocol interface.
                      Last updated -
                      11
                      433
                      Python
                      MIT License
                      • Apple
                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol implementation for the CoinMarketCap API that provides standardized access to cryptocurrency market data, exchange information, and blockchain metrics.
                      Last updated -
                      26
                      225
                      28
                      JavaScript
                      MIT License
                      • Linux
                      • Apple
                    • A
                      security
                      A
                      license
                      A
                      quality
                      MCP service that provides real-time access to Binance cryptocurrency market data, allowing AI agents to fetch current prices, order books, candlestick charts, and trading statistics through natural language queries.
                      Last updated -
                      12
                      390
                      24
                      JavaScript
                      Apache 2.0
                    • A
                      security
                      F
                      license
                      A
                      quality
                      MCP server that exposes Alpaca Market Data & Broker API as tools, enabling access to financial data like stock bars, assets, market days, and news through the Message Control Protocol.
                      Last updated -
                      4
                      11
                      2
                      TypeScript

                    View all related MCP servers

                    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