mcp-google-api 0.22.1 → 0.23.0

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/CHANGELOG.md CHANGED
@@ -1,7 +1,41 @@
1
1
  # Changelog
2
2
 
3
- ## [0.22.1](https://github.com/Ogekuri/mcp-google-api/compare/v0.22.0..v0.22.1) - 2026-11-06
3
+ ## [0.23.0](https://github.com/Ogekuri/mcp-google-api/compare/v0.22.0..v0.23.0) - 2026-11-07
4
+ ### ⛰️ Features
5
+ - add copilot CLI agent support (DES-017, REQ-110/112/113/117) [useReq] *(cli-targets)*
6
+ - Requirements: extend DES-017, REQ-110, REQ-112, REQ-113, REQ-117 with the copilot target
7
+ - Source: add COPILOT_TARGET adapter (~/.copilot/mcp.json JSON mcpServers + ~/.copilot/skills) to CLI_TARGETS registry in src/utils/cliTargets.ts
8
+ - Docs: README supported-agents list/table and WORKFLOW/REFERENCES runtime model updated
9
+ - Verification: eslint/tsc clean, npm test 132/132 pass, enable/show/install runtime smoke on isolated HOME
10
+
4
11
  ### 🐛 Bug Fixes
12
+ - build dist via prepare lifecycle for GitHub installs [useReq] *(packaging)*
13
+ - Develop-channel installs (npm install -g github:Ogekuri/mcp-google-api#<tag>,
14
+ - REQ-171) packed the fetched git tree without dist/: no build lifecycle ran, so
15
+ - every installed package hit the PRJ-021 remediation error and the post-upgrade
16
+ - install child failed (evidence: v0.22.4 pack listing had 0 dist entries).
17
+ - package.json: declare scripts.prepare = npm run build so npm git-dep
18
+ - preparation builds dist/ into the packed tarball (PRJ-020; verified by
19
+ - local git-sim packs: 8 dist entries incl. dist/cli.js).
20
+ - tests/npmPublishContract.unit.test.ts: add failing-first reproducer test
21
+ - pinning the prepare lifecycle contract (no chained installs, PKG-019) and
22
+ - restore deterministic pack listing via --ignore-scripts.
23
+ - usereq/docs/WORKFLOW.md: document the prepare build inside EDGE-09.
24
+ - spawn package-manager child with neutral home cwd [useReq] *(upgrade)*
25
+ - Defect: --upgrade (npm and --dev|--develop channels) and --uninstall
26
+ - spawned npm from the caller's working directory. When invoked from the
27
+ - source checkout of the same package (scripts/mcp-google-api.sh cd's to
28
+ - the repo root), npm reconciled the git-ref global install against that
29
+ - same-name local project and corrupted reify: TAR_ENTRY_ERROR ENOENT
30
+ - floods on hono/@modelcontextprotocol/sdk/@grpc/grpc-js plus a fatal
31
+ - lifecycle 'spawn sh ENOENT' (protobufjs) against a cwd deleted
32
+ - mid-reify.
33
+ - Fix: runPackageManagerCommand spawns the child with cwd = os.homedir()
34
+ - (explicit neutral directory, env/prefix unchanged); stdio inheritance,
35
+ - exit propagation, and the REQ-128 manual-command hint are unchanged.
36
+ - Reproducer test (HDT Level 1) added to tests/upgradeManager.unit.test.ts:
37
+ - asserts the child cwd is the user home and never the caller cwd; suite
38
+ - went 11 pass / 1 fail before the fix to 136/136 after.
5
39
  - report skipped server-start dispatch with build remediation [useReq] *(cli)*
6
40
  - Root cause of the persistent pi 'MCP connection closed' after the 0.21.0 rename:
7
41
  - the REQ-114 launcher 'npx -y mcp-google-api start --stdio' resolves a same-name
@@ -16,6 +50,118 @@
16
50
  - Document the stale-artifact remediation in docs/CONFIGURATION.md; update
17
51
  - WORKFLOW.md TRACE-A/EDGE-06 and regenerate REFERENCES.md.
18
52
 
