the-news-api
the-news-api-mcp-server
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:
- Clone the repository git clone <repository-url>
- Install dependencies npm install
- Create and configure environment
cp .env.example .env
Edit .env and set NEWS_API_TOKEN, PORT, DATABASE_URL as needed
- Generate Prisma client (if using Prisma ORM) npx prisma generate
- Build the project npm run build
- Start the server npm start
Validation:
- The server should start on the port defined in .env (default 3000)
- Access http://localhost:3000/docs to view interactive API docs
- Check health at http://localhost:3000/health
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
generative-ui-playground
Interact with all three types of generative UI, all in one interface
freepik
The Freepik enables popular agent Model Context Protocol (MCP) to integrate with Freepik APIs through function calling.
language
MCP server from alexwohletz/language-server-mcp
html-to-markdown
MCP server for converting HTML to Markdown using Turndown.js. Fetch web pages and convert them to clean, formatted Markdown.
mcp-doc-forge
MCP server that provides doc forge capabilities
mcp -client-spring-ai
MCP server from mohamedYoussfi/mcp-server-client-spring-ai