Skip to main content
Glama
newsapi-ai-mcp

newsapi-ai-mcp

by elcamino

newsapi-ai-mcp

MCP server for newsapi.ai (Event Registry): search news articles and events from ~150k sources worldwide — from Claude (Code, Desktop, claude.ai), Codex, OpenCode, Cursor or any other MCP client. Ships with an Agent Skill that teaches agents how to query the API well (and how to fall back to plain curl where no MCP is available).

Tools

Tool

What it does

newsapi_search_articles

Article search: keywords, concepts, categories, sources, locations, language, dates, sentiment, source rank; Advanced Query Language passthrough

newsapi_get_articles

Full text + metadata by article URI or original URL

newsapi_search_events

Event search (articles clustered by real-world happening, cross-language)

newsapi_get_event

Event details + top articles

newsapi_suggest

Resolve names → URIs (concepts, sources, source groups, categories, locations, authors)

newsapi_usage

Remaining API tokens

newsapi_raw_request

Escape hatch: any /api/v1/… endpoint (aggregations, trends, minute stream)

Results are trimmed to compact JSON (snippets instead of full bodies, flattened labels) to save context; pass response_format: "raw" for the untouched API response.

Related MCP server: AI News MCP

Configuration

Variable

NEWSAPI_AI_KEY

your newsapi.ai API key

NEWSAPI_AI_MAX_DAYS

7 or 31: hard cap, never query older data (archive queries cost more tokens)

NEWSAPI_AI_HOST

API host, default https://eventregistry.org

NEWSAPI_AI_CONFIG

path of the config file, default ~/.config/newsapi-ai-mcp/config.json

MCP_AUTH_TOKEN

HTTP mode only: bearer token clients must send

Instead of environment variables you can use a config file — handy for GUI apps, which on macOS don't see variables from ~/.zshrc:

mkdir -p ~/.config/newsapi-ai-mcp && chmod 700 ~/.config/newsapi-ai-mcp
echo '{"apiKey": "your-key", "maxDays": 31}' > ~/.config/newsapi-ai-mcp/config.json
chmod 600 ~/.config/newsapi-ai-mcp/config.json

Key lookup order: plugin settings → NEWSAPI_AI_KEY → config file. Empty values and unexpanded ${…} placeholders are skipped.

Claude Code: one-step plugin (MCP server + skill)

This repo is also a Claude Code plugin marketplace. The plugin installs the MCP server and the skill together:

/plugin install newsapi-ai --marketplace elcamino/newsapi-ai-mcp

(older Claude Code: /plugin marketplace add elcamino/newsapi-ai-mcp, then /plugin install newsapi-ai@elcamino)

During installation Claude Code shows a settings dialog:

Setting

newsapi.ai API key

stored in the system credential store (macOS Keychain), never in a settings file

Limit searches to recent news

off / 31 / 7 days

Change them later with /plugin configure newsapi-ai@elcamino (or /plugin → Installed → newsapi-ai). From a shell: claude plugin install newsapi-ai@elcamino --config api_key=… --config max_days=31. Restart the session after changing settings.

Claude Cowork / desktop chat: these don't show plugin settings dialogs. The plugin still loads there; put the key into the config file (see Configuration) instead.

Install — local (stdio)

Alternatives to npx -y newsapi-ai-mcp: npx -y github:elcamino/newsapi-ai-mcp (latest main) or node /path/to/newsapi-ai-mcp/dist/index.js (after npm install in a checkout).

Claude Code

claude mcp add newsapi-ai -s user -e NEWSAPI_AI_KEY=your-key -- npx -y newsapi-ai-mcp

Claude Desktop — claude_desktop_config.json

{
  "mcpServers": {
    "newsapi-ai": {
      "command": "npx",
      "args": ["-y", "newsapi-ai-mcp"],
      "env": { "NEWSAPI_AI_KEY": "your-key" }
    }
  }
}

Codex CLI — ~/.codex/config.toml

[mcp_servers.newsapi-ai]
command = "npx"
args = ["-y", "newsapi-ai-mcp"]
env = { NEWSAPI_AI_KEY = "your-key" }

OpenCode — opencode.json (project) or ~/.config/opencode/opencode.json

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "newsapi-ai": {
      "type": "local",
      "command": ["npx", "-y", "newsapi-ai-mcp"],
      "environment": { "NEWSAPI_AI_KEY": "{env:NEWSAPI_AI_KEY}" },
      "enabled": true
    }
  }
}

Cursor / Windsurf / Cline / Zed / anything else: same command + args + env triple in that client's MCP config.

Install — remote (Streamable HTTP)

For claude.ai custom connectors, Claude mobile, or sharing one server across machines:

NEWSAPI_AI_KEY=your-key MCP_AUTH_TOKEN=$(openssl rand -hex 32) \
  npx -y newsapi-ai-mcp --http --host 0.0.0.0 --port 8787
  • Endpoint: https://your-host/mcp (health check: /health). Stateless, POST only.

  • Auth: Authorization: Bearer <MCP_AUTH_TOKEN>; clients that can't set headers (e.g. a claude.ai custom connector) can use https://your-host/mcp?token=<MCP_AUTH_TOKEN>.

  • Optional per-client API key: header X-NewsAPI-Key overrides NEWSAPI_AI_KEY.

  • Run it behind TLS (Caddy, Traefik, Cloudflare Tunnel).

