一个强大的模型上下文协议(MCP)服务器,通过yahooquery库提供全面访问雅虎财经数据的功能。该服务器提供了广泛的金融数据、市场信息和股票分析工具,可以与AI助手和应用程序集成。
本软件仅供教育和信息用途
Zentickr 提供金融数据和市场信息访问,但不提供财务建议。通过此服务器生成的数据、分析和见解不应被视为:
关键点:
数据准确性: 尽管我们力求准确,但金融数据可能会延迟、不完整或存在错误。请始终从官方来源验证关键信息。
克隆仓库
git clone <your-repository-url>
cd Zentickr
创建虚拟环境
python -m venv env
source env/bin/activate # 在 Windows 上:env\Scripts\activate
安装依赖项
pip install -r requirements.txt
运行服务器
选项 1:使用运行脚本(推荐)
最简单的方法是使用提供的运行脚本:
Windows:
.\run_server.bat
Unix/Linux/macOS:
./run_server.sh
这些脚本会自动激活虚拟环境并运行服务器。
选项 2:手动执行
激活虚拟环境:
source env/bin/activate # 在 Windows 上:env\Scripts\activate
运行服务器:
python run_server.py
服务器通过标准 I/O 传输进行通信,并可与兼容 MCP 的客户端集成:
python run_server.py
这里有一些实际工作的例子,展示了 Zentickr 的能力:
查询: 获取苹果、微软和谷歌的当前财务数据
get_financial_data("AAPL,MSFT,GOOGL")
样本响应:
{
"AAPL": {
"currentPrice": 189.84,
"targetHighPrice": 250.0,
"targetLowPrice": 158.0,
"targetMeanPrice": 201.32,
"recommendationMean": 2.1,
"recommendationKey": "buy",
"numberOfAnalystOpinions": 35,
"totalCash": 62639001600,
"totalDebt": 104590000128,
"totalRevenue": 394328993792,
"debtToEquity": 184.37,
"revenuePerShare": 25.42,
"returnOnAssets": 0.22689,
"returnOnEquity": 1.56456,
"grossProfits": 169148000000,
"freeCashflow": 84726874112,
"operatingCashflow": 118287998976,
"earningsGrowth": 0.11,
"revenueGrowth": 0.061,
"grossMargins": 0.45962,
"ebitdaMargins": 0.33826,
"operatingMargins": 0.30743
}
}
查询: 获取苹果过去6个月的日价格历史
get_historical_prices("AAPL", period="6mo", interval="1d")
样本响应:
[
{
"symbol": "AAPL",
"date": "2024-12-18",
"open": 188.89,
"high": 190.32,
"low": 188.44,
"close": 189.84,
"volume": 45234567,
"adjclose": 189.84
},
{
"symbol": "AAPL",
"date": "2024-12-17",
"open": 187.23,
"high": 189.15,
"low": 186.98,
"close": 188.89,
"volume": 52341789,
"adjclose": 188.89
}
]
查询: 获取特斯拉的详细公司信息
get_company_profile("TSLA")
get_company_officers("TSLA")
样本响应:
{
"asset_profile": {
"TSLA": {
"address1": "1 Tesla Road",
"city": "Austin",
"state": "TX",
"zip": "78725",
"country": "United States",
"phone": "512 516 8177",
"website": "https://www.tesla.com",
"industry": "Auto Manufacturers",
"sector": "Consumer Cyclical",
"longBusinessSummary": "特斯拉公司设计、开发、制造、租赁和销售电动汽车以及能源生产和存储系统...",
"fullTimeEmployees": 140473,
"companyOfficers": [
{
"maxAge": 1,
"name": "Mr. Elon R. Musk",
"age": 52,
"title": "首席执行官兼董事",
"yearBorn": 1971,
"fiscalYear": 2023,
"totalPay": 0,
"exercisedValue": 0,
"unexercisedValue": 0
}
]
}
}
}
查询: 获取Netflix的季度收入报表
get_income_statement("NFLX", frequency="quarterly")
样本响应:
[
{
"symbol": "NFLX",
"asOfDate": "2024-09-30",
"periodType": "3M",
"TotalRevenue": 9824569000,
"CostOfRevenue": 5767234000,
"GrossProfit": 4057335000,
"OperatingExpense": 2892456000,
"OperatingIncome": 1164879000,
"NetIncome": 2364391000,
"EPS": 5.4,
"DilutedEPS": 5.38
}
]
查询: 获取亚马逊的当前分析师推荐
get_recommendations("AMZN")
get_recommendation_trend("AMZN")
样本响应:
{
"recommendations": [
{
"firm": "摩根士丹利",
"toGrade": "超配",
"fromGrade": "标配",
"action": "上调",
"date": "2024-12-15"
},
{
"firm": "高盛",
"toGrade": "买入",
"fromGrade": "买入",
"action": "维持",
"date": "2024-12-10"
}
],
"recommendation_trend": {
"period": "0m",
"strongBuy": 15,
"buy": 25,
"hold": 8,
"sell": 1,
"strongSell": 0
}
}
查询: 搜索与“人工智能”相关的公司
search_symbols("nvidia")
样本响应:
[
{
"symbol": "NVDA",
"name": "英伟达公司",
"type": "EQUITY",
"exchange": "NMS"
},
{
"symbol": "NVDL",
"name": "GraniteShares 1.5x Long NVDA Daily ETF",
"type": "ETF",
"exchange": "NMS"
}
]
查询: 获取环境、社会和治理评分
get_esg_scores("MSFT")
样本响应:
{
"MSFT": {
"totalEsg": 18.12,
"environmentScore": 2.89,
"socialScore": 8.45,
"governanceScore": 6.78,
"esgPerformance": "超越",
"peerCount": 157,
"peerGroup": "软件",
"percentile": 8.92,
"peerEsgScorePerformance": {
"min": 7.32,
"avg": 24.56,
"max": 58.43
}
}
}
查询: 获取即将到来的收益和事件
get_calendar_events("AAPL")
样本响应:
{
"AAPL": {
"earnings": {
"earningsDate": ["2025-01-30"],
"earningsAverage": 2.35,
"earningsLow": 2.28,
"earningsHigh": 2.42,
"revenueAverage": 124500000000,
"revenueLow": 121200000000,
"revenueHigh": 127800000000
},
"exDividendDate": "2024-11-08",
"dividendDate": "2024-11-14"
}
}
查询: 比较科技巨头的关键指标
get_valuation_measures("AAPL,MSFT,GOOGL,AMZN,META")
样本响应:
{
"AAPL": {
"marketCap": 2945234567890,
"enterpriseValue": 2987654321098,
"trailingPE": 28.42,
"forwardPE": 25.67,
"pegRatio": 2.34,
"priceToBook": 45.23,
"priceToSalesTrailing12Months": 7.89
},
"MSFT": {
"marketCap": 2834567890123,
"enterpriseValue": 2845678901234,
"trailingPE": 32.15,
"forwardPE": 28.94,
"pegRatio": 1.98,
"priceToBook": 12.45,
"priceToSalesTrailing12Months": 11.23
}
}
查询: 获取实时5分钟间隔的日内交易数据
get_historical_prices("SPY", period="1d", interval="5m")
样本响应:
[
{
"symbol": "SPY",
"date": "2025-06-18 09:30:00-04:00",
"open": 542.15,
"high": 542.89,
"low": 541.78,
"close": 542.34,
"volume": 2456789
},
{
"symbol": "SPY",
"date": "2025-06-18 09:35:00-04:00",
"open": 542.34,
"high": 2025-06-18 09:35:00-04:00,
"low": 542.01,
"close": 542.98,
"volume": 1987654
}
]
# 获取当前财务数据
get_financial_data("AAPL,GOOGL,MSFT")
# 获取当前股票价格
get_price_data("AAPL")
# 搜索股票符号
search_symbols("Apple Inc")
# 获取年度收入报表
get_income_statement("AAPL", frequency="annual")
# 获取季度资产负债表
get_balance_sheet("AAPL", frequency="quarterly")
# 获取现金流量表
get_cash_flow("AAPL", frequency="annual")
# 获取1年每日价格
get_historical_prices("AAPL", period="1y", interval="1d")
# 获取自定义日期范围
get_historical_prices("AAPL", start_date="2024-01-01", end_date="2024-12-31")
# 获取日内数据
get_historical_prices("AAPL", period="1d", interval="5m")
# 获取公司概况和详情
get_company_profile("AAPL")
# 获取执行团队信息
get_company_officers("AAPL")
# 获取估值指标
get_valuation_measures("AAPL")
# 获取分析师推荐
get_recommendations("AAPL")
# 获取收益数据和趋势
get_earnings("AAPL")
get_earnings_trend("AAPL")
# 获取机构持股
get_institution_ownership("AAPL")
# 获取ESG评分
get_esg_scores("AAPL")
服务器可以通过环境变量或修改服务器配置进行配置:
# 在您的MCP客户端配置中
{
"mcpServers": {
"zentickr": {
"command": "python",
"args": ["path/to/zentickr/run_server.py"],
"env": {}
}
}
}
要将此MCP服务器与Claude Desktop集成,请在Claude Desktop配置文件中添加以下配置:
选项 1:使用运行脚本(推荐)
{
"mcpServers": {
"zentickr": {