nyt mcp
MCP服务器 《纽约时报》API.
工具
| 工具 | 纽约时报API | 说明 |
|---|---|---|
search_articles | 文章搜索 | 使用Lucene过滤器、日期范围、分页按关键字搜索 |
get_top_stories | 热门故事 | 按部分(家庭、世界、科学等)列出的当前热门故事 |
get_most_popular | 最受欢迎 | 最受电子邮件/分享/查看的文章(1、7或30天) |
get_newswire | Times Newswire | 刚刚发表的文章直播 |
get_bestsellers | 书籍 | 《纽约时报》畅销书排行榜(精装小说等) |
get_archive | 存档 | 1851年以来任何月份的文章元数据 |
read_article | *(刮擦)* | 获取并提取《纽约时报》文章URL的全文 |
设置
- 获取API密钥 在 .
- 设置
API_KEY环境变量(或创建.env文件):
export API_KEY=your-nyt-api-key安装
无需安装,只需运行 uvx:
# From PyPI (after publishing)
uvx nyt-mcp
# From GitHub
uvx --from git+https://github.com/joe5saia/nyt-mcp nyt-mcp或永久安装:
uv tool install nyt-mcp
# or from GitHub:
uv tool install git+https://github.com/joe5saia/nyt-mcp作为MCP服务器运行
克劳德代码
claude mcp add nyt-mcp -- uvx nyt-mcp安培
添加到MCP配置中(例如。 ~/.config/amp/settings.json):
{
"mcpServers": {
"nyt-mcp": {
"command": "uvx",
"args": ["nyt-mcp"],
"env": {
"API_KEY": "your-nyt-api-key"
}
}
}
}独立(stdio)
API_KEY=your-key uvx nyt-mcp发展
uv run ruff check src/ tests/ # lint
uv run ruff format src/ tests/ # format
uv run ty check src/ # type check
uv run pytest tests/ -v # test