NYT
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"aovabo-nyt-mcp-server": {
"command": "python",
"args": [
"src/server.py"
],
"env": {
"MCP_HOST": "0.0.0.0",
"MCP_PORT": "8000",
"NYT_API_KEY": "YOUR_API_KEY"
}
}
}
}You will run a Python-based MCP server that acts as a single gateway to New York Times APIs, simplifying how you query articles, top stories, real-time news, most popular items, archive data, and the Books API from a unified endpoint.
How to use
Use a dedicated MCP client to interact with the NYT MCP server through the single /mcp/message endpoint. You send a message that specifies the desired NYT API function (such as article_search or times_wire) along with parameters, and the server returns a clean, formatted response. You can rely on the health endpoint to verify the server is up and ready to serve requests.
How to install
Prerequisites you need to meet before starting:
- Python 3.8+ must be installed on your system
- pip must be available to install dependencies
- A valid NYT API key is required to access NYT APIs
Follow these steps to set up and run the MCP server locally:
git clone https://github.com/your-username/nyt-mcp-server.git
cd nyt-mcp-server
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
# Create environment configuration
cat > .env << 'ENV'
NYT_API_KEY=your_api_key_here
MCP_PORT=8000
MCP_HOST=0.0.0.0
ENV
# Run the server
python src/server.py
Additional configuration and security notes
The server expects environment configuration to provide your NYT API key and how the MCP server should bind to network interfaces. Keep your NYT API key private and avoid committing the .env file. Use environment variables for sensitive data.
Troubleshooting and tips
- If the server does not start, verify Python 3.8+ is active and the virtual environment is activated.
- Ensure your NYT_API_KEY is correctly set in the .env file or as an environment variable.
- Check that the host and port are accessible (MCP_HOST and MCP_PORT) and that no firewall blocks port 8000 by default.
- Use the health endpoint /health to confirm the server status after startup.
Available tools
POST /mcp/message
Main endpoint for all NYT API interactions. You send a structured message describing the desired NYT API operation and parameters, and receive a unified response.
GET /health
Health check endpoint to verify the MCP server is running and healthy.
article_search
Perform a comprehensive search for NYT articles with query, sort, and pagination options.
top_stories
Retrieve top stories for a specific section.
times_wire
Receive real-time updates from Times Wire with configurable limits and sources.
most_popular
Fetch most popular NYT items by type and time period.
archive
Access NYT archive data by year and month.
books
Query the Books API for lists like hardcover-fiction.