@cyanheads/gdelt-mcp-server 0.1.1
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.
- package/CLAUDE.md +405 -0
- package/Dockerfile +98 -0
- package/README.md +336 -0
- package/changelog/0.1.x/0.1.0.md +23 -0
- package/changelog/0.1.x/0.1.1.md +18 -0
- package/changelog/template.md +119 -0
- package/dist/config/server-config.d.ts +13 -0
- package/dist/config/server-config.d.ts.map +1 -0
- package/dist/config/server-config.js +28 -0
- package/dist/config/server-config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-server/tools/date-resolution.d.ts +7 -0
- package/dist/mcp-server/tools/date-resolution.d.ts.map +1 -0
- package/dist/mcp-server/tools/date-resolution.js +13 -0
- package/dist/mcp-server/tools/date-resolution.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.d.ts +52 -0
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.js +182 -0
- package/dist/mcp-server/tools/definitions/get-coverage-breakdown.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.d.ts +54 -0
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.js +173 -0
- package/dist/mcp-server/tools/definitions/get-coverage-timeline.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tone-distribution.tool.d.ts +41 -0
- package/dist/mcp-server/tools/definitions/get-tone-distribution.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tone-distribution.tool.js +143 -0
- package/dist/mcp-server/tools/definitions/get-tone-distribution.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.d.ts +44 -0
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.js +134 -0
- package/dist/mcp-server/tools/definitions/get-tv-clips.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tv-context.tool.d.ts +32 -0
- package/dist/mcp-server/tools/definitions/get-tv-context.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tv-context.tool.js +114 -0
- package/dist/mcp-server/tools/definitions/get-tv-context.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tv-trending.tool.d.ts +27 -0
- package/dist/mcp-server/tools/definitions/get-tv-trending.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/get-tv-trending.tool.js +82 -0
- package/dist/mcp-server/tools/definitions/get-tv-trending.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/index.d.ts +14 -0
- package/dist/mcp-server/tools/definitions/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/index.js +14 -0
- package/dist/mcp-server/tools/definitions/index.js.map +1 -0
- package/dist/mcp-server/tools/definitions/list-tv-stations.tool.d.ts +32 -0
- package/dist/mcp-server/tools/definitions/list-tv-stations.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/list-tv-stations.tool.js +94 -0
- package/dist/mcp-server/tools/definitions/list-tv-stations.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-articles.tool.d.ts +45 -0
- package/dist/mcp-server/tools/definitions/search-articles.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-articles.tool.js +142 -0
- package/dist/mcp-server/tools/definitions/search-articles.tool.js.map +1 -0
- package/dist/mcp-server/tools/definitions/search-tv.tool.d.ts +48 -0
- package/dist/mcp-server/tools/definitions/search-tv.tool.d.ts.map +1 -0
- package/dist/mcp-server/tools/definitions/search-tv.tool.js +159 -0
- package/dist/mcp-server/tools/definitions/search-tv.tool.js.map +1 -0
- package/dist/services/gdelt/gdelt-doc-service.d.ts +89 -0
- package/dist/services/gdelt/gdelt-doc-service.d.ts.map +1 -0
- package/dist/services/gdelt/gdelt-doc-service.js +116 -0
- package/dist/services/gdelt/gdelt-doc-service.js.map +1 -0
- package/dist/services/gdelt/gdelt-fetch.d.ts +11 -0
- package/dist/services/gdelt/gdelt-fetch.d.ts.map +1 -0
- package/dist/services/gdelt/gdelt-fetch.js +46 -0
- package/dist/services/gdelt/gdelt-fetch.js.map +1 -0
- package/dist/services/gdelt/gdelt-tv-service.d.ts +78 -0
- package/dist/services/gdelt/gdelt-tv-service.d.ts.map +1 -0
- package/dist/services/gdelt/gdelt-tv-service.js +153 -0
- package/dist/services/gdelt/gdelt-tv-service.js.map +1 -0
- package/dist/services/gdelt/rate-limiter.d.ts +19 -0
- package/dist/services/gdelt/rate-limiter.d.ts.map +1 -0
- package/dist/services/gdelt/rate-limiter.js +47 -0
- package/dist/services/gdelt/rate-limiter.js.map +1 -0
- package/dist/services/gdelt/types.d.ts +87 -0
- package/dist/services/gdelt/types.d.ts.map +1 -0
- package/dist/services/gdelt/types.js +6 -0
- package/dist/services/gdelt/types.js.map +1 -0
- package/package.json +80 -0
- package/server.json +99 -0
package/README.md
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>@cyanheads/gdelt-mcp-server</h1>
|
|
3
|
+
<p><b>Search and analyze global news coverage and US television transcripts via the GDELT Project's real-time APIs via MCP. STDIO or Streamable HTTP.</b>
|
|
4
|
+
<div>9 Tools</div>
|
|
5
|
+
</p>
|
|
6
|
+
</div>
|
|
7
|
+
|
|
8
|
+
<div align="center">
|
|
9
|
+
|
|
10
|
+
[](./CHANGELOG.md) [](./LICENSE) [](https://modelcontextprotocol.io/) [](https://www.typescriptlang.org/) [](https://bun.sh/)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div align="center">
|
|
15
|
+
|
|
16
|
+
[](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)
|
|
17
|
+
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Tools
|
|
23
|
+
|
|
24
|
+
Nine tools across two GDELT APIs — DOC API for global print/web news (last 3 months, 65 languages, no auth) and TV API for US television transcripts (2009–Oct 2024, 150+ stations):
|
|
25
|
+
|
|
26
|
+
| Tool | Description |
|
|
27
|
+
|:---|:---|
|
|
28
|
+
| `gdelt_search_articles` | Search the last 3 months of global news coverage (65 languages) with full-text and filter operators. Returns up to 250 articles. |
|
|
29
|
+
| `gdelt_get_coverage_timeline` | Retrieve a time series of coverage volume or average tone for a query. `volume_with_articles` mode includes top articles per spike timestep. |
|
|
30
|
+
| `gdelt_get_tone_distribution` | Get a tone histogram (bins ~−30 to +30) showing whether coverage is uniformly negative, bimodal, or clustered near neutral. |
|
|
31
|
+
| `gdelt_get_coverage_breakdown` | Break down coverage volume by source language or source country — a multi-series time series showing geographic propagation. |
|
|
32
|
+
| `gdelt_search_tv` | Search US television news closed captions (2009–Oct 2024) and return per-station airtime time series. |
|
|
33
|
+
| `gdelt_get_tv_clips` | Retrieve up to 3,000 matching TV clips with transcript excerpts and Internet Archive viewing links. |
|
|
34
|
+
| `gdelt_get_tv_context` | Get the 200 most frequent co-occurring words and phrases from TV clips matching a query. |
|
|
35
|
+
| `gdelt_get_tv_trending` | Retrieve trending topics currently dominating US television news (updated every 15 minutes; no query required). |
|
|
36
|
+
| `gdelt_list_tv_stations` | List all TV stations with market, network, and monitoring date ranges to verify station availability before querying. |
|
|
37
|
+
|
|
38
|
+
### `gdelt_search_articles`
|
|
39
|
+
|
|
40
|
+
Search the last 3 months of global news with GDELT's full query syntax.
|
|
41
|
+
|
|
42
|
+
- Keywords, phrases (`"bird flu"`), boolean OR, and exclusion (`-sports`)
|
|
43
|
+
- Filter operators: `sourcecountry:`, `sourcelang:`, `domain:`, `theme:` (GKG taxonomy), `tone<`/`tone>`
|
|
44
|
+
- Proximity and repetition: `near20:"flu virus"`, `repeat3:"outbreak"`
|
|
45
|
+
- Configurable sort (relevance, date) and result count (up to 250)
|
|
46
|
+
- Returns URL, title, publication date, domain, language, source country, and social image URL
|
|
47
|
+
- Query is echoed in response for chaining
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
### `gdelt_get_coverage_timeline`
|
|
52
|
+
|
|
53
|
+
Retrieve when coverage of a topic spiked, with three modes:
|
|
54
|
+
|
|
55
|
+
- `volume` — normalized percentage of all global coverage per timestep
|
|
56
|
+
- `volume_with_articles` — volume plus top articles driving each spike; use for signal detection without a follow-up search call
|
|
57
|
+
- `tone` — average sentiment score per timestep (combine with `gdelt_get_tone_distribution` for the full picture)
|
|
58
|
+
- Configurable smoothing and time range
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
### `gdelt_get_tone_distribution`
|
|
63
|
+
|
|
64
|
+
Snapshot tone histogram across all articles matching a query.
|
|
65
|
+
|
|
66
|
+
- Bins from approximately −30 to +30; each bin includes representative article URLs
|
|
67
|
+
- Summary fields: `peakNegativeBin`, `peakPositiveBin`, `neutralPct` (% of articles in the −2 to +2 range)
|
|
68
|
+
- Distinct from the tone timeline — distribution across all matching articles, not over time
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
### `gdelt_get_coverage_breakdown`
|
|
73
|
+
|
|
74
|
+
Multi-series time series showing which countries or languages drove coverage.
|
|
75
|
+
|
|
76
|
+
- Break down by `language` or `country`
|
|
77
|
+
- Top 10 series by total volume; remaining series aggregated into an "Other" bucket
|
|
78
|
+
- Use to trace how a story propagated geographically
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
### `gdelt_search_tv`
|
|
83
|
+
|
|
84
|
+
Search US television news transcripts (2009–Oct 2024) with per-station airtime analysis.
|
|
85
|
+
|
|
86
|
+
- Structured `stations` parameter (e.g. `["CNN", "FOXNEWS"]`) — the server embeds station filters in the query string
|
|
87
|
+
- Normalize results to relative % or return raw counts
|
|
88
|
+
- TV-specific operators: `market:`, `show:`, `context:`
|
|
89
|
+
- Use `gdelt_list_tv_stations` to verify station active date ranges before querying recent events
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
### `gdelt_get_tv_clips`
|
|
94
|
+
|
|
95
|
+
Retrieve actual TV news clips driving a coverage signal.
|
|
96
|
+
|
|
97
|
+
- Up to 3,000 clips per call
|
|
98
|
+
- Each clip: show name, station, air timestamp, 15-second transcript excerpt, direct Archive.org link, and optional thumbnail
|
|
99
|
+
- Sort by relevance, date descending, or date ascending
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### `gdelt_get_tv_context`
|
|
104
|
+
|
|
105
|
+
Vocabulary framing analysis for TV coverage of a topic.
|
|
106
|
+
|
|
107
|
+
- Returns the 200 most frequent non-stopword terms from matching clips
|
|
108
|
+
- Relative frequency scores (query term = 100)
|
|
109
|
+
- Use to identify narrative framing, related concepts, or follow-up search terms
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
### `gdelt_get_tv_trending`
|
|
114
|
+
|
|
115
|
+
Zero-argument entry point for the current TV news cycle.
|
|
116
|
+
|
|
117
|
+
- Returns trending topics, keywords, and phrases dominating national networks
|
|
118
|
+
- Updated every 15 minutes
|
|
119
|
+
- Note: coverage data ends Oct 2024; results reflect the archive endpoint, not a live feed
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
### `gdelt_list_tv_stations`
|
|
124
|
+
|
|
125
|
+
Station metadata lookup before querying.
|
|
126
|
+
|
|
127
|
+
- All available stations with market, network, monitoring start date, and end date
|
|
128
|
+
- `isActive` flag — `true` when end date is within the last 24 hours
|
|
129
|
+
- Use to verify a station was active during a target time period
|
|
130
|
+
|
|
131
|
+
## Features
|
|
132
|
+
|
|
133
|
+
Built on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):
|
|
134
|
+
|
|
135
|
+
- Declarative tool definitions — single file per tool, framework handles registration and validation
|
|
136
|
+
- Unified error handling — handlers throw, framework catches, classifies, and formats
|
|
137
|
+
- Pluggable auth: `none`, `jwt`, `oauth`
|
|
138
|
+
- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`
|
|
139
|
+
- Structured logging with optional OpenTelemetry tracing
|
|
140
|
+
- STDIO and Streamable HTTP transports
|
|
141
|
+
|
|
142
|
+
GDELT-specific:
|
|
143
|
+
|
|
144
|
+
- Shared rate-limit queue (1 req/5s) across all tools — enforces GDELT's published limit without caller coordination
|
|
145
|
+
- Two service layers (`GdeltDocService`, `GdeltTvService`) mapping clean tool parameters to the DOC and TV API URL conventions
|
|
146
|
+
- TV station filter operators embedded in query strings internally — callers pass structured `stations` arrays, not raw query syntax
|
|
147
|
+
|
|
148
|
+
Agent-friendly output:
|
|
149
|
+
|
|
150
|
+
- Query echo on every response — searches return the original query and applied timespan so agents can chain calls without re-deriving parameters
|
|
151
|
+
- Discriminated series labels — timeline and breakdown responses carry typed `label` fields (`"Volume Intensity"`, `"Average Tone"`, language/country names) rather than positional arrays
|
|
152
|
+
- Structured station metadata — `isActive` boolean and ISO 8601 date fields let agents reason about TV station availability without parsing date strings
|
|
153
|
+
- Partial-coverage signals in distribution output — `neutralPct`, `peakNegativeBin`, `peakPositiveBin` summary fields let agents branch on sentiment without histogramming the raw bins themselves
|
|
154
|
+
|
|
155
|
+
## Getting started
|
|
156
|
+
|
|
157
|
+
Add the following to your MCP client configuration file.
|
|
158
|
+
|
|
159
|
+
```json
|
|
160
|
+
{
|
|
161
|
+
"mcpServers": {
|
|
162
|
+
"gdelt": {
|
|
163
|
+
"type": "stdio",
|
|
164
|
+
"command": "bunx",
|
|
165
|
+
"args": ["@cyanheads/gdelt-mcp-server@latest"],
|
|
166
|
+
"env": {
|
|
167
|
+
"MCP_TRANSPORT_TYPE": "stdio",
|
|
168
|
+
"MCP_LOG_LEVEL": "info"
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Or with npx (no Bun required):
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{
|
|
179
|
+
"mcpServers": {
|
|
180
|
+
"gdelt": {
|
|
181
|
+
"type": "stdio",
|
|
182
|
+
"command": "npx",
|
|
183
|
+
"args": ["-y", "@cyanheads/gdelt-mcp-server@latest"],
|
|
184
|
+
"env": {
|
|
185
|
+
"MCP_TRANSPORT_TYPE": "stdio",
|
|
186
|
+
"MCP_LOG_LEVEL": "info"
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Or with Docker:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"mcpServers": {
|
|
198
|
+
"gdelt": {
|
|
199
|
+
"type": "stdio",
|
|
200
|
+
"command": "docker",
|
|
201
|
+
"args": [
|
|
202
|
+
"run", "-i", "--rm",
|
|
203
|
+
"-e", "MCP_TRANSPORT_TYPE=stdio",
|
|
204
|
+
"ghcr.io/cyanheads/gdelt-mcp-server:latest"
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
For Streamable HTTP, set the transport and start the server:
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
MCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http
|
|
215
|
+
# Server listens at http://localhost:3010/mcp
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Prerequisites
|
|
219
|
+
|
|
220
|
+
- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).
|
|
221
|
+
- No API key required — GDELT is a free public API.
|
|
222
|
+
|
|
223
|
+
### Installation
|
|
224
|
+
|
|
225
|
+
1. **Clone the repository:**
|
|
226
|
+
|
|
227
|
+
```sh
|
|
228
|
+
git clone https://github.com/cyanheads/gdelt-mcp-server.git
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
2. **Navigate into the directory:**
|
|
232
|
+
|
|
233
|
+
```sh
|
|
234
|
+
cd gdelt-mcp-server
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
3. **Install dependencies:**
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
bun install
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
4. **Configure environment:**
|
|
244
|
+
|
|
245
|
+
```sh
|
|
246
|
+
cp .env.example .env
|
|
247
|
+
# edit .env if you need to override defaults
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Configuration
|
|
251
|
+
|
|
252
|
+
All configuration is validated at startup via Zod schemas in `src/config/server-config.ts`. Key environment variables:
|
|
253
|
+
|
|
254
|
+
| Variable | Description | Default |
|
|
255
|
+
|:---------|:------------|:--------|
|
|
256
|
+
| `GDELT_BASE_URL` | Override the GDELT API base URL for both DOC and TV APIs. | `https://api.gdeltproject.org/api/v2` |
|
|
257
|
+
| `GDELT_REQUEST_DELAY_MS` | Minimum milliseconds between GDELT requests (enforces 1 req/5s limit). | `5100` |
|
|
258
|
+
| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |
|
|
259
|
+
| `MCP_HTTP_PORT` | Port for the HTTP server. | `3010` |
|
|
260
|
+
| `MCP_HTTP_ENDPOINT_PATH` | HTTP endpoint path where the MCP server is mounted. | `/mcp` |
|
|
261
|
+
| `MCP_PUBLIC_URL` | Public origin override for TLS-terminating reverse-proxy deployments. | none |
|
|
262
|
+
| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |
|
|
263
|
+
| `MCP_LOG_LEVEL` | Log level (`debug`, `info`, `warning`, `error`, etc.). | `info` |
|
|
264
|
+
| `MCP_GC_PRESSURE_INTERVAL_MS` | Opt-in Bun-only forced-GC pressure loop in ms. Try `60000` if heap growth is observed under sustained HTTP load. | `0` (disabled) |
|
|
265
|
+
| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |
|
|
266
|
+
| `STORAGE_PROVIDER_TYPE` | Storage backend: `in-memory`, `filesystem`, `supabase`, `cloudflare-kv/r2/d1`. | `in-memory` |
|
|
267
|
+
| `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |
|
|
268
|
+
|
|
269
|
+
See [`.env.example`](./.env.example) for the full list of optional overrides.
|
|
270
|
+
|
|
271
|
+
## Running the server
|
|
272
|
+
|
|
273
|
+
### Local development
|
|
274
|
+
|
|
275
|
+
- **Build and run:**
|
|
276
|
+
|
|
277
|
+
```sh
|
|
278
|
+
# One-time build
|
|
279
|
+
bun run rebuild
|
|
280
|
+
|
|
281
|
+
# Run the built server
|
|
282
|
+
bun run start:stdio
|
|
283
|
+
# or
|
|
284
|
+
bun run start:http
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
- **Run checks and tests:**
|
|
288
|
+
|
|
289
|
+
```sh
|
|
290
|
+
bun run devcheck # Lint, format, typecheck, security audit
|
|
291
|
+
bun run test # Vitest test suite
|
|
292
|
+
bun run lint:mcp # Validate MCP definitions against spec
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Docker
|
|
296
|
+
|
|
297
|
+
```sh
|
|
298
|
+
docker build -t gdelt-mcp-server .
|
|
299
|
+
docker run --rm -p 3010:3010 gdelt-mcp-server
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
The Dockerfile defaults to HTTP transport, stateless session mode, and logs to `/var/log/gdelt-mcp-server`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.
|
|
303
|
+
|
|
304
|
+
## Project structure
|
|
305
|
+
|
|
306
|
+
| Directory | Purpose |
|
|
307
|
+
|:----------|:--------|
|
|
308
|
+
| `src/index.ts` | `createApp()` entry point — registers tools and inits services. |
|
|
309
|
+
| `src/config` | Server-specific environment variable parsing and validation with Zod. |
|
|
310
|
+
| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`). Nine tools across DOC and TV APIs. |
|
|
311
|
+
| `src/services/gdelt-doc` | `GdeltDocService` — wraps the DOC API for article search, timelines, tone, and breakdowns. |
|
|
312
|
+
| `src/services/gdelt-tv` | `GdeltTvService` — wraps the TV API for transcript search, clips, context, and trending. |
|
|
313
|
+
| `src/services/gdelt-rate-limiter` | `GdeltRateLimiter` singleton — shared 1 req/5s queue across both services. |
|
|
314
|
+
| `tests/` | Unit and integration tests mirroring `src/`. |
|
|
315
|
+
|
|
316
|
+
## Development guide
|
|
317
|
+
|
|
318
|
+
See [`CLAUDE.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:
|
|
319
|
+
|
|
320
|
+
- Handlers throw, framework catches — no `try/catch` in tool logic
|
|
321
|
+
- Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage
|
|
322
|
+
- Register new tools via the barrels in `src/mcp-server/tools/definitions/index.ts`
|
|
323
|
+
- Wrap GDELT API calls: validate raw JSON → normalize to domain type → return output schema; never fabricate missing fields
|
|
324
|
+
|
|
325
|
+
## Contributing
|
|
326
|
+
|
|
327
|
+
Issues and pull requests are welcome. Run checks and tests before submitting:
|
|
328
|
+
|
|
329
|
+
```sh
|
|
330
|
+
bun run devcheck
|
|
331
|
+
bun run test
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
## License
|
|
335
|
+
|
|
336
|
+
Apache-2.0 — see [LICENSE](./LICENSE) for details.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Initial release — 9 tools for GDELT DOC and TV API search, timelines, tone analysis, and TV transcript coverage"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.1.0 — 2026-05-25
|
|
8
|
+
|
|
9
|
+
## Added
|
|
10
|
+
|
|
11
|
+
- **`gdelt_search_articles`** — full-text search across the last 3 months of global news (65 languages, up to 250 results) with DOC API query syntax: phrases, boolean OR, `sourcecountry:`, `sourcelang:`, `domain:`, `theme:`, `tone<`/`tone>`, `near:`, `repeat:`
|
|
12
|
+
- **`gdelt_get_coverage_timeline`** — coverage volume and tone time series with three modes: `volume`, `volume_with_articles` (top articles per timestep), and `tone`
|
|
13
|
+
- **`gdelt_get_tone_distribution`** — tone histogram (~−30 to +30 bins) with `peakNegativeBin`, `peakPositiveBin`, and `neutralPct` summary fields
|
|
14
|
+
- **`gdelt_get_coverage_breakdown`** — multi-series coverage timeline broken down by source `language` or `country`; top 10 series plus aggregated "Other" bucket
|
|
15
|
+
- **`gdelt_search_tv`** — US TV transcript search (2009–Oct 2024, 150+ stations) with per-station normalized airtime time series
|
|
16
|
+
- **`gdelt_get_tv_clips`** — retrieves up to 3,000 TV clips with 15-second transcript excerpts and Internet Archive viewing links
|
|
17
|
+
- **`gdelt_get_tv_context`** — top 200 co-occurring words/phrases from TV clips matching a query, with relative frequency scores
|
|
18
|
+
- **`gdelt_get_tv_trending`** — zero-argument tool returning trending topics across national TV networks (updated every 15 minutes)
|
|
19
|
+
- **`gdelt_list_tv_stations`** — station metadata (market, network, date range, `isActive` flag) for verifying availability before querying
|
|
20
|
+
- **`GdeltDocService`** — wraps the DOC API (`/api/v2/doc/doc`); used by article search, timeline, tone, and breakdown tools
|
|
21
|
+
- **`GdeltTvService`** — wraps the TV API (`/api/v2/tv/tv`); used by TV search, clips, context, trending, and station list tools
|
|
22
|
+
- **`GdeltRateLimiter`** singleton — shared 1 req/5s queue across both services, enforcing GDELT's published rate limit
|
|
23
|
+
- `bunfig.toml` for Bun runtime configuration
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
summary: "Fix 7 API contract bugs — wrong response keys, invalid query modes, and empty-response handling across TV and DOC tools"
|
|
3
|
+
breaking: false
|
|
4
|
+
security: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# 0.1.1 — 2026-05-25
|
|
8
|
+
|
|
9
|
+
## Fixed
|
|
10
|
+
|
|
11
|
+
- **`gdelt_get_tone_distribution`** — `tonechart` bins expose article URLs under `toparts`, not `articles`; handler now reads the correct key
|
|
12
|
+
- **`gdelt_get_coverage_timeline`** — `volume_with_articles` mode likewise reads `toparts` per timestep instead of `articles`
|
|
13
|
+
- **`gdelt_get_tv_clips`** — thumbnail URL field is `preview_thumb`, not `thumbnail_url`; clips now include thumbnails when available
|
|
14
|
+
- **`gdelt_search_tv`** — TV timeline modes corrected: `timelinevolnorm` (normalized) and `timelinevol` (raw); prior values `timelinenorm`/`timeline` are not valid TV API modes
|
|
15
|
+
- **`gdelt_get_tv_context`** — `RawTvWord` fields are `label`/`count`, not `Label`/`Score`; context words now populate correctly
|
|
16
|
+
- **`gdelt_get_tv_trending`** — trending response key is `OverallTrendingTopics` (with fallback to `OverallTrendingPhrases`); prior key `topics` never matched, always returned empty
|
|
17
|
+
- **`gdelt_list_tv_stations`** — station list response key is `station_details`, not `stations`; station metadata now returns correctly
|
|
18
|
+
- **Empty-response guard** — `gdelt-fetch.ts` now throws `serviceUnavailable` on an empty API response body instead of passing a blank string to `JSON.parse`
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
---
|
|
2
|
+
# FORMAT REFERENCE — do not edit. Copy this file to
|
|
3
|
+
# `changelog/<major.minor>.x/<version>.md` (e.g. `changelog/0.8.x/0.8.6.md`)
|
|
4
|
+
# to author a new release. Set that file's H1 to `# <version> — YYYY-MM-DD`
|
|
5
|
+
# with a concrete date.
|
|
6
|
+
|
|
7
|
+
# Required. One-line GitHub Release-style headline. 350 character cap.
|
|
8
|
+
# Default short and scannable. Don't pad, don't stitch unrelated changes with
|
|
9
|
+
# semicolons — pick the headline. Quotes required: unquoted YAML treats `: `
|
|
10
|
+
# inside the value as a key separator and fails GitHub's strict parser.
|
|
11
|
+
summary: ""
|
|
12
|
+
|
|
13
|
+
# Set `true` when consumers must change code to upgrade: API removals,
|
|
14
|
+
# signature changes, config renames, behavior changes that break existing
|
|
15
|
+
# usage. Flagged as `Breaking` in the rollup.
|
|
16
|
+
breaking: false
|
|
17
|
+
|
|
18
|
+
# Set `true` if this release contains any security fix. Pairs with the
|
|
19
|
+
# `## Security` section below. Flagged as `Security` in the rollup so
|
|
20
|
+
# users can triage upgrade urgency at a glance.
|
|
21
|
+
security: false
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# <version> — YYYY-MM-DD
|
|
25
|
+
|
|
26
|
+
<!--
|
|
27
|
+
AUTHORING GUIDE — applies to the new per-version file you create from this
|
|
28
|
+
template.
|
|
29
|
+
|
|
30
|
+
Audience: someone scanning release notes to decide what affects them. Lead
|
|
31
|
+
each bullet with the symbol or concept name in **bold** so they can skip
|
|
32
|
+
what's irrelevant and zoom in on what's not.
|
|
33
|
+
|
|
34
|
+
Tone: terse, fact-dense, not verbose. Default to one sentence per bullet —
|
|
35
|
+
name the symbol, state what changed, stop. Use a second sentence only when
|
|
36
|
+
it carries weight. If a bullet feels long, it is.
|
|
37
|
+
|
|
38
|
+
Cut: mechanism walkthroughs (those belong in JSDoc, AGENTS.md, or the
|
|
39
|
+
relevant skill), ceremonial framings ("This release introduces…",
|
|
40
|
+
backwards-compat paragraphs), file-by-file test enumerations, internal
|
|
41
|
+
implementation notes. Prefer code/symbol names over English re-explanations.
|
|
42
|
+
|
|
43
|
+
Narrative intro: skip by default. Add one short sentence only when the
|
|
44
|
+
release theme genuinely needs framing the bullets can't carry.
|
|
45
|
+
|
|
46
|
+
Sections: Keep a Changelog order — Added, Changed, Deprecated, Removed,
|
|
47
|
+
Fixed, Security. Include only sections with entries; delete the rest
|
|
48
|
+
(including the commented-out scaffolding below). Don't ship empty headers.
|
|
49
|
+
|
|
50
|
+
Include: every distinct fact a reader needs to adopt or audit the release —
|
|
51
|
+
new exports, signatures, lint rule IDs, env vars, breaking changes, version
|
|
52
|
+
bumps on shipped skills. Nothing more.
|
|
53
|
+
|
|
54
|
+
Links: link issues, PRs, docs, or skills where they help a reader jump to
|
|
55
|
+
context. Once per item per entry — don't re-link the same issue in summary,
|
|
56
|
+
narrative, and bullet. Skip links for inline symbol names; code spans speak
|
|
57
|
+
for themselves.
|
|
58
|
+
|
|
59
|
+
Issue/PR URLs: use full URLs. GitHub's bare `#NN` auto-link only resolves
|
|
60
|
+
inside its own UI, not in npm reads or local editors.
|
|
61
|
+
|
|
62
|
+
[#38](https://github.com/cyanheads/mcp-ts-core/issues/38) ← issue
|
|
63
|
+
[#42](https://github.com/cyanheads/mcp-ts-core/pull/42) ← PR
|
|
64
|
+
|
|
65
|
+
Verify numbers exist before linking (`gh issue view NN`, `gh pr view NN`).
|
|
66
|
+
Never speculate on a future number — `#42` for an upcoming PR silently
|
|
67
|
+
resolves to whatever real item already owns 42, and timeline previews pull
|
|
68
|
+
in that unrelated item's metadata.
|
|
69
|
+
|
|
70
|
+
TAG ANNOTATIONS — the annotated tag body renders as the GitHub Release body
|
|
71
|
+
via `gh release create --notes-from-tag`. The tag is a derivative of this
|
|
72
|
+
changelog entry — a condensed, scannable version, not a copy. Format:
|
|
73
|
+
|
|
74
|
+
<theme — omit version number, GitHub prepends it>
|
|
75
|
+
← blank line
|
|
76
|
+
<1-2 sentence context: what this release does>
|
|
77
|
+
← blank line
|
|
78
|
+
Dependency bumps: ← section header
|
|
79
|
+
← blank line
|
|
80
|
+
- `@cyanheads/mcp-ts-core` ^0.9.1 → ^0.9.6 ← bullet
|
|
81
|
+
← blank line
|
|
82
|
+
Changed: ← only sections with entries
|
|
83
|
+
← blank line
|
|
84
|
+
- `format()` output includes `query` in text mode
|
|
85
|
+
← blank line
|
|
86
|
+
Added:
|
|
87
|
+
← blank line
|
|
88
|
+
- `manifest.json` scaffolded for MCPB bundle support
|
|
89
|
+
- Install badges (Claude Desktop, Cursor, VS Code)
|
|
90
|
+
← blank line
|
|
91
|
+
<N> tests pass; `bun run devcheck` clean. ← footer
|
|
92
|
+
|
|
93
|
+
Never a flat comma-separated string. Always structured markdown with
|
|
94
|
+
sections. The tag must scan well as a rendered GitHub Release page.
|
|
95
|
+
-->
|
|
96
|
+
|
|
97
|
+
## Added
|
|
98
|
+
|
|
99
|
+
-
|
|
100
|
+
|
|
101
|
+
## Changed
|
|
102
|
+
|
|
103
|
+
-
|
|
104
|
+
|
|
105
|
+
<!-- ## Deprecated
|
|
106
|
+
|
|
107
|
+
- -->
|
|
108
|
+
|
|
109
|
+
<!-- ## Removed
|
|
110
|
+
|
|
111
|
+
- -->
|
|
112
|
+
|
|
113
|
+
## Fixed
|
|
114
|
+
|
|
115
|
+
-
|
|
116
|
+
|
|
117
|
+
<!-- ## Security
|
|
118
|
+
|
|
119
|
+
- -->
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration parsed from environment variables.
|
|
3
|
+
* @module config/server-config
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
declare const ServerConfigSchema: z.ZodObject<{
|
|
7
|
+
baseUrl: z.ZodDefault<z.ZodString>;
|
|
8
|
+
requestDelayMs: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type ServerConfig = z.infer<typeof ServerConfigSchema>;
|
|
11
|
+
export declare function getServerConfig(): ServerConfig;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=server-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.d.ts","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAG3C,QAAA,MAAM,kBAAkB;;;iBAYtB,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAI9D,wBAAgB,eAAe,IAAI,YAAY,CAM9C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Server-specific configuration parsed from environment variables.
|
|
3
|
+
* @module config/server-config
|
|
4
|
+
*/
|
|
5
|
+
import { z } from '@cyanheads/mcp-ts-core';
|
|
6
|
+
import { parseEnvConfig } from '@cyanheads/mcp-ts-core/config';
|
|
7
|
+
const ServerConfigSchema = z.object({
|
|
8
|
+
baseUrl: z
|
|
9
|
+
.string()
|
|
10
|
+
.url()
|
|
11
|
+
.default('https://api.gdeltproject.org/api/v2')
|
|
12
|
+
.describe('Base URL for GDELT APIs'),
|
|
13
|
+
requestDelayMs: z.coerce
|
|
14
|
+
.number()
|
|
15
|
+
.int()
|
|
16
|
+
.min(0)
|
|
17
|
+
.default(5100)
|
|
18
|
+
.describe('Minimum milliseconds between API requests to satisfy 1 req/5s rate limit'),
|
|
19
|
+
});
|
|
20
|
+
let _config;
|
|
21
|
+
export function getServerConfig() {
|
|
22
|
+
_config ??= parseEnvConfig(ServerConfigSchema, {
|
|
23
|
+
baseUrl: 'GDELT_BASE_URL',
|
|
24
|
+
requestDelayMs: 'GDELT_REQUEST_DELAY_MS',
|
|
25
|
+
});
|
|
26
|
+
return _config;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=server-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-config.js","sourceRoot":"","sources":["../../src/config/server-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,wBAAwB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,EAAE;SACL,OAAO,CAAC,qCAAqC,CAAC;SAC9C,QAAQ,CAAC,yBAAyB,CAAC;IACtC,cAAc,EAAE,CAAC,CAAC,MAAM;SACrB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,0EAA0E,CAAC;CACxF,CAAC,CAAC;AAIH,IAAI,OAAiC,CAAC;AAEtC,MAAM,UAAU,eAAe;IAC7B,OAAO,KAAK,cAAc,CAAC,kBAAkB,EAAE;QAC7C,OAAO,EAAE,gBAAgB;QACzB,cAAc,EAAE,wBAAwB;KACzC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview gdelt-mcp-server MCP server entry point.
|
|
4
|
+
* @module index
|
|
5
|
+
*/
|
|
6
|
+
import { createApp } from '@cyanheads/mcp-ts-core';
|
|
7
|
+
import { getServerConfig } from './config/server-config.js';
|
|
8
|
+
import { gdeltGetCoverageBreakdown, gdeltGetCoverageTimeline, gdeltGetToneDistribution, gdeltGetTvClips, gdeltGetTvContext, gdeltGetTvTrending, gdeltListTvStations, gdeltSearchArticles, gdeltSearchTv, } from './mcp-server/tools/definitions/index.js';
|
|
9
|
+
import { initGdeltDocService } from './services/gdelt/gdelt-doc-service.js';
|
|
10
|
+
import { initGdeltTvService } from './services/gdelt/gdelt-tv-service.js';
|
|
11
|
+
import { initRateLimiter } from './services/gdelt/rate-limiter.js';
|
|
12
|
+
await createApp({
|
|
13
|
+
tools: [
|
|
14
|
+
gdeltSearchArticles,
|
|
15
|
+
gdeltGetCoverageTimeline,
|
|
16
|
+
gdeltGetToneDistribution,
|
|
17
|
+
gdeltGetCoverageBreakdown,
|
|
18
|
+
gdeltSearchTv,
|
|
19
|
+
gdeltGetTvClips,
|
|
20
|
+
gdeltGetTvContext,
|
|
21
|
+
gdeltGetTvTrending,
|
|
22
|
+
gdeltListTvStations,
|
|
23
|
+
],
|
|
24
|
+
resources: [],
|
|
25
|
+
prompts: [],
|
|
26
|
+
instructions: 'GDELT MCP Server — global news and TV transcript analysis.\n' +
|
|
27
|
+
'- gdelt_search_articles: full-text news search (last 3 months, 65+ languages)\n' +
|
|
28
|
+
'- gdelt_get_coverage_timeline: when did coverage spike? (use mode volume_with_articles for signal detection)\n' +
|
|
29
|
+
'- gdelt_get_tone_distribution: emotional distribution of coverage (histogram)\n' +
|
|
30
|
+
'- gdelt_get_coverage_breakdown: which countries/languages drove coverage?\n' +
|
|
31
|
+
'- gdelt_search_tv: US TV transcript search (2009–Oct 2024, 150+ stations)\n' +
|
|
32
|
+
'- gdelt_get_tv_clips: read actual TV transcript excerpts with archive links\n' +
|
|
33
|
+
'- gdelt_get_tv_context: vocabulary framing a topic on television\n' +
|
|
34
|
+
'- gdelt_get_tv_trending: current trending topics on TV news (Oct 2024 archive cutoff)\n' +
|
|
35
|
+
'- gdelt_list_tv_stations: verify station IDs and active date ranges before TV queries\n' +
|
|
36
|
+
'Rate limit: 1 request per 5 seconds — multi-step workflows take 15+ seconds.',
|
|
37
|
+
setup(core) {
|
|
38
|
+
const serverConfig = getServerConfig();
|
|
39
|
+
initRateLimiter(serverConfig.requestDelayMs);
|
|
40
|
+
initGdeltDocService(core.config, core.storage, serverConfig);
|
|
41
|
+
initGdeltTvService(core.config, core.storage, serverConfig);
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EACL,yBAAyB,EACzB,wBAAwB,EACxB,wBAAwB,EACxB,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,GACd,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,SAAS,CAAC;IACd,KAAK,EAAE;QACL,mBAAmB;QACnB,wBAAwB;QACxB,wBAAwB;QACxB,yBAAyB;QACzB,aAAa;QACb,eAAe;QACf,iBAAiB;QACjB,kBAAkB;QAClB,mBAAmB;KACpB;IACD,SAAS,EAAE,EAAE;IACb,OAAO,EAAE,EAAE;IACX,YAAY,EACV,8DAA8D;QAC9D,iFAAiF;QACjF,gHAAgH;QAChH,iFAAiF;QACjF,6EAA6E;QAC7E,6EAA6E;QAC7E,+EAA+E;QAC/E,oEAAoE;QACpE,yFAAyF;QACzF,yFAAyF;QACzF,8EAA8E;IAEhF,KAAK,CAAC,IAAI;QACR,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC;QACvC,eAAe,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;QAC7C,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAC7D,kBAAkB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9D,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared date resolution inference for GDELT timeline data.
|
|
3
|
+
* @module mcp-server/tools/date-resolution
|
|
4
|
+
*/
|
|
5
|
+
/** Infer date resolution from a list of GDELT date strings. */
|
|
6
|
+
export declare function inferDateResolution(dates: string[]): 'hour' | 'day';
|
|
7
|
+
//# sourceMappingURL=date-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-resolution.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/date-resolution.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+DAA+D;AAC/D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,KAAK,CAKnE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Shared date resolution inference for GDELT timeline data.
|
|
3
|
+
* @module mcp-server/tools/date-resolution
|
|
4
|
+
*/
|
|
5
|
+
/** Infer date resolution from a list of GDELT date strings. */
|
|
6
|
+
export function inferDateResolution(dates) {
|
|
7
|
+
if (dates.length < 2)
|
|
8
|
+
return 'day';
|
|
9
|
+
const sample = dates[0] ?? '';
|
|
10
|
+
// GDELT timeline dates include a time component for hourly data
|
|
11
|
+
return sample.includes('T') && sample.length > 10 ? 'hour' : 'day';
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=date-resolution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-resolution.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/date-resolution.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,+DAA+D;AAC/D,MAAM,UAAU,mBAAmB,CAAC,KAAe;IACjD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IAC9B,gEAAgE;IAChE,OAAO,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;AACrE,CAAC"}
|