# NewsAPI — how to use (mcp.ai)

Connect your NewsAPI account and use 4 tools for news and lifestyle straight from your AI agent. Connect with your own API key. News API is a simple HTTP REST API for searching and retrieving live articles from all over the web.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_news_api?ms=1787291220000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `news_api_get_everything`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/news_api`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/news_api/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/news_api/get/everything` — Tool to search through every article published by over 150,000 sources. At least one of q, sources, language, or domains must be set or the API returns a parametersMissing error. Historical date range
  - body: { q?: string, to?: string, from?: string, page?: integer, sortBy?: string, domains?: string, sources?: string, language?: string, pageSize?: integer, qInTitle?: string, excludeDomains?: string }
- `POST https://api.mcp.ai/api/news_api/get/sources` — Tool to fetch available news sources. Use when you need to retrieve a list of publishers by optional filters like category, language, or country. Source IDs returned here are the only valid IDs for fi
  - body: { country?: string, category?: string, language?: string }
- `POST https://api.mcp.ai/api/news_api/get/top/headlines` — Tool to retrieve live top and breaking headlines; does not support historical or date-bounded queries (use NEWS_API_GET_EVERYTHING for past date ranges). Results favor major outlets; use NEWS_API_GET_
  - body: { q?: string, page?: integer, country?: string, sources?: string, category?: string, pageSize?: integer }
- `POST https://api.mcp.ai/api/news_api/get/v1/articles` — Tool to fetch live article metadata from a news source using the legacy v1 API. Use when you need headlines from a specific source identifier. This v1 endpoint has been superseded by /v2/top-headlines
  - body: { sortBy?: string, source: string }

## Example prompts
- "What can I do in NewsAPI?"
- "Show me a summary of my NewsAPI account"

## More
- Page: https://mcp.ai/news_api
- Agent spec (llms.txt): https://mcp.ai/news_api/llms.txt
- Postman collection: https://mcp.ai/news_api/postman.json
