GNews MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
GNews MCP Server
A remote Model Context Protocol (MCP) server that gives AI applications access to the GNews API for searching news and fetching trending headlines. It runs as a FastAPI app over HTTP, with OAuth2 bearer-token authentication enforced by middleware.
Features
search_news— search news articles by keyword, with filtering and sorting.get_top_headlines— trending articles by category.OAuth2 bearer-token auth (via ScaleKit) on every request, plus a public OAuth protected-resource metadata endpoint for client discovery. See
docs/ARCHITECTURE.mdfor how the pieces fit together.
Related MCP server: Gemini News Summarizer MCP Server
Requirements
Python 3.11+
A free GNews API key
ScaleKit credentials for OAuth (see
.env.example)
Setup
# 1. Install dependencies
pip install -r requirements.txt
# or: uv sync
# 2. Configure environment
cp .env.example .env
# then fill in GNEWS_API_KEY and the SCALEKIT_* values in .envRunning
python main.py
# or: uv run main.pyThe server starts on the port from PORT (default 10000) and exposes:
The MCP endpoint(s) over HTTP at
/A public discovery endpoint at
/.well-known/oauth-protected-resource/mcp
Run locally without auth (for trying it out)
The server requires OAuth by default. If you just want to explore the tools locally and don't have ScaleKit set up, you can disable the auth middleware with an environment flag (local use only — never in a deployed server):
DISABLE_AUTH=1 python main.pyWith DISABLE_AUTH=1, no ScaleKit configuration is needed; only GNEWS_API_KEY
is required for the tools to return data. You'll see a warning printed on startup
so it's obvious auth is off.
Authentication
Every request except the /.well-known/* endpoints must include a valid token:
Authorization: Bearer <access_token>AuthMiddleware (see auth.py) validates the token's issuer and audience with
ScaleKit, and requires the gnews:read scope for tools/call requests. Invalid
or missing tokens get a 401 response with a WWW-Authenticate header pointing
at the resource metadata URL.
Tools
search_news
Search for news articles by keyword.
Parameter | Type | Default | Notes |
| string | — (required) | Keywords; supports |
| string | none | 2-letter language code |
| string | none | 2-letter country code |
| int | 10 | 1–100 |
| string | none | fields to search: |
| string | none | allow nulls for: |
| string | none | ISO-8601 lower bound |
| string | none | ISO-8601 upper bound |
| enum |
|
|
| int | 1 | pagination |
get_top_headlines
Trending articles by category.
Parameter | Type | Default | Notes |
| enum |
|
|
| string | none | 2-letter language code |
| string | none | 2-letter country code |
| int | 10 | 1–100 |
| string | none | allow nulls for: |
| string | none | ISO-8601 lower bound |
| string | none | ISO-8601 upper bound |
| string | none | extra keywords to filter headlines |
| int | 1 | pagination |
Both tools return a structured result:
{
"success": true,
"query": "search terms",
"totalArticles": 150,
"articles": [
{
"title": "Article Title",
"description": "…",
"content": "…",
"url": "https://example.com/article",
"image": "https://example.com/image.jpg",
"publishedAt": "2024-01-01T12:00:00Z",
"source": { "name": "Source Name", "url": "https://source.com" }
}
],
"parameters_used": { }
}On failure, success is false and an error message is included.
Query syntax
The GNews API supports logical operators and phrases:
AND/OR/NOT— e.g.Apple AND iPhone,Apple OR Microsoft,Apple NOT iPhone"exact phrase"— e.g."Apple iPhone 15"grouping — e.g.
(Apple AND iPhone) OR Microsoft
Supported languages
Arabic (ar), Chinese (zh), Dutch (nl), English (en), French (fr), German (de), Greek (el), Hindi (hi), Italian (it), Japanese (ja), Malayalam (ml), Marathi (mr), Norwegian (no), Portuguese (pt), Romanian (ro), Russian (ru), Spanish (es), Swedish (sv), Tamil (ta), Telugu (te), Ukrainian (uk)
Supported countries
au, br, ca, cn, eg, fr, de, gr, hk, in, ie, it, jp, nl, no, pk, pe, ph, pt, ro, ru, sg, es, se, ch, tw, ua, gb, us
Development
python test_server.py # smoke test: env + tools registered (no network needed)
python examples.py # live GNews API calls (needs a real GNEWS_API_KEY)
make help # see all Make targetsRate limits
GNews' free plan allows 100 requests/day; paid plans allow more. The server surfaces GNews rate-limit errors in its structured error responses.
Deployment
Because this is a remote MCP server, it needs a public HTTPS URL so clients can reach it and complete OAuth discovery. Two common ways:
Expose a local server with ngrok (temporary)
Good for development and demos — run the server on your machine and tunnel a public URL to it.
# one-time: register your ngrok authtoken
ngrok config add-authtoken <your-token>
# terminal 1 — run the server (default port 10000)
python main.py
# terminal 2 — expose it
ngrok http 10000ngrok prints a public URL like https://<id>.ngrok-free.app. Your discovery
endpoint is then https://<id>.ngrok-free.app/.well-known/oauth-protected-resource/mcp.
Important: the OAuth flow advertises URLs, so the ScaleKit values that embed a
base URL — SCALEKIT_RESOURCE_METADATA_URL and the URLs inside
METADATA_JSON_RESPONSE — must use the ngrok URL, not localhost. The free
ngrok URL changes on every restart, so update those values each time (or use a
reserved ngrok domain).
Deploy on Render (persistent)
Push this repo to GitHub.
On Render: New → Web Service, connect the repo.
Runtime: Python 3.11.
Build command:
pip install -r requirements.txtStart command:
uvicorn main:app --host 0.0.0.0 --port $PORT(Render provides$PORT; the app already binds0.0.0.0.)Environment variables: add everything from
.env.example(GNEWS_API_KEY, allSCALEKIT_*,METADATA_JSON_RESPONSE). Never commit a real.env.Deploy. Your MCP endpoint and the
/.well-known/...discovery URL are then served over HTTPS at your*.onrender.comdomain. Important: as with ngrok, point the ScaleKit/metadata URLs at your Render domain, notlocalhost, or OAuth discovery won't line up.
The app runs on Uvicorn (ASGI). The
python main.pyentry point already starts Uvicorn; the explicituvicorn main:app ...command above is the equivalent form platforms expect as a start command.
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Real-time Google News headlines, breaking publisher articles & topic search remote MCP server.
GNews MCP — Global news search via GNews API (gnews.io)
Official GNews API server: search news articles and top headlines from 80,000+ sources.
Google News headlines, sources, and links via the Apify Google News API, hosted MCP.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceA remote MCP server that enables searching for news articles on specific topics through the Tavily API without requiring authentication.-
- -licenseNot gradedqualityNot gradedmaintenanceAn MCP server that enables a Gemini-based chatbot to fetch and summarize current news headlines from GNews API when users ask about trending topics.-
- FlicenseNot gradedqualityDmaintenanceMCP server providing access to the GNews API for fetching news articles and headlines. Supports search and top headlines with advanced filtering by language, country, category, and date.1-
- AlicenseNot gradedqualityBmaintenanceA 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.153 npm3MIT