这是一个MCP服务器,它将大语言模型(LLM)与《卫报》自1999年以来的存档连接起来,其中包含超过190万篇文章的全文内容。该服务器可用于获取实时头条新闻、进行新闻分析以及开展历史研究。
本服务器可将大语言模型与《卫报》的海量文章存档相连,为用户提供丰富的新闻资源,满足实时资讯获取、新闻分析和历史研究等多方面需求。
需要一个《卫报》开放平台的API密钥。你可以在此处获取:https://open-platform.theguardian.com/access/
《卫报》为存档的非商业使用提供了慷慨的API访问权限,包括每秒1次调用和每天500次调用。(详见完整的条款与条件。商业使用需要不同的许可证。)
安装命令如下:
npx guardian-mcp-server
MCP客户端配置示例:
{
"mcpServers": {
"guardian": {
"command": "npx",
"args": ["guardian-mcp-server"],
"env": {
"GUARDIAN_API_KEY": "your-key-here"
}
}
}
}
以下是使用不同API接口的示例:
guardian_search:搜索存档文章使用detail_level参数来确定API响应的大小并优化性能:minimal(仅标题)、standard(标题、摘要和元数据)或full(所有内容,包括文章全文)。
{
"query": "climate change",
"section": "environment",
"detail_level": "minimal",
"from_date": "2024-01-01",
"order_by": "newest"
}
guardian_get_article:获取单篇文章{
"article_id": "https://www.theguardian.com/politics/2024/dec/01/example",
"truncate": false // 默认返回完整内容
}
guardian_search_tags:搜索《卫报》的5万多个手动分配的标签guardian_find_related:查找与某篇文章相似的文章(通过共享标签)guardian_get_article_tags:返回分配给任何文章的标签{
"article_id": "politics/2024/example"
}
guardian_lookback:按日期进行历史搜索guardian_content_timeline:分析特定时间段内《卫报》关于特定主题的内容{
"query": "artificial intelligence",
"from_date": "2024-01-01",
"to_date": "2024-06-30",
"interval": "month"
}
guardian_top_stories_by_date:估算编辑重要性;《卫报》的API本身不会返回区分头版故事和内页简报的数据,此接口试图综合得出一个排名{
"date": "2016-06-24", // 英国脱欧公投日
"story_count": 5
}
guardian_topic_trends:通过相关性分析和竞争排名比较多个主题随时间的变化{
"topics": ["artificial intelligence", "climate change", "brexit"],
"from_date": "2023-01-01",
"to_date": "2024-12-31",
"interval": "quarter"
}
guardian_author_profile:生成《卫报》记者的简介以及他们报道的领域{
"author": "George Monbiot",
"analysis_period": "2024"
}
guardian_longread:搜索《卫报》的长篇特写系列guardian_browse_section:浏览特定板块的近期文章guardian_get_sections:获取《卫报》的所有可用板块guardian_search_by_length:按字数过滤文章guardian_search_by_author:按作者搜索文章guardian_recommend_longreads:根据用户兴趣获取个性化的长篇特写推荐{
"count": 3,
"context": "I'm researching technology, especially AI",
"topic_preference": "digital culture"
}
本项目采用MIT许可证。