
一个用于股票市场数据 API 的 MCP 服务器,Alphavantage API。
概览
一个用于股票市场数据 API 的 MCP 服务器,Alphavantage API。 : https://pypi.org/project/alphavantage-mcp/ 1. 注册免费的 Alphavantage API 密钥 2.将 API 密钥添加到你的环境变量中ALPHAVANTAGE_API_KEY 使用 AlphaVantage MCP 服务器最简单的方式是使用 uvx: AlphaVantage 服务器可以运行两种不同的模式: 这是像 Claude Desktop 这样的工具使用的标准 MCP 服务器模式。 该模式通过HTTP流提供实时更新。 该模式为HTTP服务器增加了OAuth 2.1认证,遵循MCP的安全访问规范。
概述(AI 翻译)
一个用于股票市场数据 API 的 MCP 服务器,Alphavantage API。
MCP 服务器网址:https://mcp.alphavantage.co
PyPi:https://pypi.org/project/alphavantage-mcp/
配置
获取API密钥
- 注册免费的 Alphavantage API 密钥
- 将 API 密钥添加到你的环境变量中,作为
ALPHAVANTAGE_API_KEY
安装
选项1:使用UVX(推荐)
使用 AlphaVantage MCP 服务器最简单的方式是使用 uvx:
选项2:使用点数
选项3:来自源头
服务器模式
AlphaVantage 服务器可以运行两种不同的模式:
Stdio 服务器(默认)
这是像 Claude Desktop 这样的工具使用的标准 MCP 服务器模式。
可流式HTTP服务器
该模式通过HTTP流提供实时更新。
带OAuth 2.1认证的可流式HTTP服务器
该模式为HTTP服务器增加了OAuth 2.1认证,遵循MCP的安全访问规范。
OAuth 配置
使用--oauth标志时,服务器需要通过环境变量进行OAuth 2.1配置:
必备环境变量:
可选环境变量:
OAuth 特色
OAuth 实现提供了:
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
✅ Official Alpha Vantage MCP Server
A MCP server for the stock market data API, Alphavantage API.
MCP Server URL: https://mcp.alphavantage.co
PyPi: https://pypi.org/project/alphavantage-mcp/
Configuration
Getting an API Key
- Sign up for a Free Alphavantage API key
- Add the API key to your environment variables as
ALPHAVANTAGE_API_KEY
Installation
Option 1: Using uvx (Recommended)
The easiest way to use the AlphaVantage MCP server is with uvx:
# Run directly without installation
uvx alphavantage-mcp
# Or with specific arguments
uvx alphavantage-mcp --server http --port 8080
Option 2: Using pip
pip install alphavantage-mcp
alphavantage-mcp
Option 3: From source
git clone https://github.com/calvernaz/alphavantage.git
cd alphavantage
uv run alphavantage
Server Modes
The AlphaVantage server can run in two different modes:
Stdio Server (Default)
This is the standard MCP server mode used for tools like Claude Desktop.
alphavantage
# or explicitly:
alphavantage --server stdio
Streamable HTTP Server
This mode provides real-time updates via HTTP streaming.
alphavantage --server http --port 8080
Streamable HTTP Server with OAuth 2.1 Authentication
This mode adds OAuth 2.1 authentication to the HTTP server, following the MCP specification for secure access.
alphavantage --server http --port 8080 --oauth
OAuth Configuration
When using the --oauth flag, the server requires OAuth 2.1 configuration via environment variables:
Required Environment Variables:
export OAUTH_AUTHORIZATION_SERVER_URL="https://your-auth-server.com/realms/your-realm"
export OAUTH_RESOURCE_SERVER_URI="https://your-mcp-server.com"
Optional Environment Variables:
# Token validation method (default: jwt)
export OAUTH_TOKEN_VALIDATION_METHOD="jwt" # or "introspection"
# For JWT validation
export OAUTH_JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n...\n-----END PUBLIC KEY-----"
export OAUTH_JWT_ALGORITHM="RS256" # default
# For token introspection validation
export OAUTH_INTROSPECTION_ENDPOINT="https://your-auth-server.com/realms/your-realm/protocol/openid-connect/token/introspect"
export OAUTH_INTROSPECTION_CLIENT_ID="your-client-id"
export OAUTH_INTROSPECTION_CLIENT_SECRET="your-client-secret"
# Optional: Required scopes (space-separated)
export OAUTH_REQUIRED_SCOPES="mcp:access mcp:read"
安装
uvx alphavantage-mcp配置
{
"mcpServers": {
"alphavantage": {
"command": "uvx",
"args": ["alphavantage-mcp"],
"env": {
"ALPHAVANTAGE_API_KEY": "YOUR_API_KEY_HERE"
}
}
}
}