NYTimes MCP
Enables access to New York Times content through 5 specialized tools including article search, real-time news wire, most popular articles, monthly archives, and bestseller lists.
README
NYTimes MCP
A FastMCP-based Model Context Protocol (MCP) server that provides access to the New York Times APIs through native MCP tools and resources.
Overview
This MCP server provides 5 specialized tools for accessing various New York Times APIs:
- Article Search - Search the NYT article archive
- News Wire - Real-time news feed
- Most Popular - Most viewed/shared/emailed articles
- Archive - Monthly article archives
- Bestseller Lists - NYT book bestseller lists
Features
- Native MCP Protocol: Built with FastMCP for seamless integration with MCP clients
- 5 Specialized Tools: One tool per NYT API endpoint for maximum flexibility
- 3 Reference Resources: Discoverable resources for available sections, lists, and API limits
- Formatted Responses: Clean, simplified responses for most endpoints
- Type-Safe Parameters: Full type validation on all tool parameters
- Error Handling: Robust error management with detailed error messages
Requirements
- Python 3.13+
- NYT API Key (get one at NYT Developer Portal)
- uv for package management
- Note: if using pip, you should do yourself a favor and do
pip install uv, then feel free to follow the rest of this guide.
- Note: if using pip, you should do yourself a favor and do
Quickest start (Agent MCP settings)
If using Claude Desktop, Claude Code, Gemini CLI, Qwen Code, etc, simply add the following to your MCP settings JSON file, replacing your_api_key_here with your actual NYT API key.
{
"mcpServers": {
"nytimes": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/jeffmm/nytimes-mcp.git",
"nytimes-mcp"
],
"env": {
"NYT_API_KEY": "your_api_key_here"
}
}
}
}
Your agent tool should now be able to access the NYTimes MCP server tools.
Quick Start (manual)
1. Clone and Install
git clone https://github.com/your-username/nytimes-mcp.git
cd nytimes-mcp
2. Install with uv
uv tool install .
3. Configure API Key
Ensure you have your NYT API key in your environment.
export NYT_API_KEY=your_api_key_here
Alternatively, create a .env file:
NYT_API_KEY=your_api_key_here
4. Run the Server
Development Mode (with Inspector)
fastmcp dev src/nytimes_mcp/server.py:mcp
This starts the MCP Inspector UI for testing tools interactively.
Production Mode
uvx nytimes-mcp
Project Structure
nytimes-mcp/
├── src/
│ └── nytimes_mcp/
│ ├── __init__.py
│ ├── server.py # FastMCP server with tool/resource definitions
│ ├── tools.py # NYT API tool implementations
│ ├── resources.py # MCP resource definitions
│ ├── nyt_client.py # NYT API client logic
│ ├── utils.py # Response formatting utilities
│ └── config.py # Configuration settings
├── .env
├── .gitignore
├── pyproject.toml
├── CLAUDE.md
└── README.md
Available MCP Tools
1. search_articles
Search NYT articles by query, date range, and other criteria.
Parameters:
query(string, required): Search querysort(string, optional): "newest" or "oldest" (default: "newest")begin_date(string, optional): Start date in YYYYMMDD formatend_date(string, optional): End date in YYYYMMDD formatpage(int, optional): Page number for pagination
Returns: Formatted response with articles array containing headline, snippet, web_url, and pub_date
2. get_latest_news
Get the latest news items from the NYT news wire.
Parameters:
limit(int, optional): Number of items to return (default: 20)offset(int, optional): Pagination offset (default: 0)source(string, optional): "nyt" or "inyt" (default: "nyt")section(string, optional): relevant section, e.g. "u.s.", "technology" (default: "all")- See
nyt://reference/sectionsresource for available sections
- See
Returns: Formatted response with news_items array
3. get_most_popular
Get the most popular NYT articles.
Parameters:
type(string, optional): "viewed", "shared", or "emailed" (default: "viewed")time_period(string, optional): "1", "7", or "30" days (default: "1")- See
nyt://reference/popular-typesresource for available options
- See
Returns: Formatted response with articles array
4. get_archive
Get NYT articles from a specific month and year archive.
Parameters:
year(int, optional): Year (default: current year)month(int, optional): Month 1-12 (default: current month)
Returns: Full NYT archive API response (unformatted)
5. get_bestseller_list
Get NYT bestseller lists.
Parameters:
list(string, optional): List name (default: "hardcover-fiction")- See
nyt://reference/bestseller-listsresource for available list names
- See
offset(int, optional): Pagination offset (default: 0)
Returns: Full NYT Books API response (unformatted)
Available MCP Resources
Resources provide reference data that can be accessed by MCP clients:
nyt://reference/sections- Available sections for top_storiesnyt://reference/bestseller-lists- Available bestseller list namesnyt://reference/api-limits- NYT API rate limits and usage information
Using with MCP Clients
Claude Desktop (or most other CLI tools)
Add to your MCP configuration JSON:
{
"mcpServers": {
"nytimes": {
"command": "uvx",
"args": ["nytimes-mcp"],
"env": {
"NYT_API_KEY": "your_api_key_here"
}
}
}
}
Or if installed locally
{
"mcpServers": {
"nytimes": {
"command": "uvx",
"args": ["nytimes-mcp"],
"env": {
"NYT_API_KEY": "your_api_key_here"
}
}
}
}
Development
Install Development Dependencies
uv sync
Run Tests
uv run pytest
Development Server with Inspector
uv run fastmcp dev src/nytimes_mcp/server.py:mcp
This opens the MCP Inspector for interactive testing.
API Rate Limits
The NYT API has rate limits (approximately 5 requests/minute, 500 requests/day maximum). Use the nyt://reference/api-limits resource to check current limits.
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
MIT License
Security Note
- Never commit your
.envfile - Keep your NYT API key private
- Use environment variables for sensitive data
Contact
Create an issue for bug reports or feature requests.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。