Docker + Caddy:

docker compose up -d   # see docker-compose.yml, put NEWSAPI_AI_KEY / MCP_AUTH_TOKEN in .env
news-mcp.example.com {
  reverse_proxy newsapi-ai-mcp:8787
}

Then in claude.ai: Settings → Connectors → Add custom connector → URL https://news-mcp.example.com/mcp?token=….

Remote config for other clients, e.g. Claude Code:

claude mcp add --transport http newsapi-ai https://news-mcp.example.com/mcp --header "Authorization: Bearer …"

The skill

skills/newsapi-ai/ is a standard SKILL.md folder:

  • Claude Code: comes with the plugin above; or copy to ~/.claude/skills/newsapi-ai/

  • claude.ai / Desktop: zip the folder and upload it under Settings → Capabilities → Skills (claude.ai skills also sync into Claude Code sessions signed in with a claude.ai account)

  • Codex / OpenCode / others with Agent Skills support: put it in the client's skills directory; otherwise paste it into AGENTS.md or the system prompt

Development

npm install
npm test        # builds, then runs an end-to-end test (stdio + HTTP) against a mock API

Releases: bump version in package.json and src/index.ts, push a tag vX.Y.Z — the GitHub workflow tests and publishes to npm (needs the NPM_TOKEN repo secret).

MIT License.

Available Tools

7 tools
newsapi_get_articlesGet full articlesA
Read-onlyIdempotent

Fetch full details (complete body text, authors, concepts, categories) for articles by their newsapi.ai URI (from search results) or by original article URL.

Inputs: uris, urls, body_chars, result_lang, +2 more.

newsapi_get_eventGet event detailsB
Read-onlyIdempotent

Details for one event (summary, concepts, location) plus optionally its top articles.

Inputs: event_uri (required), body_chars, result_lang, articles_lang, +3 more.

newsapi_raw_requestRaw newsapi.ai requestA
Read-only

Escape hatch: POST arbitrary parameters to any newsapi.ai endpoint under /api/v1/ (e.g. /api/v1/article/getArticles with resultType=conceptTrends, /api/v1/minuteStreamArticles, /api/v1/trends). The API key is added automatically. Prefer the dedicated tools when they fit.

Inputs: path (required), params.

newsapi_search_articlesSearch news articlesA
Read-onlyIdempotent

Search ~150k news/blog/press-release sources worldwide (newsapi.ai / Event Registry). Filter by keywords, concepts, categories, sources, locations, language and date. For entities (companies, people, places) prefer concept_uris over keywords – resolve them first with newsapi_suggest. Each call consumes API tokens; queries older than 31 days cost more. Returns compact results unless response_format=raw.

Inputs: lang, page, count, sort_by, +31 more.

newsapi_search_eventsSearch news eventsA
Read-onlyIdempotent

Search events: clusters of articles (often across languages) reporting on the same real-world happening. Good for 'what happened around X' and for spotting stories with broad coverage. Same filters as article search.

Inputs: lang, page, count, sort_by, +25 more.

newsapi_suggestResolve names to URIsA
Read-onlyIdempotent

Autocomplete names to the URIs that the search tools need: concepts (people, organisations, places, topics → Wikipedia URI), sources (news outlets → domain URI), source_groups, categories, locations, authors. Call this BEFORE filtering by entity, source or category.

Inputs: kind (required), prefix (required), lang, count.

newsapi_usageAPI token usageA
Read-onlyIdempotent

Show how many newsapi.ai API tokens are available and used on the current plan.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a distinct purpose: search_articles vs search_events target articles vs clusters, get_articles vs get_event fetch details for each, and suggest/usage/raw_request are clearly separate meta/helper tools. Boundaries are well-drawn, and raw_request is explicitly labeled as a fallback for cases the dedicated tools don't cover.

    Naming Consistency4/5

    All tools share a clean newsapi_ prefix with snake_case and mostly verb_noun structure (search_articles, search_events, get_articles, get_event, suggest, raw_request). newsapi_usage is noun-only and breaks the verb pattern slightly, but overall the convention is predictable.

    Tool Count5/5

    Seven tools is a well-scoped surface for a news search API, covering search, retrieval, discovery/autocomplete, usage, and an escape hatch without redundancy. Each tool earns its place.

    Completeness4/5

    The lifecycle is well covered: query (search_articles/events), retrieve full details (get_articles/get_event), resolve entities/sources (suggest), monitor quota (usage), and extend via raw_request. Some higher-level analytics (e.g. trends, concept trends) require the raw escape hatch rather than dedicated tools, a minor gap.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      A Model Context Protocol (MCP) server that provides real-time news intelligence using NewsAPI.ai. This server enables LLMs to search articles, track events, and analyze news through natural conversation.
      492 npm
      3
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Local MCP server that ingests and normalizes recent AI, tech, and research news from multiple sources, exposing tools for media agents to query and retrieve article content on demand.
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables users to query news mention volume time series, growth percentages, and live Google News feeds as an MCP tool, integrating with AI hosts like Claude and Cursor.
      3
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to query news articles from TheNewsAPI.com through natural-language prompts, exposing search, top stories, headlines, similar articles, article lookup, and source listing as MCP tools.
      MIT