@globalfishingwatch/mcp 0.0.5 → 0.0.7

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # gfw-mcp-js
1
+ # @globalfishingwatch/mcp
2
2
 
3
3
  Access [Global Fishing Watch](https://globalfishingwatch.org) data from any MCP-compatible AI assistant or directly from the terminal. Search vessels, retrieve fishing and port-visit events, look up Marine Protected Areas, Exclusive Economic Zones and RFMOs, calculate fishing activity hours within any region, and compute aggregate event statistics.
4
4
 
@@ -19,10 +19,20 @@ This package can be used in two modes:
19
19
  ### Quick start (no install)
20
20
 
21
21
  ```bash
22
- npx gfw-mcp-js mcp
22
+ GFW_TOKEN=your_gfw_api_key_here npx @globalfishingwatch/mcp mcp
23
23
  ```
24
24
 
25
- Set your API key via the `GFW_TOKEN` environment variable (or `API_KEY` for compatibility).
25
+ `mcp` is a subcommand of the CLI that starts the MCP stdio server.
26
+
27
+ ### Authentication
28
+
29
+ The MCP server resolves the API token in this order:
30
+
31
+ 1. `GFW_TOKEN` environment variable
32
+ 2. `API_KEY` environment variable (compatibility alias)
33
+ 3. `~/.gfw/config.json` (saved via `gfw auth login`)
34
+
35
+ If you have already run `gfw auth login` from the CLI, the MCP server will pick up the stored token automatically — no need to set environment variables in your client config.
26
36
 
27
37
  ### Client configuration
28
38
 
@@ -36,7 +46,7 @@ Set your API key via the `GFW_TOKEN` environment variable (or `API_KEY` for comp
36
46
  "mcpServers": {
37
47
  "gfw": {
38
48
  "command": "npx",
39
- "args": ["-y", "gfw-mcp-js", "mcp"],
49
+ "args": ["-y", "@globalfishingwatch/mcp", "mcp"],
40
50
  "env": {
41
51
  "GFW_TOKEN": "your_gfw_api_key_here"
42
52
  }
@@ -48,7 +58,7 @@ Set your API key via the `GFW_TOKEN` environment variable (or `API_KEY` for comp
48
58
  #### Claude Code
49
59
 
50
60
  ```bash
51
- claude mcp add gfw -- npx -y gfw-mcp-js mcp
61
+ claude mcp add gfw -- npx -y @globalfishingwatch/mcp mcp
52
62
  export GFW_TOKEN=your_gfw_api_key_here
53
63
  ```
54
64
 
@@ -61,7 +71,7 @@ export GFW_TOKEN=your_gfw_api_key_here
61
71
  "mcpServers": {
62
72
  "gfw": {
63
73
  "command": "npx",
64
- "args": ["-y", "gfw-mcp-js", "mcp"],
74
+ "args": ["-y", "@globalfishingwatch/mcp", "mcp"],
65
75
  "env": { "GFW_TOKEN": "your_gfw_api_key_here" }
66
76
  }
67
77
  }
@@ -77,7 +87,7 @@ export GFW_TOKEN=your_gfw_api_key_here
77
87
  "mcpServers": {
78
88
  "gfw": {
79
89
  "command": "npx",
80
- "args": ["-y", "gfw-mcp-js", "mcp"],
90
+ "args": ["-y", "@globalfishingwatch/mcp", "mcp"],
81
91
  "env": { "GFW_TOKEN": "your_gfw_api_key_here" }
82
92
  }
83
93
  }
@@ -94,7 +104,7 @@ export GFW_TOKEN=your_gfw_api_key_here
94
104
  "gfw": {
95
105
  "type": "stdio",
96
106
  "command": "npx",
97
- "args": ["-y", "gfw-mcp-js", "mcp"],
107
+ "args": ["-y", "@globalfishingwatch/mcp", "mcp"],
98
108
  "env": { "GFW_TOKEN": "your_gfw_api_key_here" }
99
109
  }
100
110
  }
@@ -112,7 +122,7 @@ export GFW_TOKEN=your_gfw_api_key_here
112
122
  "servers": {
113
123
  "gfw": {
114
124
  "command": "npx",
115
- "args": ["-y", "gfw-mcp-js", "mcp"],
125
+ "args": ["-y", "@globalfishingwatch/mcp", "mcp"],
116
126
  "env": { "GFW_TOKEN": "your_gfw_api_key_here" }
117
127
  }
118
128
  }
@@ -130,7 +140,7 @@ export GFW_TOKEN=your_gfw_api_key_here
130
140
  "mcpServers": {
131
141
  "gfw": {
132
142
  "command": "npx",
133
- "args": ["-y", "gfw-mcp-js", "mcp"],
143
+ "args": ["-y", "@globalfishingwatch/mcp", "mcp"],
134
144
  "env": { "GFW_TOKEN": "your_gfw_api_key_here" }
135
145
  }
136
146
  }
@@ -145,7 +155,7 @@ cd gfw-mcp
145
155
  npm install && npm run build
146
156
  ```
147
157
 
148
- Then replace `npx -y gfw-mcp-js` with `node /absolute/path/to/gfw-mcp/dist/bin.js` in any config above.
158
+ Then replace `npx -y @globalfishingwatch/mcp` with `node /absolute/path/to/gfw-mcp/dist/bin.js` in any config above.
149
159
 
150
160
  ### Available MCP tools
151
161
 
@@ -167,11 +177,11 @@ Then replace `npx -y gfw-mcp-js` with `node /absolute/path/to/gfw-mcp/dist/bin.j
167
177
 
168
178
  ```bash
169
179
  # Run without installing
170
- npx gfw-mcp-js --help
180
+ npx @globalfishingwatch/mcp --help
171
181
 
172
182
  # Or install globally
173
- npm install -g gfw-mcp-js
174
- gfw-mcp-js --help
183
+ npm install -g @globalfishingwatch/mcp
184
+ gfw-mcp --help
175
185
  ```
176
186
 
177
187
  ### Authentication
@@ -184,19 +194,19 @@ Token resolution order:
184
194
 
185
195
  ```bash
186
196
  # Save token interactively (stored in ~/.gfw/config.json)
187
- npx gfw-mcp-js auth login
197
+ npx @globalfishingwatch/mcp auth login
188
198
 
189
199
  # Check which token source is active
190
- npx gfw-mcp-js auth status
200
+ npx @globalfishingwatch/mcp auth status
191
201
 
192
202
  # Remove stored token
193
- npx gfw-mcp-js auth logout
203
+ npx @globalfishingwatch/mcp auth logout
194
204
  ```
195
205
 
196
206
  Or pass the token inline for a single command:
197
207
 
198
208
  ```bash
199
- GFW_TOKEN=your_key npx gfw-mcp-js vessel-search --name "Maria"
209
+ GFW_TOKEN=your_key npx @globalfishingwatch/mcp vessel-search --name "Maria"
200
210
  ```
201
211
 
202
212
  ### Commands
@@ -206,7 +216,7 @@ GFW_TOKEN=your_key npx gfw-mcp-js vessel-search --name "Maria"
206
216
  Search vessels by name, MMSI, IMO, callsign, flag, or activity date range.
207
217
 
208
218
  ```bash
209
- npx gfw-mcp-js vessel-search [--name <name>] [--mmsi <mmsi>] [--imo <imo>]
219
+ npx @globalfishingwatch/mcp vessel-search [--name <name>] [--mmsi <mmsi>] [--imo <imo>]
210
220
  [--callsign <cs>] [--flag <ISO3>] [--active-from <YYYY-MM-DD>]
211
221
  [--active-to <YYYY-MM-DD>] [--limit <n>]
212
222
  ```
@@ -222,9 +232,9 @@ At least one filter must be provided.
222
232
  | `--limit` | 1–50 (default 10) |
223
233
 
224
234
  ```bash
225
- npx gfw-mcp-js vessel-search --name "Maria" --flag CHN
226
- npx gfw-mcp-js vessel-search --mmsi 123456789
227
- npx gfw-mcp-js vessel-search --flag ESP --active-from 2024-01-01 --active-to 2024-12-31 --limit 20
235
+ npx @globalfishingwatch/mcp vessel-search --name "Maria" --flag CHN
236
+ npx @globalfishingwatch/mcp vessel-search --mmsi 123456789
237
+ npx @globalfishingwatch/mcp vessel-search --flag ESP --active-from 2024-01-01 --active-to 2024-12-31 --limit 20
228
238
  ```
229
239
 
230
240
  #### `vessel-by-id`
@@ -232,12 +242,12 @@ npx gfw-mcp-js vessel-search --flag ESP --active-from 2024-01-01 --active-to 202
232
242
  Fetch full vessel profile(s) by GFW vessel ID.
233
243
 
234
244
  ```bash
235
- npx gfw-mcp-js vessel-by-id --ids <id> [<id2> ...]
245
+ npx @globalfishingwatch/mcp vessel-by-id --ids <id> [<id2> ...]
236
246
  ```
237
247
 
238
248
  ```bash
239
- npx gfw-mcp-js vessel-by-id --ids abc123
240
- npx gfw-mcp-js vessel-by-id --ids abc123 def456 ghi789
249
+ npx @globalfishingwatch/mcp vessel-by-id --ids abc123
250
+ npx @globalfishingwatch/mcp vessel-by-id --ids abc123 def456 ghi789
241
251
  ```
242
252
 
243
253
  #### `vessel-events`
@@ -245,7 +255,7 @@ npx gfw-mcp-js vessel-by-id --ids abc123 def456 ghi789
245
255
  Retrieve fishing, encounter, port visit, or loitering events.
246
256
 
247
257
  ```bash
248
- npx gfw-mcp-js vessel-events --event-type <type>
258
+ npx @globalfishingwatch/mcp vessel-events --event-type <type>
249
259
  --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>
250
260
  [--vessel-id <id>] [--limit <n>] [--offset <n>]
251
261
  [--confidence <2|3|4> ...] # port_visit only
@@ -263,10 +273,10 @@ npx gfw-mcp-js vessel-events --event-type <type>
263
273
  | `--region-type` | `MPA` \| `EEZ` \| `RFMO` |
264
274
 
265
275
  ```bash
266
- npx gfw-mcp-js vessel-events --event-type fishing --start-date 2024-01-01 --end-date 2024-06-01
267
- npx gfw-mcp-js vessel-events --event-type port_visit --vessel-id abc123 --start-date 2024-01-01 --end-date 2024-12-31
268
- npx gfw-mcp-js vessel-events --event-type encounter --start-date 2024-01-01 --end-date 2024-12-31 --encounter-types CARRIER-FISHING SUPPORT-FISHING
269
- npx gfw-mcp-js vessel-events --event-type fishing --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-06-01
276
+ npx @globalfishingwatch/mcp vessel-events --event-type fishing --start-date 2024-01-01 --end-date 2024-06-01
277
+ npx @globalfishingwatch/mcp vessel-events --event-type port_visit --vessel-id abc123 --start-date 2024-01-01 --end-date 2024-12-31
278
+ npx @globalfishingwatch/mcp vessel-events --event-type encounter --start-date 2024-01-01 --end-date 2024-12-31 --encounter-types CARRIER-FISHING SUPPORT-FISHING
279
+ npx @globalfishingwatch/mcp vessel-events --event-type fishing --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-06-01
270
280
  ```
271
281
 
272
282
  #### `events-stats`
@@ -274,7 +284,7 @@ npx gfw-mcp-js vessel-events --event-type fishing --region-type EEZ --region-id
274
284
  Compute aggregate event statistics over a date range.
275
285
 
276
286
  ```bash
277
- npx gfw-mcp-js events-stats --event-type <type>
287
+ npx @globalfishingwatch/mcp events-stats --event-type <type>
278
288
  --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>
279
289
  [--group-by <FLAG|GEARTYPE>]
280
290
  [--region-type <MPA|EEZ|RFMO>] [--region-id <id>]
@@ -291,9 +301,9 @@ npx gfw-mcp-js events-stats --event-type <type>
291
301
  | `--encounter-types` | `CARRIER-FISHING` \| `CARRIER-BUNKER` \| `FISHING-BUNKER` \| `FISHING-FISHING` \| `SUPPORT-FISHING` (encounter only; default `CARRIER-FISHING SUPPORT-FISHING`) |
292
302
 
293
303
  ```bash
294
- npx gfw-mcp-js events-stats --event-type fishing --start-date 2024-01-01 --end-date 2024-12-31
295
- npx gfw-mcp-js events-stats --event-type fishing --start-date 2024-01-01 --end-date 2024-12-31 --group-by GEARTYPE
296
- npx gfw-mcp-js events-stats --event-type encounter --start-date 2024-01-01 --end-date 2024-12-31 --region-type RFMO --region-id WCPFC
304
+ npx @globalfishingwatch/mcp events-stats --event-type fishing --start-date 2024-01-01 --end-date 2024-12-31
305
+ npx @globalfishingwatch/mcp events-stats --event-type fishing --start-date 2024-01-01 --end-date 2024-12-31 --group-by GEARTYPE
306
+ npx @globalfishingwatch/mcp events-stats --event-type encounter --start-date 2024-01-01 --end-date 2024-12-31 --region-type RFMO --region-id WCPFC
297
307
  ```
298
308
 
299
309
  #### `region-id-lookup`
@@ -301,7 +311,7 @@ npx gfw-mcp-js events-stats --event-type encounter --start-date 2024-01-01 --end
301
311
  Resolve an MPA, EEZ, or RFMO name to its canonical ID.
302
312
 
303
313
  ```bash
304
- npx gfw-mcp-js region-id-lookup --region-type <MPA|EEZ|RFMO> --query <name> [--limit <n>]
314
+ npx @globalfishingwatch/mcp region-id-lookup --region-type <MPA|EEZ|RFMO> --query <name> [--limit <n>]
305
315
  ```
306
316
 
307
317
  Use this before `vessel-report` or `vessel-events` when you only know the human-readable name of a region.
@@ -312,9 +322,9 @@ Use this before `vessel-report` or `vessel-events` when you only know the human-
312
322
  | `--limit` | 1–20 (default 5) |
313
323
 
314
324
  ```bash
315
- npx gfw-mcp-js region-id-lookup --region-type MPA --query "Galapagos"
316
- npx gfw-mcp-js region-id-lookup --region-type EEZ --query "Patagonia" --limit 10
317
- npx gfw-mcp-js region-id-lookup --region-type RFMO --query "WCPFC"
325
+ npx @globalfishingwatch/mcp region-id-lookup --region-type MPA --query "Galapagos"
326
+ npx @globalfishingwatch/mcp region-id-lookup --region-type EEZ --query "Patagonia" --limit 10
327
+ npx @globalfishingwatch/mcp region-id-lookup --region-type RFMO --query "WCPFC"
318
328
  ```
319
329
 
320
330
  #### `region-geometry`
@@ -322,7 +332,7 @@ npx gfw-mcp-js region-id-lookup --region-type RFMO --query "WCPFC"
322
332
  Get the GeoJSON URL for a specific region (no API token required).
323
333
 
324
334
  ```bash
325
- npx gfw-mcp-js region-geometry --region-type <MPA|EEZ|RFMO> --id <id>
335
+ npx @globalfishingwatch/mcp region-geometry --region-type <MPA|EEZ|RFMO> --id <id>
326
336
  ```
327
337
 
328
338
  | Parameter | Format / values |
@@ -330,8 +340,8 @@ npx gfw-mcp-js region-geometry --region-type <MPA|EEZ|RFMO> --id <id>
330
340
  | `--region-type` | `MPA` \| `EEZ` \| `RFMO` |
331
341
 
332
342
  ```bash
333
- npx gfw-mcp-js region-geometry --region-type EEZ --id 8386
334
- npx gfw-mcp-js region-geometry --region-type MPA --id 12345
343
+ npx @globalfishingwatch/mcp region-geometry --region-type EEZ --id 8386
344
+ npx @globalfishingwatch/mcp region-geometry --region-type MPA --id 12345
335
345
  ```
336
346
 
337
347
  #### `vessel-report`
@@ -341,7 +351,7 @@ Calculate fishing or presence hours inside a region. Date range must not exceed
341
351
  > **Important:** This command must never be run in parallel. If multiple reports are needed, run them sequentially — one at a time, waiting for each to complete before starting the next.
342
352
 
343
353
  ```bash
344
- npx gfw-mcp-js vessel-report --region-type <MPA|EEZ|RFMO> --region-id <id>
354
+ npx @globalfishingwatch/mcp vessel-report --region-type <MPA|EEZ|RFMO> --region-id <id>
345
355
  --start-date <YYYY-MM-DD> --end-date <YYYY-MM-DD>
346
356
  [--type <FISHING|PRESENCE>]
347
357
  [--flags <ISO3> ...]
@@ -363,10 +373,10 @@ npx gfw-mcp-js vessel-report --region-type <MPA|EEZ|RFMO> --region-id <id>
363
373
  | `--group-by` | `VESSEL_ID` (default) \| `FLAG` \| `GEARTYPE` \| `FLAGANDGEARTYPE` (`GEARTYPE`/`FLAGANDGEARTYPE` only valid with `--type FISHING`) |
364
374
 
365
375
  ```bash
366
- npx gfw-mcp-js vessel-report --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-12-31
367
- npx gfw-mcp-js vessel-report --region-type MPA --region-id 12345 --start-date 2024-01-01 --end-date 2024-12-31 --flags CHN ESP
368
- npx gfw-mcp-js vessel-report --region-type RFMO --region-id WCPFC --start-date 2024-01-01 --end-date 2024-12-31 --type FISHING --group-by FLAG
369
- npx gfw-mcp-js vessel-report --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-12-31 --type PRESENCE --vessel-types fishing cargo
376
+ npx @globalfishingwatch/mcp vessel-report --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-12-31
377
+ npx @globalfishingwatch/mcp vessel-report --region-type MPA --region-id 12345 --start-date 2024-01-01 --end-date 2024-12-31 --flags CHN ESP
378
+ npx @globalfishingwatch/mcp vessel-report --region-type RFMO --region-id WCPFC --start-date 2024-01-01 --end-date 2024-12-31 --type FISHING --group-by FLAG
379
+ npx @globalfishingwatch/mcp vessel-report --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-12-31 --type PRESENCE --vessel-types fishing cargo
370
380
  ```
371
381
 
372
382
  ### Output
@@ -374,8 +384,8 @@ npx gfw-mcp-js vessel-report --region-type EEZ --region-id 8386 --start-date 202
374
384
  All commands output JSON to stdout, ready to pipe to `jq`:
375
385
 
376
386
  ```bash
377
- npx gfw-mcp-js vessel-search --name "Maria" | jq '.results[].name'
378
- npx gfw-mcp-js vessel-report --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-12-31 | jq '.fishingHours'
387
+ npx @globalfishingwatch/mcp vessel-search --name "Maria" | jq '.results[].name'
388
+ npx @globalfishingwatch/mcp vessel-report --region-type EEZ --region-id 8386 --start-date 2024-01-01 --end-date 2024-12-31 | jq '.fishingHours'
379
389
  ```
380
390
 
381
391
  ---
@@ -394,11 +404,11 @@ npx gfw-mcp-js vessel-report --region-type EEZ --region-id 8386 --start-date 202
394
404
  ## Project structure
395
405
 
396
406
  ```
397
- bin.ts # Dispatcher: routes to MCP server or CLI
398
- index.ts # MCP server entry point (stdio transport)
407
+ bin.ts # Entry point: loads CLI (dist/bin.js registered as "mcp" binary)
408
+ index.ts # MCP server stdio setup (used by the `mcp` CLI command)
399
409
  mcp-server.ts # McpServer creation and tool registration
400
410
  cli/
401
- index.ts # CLI entry point (commander)
411
+ index.ts # CLI entry point (commander); includes the `mcp` subcommand
402
412
  auth.ts # Token resolution and auth commands
403
413
  middleware/
404
414
  auth.ts # Bearer / X-API-Key authentication middleware
package/dist/bin.js CHANGED
@@ -1,19 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- /**
4
- * Single entry point for the gfw-mcp-js package.
5
- *
6
- * npx gfw-mcp-js mcp → start MCP stdio server
7
- * npx gfw-mcp-js vessel-search --name Maria → CLI one-shot
8
- * npx gfw-mcp-js --help → CLI help
9
- */
10
3
  Object.defineProperty(exports, "__esModule", { value: true });
11
- const [, , first] = process.argv;
12
- if (first === 'mcp') {
13
- // Remove the 'mcp' argument so the MCP entry point sees a clean argv
14
- process.argv.splice(2, 1);
15
- import('./index.js').catch((err) => { console.error(err); process.exit(1); });
16
- }
17
- else {
18
- import('./cli/index.js').catch((err) => { console.error(err); process.exit(1); });
19
- }
4
+ require("./cli/index.js");
package/dist/cli/index.js CHANGED
@@ -48,6 +48,18 @@ async function run(fn) {
48
48
  }
49
49
  const program = new commander_1.Command();
50
50
  program.name('gfw').description('Global Fishing Watch CLI').version('1.0.0');
51
+ // ── mcp ───────────────────────────────────────────────────────────────────────
52
+ program
53
+ .command('mcp')
54
+ .description('Start the GFW MCP stdio server')
55
+ .action(async () => {
56
+ const { createServer } = await import('../mcp-server.js');
57
+ const { StdioServerTransport } = await import('@modelcontextprotocol/sdk/server/stdio.js');
58
+ const server = createServer();
59
+ const transport = new StdioServerTransport();
60
+ await server.connect(transport);
61
+ console.error('GFW MCP Server running on stdio');
62
+ });
51
63
  // ── auth ──────────────────────────────────────────────────────────────────────
52
64
  const auth = program.command('auth').description('Manage GFW API credentials');
53
65
  auth.command('login').description('Save a GFW API token').action(auth_js_1.authLogin);
package/dist/index.js CHANGED
@@ -78,7 +78,7 @@ const server = (0, mcp_server_js_1.createServer)();
78
78
  async function main() {
79
79
  const transport = new stdio_js_1.StdioServerTransport();
80
80
  await server.connect(transport);
81
- console.error('Demo MCP Server running on stdio');
81
+ console.error('GFW MCP Server running on stdio');
82
82
  }
83
83
  main().catch((error) => {
84
84
  console.error('Fatal error in main():', error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalfishingwatch/mcp",
3
- "version": "0.0.5",
3
+ "version": "0.0.7",
4
4
  "description": "MCP server for Global Fishing Watch data — vessel search, events, fishing hours, and region lookups",
5
5
  "author": "Global Fishing Watch",
6
6
  "license": "Apache-2.0",
@@ -14,9 +14,6 @@
14
14
  "ais"
15
15
  ],
16
16
  "main": "./dist/index.js",
17
- "bin": {
18
- "gfw-mcp": "./dist/bin.js"
19
- },
20
17
  "files": [
21
18
  "dist/"
22
19
  ],