EODHD MCP服务器
一个模型上下文协议(MCP)服务器,它公开了 EOD历史数据 (EODHD)API到MCP兼容客户端(克劳德桌面、克劳德代码、ChatGPT MCP/连接器、MCP检查器、自定义代理等)。
它提供基于工具的访问:
主要订阅数据集:
- 日终、日内和分时数据
- 实时(延迟)报价和US Live v2扩展报价
- 基本面、收益和财务
- 新闻、情绪和新闻词权重
- 股票筛选器和发现端点
- 公司行为(股息、拆分、首次公开募股)
- 宏观指标、交易所和上市
- 芝加哥期权交易所指数和馈送
市场数据集:
- 期权(合约、EOD、基础交易品种)
- illio(绩效、风险和市场洞察)
- Praams(风险评分、债券、银行)
- Investverte ESG(公司、国家、行业)
亮点
✅ 日终、日内和美国分时数据
✅ 实时(延迟)报价和延长美国报价(实时v2报价)
✅ 基本面(股票、ETF、共同基金、指数、加密货币、外汇)
✅ 收益、首次公开募股、拆分、股息和交易品种变更
✅ 新闻、情绪和主题/单词权重
✅ 筛选器和技术指标(SMA、EMA、MACD、Stoch、BBands等)
✅ 美国期权(合同、EOD、基础)
✅ 宏观指标、经济事件、交易所和股票
✅ 市场工具(illio、Praams、Investverte ESG、CBOE)
需求
- python 3.10+
- 有效的EODHD API密钥
- 工作室:set EODHD_API_KEY 或通过 --use-local --apikey - 超文本传输协议 /v1/mcp:通过headers/query参数传递(未注入env) - OAuth /v2/mcp:使用Bearer令牌流
- MCP兼容客户端,例如:
- 克劳德桌面/克劳德代码
- 带MCP/连接器的ChatGPT
- MCP检查员
- 自定义MCP客户端
安装和设置
1) 克隆并安装
git clone https://github.com/Enlavan/EODHD_MCP_server.git
cd EODHD_MCP_server
pip install -r requirements.txt创建一个 .env 在repo根目录(由 server.py):
EODHD_API_KEY=YOUR_EODHD_API_KEY
# Optional (HTTP server):
MCP_HOST=127.0.0.1
MCP_PORT=8000
JWT_SECRET=YOUR_LONG_RANDOM_SECRET
MCP_SERVER_URL=https://mcp.eodhd.dev
# If behind a reverse proxy (recommended), allow X-Forwarded-* handling
PROXY_HEADERS=true
FORWARDED_ALLOW_IPS=*______________________________________________________________________
2) 作为本地HTTP服务器运行
选项A(根入口点):
python server.py
# → http://127.0.0.1:8000/v1/mcp (defaults; override with MCP_HOST/MCP_PORT)注意:默认情况下启用OAuth模式,需要 JWT_SECRET.使用 --no-oauth 禁用。 根路径 / 不提供信息页面;使用 .well-known 发现端点。 对于HTTP /v1/mcp,API密钥不是从env注入的;通过headers/query或tool-param提供。
______________________________________________________________________
3) 作为MCP sse服务器运行
python server.py --sse______________________________________________________________________
4) 作为MCP stdio服务器运行
对于通过stdio启动服务器的客户端:
# Use env EODHD_API_KEY or pass API key via CLI (stdio only)
python server.py --stdio
python server.py --stdio --use-local --apikey YOUR_EODHD_API_KEY(对于HTTP/SSE,API密钥不是从env注入的;通过头/查询或OAuth提供。)
______________________________________________________________________
与Claude Desktop一起使用
A) 通过MCP捆绑包安装(.mcpb)
- 下载
.mcpb从发布(https://github.com/Enlavan/EODHD_MCP_server/releases). - 克劳德桌面→ 设置→ 扩展→ 高级→ 安装扩展.
- 选择
.mcpb,批准,输入您的API密钥,启用扩展。
B) 使用源代码签出(开发人员配置)
- 克隆此仓库(https://github.com/Enlavan/EODHD_MCP_server)任何地方。
- 克劳德桌面→ 开发者→ 编辑配置,添加:
{
"mcpServers": {
"eodhd-mcp": {
"command": "python3",
"args": [
"/home/user/EODHD_MCP_server/server.py", //actual path to the library
"--stdio"
],
"env": {
"EODHD_API_KEY": "YOUR_EODHD_API_KEY" //your valid EODHD API key
}
}
}
}重新启动克劳德桌面。服务器将通过stdio按需启动。
______________________________________________________________________
与ChatGPT一起使用(测试版MCP支持)
- 打开ChatGPT 设置 → 确保你的计划得到支持 连接器/MCP.
- 启用开发人员/连接器功能。
- 添加自定义MCP 超文本传输协议 来源:
- 网址: http://127.0.0.1:8000/v1/mcp (或您部署的URL) - 通过头/查询参数(legacy/v1/mcp)提供您的EODHD API密钥,或在 /v2/mcp.
- 开始新的聊天→ 添加源 → 选择您的MCP服务器。
如果你的ChatGPT工作区支持带有查询参数的托管连接器,你可以部署HTTP服务器并公开一个URL,如下所示: https://YOUR_HOST/v1/mcp (网关或查询参数提供的API密钥)。______________________________________________________________________
使用示例
以下是具体示例,显示了如何使用自然语言提示(Claude/ChatGPT)的服务器
示例1
一旦MCP服务器在您的客户端中注册(Claude Desktop、Claude Code、ChatGPT MCP等),您可以简单地问:
- 获取AAPL的每日OHLCV数据。美国在2023年1月1日至2023年2月28日期间使用EODHD MCP工具并总结价格趋势。
示例2
- 使用EODHD MCP服务器:
- 获取AAPL的完整基础知识。美国(包括金融),
- 获取AAPL的最新公司新闻。我们,
- 总结最近的新闻如何与基本面保持一致。
实施例3
- 要求EODHD MCP工具:
- 筛选市值>10B的美国科技股, - 计算AAPL的30天SMA和MACD。2022年中期,美国, - 列出一些AAPL。美国期权合约,并显示其中一份的EOD数据。
您的MCP客户端会将这些转换为以下调用:
- 获取历史库存价格、获取基本数据、获取公司新闻,
- get_stock_screener_data、get_technological indicators、get_mpuus_options_connects、,
- get_mp_us_options_od等。
______________________________________________________________________
运行内置测试客户端
test/目录包含MCP客户端,这些客户端使用 test/all_tests.py中的测试目录。
*HTTP测试*
终端1:启动HTTP MCP服务器
python server.py
# uses http://127.0.0.1:8000/v1/mcp by default终端2:运行HTTP客户端测试
python test/test_client_http.py
# uses http://127.0.0.1:8000/v1/mcp by default*SSE试验*
终端1:启动SSE MCP服务器
python server.py --sse终端2:运行SSE客户端测试
python test/test_client_sse.py*STDIO测试*
python test/test_client_stdio.py --cmd "python3 server.py --stdio --use-local --apikey YOUR_EODHD_API_KEY"这些客户端加载test/all_tests.py(如果你选择,还可以加载all_tests_beta.py),它注册了一组针对所有工具的全面工作调用。
______________________________________________________________________
MCP工具
以下工具在app/tools/下作为单独的模块实现,并在注册 MCP服务器。
核心市场数据
get_historical_stock_prices–符号和日期范围的每日OHLCV
get_intraday_historical_data–日内柱状图(1m、5m、1h等)
get_us_tick_data–美国股票分时数据
get_live_price_data–实时(延迟)报价
get_us_live_extended_quotes–US Live v2扩展报价
capture_realtime_ws–实时WebSocket捕获:
- us_trades(例如AAPL、MSFT、TSLA)
- 加密货币(例如BTC-USD、ETH-USD)
- 外汇(如欧元兑美元)
新闻、情感、发现
get_company_news–公司/股票新闻
get_sentiment_data–一个或多个符号的新闻情绪
get_news_word_weights–日期窗口内的加权新闻关键字
get_stocks_from_search–按股票代码、名称、ISIN等搜索公司/债券。
get_stock_screener_data–EODHD股票筛选器包装器(过滤器、信号、排序)
交换和参考数据
get_exchanges_list–列出所有交易所
get_exchange_tickers–给定交易所的门票(和可选类型)
get_exchange_details–每个交易所的交易时间、假期等
get_symbol_change_history–符号/代码更改历史
基础知识、宏观和用户详细信息
get_fundamentals_data–基础知识:
- 股票,
- ETF,
- 共同基金,
- 指数,
- 加密货币,
- 外汇
get_historical_market_cap–历史市值系列
get_macro_indicator宏观指标(GDP、CPI等)
get_economic_events–经济事件,包括过滤器(比较、类型)
get_user_details–帐户和配额/使用信息
get_insider_transactions–内幕交易数据(带符号和窗口过滤器)
日历和公司行为
get_upcoming_earnings–收益日历(按日期或符号列表)
get_earnings_trends–一个或多个股票的收益趋势
get_upcoming_ipos–即将进行的首次公开募股
get_upcoming_splits–即将进行的股票分割
get_upcoming_dividends–即将到来的股息(按符号、日期或窗口)
技术指标
get_technical_indicators–EODHD技术指标API:
- SMA,EMA
- 指数平滑异同移动平均线
- 随机指标,StochRSI
- 自动目标识别
- 合成孔径雷达
- 贝塔系数与指数(例如NDX.INDX)
- 布林带
- 分体式调节系列
- AmiBroker格式导出
美国选项
get_mp_us_options_contracts–合同列表(基础、罢工、类型、到期、分页过滤器)
get_mp_us_options_eod–EOD选项数据(按合同+可选过滤器)
get_mp_us_options_underlyings–基础符号列表
指数和芝加哥期权交易所
get_mp_indices_list–EODHD MP索引列表
get_mp_index_components–给定索引的组件(例如GSPC.INDX)
get_cboe_indices_list–芝加哥期权交易所指数列表
get_cboe_index_data–CBOE指数馈送(例如快照_官方_关闭)
illio Marketplace订阅数据
get_mp_illio_performance_insights
get_mp_illio_risk_insights
get_mp_illio_market_insights_performance
get_mp_illio_market_insights_best_worst
get_mp_illio_market_insights_volatility
get_mp_illio_market_insights_risk_return
get_mp_illio_market_insights_largest_volatility
get_mp_illio_market_insights_beta_bands
这些工具支持SnP500、道琼斯、纳斯达克100、NDX、spx等规范ID。 其中服务器将别名规范化为正确的索引。
Praams Marketplace订阅数据
get_mp_praams_risk_scoring_by_ticker
get_mp_praams_risk_scoring_by_isin
get_mp_praams_bond_analyze_by_isin
get_mp_praams_bank_income_statement_by_ticker
get_mp_praams_bank_income_statement_by_isin
get_mp_praams_bank_balance_sheet_by_ticker
get_mp_praams_bank_balance_sheet_by_isin
Investverte Marketplace订阅数据
get_mp_investverte_esg_list_companies
get_mp_investverte_esg_list_countries
get_mp_investverte_esg_view_country
get_mp_investverte_esg_view_company
get_mp_investverte_esg_list_sectors
get_mp_investverte_esg_view_sector
有关具体的参数示例和边缘情况覆盖率,请参阅test/all_tests.py, 它记录了一系列针对所有工具的“快乐路径”和近边界调用。
______________________________________________________________________
项目结构
EODHD_MCP_server/
├── app/
│ ├── api_client.py
│ ├── config.py
│ └── tools/
│ ├── __init__.py
│ ├── capture_realtime_ws.py
│ ├── get_cboe_index_data.py
│ ├── get_cboe_indices_list.py
│ ├── get_company_news.py
│ ├── get_earnings_trends.py
│ ├── get_economic_events.py
│ ├── get_exchange_details.py
│ ├── get_exchanges_list.py
│ ├── get_exchange_tickers.py
│ ├── get_fundamentals_data.py
│ ├── get_historical_market_cap.py
│ ├── get_historical_stock_prices.py
│ ├── get_insider_transactions.py
│ ├── get_intraday_historical_data.py
│ ├── get_live_price_data.py
│ ├── get_macro_indicator.py
│ ├── get_mp_illio_market_insights_best_worst.py
│ ├── get_mp_illio_market_insights_beta_bands.py
│ ├── get_mp_illio_market_insights_largest_volatility.py
│ ├── get_mp_illio_market_insights_performance.py
│ ├── get_mp_illio_market_insights_risk_return.py
│ ├── get_mp_illio_market_insights_volatility.py
│ ├── get_mp_illio_performance_insights.py
│ ├── get_mp_illio_risk_insights.py
│ ├── get_mp_index_components.py
│ ├── get_mp_indices_list.py
│ ├── get_mp_investverte_esg_list_companies.py
│ ├── get_mp_investverte_esg_list_countries.py
│ ├── get_mp_investverte_esg_list_sectors.py
│ ├── get_mp_investverte_esg_view_company.py
│ ├── get_mp_investverte_esg_view_country.py
│ ├── get_mp_investverte_esg_view_sector.py
│ ├── get_mp_praams_bank_balance_sheet_by_isin.py
│ ├── get_mp_praams_bank_balance_sheet_by_ticker.py
│ ├── get_mp_praams_bank_income_statement_by_isin.py
│ ├── get_mp_praams_bank_income_statement_by_ticker.py
│ ├── get_mp_praams_bond_analyze_by_isin.py
│ ├── get_mp_praams_risk_scoring_by_isin.py
│ ├── get_mp_praams_risk_scoring_by_ticker.py
│ ├── get_company_news.py
│ ├── get_exchange_tickers.py
│ ├── get_exchanges_list.py
│ ├── get_historical_stock_prices.py
│ ├── get_intraday_historical_data.py
│ ├── get_live_price_data.py
│ ├── get_stocks_from_search.py
│ └── get_user_details.py
├── assets/
│ ├── icon.png
│ └── icon.svg
├── test/
│ ├── all_tests.py
│ ├── all_tests_beta.py
│ ├── test_client_http.py
│ ├── test_client_sse.py
│ └── test_client_stdio.py
├── LICENSE
├── manifest.json
├── README.md
└── server.py
入口点
server.py–主入口点(默认为HTTP,支持--stdio和--sse).
______________________________________________________________________
隐私和数据处理
此MCP服务器充当您的MCP客户端和EODHD的HTTP API之间的瘦代理。
- 您的EODHD API密钥仅用于验证对EODHD API的请求。
- 服务器将工具请求转发给EODHD,并将响应返回给您的MCP客户端。
- 默认情况下,服务器不会持久化或缓存您的提示或EODHD响应。
- 所有数据处理和保留最终都受EODHD自己的政策和您的订阅计划的约束。
详情请参阅EODHD的官方隐私政策: EODHD隐私政策
通过使用此MCP服务器,您同意通过它获取的任何数据都受EODHD隐私政策和服务条款的约束。
许可证
该项目根据MIT许可证获得许可。有关详细信息,请参阅许可证。
贡献
欢迎捐款:
为bug、问题或功能请求打开一个问题。
如果您计划进行更大的更改(新工具、新的Marketplace集成等),请描述 你在这个问题上的方法是第一位的。
在test/all_tests.py(以及可选的all_tests_beta.py)中添加或更新测试,以涵盖 新行为。
运行HTTP/SSE/STDIO测试客户端以确保一切通过。
提交一份引用相关问题的PR。
特别是包含日志、工具参数和清晰再现步骤的Bug报告 有帮助。
