Get the FREE Ultimate OpenClaw Setup Guide →

the-news-api

the-news-api-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio malachi-devel-the-news-api-mcp-server node dist/server.js \
  --env PORT="3000" \
  --env NODE_ENV="development|production" \
  --env DATABASE_URL="Database connection URL, e.g. SQLite path or PostgreSQL/MySQL URL" \
  --env NEWS_API_TOKEN="Your TheNewsAPI API key"

How to use

This MCP server provides a modular News Aggregator API built with TypeScript and MCP conventions. It exposes endpoints to fetch top and all news with filtering, retrieve similar articles by UUID, and fetch individual articles by UUID, along with sources. It also includes caching management and health/docs endpoints, making it friendly for AI agents that rely on structured responses. You can inspect or consume the API via the interactive docs at /docs and retrieve the OpenAPI spec from /docs.json. Use the cache endpoints to monitor or clear cached items as needed, and leverage the /health endpoint to verify server readiness before integrating into workflows.

How to install

Prerequisites:

  • Node.js (v14+ recommended) and npm
  • Git
  • A TheNewsAPI API key for NEWS_API_TOKEN

Steps:

  1. Clone the repository git clone <repository-url>
  2. Install dependencies npm install
  3. Create and configure environment cp .env.example .env

    Edit .env and set NEWS_API_TOKEN, PORT, DATABASE_URL as needed

  4. Generate Prisma client (if using Prisma ORM) npx prisma generate
  5. Build the project npm run build
  6. Start the server npm start

Validation:

Additional notes

Environment variables:

  • NEWS_API_TOKEN: API key for TheNewsAPI
  • PORT: Web server port
  • NODE_ENV: Environment mode (development|production)
  • DATABASE_URL: Database connection string; defaults to SQLite in development Common issues:
  • Missing or invalid NEWS_API_TOKEN will cause 401 errors from upstream API calls
  • prisma generate required if Prisma is used; ensure database migrations are applied
  • If /docs or /docs.json fail, ensure the server has OpenAPI docs generation enabled and is running with a valid schema Configuration tips:
  • Use caching to reduce redundant external API calls; monitor via /api/cache/stats
  • For production, set NODE_ENV=production and configure a robust DATABASE_URL
  • Ensure the environment file is loaded at startup (e.g., via dotenv integration in the server)

Related MCP Servers

Sponsor this space

Reach thousands of developers