53
+ ### 🚜 Changes
54
+ - make --upgrade update unconditionally [useReq] *(upgradeManager)*
55
+ - --upgrade now reinstalls mcp-google-api@latest in every invocation,
56
+ - without any pre-upgrade version comparison (REQ-146 rewrite).
57
+ - Removed the pre-upgrade registry necessity check and the
58
+ - already-latest skip path (REQ-144, REQ-145, REQ-147 deleted) and the
59
+ - pre-upgrade-latest summary shortcut (REQ-181 deleted); REQ-172
60
+ - reworded since the comparison no longer exists.
61
+ - The summary updated version now comes from the post-upgrade probe
62
+ - (REQ-134); unused isUpgradeNecessary removed.
63
+ - Requirements, workflow model, and references updated; typecheck and
64
+ - 136 unit tests pass.
65
+ - self-heal npm reify ENOENT in --upgrade [useReq] *(upgradeManager)*
66
+ - --upgrade update children (npm and --develop/--dev channels) run with
67
+ - captured output echoed on stderr (REQ-125, REQ-171).
68
+ - A non-zero exit carrying an ENOENT reify diagnostic triggers one
69
+ - tolerated npm uninstall -g clean-slate child plus a single retry,
70
+ - repairing corrupted global trees whose dependency lifecycle spawns
71
+ - fail like the reported 'spawn sh ENOENT' (REQ-182, REQ-183).
72
+ - Requirements, workflow model, and references updated; typecheck and
73
+ - 136 unit tests pass.
74
+ - resolve npmjs latest via packument manifest [useReq] *(upgradeManager)*
75
+ - --ver/--version now probe the npm packument manifest with the
76
+ - abbreviated Accept header and print dist-tags.latest (REQ-179, REQ-180).
77
+ - --upgrade reports the pre-upgrade npmjs latest as the summary updated
78
+ - version and skips the post-upgrade probe when resolved (REQ-181).
79
+ - REQUIREMENTS/WORKFLOW/REFERENCES updated; typecheck and 136 unit
80
+ - tests pass.
81
+ - ship mcp-google-api launcher bin with remediation [useReq] *(bin)*
82
+ - PRJ-020: the installed mcp-google-api bin executes the packaged
83
+ - dist/cli.js Node entry forwarding every argument unchanged with no
84
+ - implicit install/build steps (analogous to scripts/mcp-google-api.sh).
85
+ - PRJ-021: new launcher bin/mcp-google-api.mjs (realpath-safe package-root
86
+ - resolution) prints JSON build-remediation guidance on stderr and exits
87
+ - non-zero when dist/cli.js is missing - impossible to deliver from the
88
+ - built artifact itself.
89
+ - package.json: bin repointed to bin/mcp-google-api.mjs; files allowlist
90
+ - ships bin/ (verified in npm pack --dry-run); .gitignore gains !bin/
91
+ - exceptions (CTN-010).
92
+ - PKG-038 publication fixture updated for the bin/ prefix; verified live:
93
+ - launcher forwards (--help, exit 0) and remediates (exit 1, JSON stderr);
94
+ - 136/136 tests, typecheck and eslint clean.
95
+ - add develop-channel coverage for --upgrade --dev|--develop [useReq] *(test)*
96
+ - TST-023: new test requirement mapping REQ-170/171/172/173/177/178 to
97
+ - tests/upgradeManager.unit.test.ts.
98
+ - HDT Level 0: buildDevelopUpgradeCommand builds the raw tag install
99
+ - command npm install -g github:Ogekuri/mcp-google-api#<tag>.
100
+ - HDT Level 1: the develop channel probes only the GitHub releases
101
+ - endpoint bypassing the idle cache (REQ-177), spawns the tagged install
102
+ - with the raw tag_name (REQ-171), always proceeds even when the probed
103
+ - tag equals the installed version (REQ-172), reports the probed version
104
+ - in the summary (REQ-173), and fails fast on probe error without
105
+ - spawning any child process (REQ-178).
106
+ - No src/ changes: verification confirmed the implementation already
107
+ - satisfied the request; 135/135 tests, typecheck and eslint clean.
108
+ - move publish guard to tools/ with gitignore exception [useReq] *(tools)*
109
+ - Move scripts/check-publish-version.mjs to tools/ (PKG-057 updated):
110
+ - the ../package.json resolution keeps working at the same directory
111
+ - depth; guard verified executable from the new path (exit 0).
112
+ - Wire package.json check:publish-version to the new path; the
113
+ - prepublishOnly chain (PKG-005, PKG-017) is unchanged.
114
+ - .gitignore: append !tools/ and !tools/**/* at the tail of the
115
+ - negated-inclusion included-paths section (CTN-009); git check-ignore
116
+ - confirms the guard is version-controlled.
117
+ - requirements: scripts/ tree entry reduced to the mcp-google-api.sh
118
+ - launcher; tools/ entry added for the publish guard.
119
+ - BREAKING CHANGE: remove redundant shell helpers, document HTTP vs stdio [useReq] *(scripts)*
120
+ - Delete scripts/build.sh, start-http.sh, start-mcp.sh, test.sh: thin
121
+ - wrappers over npm run build/start/test/test:e2e; PKG-019 keeps the
122
+ - single npm run verify pipeline and REQ-094 forbids implicit builds.
123
+ - scripts/ now holds only mcp-google-api.sh (PRJ-018, PRJ-019) and the
124
+ - retained check-publish-version.mjs publish guard: required prepublishOnly
125
+ - stage, not an end-user accessory (PKG-057, PKG-005, PKG-017).
126
+ - README: new 'stdio vs Streamable HTTP' comparison section (PKG-054,
127
+ - PKG-055, PKG-056).
128
+ - Remove the obsolete start-mcp.sh remediation test whose subject was
129
+ - deleted; no src/ changes, WORKFLOW.md unaffected.
130
+ - --dev|--develop installs the latest tagged GitHub release [useReq] *(upgrade)*
131
+ - REQ-170..173: --upgrade --develop|--dev now selects the latest tagged
132
+ - GitHub release regardless of the branch carrying the tag; REQ-177 adds
133
+ - the forced releases-API probe bypassing the idle cache gate; REQ-178
134
+ - fails fast with a stderr diagnostic and no child spawn on probe failure.
135
+ - upgradeManager: GITHUB_UPGRADE_REPOSITORY + buildDevelopUpgradeCommand(tag)
136
+ - replace PACKAGE_DEVELOP_UPGRADE_COMMAND; develop branch probes GitHub first,
137
+ - installs github:Ogekuri/mcp-google-api#<tag>, and reports the probed version.
138
+ - autoUpdate: GitHubLatestVersionProbe ok outcome now carries the raw tag_name.
139
+ - cli: help text and dispatch comments document the new channel semantics.
140
+ - BREAKING CHANGE: remove legacy exec aliases, placeholder key, entry-gate fallback [useReq] *(cli)*
141
+ - BREAKING: exec accepts only canonical maps_ tool names (REQ-073); short/snake_case/batch-geocode-tool aliases removed from EXEC_TOOLS, execTool switch, help examples, and README.
142
+ - BREAKING: legacy INSTALL_API_KEY_PLACEHOLDER config value no longer loads as unset (DES-023, REQ-142); empty values still do.
143
+ - BREAKING: superseded isRunDirectly basename entry-gate removed; isEntryMainModule() alone decides dispatch.
144
+ - DOCTOR_PROBES use canonical tool names; tests canonicalized per user-requested legacy removal.
145
+ - Verified: typecheck, static-check clean, npm test 132/132; exec geocode now rejected as unknown tool.
146
+ - make --help user-facing and document --develop/--dev [useReq] *(cli)*
147
+ - REQ-174: help descriptions limited to user-facing usage; removed internal details (persisted configuration, settings file, dispatch order, dist/cli.js path).
148
+ - REQ-175: --upgrade epilog documents the --develop | --dev GitHub develop-branch option.
149
+ - REQ-176: --ver described accurately as installed, npmjs-latest, and GitHub-latest versions.
150
+ - Verified facts kept: exec alias list (batch-geocode-tool) and search-nearby example params match the schema.
151
+ - Verified: static-check clean, npm test 132/132 (help contract REQ-129/130/131 intact).
152
+ - add --develop/--dev GitHub develop-branch upgrade channel [useReq] *(upgrade-manager)*
153
+ - REQ-170..173: --upgrade accepts --develop with equivalent --dev alias selecting the GitHub develop branch.
154
+ - REQ-125/REQ-144 scoped to the default npm channel; develop channel skips the registry gate and already-latest path.
155
+ - upgradeManager: UpgradeChannel, PACKAGE_DEVELOP_UPGRADE_COMMAND (npm install -g github:Ogekuri/mcp-google-api#develop), parseUpgradeChannel; parseManagementCommand accepts the --upgrade + --develop/--dev pair.
156
+ - Develop-channel summary reports unknown as the updated version; default npm path unchanged.
157
+ - WORKFLOW.md TRACE-A/L and EDGE-07/09 updated; REFERENCES.md regenerated.
158
+ - Verified: typecheck, static-check clean, npm test 132/132.
159
+ - encode README header block structure and centered quick index [useReq] *(readme)*
160
+ - Add requirements PKG-046..PKG-053: [!CAUTION] pre-header, exact title format, centered badge/description/quick-index/status blocks, fixed H1 section order, quick-start step order.
161
+ - Rebuild README header: centered description block (strong summary + br + detail), HTML quick-index anchors now including Requirements, single status+notice centered block.
162
+ - No source-code change; WORKFLOW.md runtime model unaffected; REFERENCES.md regenerated unchanged.
163
+ - Verified: static-check clean; npm test 132/132 pass.
164
+
19
165
  ## [0.22.0](https://github.com/Ogekuri/mcp-google-api/compare/v0.21.0..v0.22.0) - 2026-11-06
20
166
  ### 🐛 Bug Fixes
21
167
  - symlink-aware main-module gate restores CLI dispatch [useReq] *(cli)*
@@ -409,7 +555,7 @@
409
555
  - \[0.20.0\]: https://github.com/Ogekuri/mcp-google-api/releases/tag/v0.20.0
410
556
  - \[0.21.0\]: https://github.com/Ogekuri/mcp-google-api/releases/tag/v0.21.0
411
557
  - \[0.22.0\]: https://github.com/Ogekuri/mcp-google-api/releases/tag/v0.22.0
412
- - \[0.22.1\]: https://github.com/Ogekuri/mcp-google-api/releases/tag/v0.22.1
558
+ - \[0.23.0\]: https://github.com/Ogekuri/mcp-google-api/releases/tag/v0.23.0
413
559
 
414
560
  [0.2.0]: https://github.com/Ogekuri/mcp-google-api/releases/tag/v0.2.0
415
561
  [0.3.0]: https://github.com/Ogekuri/mcp-google-api/compare/v0.2.0..v0.3.0
@@ -431,4 +577,4 @@
431
577
  [0.20.0]: https://github.com/Ogekuri/mcp-google-api/compare/v0.19.0..v0.20.0
432
578
  [0.21.0]: https://github.com/Ogekuri/mcp-google-api/compare/v0.20.0..v0.21.0
433
579
  [0.22.0]: https://github.com/Ogekuri/mcp-google-api/compare/v0.21.0..v0.22.0
434
- [0.22.1]: https://github.com/Ogekuri/mcp-google-api/compare/v0.22.0..v0.22.1
580
+ [0.23.0]: https://github.com/Ogekuri/mcp-google-api/compare/v0.22.0..v0.23.0
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  > * **No Support or Feature Requests:** please **do not** open issues, bug reports, or feature requests. They will not be addressed or accepted at this stage.
11
11
  > * **No Warranty:** this software is provided **"AS IS"**, without warranty of any kind, express or implied. Use it strictly for testing and evaluation purposes at your own sole risk.
12
12
 
13
- # mcp-google-api / MCP Google API server (0.22.1)
13
+ # mcp-google-api / MCP Google API server (0.23.0)
14
14
 
15
15
  <p align="center">
16
16
  <img src="https://img.shields.io/badge/node-%3E%3D24-339933?style=flat-square&logo=nodedotjs&logoColor=white" alt="Node.js >= 24">
@@ -19,15 +19,25 @@
19
19
  <img src="https://img.shields.io/badge/platform-Windows%20%7C%20macOS%20%7C%20Linux-6A7EC2?style=flat-square&logo=terminal&logoColor=white" alt="Platforms">
20
20
  </p>
21
21
 
22
- **MCP Google API server** — Google APIs for AI agents over the [Model Context Protocol](https://modelcontextprotocol.io).
23
-
24
- The server exposes Google API families to AI agents over stdio or Streamable HTTP. The currently implemented family is **Google Maps**, providing 18 read-only tools: geocoding and reverse geocoding, Places API (New) text/nearby search with server-side filters (`priceLevels`, `minRating`, `strictTypeFiltering`), place details, directions, distance matrix, timezone, elevation, weather, air quality, static maps, batch geocode, and the composite tools explore-area, plan-route, compare-places, search-along-route, and local-rank-tracker. Tools are declared read-only, non-destructive, idempotent, and open-world via MCP annotations. The server ships the **eatspot-discovery** agent skill for budget-, quality-, category-, and schedule-validated venue search, and installs itself plus its skills into supported CLI agents (pi, OpenClaw, Codex, Antigravity, Claude) with one command.
25
-
26
- [Feature Highlights](#feature-highlights) | [Quick Start](#quick-start) | [User's Guide](#users-guide) | [Acknowledgments](#acknowledgments)
22
+ <p align="center">
23
+ <strong>MCP Google API server — Google APIs for AI agents over the <a href="https://modelcontextprotocol.io">Model Context Protocol</a></strong>
24
+ <br>
25
+ The server exposes Google API families to AI agents over stdio or Streamable HTTP. The currently implemented family is <strong>Google Maps</strong>, providing 18 read-only tools: geocoding and reverse geocoding, Places API (New) text/nearby search with server-side filters (<code>priceLevels</code>, <code>minRating</code>, <code>strictTypeFiltering</code>), place details, directions, distance matrix, timezone, elevation, weather, air quality, static maps, batch geocode, and the composite tools explore-area, plan-route, compare-places, search-along-route, and local-rank-tracker. Tools are declared read-only, non-destructive, idempotent, and open-world via MCP annotations. The server ships the <strong>eatspot-discovery</strong> agent skill for budget-, quality-, category-, and schedule-validated venue search, and installs itself plus its skills into supported CLI agents (pi, OpenClaw, Codex, Antigravity, Claude) with one command.
26
+ </p>
27
27
 
28
- 🚧 **DRAFT:** Proof-of-Concept (PoC) Version 📝 — Work in Progress 🏗️ 🚧
28
+ <p align="center">
29
+ <a href="#feature-highlights">Feature Highlights</a> |
30
+ <a href="#quick-start">Quick Start</a> |
31
+ <a href="#requirements">Requirements</a> |
32
+ <a href="#users-guide">User's Guide</a> |
33
+ <a href="#acknowledgments">Acknowledgments</a>
34
+ </p>
29
35
 
30
- ⚠️ **IMPORTANT NOTICE**: Created with [**PI-useReq/pi-usereq**](https://www.npmjs.com/package/pi-usereq) 🤖✨ ⚠️
36
+ <p align="center">
37
+ 🚧 <strong>STAGE:</strong> PRE-ALPHA 📝 — Proof-of-Concept (PoC), Work in Progress 🏗️ 🚧
38
+ <br>
39
+ ⚠️ <strong>IMPORTANT NOTICE</strong>: Created with <a href="https://www.npmjs.com/package/pi-usereq"><strong>PI-useReq/pi-usereq</strong></a> 🤖✨ ⚠️
40
+ </p>
31
41
 
32
42
  # Feature Highlights
33
43
 
@@ -58,7 +68,7 @@ mcp-google-api api-key "AIza..."
58
68
  mcp-google-api doctor # local self-check: Node, package, key, settings (no network)
59
69
  ```
60
70
 
61
- **3. Run** — register the server into your CLI agents (supported: `pi`, `openclaw`, `codex`, `antigravity`, `claude`), then start it:
71
+ **3. Run** — register the server into your CLI agents (supported: `pi`, `openclaw`, `codex`, `antigravity`, `claude`, `copilot`), then start it:
62
72
 
63
73
  ```bash
64
74
  mcp-google-api enable pi
@@ -129,10 +139,11 @@ The `--host` and `--port` flags override the persisted settings for a single `st
129
139
  | codex | `~/.codex/config.toml` (`mcp_servers` table) | `~/.codex/skills` |
130
140
  | antigravity | `~/.gemini/settings.json` | `~/.gemini/config/skills` |
131
141
  | claude | `~/.claude.json` | `~/.claude/skills` |
142
+ | copilot | `~/.copilot/mcp.json` | `~/.copilot/skills` |
132
143
 
133
144
  - **pi**: after installing, run `/reload` in the session if the configuration was changed externally; `/mcp` inspects status, tools, and connection errors.
134
145
  - **OpenClaw**: reload the gateway or restart the agent session so the new server gets connected.
135
- - `mcp-google-api show` prints the CLI Configuration table (all five agents) and the Installation Status table (server + each skill per enabled CLI with OK / MISSING / STALE).
146
+ - `mcp-google-api show` prints the CLI Configuration table (all six agents) and the Installation Status table (server + each skill per enabled CLI with OK / MISSING / STALE).
136
147
  - `mcp-google-api install --debug-skills` additionally appends each skill's packaged debug overlay to the installed `SKILL.md`; plain installs and `api-key`/`--upgrade` refreshes never append it, and `show` reports OK in both modes.
137
148
 
138
149
  ## Running the server
@@ -149,6 +160,17 @@ mcp-google-api run # alias of start
149
160
  - stdio mode refuses to start without a configured key and exits 1 with a stderr error inviting `mcp-google-api api-key <key>`; HTTP mode starts anyway and logs a warning (per-request header keys remain usable).
150
161
  - The automatic update check runs at startup (default on): a newer npm version is reported on stderr only with an upgrade command; it never blocks startup.
151
162
 
163
+ ### stdio vs Streamable HTTP
164
+
165
+ | | stdio | Streamable HTTP |
166
+ |---|---|---|
167
+ | Launch | `mcp-google-api start --stdio` (what `install` registers in MCP-client configs) | `mcp-google-api start` or `run`, with optional `--host`/`--port` |
168
+ | Channel | JSON-RPC 2.0 frames over stdin/stdout; stdout carries only protocol traffic, diagnostics go to stderr | HTTP POST/GET/DELETE on `http://<host>:<port>/mcp`; GET upgrades to SSE for server-to-client notifications |
169
+ | API key | resolved once at startup from the persisted `apiKey` setting; startup fails without one | per-request `X-Google-Maps-API-Key` or `Authorization: Bearer` header, then the session key, then the configured setting; startup only warns without one |
170
+ | Typical use | locally registered MCP clients (pi, OpenClaw, Codex, Antigravity, Claude) launched by `install` | remote or multi-client access to one shared server, each client isolated by its `mcp-session-id` |
171
+
172
+ Use **stdio** when a local MCP client launches the server from its own configuration; use **Streamable HTTP** when several clients, local or remote, share one server instance. Both transports expose the same 18 tools and the same per-session/per-request key isolation semantics.
173
+
152
174
  ## Per-request API keys
153
175
 
154
176
  On the HTTP transport each request may supply its own key with top priority: the `X-Google-Maps-API-Key` header, or an `Authorization: Bearer <key>` header. Each session (`mcp-session-id`) keeps its session key; the configured `apiKey` setting is the fallback. This lets concurrent clients use isolated credentials against one server.
@@ -167,7 +189,7 @@ mcp-google-api doctor --live --apikey "AIza..." # override the key for the probe
167
189
  ## One-shot CLI tools
168
190
 
169
191
  ```bash
170
- mcp-google-api exec geocode '{"address":"Tokyo Tower"}' # run one tool; short/snake_case/maps_-prefixed names accepted
192
+ mcp-google-api exec maps_geocode '{"address":"Tokyo Tower"}' # run one tool by its canonical maps_ name
171
193
  mcp-google-api batch-geocode -i addresses.txt -o results.json # geocode one address per line
172
194
  cat addresses.txt | mcp-google-api batch-geocode -i - # from stdin
173
195
  ```
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file mcp-google-api.mjs
4
+ * @brief Installed distribution bin launcher executing the mcp-google-api Node.js CLI (PRJ-020).
5
+ * @details Mirrors `scripts/mcp-google-api.sh` for the installed package: resolves the
6
+ * real package root from this script's own location (realpath-safe against npm's
7
+ * symlinked global `bin/` links and renamed launchers), verifies the packaged
8
+ * `dist/cli.js` entry exists, and either forwards every argument unchanged to that
9
+ * Node.js entry with inherited stdio, propagating its exit code (PRJ-020, PRJ-019
10
+ * semantics), or prints exactly one JSON build-remediation diagnostic on stderr
11
+ * naming the package root and the build/refresh commands, exiting non-zero
12
+ * (PRJ-021; remediation guidance in the REQ-094 family). No implicit install or
13
+ * build steps are ever executed (PRJ-019). A plain Node.js ESM script is used
14
+ * instead of pointing the npm `bin` field directly at `dist/cli.js` because a built
15
+ * artifact cannot detect its own absence: the launcher must stay runnable on stale
16
+ * or unbuilt distributions to deliver the remediation path. On Windows, npm wraps
17
+ * this file in a `.cmd` shim that invokes `node`, so the shebang is informational.
18
+ * @satisfies PRJ-016, PRJ-020, PRJ-021
19
+ * @note stdout is reserved for the launched CLI; this launcher writes only to
20
+ * stderr, and only on the missing-artifact remediation path (PRJ-021).
21
+ * @warning The remediation diagnostic is emitted by this launcher, never by
22
+ * `dist/cli.js`: a missing artifact bypasses every CLI-side guard (REQ-094 covers
23
+ * dispatch from an existing artifact; PRJ-021 covers the artifact-missing case).
24
+ */
25
+ import { spawnSync } from "node:child_process";
26
+ import { existsSync, realpathSync } from "node:fs";
27
+ import { dirname, join } from "node:path";
28
+ import { fileURLToPath } from "node:url";
29
+
30
+ const launcherPath = realpathSync(fileURLToPath(import.meta.url));
31
+ const packageRoot = dirname(dirname(launcherPath));
32
+ const cliEntry = join(packageRoot, "dist", "cli.js");
33
+
34
+ if (!existsSync(cliEntry)) {
35
+ process.stderr.write(
36
+ JSON.stringify(
37
+ {
38
+ error: "dist/cli.js missing",
39
+ packageRoot,
40
+ remediation:
41
+ "build first: npm ci && npm run build (source checkout) or refresh the global install: npm install -g mcp-google-api@latest",
42
+ },
43
+ null,
44
+ 2,
45
+ ) + "\n",
46
+ );
47
+ process.exit(1);
48
+ }
49
+
50
+ const child = spawnSync(process.execPath, [cliEntry, ...process.argv.slice(2)], {
51
+ stdio: "inherit",
52
+ });
53
+ process.exit(child.status ?? 1);
package/dist/cli.d.ts CHANGED
@@ -61,7 +61,7 @@ declare function startServer(port: number, apiKey?: string, host?: string): Prom
61
61
  type ShutdownExitHook = (code: number) => void;
62
62
  declare function createShutdownHandler(servers: readonly BaseMcpServer[], exitHook?: ShutdownExitHook): (signal: string) => Promise<void>;
63
63
  declare function installShutdownHandlers(servers: readonly BaseMcpServer[]): void;
64
- declare const EXEC_TOOLS: readonly ["geocode", "reverse-geocode", "search-nearby", "search-places", "place-details", "directions", "distance-matrix", "elevation", "timezone", "weather", "explore-area", "plan-route", "compare-places", "air-quality", "static-map", "batch-geocode-tool", "search-along-route", "local-rank-tracker"];
64
+ declare const EXEC_TOOLS: readonly ["maps_geocode", "maps_reverse_geocode", "maps_search_nearby", "maps_search_places", "maps_place_details", "maps_directions", "maps_distance_matrix", "maps_elevation", "maps_timezone", "maps_weather", "maps_explore_area", "maps_plan_route", "maps_compare_places", "maps_air_quality", "maps_static_map", "maps_batch_geocode", "maps_search_along_route", "maps_local_rank_tracker"];
65
65
  interface ExecOutput {
66
66
  write(chunk: string): unknown;
67
67
  }