关于 mcp-server-fear-greed
mcp-server-fear-greed 为金融数据工作流和 MCP 客户端提供 CNN 美国股市 Fear & Greed Index。它同时返回结构化内容和文本,并支持当前指标、历史对比及各项市场因子。
主要功能
- 01获取实时情绪指数
- 02比较前收盘、周、月和年数据
- 03查看各项市场指标得分
- 04输出结构化 Markdown 或 JSON
适用场景
- 01在金融分析中检查市场情绪
- 02比较当前指数与历史区间
- 03将市场指标交给 MCP 客户端处理
MCP 相关
该 MCP 服务通过 `get_fear_greed_index` 工具提供 CNN Fear & Greed Index 和相关市场指标。支持 stdio、本地进程内调用,以及 SSE 或 Streamable HTTP 远程连接。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
工具
1收录的工具列表 · 更新于 2 周前
此工具无需参数。
详细介绍
MCP 服务恐惧与贪婪指数
一个 Model Context Protocol(MCP)服务,可访问美国股市的 CNN 恐惧与贪婪指数。此服务会获取实时市场情绪数据,并以 structuredContent 和文本 content 两种形式呈现。
功能
- 实时恐惧与贪婪指数:获取当前市场情绪评分(0-100)
- 历史对比:查看前一日收盘、前一周、前一月和前一年的数据
- 详细的市场指标:获取各个组成部分的评分,包括:
- 市场动能(S&P 500 和 S&P 125)
- 股票价格强度和广度
- 看跌/看涨期权比率
- 市场波动率(VIX)
- 垃圾债券需求
- 避险资产需求
- 灵活的输出:可选择结构化 Markdown 或原始 JSON 格式
要求
- Node.js 18 或更高版本
- VS Code、Cursor、Windsurf、Claude Desktop 或其他 MCP 客户端
快速开始
本地(Stdio)
首先,在客户端中安装恐惧与贪婪 MCP 服务。典型配置如下:
{
"mcpServers": {
"mcp-server-fear-greed": {
"command": "npx",
"args": [
"-y",
"mcp-server-fear-greed@latest"
]
}
}
}
在 VS Code 中安装
你也可以使用 VS Code CLI 安装 mcp-server-fear-greed MCP 服务:
# For VS Code
code --add-mcp '{"name":"mcp-server-fear-greed","command":"npx","args":["mcp-server-fear-greed@latest"]}'
安装后,便可在 VS Code 中将恐惧与贪婪 MCP 服务与 GitHub Copilot Agent 搭配使用。
在 Cursor 中安装
前往 Cursor Settings -> MCP -> Add new MCP Server。名称可自行设置,命令填写 npx mcp-server-fear-greed。你也可以点击 Edit,验证配置或添加类似命令的参数。
{
"mcpServers": {
"mcp-server-fear-greed": {
"command": "npx",
"args": [
"mcp-server-fear-greed@latest"
]
}
}
}
在 Windsurf 中安装
请参阅 Windsurf MCP 文档。使用以下配置:
{
"mcpServers": {
"mcp-server-fear-greed": {
"command": "npx",
"args": [
"mcp-server-fear-greed@latest"
]
}
}
}
在 Claude Desktop 中安装
请参阅 MCP 安装指南,并使用以下配置:
{
"mcpServers": {
"mcp-server-fear-greed": {
"command": "npx",
"args": [
"mcp-server-fear-greed@latest"
]
}
}
}
远程(SSE / Streamable HTTP)
同时,使用 --port $your_port 参数启动浏览器 MCP,即可将其转换为 SSE 和 Streamable HTTP 服务。
# normal run remote mcp server
npx mcp-server-fear-greed --port 8089
你可以使用以下两个 MCP 服务远程端点之一:
- Streamable HTTP(推荐):
http://127.0.0.1::8089/mcp - SSE:
http://127.0.0.1::8089/sse
然后,在 MCP 客户端配置中,将 url 设置为 SSE 端点:
{
"mcpServers": {
"mcp-server-fear-greed": {
"url": "http://127.0.0.1::8089/sse"
}
}
}
将 url 设置为 Streamable HTTP 端点:
{
"mcpServers": {
"mcp-server-fear-greed": {
"type": "streamable-http", // If there is MCP Client support
"url": "http://127.0.0.1::8089/mcp"
}
}
}
内存中调用
如果你的 MCP 客户端基于 JavaScript / TypeScript 开发,可以直接使用进程内调用,避免要求用户安装命令行界面才能使用恐惧与贪婪 MCP。
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
// type: module project usage
import { createServer } from 'mcp-server-fear-greed';
// commonjs project usage
// const { createServer } = await import('mcp-server-fear-greed')
const client = new Client(
{
name: 'test fear greed client',
version: '1.0',
},
{
capabilities: {},
},
);
const server = createServer();
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
await Promise.all([
client.connect(clientTransport),
server.connect(serverTransport),
]);
// list tools
const result = await client.listTools();
console.log(result);
// call tool
const toolResult = await client.callTool({
name: 'get_fear_greed_index',
arguments: {
format: 'json'
},
});
console.log(toolResult);
API 参考
工具:get_fear_greed_index
获取当前恐惧与贪婪指数及相关市场指标。
参数
format(可选):输出格式"structured"(默认):返回包含整理后数据的格式化 Markdown"json":返回原始 JSON 数据
使用示例
// Get structured output
await client.callTool("get_fear_greed_index");
// Get JSON output
await client.callTool("get_fear_greed_index", { format: "json" });
响应结构
该工具按以下结构返回数据:
{
"fear_and_greed": {
"score": 75,
"rating": "greed",
"timestamp": "2025-07-18T23:59:57+00:00",
"previous_close": 75.31,
"previous_1_week": 75.26,
"previous_1_month": 54.29,
"previous_1_year": 45.94
},
"fear_and_greed_historical": {
"timestamp": 1752883197000,
"score": 75,
"rating": "greed"
},
"market_momentum_sp500": {
"timestamp": 1752871567000,
"score": 61.2,
"rating": "greed"
},
"market_momentum_sp125": {
"timestamp": 1752871567000,
"score": 61.2,
"rating": "greed"
},
"stock_price_strength": {
"timestamp": 1752883197000,
"score": 80,
"rating": "extreme greed"
},
"stock_price_breadth": {
"timestamp": 1752883197000,
"score": 84,
"rating": "extreme greed"
},
"put_call_options": {
"timestamp": 1752871897000,
"score": 79.6,
"rating": "extreme greed"
},
"market_volatility_vix": {
"timestamp": 1752869701000,
"score": 50,
"rating": "neutral"
},
"market_volatility_vix_50": {
"timestamp": 1752869701000,
"score": 50,
"rating": "neutral"
},
"junk_bond_demand": {
"timestamp": 1752877800000,
"score": 88.8,
"rating": "extreme greed"
},
"safe_haven_demand": {
"timestamp": 1752868799000,
"score": 81.4,
"rating": "extreme greed"
}
}
恐惧与贪婪指数评级
该指数采用以下评级标准:
- 0-25:极度恐惧
- 26-45:恐惧
- 46-55:中性
- 56-75:贪婪
- 76-100:极度贪婪
开发
npm run dev
错误处理
该服务包含全面的错误处理机制:
- 捕获并报告网络请求失败
- 妥善处理无效的 API 响应
- 使用合理的默认值填充缺失的数据字段
- 所有错误均包含描述性消息
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。