使用说明
趋势服务器
MCP服务器,用于从Reddit和谷歌趋势中获取趋势主题,并生成PDF报告。
特性
- 从Reddit获取热门话题
- 从谷歌趋势中获取热门话题
- 从趋势新闻数据生成PDF报告
- 将PDF上传到Digital Ocean Spaces(或任何S3兼容存储)
安装
poetry install
环境变量
数字海洋空间配置(推荐)
# Required
SPACES_BUCKET=your-space-name
SPACES_KEY=your-spaces-access-key
SPACES_SECRET=your-spaces-secret-key
SPACES_ENDPOINT_URL=https://nyc3.digitaloceanspaces.com # Replace nyc3 with your region
# Optional - for CDN URLs
SPACES_CDN_BASE_URL=https://your-cdn-domain.com
AWS S3配置(备选)
如果您使用的是AWS S3而不是Digital Ocean Spaces:
# Required
SPACES_BUCKET=your-bucket-name
AWS_ACCESS_KEY_ID=your-aws-access-key
AWS_SECRET_ACCESS_KEY=your-aws-secret-key
# No endpoint URL needed for AWS S3
# Optional - for CloudFront CDN URLs
SPACES_CDN_BASE_URL=https://your-cloudfront-domain.cloudfront.net
用法
作为MCP服务器
运行服务器:
poetry run mcp run trending_server.server:app
可用工具
get_reddit_trending_topics(limit: int = 10)
从Reddit获取热门话题。
get_google_trending_topics(limit: int = 10)
从谷歌趋势中获取热门话题。
create_trending_news_pdf(asOf: str, trending: list[dict], ...)
从趋势新闻数据生成PDF报告并将其上传到存储。
参数:
asOf-ISO-8601时间戳trending-一系列趋势项目,包括:title-故事标题summary-故事描述category-其中之一:娱乐、商业、政治、体育audience-目标受众(例如,“美国”、“弗吉尼亚”)items-源URL数组
bucket_name-可选(如果没有提供,则使用env-var)cdn_base_url-可选(如果没有提供,则使用env-var)endpoint_url-可选(如果没有提供,则使用env-var)filename-可选(如果未提供,则自动生成)
退货: 上传PDF的URL(如果配置了CDN URL,否则为直接存储URL)
数字海洋空间设置
- 在您的Digital Ocean帐户中创建空间
- 生成空间访问密钥(设置→ API → 空格键)
- 记下您的空间名称和区域
- 如上所示设置环境变量
- (可选)为您的共享空间启用CDN并设置
SPACES_CDN_BASE_URL
许可证
麻省理工学院
