MCP cover image
See in Github
2025-03-06

Un serveur de protocole de concentrateur de messages (MCP) qui fournit une interface simple et unifiée aux API du New York Times. Ce serveur simplifie l'interaction avec plusieurs API NYT via un seul point de terminaison.

1

Github Watches

1

Github Forks

0

Github Stars

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
  1. Create and activate virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Create .env file:
NYT_API_KEY=your_api_key_here
MCP_PORT=8000
MCP_HOST=0.0.0.0
  1. 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

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()

# Run the async function
asyncio.run(get_news())

Message Types

1. Article Search

{
    "message_type": "article_search",
    "content": {
        "query": "technology",
        "sort": "newest",
        "page": 0
    },
    "timestamp": "2025-03-05T21:00:00Z"
}

2. Top Stories

{
    "message_type": "top_stories",
    "content": {
        "section": "technology"
    },
    "timestamp": "2025-03-05T21:00:00Z"
}

3. Times Wire

{
    "message_type": "times_wire",
    "content": {
        "limit": 5,
        "source": "nyt"
    },
    "timestamp": "2025-03-05T21:00:00Z"
}

4. Most Popular

{
    "message_type": "most_popular",
    "content": {
        "type": "viewed",
        "time_period": "7"
    },
    "timestamp": "2025-03-05T21:00:00Z"
}

5. Archive

{
    "message_type": "archive",
    "content": {
        "year": 2025,
        "month": 3
    },
    "timestamp": "2025-03-05T21:00:00Z"
}

6. Books

{
    "message_type": "books",
    "content": {
        "list": "hardcover-fiction"
    },
    "timestamp": "2025-03-05T21:00:00Z"
}

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

MIT License

Security Note

  • Never commit your .env file
  • Keep your NYT API key private
  • Use environment variables for sensitive data

Contact

Create an issue for bug reports or feature requests.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • apappascs
  • Découvrez la collection la plus complète et la plus à jour de serveurs MCP sur le marché. Ce référentiel sert de centre centralisé, offrant un vaste catalogue de serveurs MCP open-source et propriétaires, avec des fonctionnalités, des liens de documentation et des contributeurs.

  • ShrimpingIt
  • Manipulation basée sur Micropython I2C de l'exposition GPIO de la série MCP, dérivée d'Adafruit_MCP230XX

  • OffchainLabs
  • Aller la mise en œuvre de la preuve de la participation Ethereum

  • modelcontextprotocol
  • Serveurs de protocole de contexte modèle

  • Mintplex-Labs
  • L'application tout-en-un desktop et Docker AI avec chiffon intégré, agents AI, constructeur d'agent sans code, compatibilité MCP, etc.

  • huahuayu
  • Une passerelle API unifiée pour intégrer plusieurs API d'explorateur de blockchain de type étherscan avec la prise en charge du protocole de contexte modèle (MCP) pour les assistants d'IA.

    Reviews

    1 (1)
    Avatar
    user_RLR5oi0w
    2025-04-16

    I recently started using the nyt-mcp-server, and it's been phenomenal. The server is robust, easy to set up, and has improved my application's performance significantly. Kudos to aovabo for creating such a reliable product. If you're looking for a high-quality MCP server, this is your best bet!