在工程化舆情监控系统中,多平台热点聚合已成标配,但浅层统计难以支撑决策深度。TrendRadar 的 MCP AI 分析工具链,提供 13 种标准化工具,通过自然语言接口实现舆情深度挖掘:从趋势预测到情感量化,支持 Claude Desktop、Cursor 等客户端无缝集成。该工具链不依赖特定模型,基于 Model Context Protocol (MCP) 协议,确保跨客户端兼容性与可扩展性。
核心优势在于工具的分类设计与参数化调用,避免了传统 API 的碎片化。工具分为 5 类:基础查询(3 种)、智能检索(2 种)、高级分析(5 种)、数据洞察(2 种)、系统管理(1 种)。例如,get_latest_news 可快速拉取最新热点,参数包括 platforms(可选平台列表,如 ["zhihu", "weibo"])、limit(默认 50)、include_url(是否含链接)。证据显示,该工具直接访问本地 output 目录积累数据,支持 11 月测试数据集即时验证。
实际部署以 Docker 为核心,30 秒内完成。命令示例:
docker run -d --name trendradar-mcp \
-v ./config:/app/config:ro \
-v ./output:/app/output \
-e CRON_SCHEDULE="*/30 * * * *" \
wantcat/trendradar:latest
环境变量覆盖配置优先级最高:ENABLE_CRAWLER=true 开启爬虫、REPORT_MODE=incremental 设增量模式。MCP 服务启动用 uv run python -m mcp_server.server --transport http --port 3333,暴露 http://localhost:3333/mcp 接口。风险控制:端口冲突时改 --port 33333;数据不足用自带 11/1-15 日测试集。
集成清单按客户端分层:
- Cherry Studio (GUI,推荐新手):一键 STDIO 模式,5 分钟部署。配置 MCP Server 为项目路径,回复公众号 "mcp" 获图文教程。
- Claude Desktop:编辑
claude_desktop_config.json,STDIO 命令 ["uv", "--directory", "/path/to/TrendRadar", "run", "python", "-m", "mcp_server.server"]。
- Cursor:项目级
.cursor/mcp.json,HTTP 模式 url: "http://localhost:3333/mcp" 或 STDIO。
- Cline/Continue (VSCode):
~/.continue/config.json,添加 stdio/http transport。
- Claude Code CLI:
claude mcp add --transport http trendradar http://localhost:3333/mcp。
工程参数优化:
- 阈值设置:
analyze_topic_trend 的 threshold=3.0(热度阈值,默认过滤低频话题)、confidence_threshold=0.7(预测置信度)。
- 时间窗口:
time_window=24(小时,分析周期)、lookahead_hours=6(趋势预测前瞻)。
- 检索模式:
search_news 的 search_mode="keyword" 或 "semantic",threshold=0.6 控制相似度。
- 监控点:日志
docker logs trend-radar,检查 output 数据日期范围;MCP Inspector 测试工具列表(须见 13 工具)。
- 回滚策略:STDIO 失败切 HTTP;数据异常用
get_system_status 诊断。
实战案例:舆情预警系统集成。配置关键词 "AI+开源!广告",用 search_related_news_history 追踪历史关联(参数 query="TrendRadar", limit=20),情感分析 analyze_sentiment 输出正/负/中性比例。批量调用脚本:
import asyncio
from mcp_client import MCPClient
async def batch_analyze():
client = MCPClient("http://localhost:3333/mcp")
trends = await client.call("analyze_topic_trend", {"topic": "比特币", "date_range": {"start": "2025-11-20", "end": "2025-11-26"}})
sentiment = await client.call("analyze_sentiment", {"query": "AI热点"})
print(trends, sentiment)
输出 JSON 结构化,便于 Dashboard 渲染。生产阈值:max_news_per_keyword=10 限长推送,sort_by_position_first=true 优先配置顺序。
扩展风险:依赖 newsnow API,star 支持上游;高频查询设 granularity="day" 降负载。监控:trigger_crawl 手动刷新数据。
该工具链落地参数清单:
| 参数 |
默认值 |
工程建议 |
场景 |
| limit |
50 |
20 |
实时查询 |
| threshold |
0.6 |
0.7 |
相似检索 |
| granularity |
day |
hour |
精细趋势 |
| lookahead_hours |
6 |
12 |
长预测 |
| confidence_threshold |
0.7 |
0.8 |
高可靠 |
通过以上配置,舆情系统从聚合到洞察全链路自动化,决策响应时间降至分钟级。
资料来源:
[1] TrendRadar GitHub README:监控 35 个平台,提供基于 MCP 的 AI 分析(13 种工具)。
[2] 项目更新日志 v3.0.0:新增 MCP 模块,支持 Cherry Studio 等客户端。