NYT MCP Server

by aovabo

314 downloads
Not rated
GitHub

About

A Message Concentrator Protocol (MCP) server that provides a unified, simple interface to the New York Times APIs. This server simplifies interaction with multiple NYT APIs through a single endpoint.

Details

Author
aovabo
Downloads
314
Categories
Other

- Single endpoint for all NYT API interactions
- Clean, formatted API responses
- Real-time news feed via Times Wire
- Flexible article search capabilities
- Built-in health check endpoint
- Robust error handling

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name NYT MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, create and activate a Python virtual environment, install dependencies from requirements.txt, create an .env file with your NYT API key and server configuration, then run python src/server.py. The server exposes a POST endpoint at /mcp/message for all NYT API interactions and a GET /health endpoint for monitoring.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "nyt mcp server": {
            "nyt-mcp-server": {
                "command": "python",
                "args": [
                    "-m",
                    "venv",
                    "venv"
                ]
            }
        }
    }
}

McpServers

{
    "nyt-mcp-server": {
        "command": "python",
        "args": [
            "-m",
            "venv",
            "venv"
        ]
    }
}

NYT MCP Server

A Message Concentrator Protocol (MCP) server that provides a unified, simple interface to the New York Times APIs. This server simplifies interaction with multiple NYT APIs through a single endpoint.

Overview

This MCP server acts as a unified gateway to various New York Times APIs, including:
- Article Search
- Top Stories
- Times Wire (Real-time news)
- Most Popular
- Archive
- Books API

Features

- Single Endpoint: Access all NYT APIs through one consistent interface
- Clean Responses: Formatted and simplified API responses
- Real-time Updates: Live news feed via Times Wire
- Flexible Search: Comprehensive article search capabilities
- Error Handling: Robust error management
- Health Monitoring: Built-in health check endpoint
- Easy Integration: Simple to integrate with any application

Requirements

- Python 3.8+
- NYT API Key (get one at NYT Developer Portal)
- Required Python packages (see requirements.txt)

Quick Start

1. Clone the repository:

git clone https://github.com/your-username/nyt-mcp-server.git
cd nyt-mcp-server

2. Create and activate virtual environment:

python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate

3. Install dependencies:

pip install -r requirements.txt

4. Create .env file:

NYT_API_KEY=your_api_key_here
MCP_PORT=8000
MCP_HOST=0.0.0.0

5. Run the server:

python src/server.py

Project Structure

nyt-mcp-server/
├── src/
│   ├── __init__.py
│   ├── server.py
│   └── config.py
├── .env
├── .gitignore
├── requirements.txt
└── README.md

API Documentation

Base URL

http://localhost:8000

Endpoints

POST /mcp/message

Main endpoint for all NYT API interactions.

GET /health

Health check endpoint.

Example Usage

```python
import httpx
import asyncio

async def get_news():
async with httpx.AsyncClient() as client:
response = await client.post(
"http://localhost:8000/mcp/message",
json={
"message_type": "times_wire",
"content": {"limit": 5},
"timestamp": "2025-03-05T21:00:00Z"
}
)
return response.json()

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.