Alpha Vantage API 的 MCP 服务器 (@missionsquad/avantage)
该项目提供了一个模型上下文协议 (MCP) 服务器,它包装了@missionsquad/avantage
库,将 Alpha Vantage API 功能公开为语言学习模型 (LLM) 的工具。
概述
该服务器允许 LLM 与 Alpha Vantage API 交互以检索财务数据,包括:
- 核心股票数据(时间序列、报价、搜索)
- 基本面数据(公司概况、财务状况、日历)
- 外汇(FX)数据
- 加密货币数据
- 商品数据
- 经济指标
- 技术指标
- Alpha Intelligence(新闻、情绪等)
- 期权数据(溢价)
它利用@missionsquad/avantage
TypeScript 库并遵循通用 MCP 服务器模板的架构,包括多用户 API 密钥处理和AVantage
客户端实例的资源管理。
主要特点:
- **全面覆盖:**为
@missionsquad/avantage
库中几乎所有可用的功能实现 MCP 工具。 - **多用户支持:**通过
extraArgs
(首选)或回退到环境变量安全地处理 Alpha Vantage API 密钥。 - **资源管理:**使用
ResourceManager
高效管理AVantage
客户端实例。 - **强类型:**使用 TypeScript 构建,利用
@missionsquad/avantage
和 Zod 模式的类型作为工具参数。 - **标准 MCP 接口:**使用
@missionsquad/fastmcp
进行 MCP 通信。
入门
先决条件
- Node.js v20 或更高版本
- npm 或 yarn
- Alpha Vantage API 密钥(在此获取)
设置
- **克隆或复制:**克隆此存储库或复制文件。
- 安装依赖项:
- 配置环境:
- 将
.env.example
复制到.env
。 - 编辑
.env
并将API_KEY
设置为您的 Alpha Vantage API 密钥。 - 如果您有高级订阅,则可以选择设置
AV_PREMIUM=true
。 - 如果需要,调整
LOG_LEVEL
或RESOURCE_CLEANUP_INTERVAL
。
- 将
- 构建项目:
- 启动服务器:服务器将在 stdio 上监听 MCP 请求。
验证
服务器使用标准的多用户令牌处理模式:
- **
extraArgs.apiKey
(推荐):**在 MCPcall_tool
请求期间,将用户特定的 Alpha Vantage API 密钥传递到extraArgs
对象的apiKey
字段中。此密钥不属于工具架构的一部分。 - **
.env
后备:**如果未提供extraArgs.apiKey
,服务器将使用.env
文件中的API_KEY
值。
可用工具
该服务器公开了许多与@missionsquad/avantage
库中的方法相对应的工具。这些工具通常以module_method
命名(例如coreStock_intraday
、 fundamentalData_companyOverview
)。
有关参数和返回结构的详细信息,请参阅Alpha Vantage 文档和@missionsquad/avantage
库的类型(库内的src/types/*
)。
示例工具调用(概念 MCP 请求):
工具类别(模块):
alphaIntelligence_*
commodities_*
coreStock_*
crypto_*
economicIndicators_*
forex_*
fundamentalData_*
optionsData_*
(高级版)technicalIndicators_*
使用 MCP list_tools
命令获取可用工具的完整列表、其描述和参数模式。
配置
通过.env
文件配置:
多变的 | 描述 | 默认 |
---|---|---|
API_KEY | 如果extraArgs 中没有,则使用后备 Alpha Vantage API 密钥 | null |
LOG_LEVEL | 日志级别( error 、 warn 、 info 、 debug ) | info |
RESOURCE_CLEANUP_INTERVAL | 清理非活动 AVantage 客户端实例的间隔(毫秒) | 1800000 (30米) |
AV_PREMIUM | 设置为true 以在avantage 中启用高级端点访问 | false |
项目结构
遵循通用 MCP 服务器模板结构。关键文件:
src/index.ts
:主服务器入口点,工具定义。src/config.ts
:配置加载。src/logger.ts
:日志实用程序。src/resource-manager.ts
:管理AVantage
实例。src/schemas.ts
:工具参数的 Zod 模式。.nexus/
:Nexus 文档。
Nexus 文档
.nexus/features/avantage_integration/feature.md
.nexus/architecture/server_structure.md
.nexus/guides/using_avantage_tools.md
.nexus/decisions/decision_log.md
执照
MIT(假设模板许可证是 MIT。验证。)
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.
Tools
模型上下文协议服务器使 LLM 能够访问来自 Alpha Vantage API 的综合财务数据,包括股票价格、基本面、外汇、加密货币和经济指标。
Related MCP Servers
- AsecurityFlicenseAqualityThis is an MCP server that provides access to the Alpha Vantage API, allowing stock data retrieval to be used as context to LLMs.Last updated -2156JavaScript
- -securityAlicense-qualityA Model Context Protocol server providing real-time stock data and options analysis through Yahoo Finance, enabling LLMs to access market data, analyze stocks, and evaluate options strategies.Last updated -4PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to analyze options chains, calculate Greeks, and evaluate basic options strategies through Yahoo Finance data.Last updated -4PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs like Claude to interact with the Alpaca trading API, allowing for trading stocks, checking positions, fetching market data, and managing accounts through natural language.Last updated -PythonMIT License
Appeared in Searches
- A server for finding scientific articles, creating ad ideas, and deploying Facebook ads
- A platform for live probability option trading with indicators across multiple markets
- A server for obtaining historical cryptocurrency market data
- A tool or service for checking cryptocurrency prices
- A tool for analyzing Indian stock data for investment decisions using LLMs and news insights