蓝色报告MCP服务器
一个简单、快速的MCP服务器,可访问以下媒体的热门新闻报道 蓝色报告 -Bluesky的顶部链接,每小时更新一次。
特性
- 三个时段:获取每小时、每天或每周的新闻
- 结构化输出:干净、结构化的数据,包括标题、摘要和网址
- 快速性能:响应时间不超过2秒,开销最小
- 实时数据:从The Blue Report网站获取实时数据
- 错误处理:当网站不可用时,优雅的回退
先决条件
- Python 3.11或更高版本
- 紫外线 包管理器
安装
- 克隆存储库:
git clone
cd bluesky_bluereport- 使用uv安装依赖项:
uv sync用法
发展模式
使用MCP检查器测试服务器:
uv run mcp dev server.py这将在以下时间启动MCP检查器http://127.0.0.1:6274在那里你可以测试工具。
Claude桌面集成
在Claude Desktop中安装服务器:
uv run mcp install server.py直接执行
直接运行服务器:
uv run python server.py测试
运行测试脚本以验证功能:
uv run python test_server.py可用工具
1. get_hourly_news()
获取过去一小时《蓝色报道》的头条新闻。
2. get_daily_news()
获取过去24小时《蓝色报告》的头条新闻。
3. get_weekly_news()
获取过去7天《蓝色报告》的头条新闻。
数据结构
每个工具返回一个 NewsResponse 与:
{
"stories": [
{
"headline": "Story headline",
"summary": "Story summary with source and engagement",
"published_at": "2025-01-27T10:00:00",
"source": "The Blue Report",
"url": "https://example.com/story",
"category": "Bluesky Trending"
}
],
"count": 10,
"time_period": "daily",
"retrieved_at": "2025-01-27T10:00:00"
}建筑
- FastMCP服务器:使用FastMCP实现主服务器
- 蓝色报告客户端:用于网站抓取的HTTP客户端
- 数据模型:结构化输出的Pydantic模型
- HTML解析器:BeautifulSoup用于解析《蓝色报告》网站
- 错误处理:优雅的后退和伐木
演出
- 服务器启动:\=1.12.3` -MCP-SDK
httpx>=0.28.1-HTTP客户端pydantic>=2.11.7-数据验证beautifulsoup4>=4.13.4-HTML解析requests>=2.31.0-HTTP请求
发展
项目结构
bluesky_bluereport/
├── plans/
│ ├── requirements.md
│ └── plan.md
├── devlog/
│ └── mcp_server_development.md
├── src/
│ ├── __init__.py
│ ├── server.py
│ ├── blue_report.py
│ └── models.py
├── pyproject.toml
├── server.py
├── test_server.py
└── README.md开发命令
# Install dependencies
uv sync
# Run tests
uv run python test_server.py
# Start MCP Inspector
uv run mcp dev server.py
# Install in Claude Desktop
uv run mcp install server.py
# Add new dependency
uv add package-name
# Add dev dependency
uv add --dev package-name添加新功能
- 更新中的要求
plans/requirements.md - 实施变更
src/模块 - 测试用
uv run python test_server.py - 更新开发日志
devlog/ - 使用MCP检查员进行测试
许可证
MIT许可证-有关详细信息,请参阅许可证文件。
