@globalfishingwatch/mcp 0.0.6 → 0.0.8

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
@@ -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 @globalfishingwatch/mcp 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
 
@@ -394,11 +404,11 @@ npx @globalfishingwatch/mcp vessel-report --region-type EEZ --region-id 8386 --s
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@globalfishingwatch/mcp",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
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",
@@ -15,7 +15,6 @@
15
15
  ],
16
16
  "main": "./dist/index.js",
17
17
  "bin": {
18
- "gfw-mcp": "./dist/bin.js",
19
18
  "mcp": "./dist/bin.js"
20
19
  },
21
20
  "files": [