google-news-trends-mcp 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Jesse Manek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.4
2
+ Name: google-news-trends-mcp
3
+ Version: 0.1.0
4
+ Summary: Add your description here
5
+ Author-email: Jesse Manek <jesse.manek@gmail.com>
6
+ License: MIT
7
+ Requires-Python: >=3.10.18
8
+ Description-Content-Type: text/markdown
9
+ License-File: LICENSE
10
+ Requires-Dist: asyncio>=3.4.3
11
+ Requires-Dist: click>=8.2.1
12
+ Requires-Dist: cloudscraper>=1.2.71
13
+ Requires-Dist: fastmcp>=2.9.2
14
+ Requires-Dist: gnews>=0.4.1
15
+ Requires-Dist: googlenewsdecoder>=0.1.7
16
+ Requires-Dist: lxml[html-clean]>=6.0.0
17
+ Requires-Dist: newspaper4k>=0.9.3.1
18
+ Requires-Dist: nltk>=3.9.1
19
+ Requires-Dist: playwright>=1.53.0
20
+ Requires-Dist: pydantic>=2.11.7
21
+ Requires-Dist: pytest>=8.4.1
22
+ Requires-Dist: pytest-asyncio>=1.0.0
23
+ Requires-Dist: trendspy>=0.1.6
24
+ Dynamic: license-file
25
+
26
+ # Google News Trends MCP
27
+
28
+ An MCP server to access Google News and Google Trends. Does not rely on any paid APIs.
29
+ The returned data currently uses a lot of tokens, so it is recommended to always use limits when making requests.
30
+
31
+ ## Features
32
+
33
+ - Search Google News articles based on keyword, location, topic
34
+ - Get top news stories from Google News
35
+ - Google Trends keywords base on location
36
+ - Optional NLP processing to summarize articles and extract keywords
37
+
38
+ ## Installation
39
+
40
+ ### Using uv/uvx (recommended)
41
+
42
+ When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
43
+ use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *google-news-trends-mcp*.
44
+
45
+ ### Using PIP
46
+
47
+ ```bash
48
+ pip install google-news-trends-mcp
49
+ ```
50
+ After installation, you can run it as a script using:
51
+
52
+ ```bash
53
+ python -m google-news-trends-mcp
54
+ ```
55
+
56
+ ## Configuration
57
+
58
+ ### Configure for Claude.app
59
+
60
+ Add to your Claude settings:
61
+
62
+ <details>
63
+ <summary>Using uvx</summary>
64
+
65
+ ```json
66
+ {
67
+ "mcpServers": {
68
+ "google-news-trends": {
69
+ "command": "uvx",
70
+ "args": ["google-news-trends-mcp"]
71
+ }
72
+ }
73
+ }
74
+ ```
75
+ </details>
76
+
77
+ <details>
78
+ <summary>Using pip installation</summary>
79
+
80
+ ```json
81
+ {
82
+ "mcpServers": {
83
+ "google-news-trends": {
84
+ "command": "python",
85
+ "args": ["-m", "google-news-trends-mcp"]
86
+ }
87
+ }
88
+ }
89
+ ```
90
+ </details>
91
+
92
+ ### Configure for VS Code
93
+
94
+ <details>
95
+ <summary>Using uvx</summary>
96
+
97
+ ```json
98
+ {
99
+ "mcp": {
100
+ "servers": {
101
+ "google-news-trends": {
102
+ "command": "uvx",
103
+ "args": ["google-news-trends-mcp"]
104
+ }
105
+ }
106
+ }
107
+ }
108
+ ```
109
+ </details>
110
+
111
+ <details>
112
+ <summary>Using pip installation</summary>
113
+
114
+ ```json
115
+ {
116
+ "mcp": {
117
+ "servers": {
118
+ "google-news-trends": {
119
+ "command": "python",
120
+ "args": ["-m", "google-news-trends-mcp"]
121
+ }
122
+ }
123
+ }
124
+ }
125
+ ```
126
+ </details>
127
+
128
+
129
+ ## Tools
130
+
131
+ The following MCP tools are available:
132
+
133
+ | Tool Name | Description |
134
+ |--------------------------|--------------------------------------------------------------------|
135
+ | **get_news_by_keyword** | Search for news using specific keywords. |
136
+ | **get_news_by_location** | Retrieve news relevant to a particular location. |
137
+ | **get_news_by_topic** | Get news based on a chosen topic. |
138
+ | **get_top_news** | Fetch the top news stories from Google News. |
139
+ | **get_trending_keywords**| Return trending keywords from Google Trends for a specified location.|
140
+
141
+ All of the news related tools have an option to summarize the text of the article using NLP (nltk)
142
+
143
+
144
+ ## CLI
145
+ All tools can be accessed from the command line using `uv`
146
+
147
+ ```bash
148
+ uv run google-news-trends
149
+ Usage: google-news-trends [OPTIONS] COMMAND [ARGS]...
150
+
151
+ Find and download news articles using Google News.
152
+
153
+ Options:
154
+ --help Show this message and exit.
155
+
156
+ Commands:
157
+ keyword Find articles by keyword using Google News.
158
+ location Find articles by location using Google News.
159
+ top Get top news stories from Google News.
160
+ topic Find articles by topic using Google News.
161
+ trending Returns google trends for a specific geo location.
162
+ ```
163
+
164
+ ## Debugging
165
+
166
+ ```bash
167
+ npx @modelcontextprotocol/inspector uvx google-news-trends-mcp
168
+ ```
169
+
170
+ To run from within locally installed project
171
+
172
+ ```bash
173
+ cd path/to/google/news/tends/mcp
174
+ npx @modelcontextprotocol/inspector uv run google-news-trends-mcp
175
+ ```
176
+
177
+ ## Testing
178
+
179
+ ```bash
180
+ cd path/to/google/news/tends/mcp
181
+ python -m pytest
182
+ ```
@@ -0,0 +1,157 @@
1
+ # Google News Trends MCP
2
+
3
+ An MCP server to access Google News and Google Trends. Does not rely on any paid APIs.
4
+ The returned data currently uses a lot of tokens, so it is recommended to always use limits when making requests.
5
+
6
+ ## Features
7
+
8
+ - Search Google News articles based on keyword, location, topic
9
+ - Get top news stories from Google News
10
+ - Google Trends keywords base on location
11
+ - Optional NLP processing to summarize articles and extract keywords
12
+
13
+ ## Installation
14
+
15
+ ### Using uv/uvx (recommended)
16
+
17
+ When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
18
+ use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *google-news-trends-mcp*.
19
+
20
+ ### Using PIP
21
+
22
+ ```bash
23
+ pip install google-news-trends-mcp
24
+ ```
25
+ After installation, you can run it as a script using:
26
+
27
+ ```bash
28
+ python -m google-news-trends-mcp
29
+ ```
30
+
31
+ ## Configuration
32
+
33
+ ### Configure for Claude.app
34
+
35
+ Add to your Claude settings:
36
+
37
+ <details>
38
+ <summary>Using uvx</summary>
39
+
40
+ ```json
41
+ {
42
+ "mcpServers": {
43
+ "google-news-trends": {
44
+ "command": "uvx",
45
+ "args": ["google-news-trends-mcp"]
46
+ }
47
+ }
48
+ }
49
+ ```
50
+ </details>
51
+
52
+ <details>
53
+ <summary>Using pip installation</summary>
54
+
55
+ ```json
56
+ {
57
+ "mcpServers": {
58
+ "google-news-trends": {
59
+ "command": "python",
60
+ "args": ["-m", "google-news-trends-mcp"]
61
+ }
62
+ }
63
+ }
64
+ ```
65
+ </details>
66
+
67
+ ### Configure for VS Code
68
+
69
+ <details>
70
+ <summary>Using uvx</summary>
71
+
72
+ ```json
73
+ {
74
+ "mcp": {
75
+ "servers": {
76
+ "google-news-trends": {
77
+ "command": "uvx",
78
+ "args": ["google-news-trends-mcp"]
79
+ }
80
+ }
81
+ }
82
+ }
83
+ ```
84
+ </details>
85
+
86
+ <details>
87
+ <summary>Using pip installation</summary>
88
+
89
+ ```json
90
+ {
91
+ "mcp": {
92
+ "servers": {
93
+ "google-news-trends": {
94
+ "command": "python",
95
+ "args": ["-m", "google-news-trends-mcp"]
96
+ }
97
+ }
98
+ }
99
+ }
100
+ ```
101
+ </details>
102
+
103
+
104
+ ## Tools
105
+
106
+ The following MCP tools are available:
107
+
108
+ | Tool Name | Description |
109
+ |--------------------------|--------------------------------------------------------------------|
110
+ | **get_news_by_keyword** | Search for news using specific keywords. |
111
+ | **get_news_by_location** | Retrieve news relevant to a particular location. |
112
+ | **get_news_by_topic** | Get news based on a chosen topic. |
113
+ | **get_top_news** | Fetch the top news stories from Google News. |
114
+ | **get_trending_keywords**| Return trending keywords from Google Trends for a specified location.|
115
+
116
+ All of the news related tools have an option to summarize the text of the article using NLP (nltk)
117
+
118
+
119
+ ## CLI
120
+ All tools can be accessed from the command line using `uv`
121
+
122
+ ```bash
123
+ uv run google-news-trends
124
+ Usage: google-news-trends [OPTIONS] COMMAND [ARGS]...
125
+
126
+ Find and download news articles using Google News.
127
+
128
+ Options:
129
+ --help Show this message and exit.
130
+
131
+ Commands:
132
+ keyword Find articles by keyword using Google News.
133
+ location Find articles by location using Google News.
134
+ top Get top news stories from Google News.
135
+ topic Find articles by topic using Google News.
136
+ trending Returns google trends for a specific geo location.
137
+ ```
138
+
139
+ ## Debugging
140
+
141
+ ```bash
142
+ npx @modelcontextprotocol/inspector uvx google-news-trends-mcp
143
+ ```
144
+
145
+ To run from within locally installed project
146
+
147
+ ```bash
148
+ cd path/to/google/news/tends/mcp
149
+ npx @modelcontextprotocol/inspector uv run google-news-trends-mcp
150
+ ```
151
+
152
+ ## Testing
153
+
154
+ ```bash
155
+ cd path/to/google/news/tends/mcp
156
+ python -m pytest
157
+ ```
@@ -0,0 +1,49 @@
1
+ [project]
2
+ name = "google-news-trends-mcp"
3
+ version = "0.1.0"
4
+ description = "Add your description here"
5
+ readme = "README.md"
6
+ requires-python = ">=3.10.18"
7
+ authors = [
8
+ { name = "Jesse Manek", email = "jesse.manek@gmail.com" },
9
+ ]
10
+ license = { text = "MIT" }
11
+ dependencies = [
12
+ "asyncio>=3.4.3",
13
+ "click>=8.2.1",
14
+ "cloudscraper>=1.2.71",
15
+ "fastmcp>=2.9.2",
16
+ "gnews>=0.4.1",
17
+ "googlenewsdecoder>=0.1.7",
18
+ "lxml[html-clean]>=6.0.0",
19
+ "newspaper4k>=0.9.3.1",
20
+ "nltk>=3.9.1",
21
+ "playwright>=1.53.0",
22
+ "pydantic>=2.11.7",
23
+ "pytest>=8.4.1",
24
+ "pytest-asyncio>=1.0.0",
25
+ "trendspy>=0.1.6",
26
+ ]
27
+
28
+ [project.scripts]
29
+ google-news-trends-mcp = "google_news_trends_mcp.server:main"
30
+ google-news-trends = "google_news_trends_mcp.cli:cli"
31
+
32
+
33
+ [build-system]
34
+ requires = ["setuptools"]
35
+ build-backend = "setuptools.build_meta"
36
+
37
+ [dependency-groups]
38
+ dev = [
39
+ "anyio>=4.9.0",
40
+ "pytest-asyncio>=1.0.0",
41
+ ]
42
+
43
+
44
+ [tool.pytest.ini_options]
45
+ addopts = [
46
+ "--import-mode=importlib",
47
+ ]
48
+ asyncio_mode = "auto"
49
+ pythonpath = "src"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,5 @@
1
+ from google_news_trends_mcp.server import main
2
+
3
+
4
+ if __name__ == "__main__":
5
+ main()
@@ -0,0 +1,149 @@
1
+ import click
2
+ import asyncio
3
+ from google_news_trends_mcp.news import (
4
+ get_news_by_keyword,
5
+ get_news_by_location,
6
+ get_news_by_topic,
7
+ get_trending_terms,
8
+ get_top_news,
9
+ save_article_to_json,
10
+ )
11
+
12
+
13
+ @click.group()
14
+ def cli():
15
+ pass
16
+
17
+
18
+ @cli.command(help=get_news_by_keyword.__doc__)
19
+ @click.argument("keyword")
20
+ @click.option(
21
+ "--period", type=int, default=7, help="Period in days to search for articles."
22
+ )
23
+ @click.option(
24
+ "--max-results",
25
+ "max_results",
26
+ type=int,
27
+ default=10,
28
+ help="Maximum number of results to return.",
29
+ )
30
+ @click.option(
31
+ "--no-nlp", is_flag=True, default=False, help="Disable NLP processing for articles."
32
+ )
33
+ def keyword(keyword, period, max_results, no_nlp):
34
+ articles = asyncio.run(
35
+ get_news_by_keyword(
36
+ keyword, period=period, max_results=max_results, nlp=not no_nlp
37
+ )
38
+ )
39
+ # asyncio.run(articles) # Ensure the articles are fetched asynchronously
40
+ print_articles(articles)
41
+
42
+
43
+ @cli.command(help=get_news_by_location.__doc__)
44
+ @click.argument("location")
45
+ @click.option(
46
+ "--period", type=int, default=7, help="Period in days to search for articles."
47
+ )
48
+ @click.option(
49
+ "--max-results",
50
+ "max_results",
51
+ type=int,
52
+ default=10,
53
+ help="Maximum number of results to return.",
54
+ )
55
+ @click.option(
56
+ "--no-nlp", is_flag=True, default=False, help="Disable NLP processing for articles."
57
+ )
58
+ def location(location, period, max_results, no_nlp):
59
+ articles = asyncio.run(
60
+ get_news_by_location(
61
+ location, period=period, max_results=max_results, nlp=not no_nlp
62
+ )
63
+ )
64
+ print_articles(articles)
65
+
66
+
67
+ @cli.command(help=get_news_by_topic.__doc__)
68
+ @click.argument("topic")
69
+ @click.option(
70
+ "--period", type=int, default=7, help="Period in days to search for articles."
71
+ )
72
+ @click.option(
73
+ "--max-results",
74
+ "max_results",
75
+ type=int,
76
+ default=10,
77
+ help="Maximum number of results to return.",
78
+ )
79
+ @click.option(
80
+ "--no-nlp", is_flag=True, default=False, help="Disable NLP processing for articles."
81
+ )
82
+ def topic(topic, period, max_results, no_nlp):
83
+ articles = asyncio.run(
84
+ get_news_by_topic(topic, period=period, max_results=max_results, nlp=not no_nlp)
85
+ )
86
+ print_articles(articles)
87
+
88
+
89
+ @cli.command(help=get_trending_terms.__doc__)
90
+ @click.option(
91
+ "--geo", type=str, default="US", help="Country code, e.g. 'US', 'GB', 'IN', etc."
92
+ )
93
+ @click.option(
94
+ "--full-data", is_flag=True, default=False, help="Return full data for each trend."
95
+ )
96
+ @click.option(
97
+ "--max-results",
98
+ "max_results",
99
+ type=int,
100
+ default=100,
101
+ help="Maximum number of results to return.",
102
+ )
103
+ def trending(geo, full_data, max_results):
104
+ trending_terms = asyncio.run(
105
+ get_trending_terms(geo=geo, full_data=full_data, max_results=max_results)
106
+ )
107
+ if trending_terms:
108
+ print("Trending terms:")
109
+ for term in trending_terms:
110
+ print(f"- {term}")
111
+ else:
112
+ print("No trending terms found.")
113
+
114
+
115
+ @cli.command(help=get_top_news.__doc__)
116
+ @click.option(
117
+ "--period", type=int, default=3, help="Period in days to search for top articles."
118
+ )
119
+ @click.option(
120
+ "--max-results",
121
+ "max_results",
122
+ type=int,
123
+ default=10,
124
+ help="Maximum number of results to return.",
125
+ )
126
+ @click.option(
127
+ "--no-nlp", is_flag=True, default=False, help="Disable NLP processing for articles."
128
+ )
129
+ def top(period, max_results, no_nlp):
130
+ articles = asyncio.run(
131
+ get_top_news(max_results=max_results, period=period, nlp=not no_nlp)
132
+ )
133
+ print_articles(articles)
134
+ print(f"Found {len(articles)} top articles.")
135
+
136
+
137
+ def print_articles(articles):
138
+ for article in articles:
139
+ print(f"Title: {article.title}")
140
+ print(f"URL: {article.original_url}")
141
+ print(f"Authors: {article.authors}")
142
+ print(f"Publish Date: {article.publish_date}")
143
+ print(f"Top Image: {article.top_image}")
144
+ print(f"Summary: {article.summary}\n")
145
+ save_article_to_json(article)
146
+
147
+
148
+ if __name__ == "__main__":
149
+ cli()