mcp-google-api 0.22.1 → 0.25.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 +232 -3
- package/README.md +33 -11
- package/bin/mcp-google-api.mjs +53 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +181 -92
- package/dist/cli.js.map +1 -1
- package/package.json +6 -4
package/dist/cli.js
CHANGED
|
@@ -17,7 +17,6 @@ var DEFAULT_SETTINGS_ENABLED_TOOLS = "*";
|
|
|
17
17
|
var SETTINGS_PROGRAM_NAME = "mcp-google-api";
|
|
18
18
|
var CLI_SETTINGS_RELATIVE = [".config", SETTINGS_PROGRAM_NAME, "config.json"];
|
|
19
19
|
var MCP_SERVER_NAME = "mcp-google-api";
|
|
20
|
-
var INSTALL_API_KEY_PLACEHOLDER = "__RUN_mcp-google-api_api-key_TO_CONFIGURE_YOUR_API_KEY__";
|
|
21
20
|
function resolveCliSettingsPath(home) {
|
|
22
21
|
const root = home ?? (process.env.HOME ?? process.cwd());
|
|
23
22
|
return resolve(root, ...CLI_SETTINGS_RELATIVE);
|
|
@@ -53,7 +52,7 @@ function defaultSettings() {
|
|
|
53
52
|
};
|
|
54
53
|
}
|
|
55
54
|
function isUnsetApiKey(value) {
|
|
56
|
-
return value === void 0 || value === null || value.trim().length === 0
|
|
55
|
+
return value === void 0 || value === null || value.trim().length === 0;
|
|
57
56
|
}
|
|
58
57
|
function uniqueStrings(value) {
|
|
59
58
|
if (!Array.isArray(value)) return [];
|
|
@@ -1501,6 +1500,7 @@ var AUTO_UPDATE_DISABLED_ENV = "MCP_AUTO_UPDATE_DISABLED";
|
|
|
1501
1500
|
var DEFAULT_PACKAGE_NAME = "mcp-google-api";
|
|
1502
1501
|
var DEFAULT_REGISTRY_BASE_URL = "https://registry.npmjs.org";
|
|
1503
1502
|
var DEFAULT_UPDATE_CHECK_TIMEOUT_MS = 2e3;
|
|
1503
|
+
var DEFAULT_PACKUMENT_ACCEPT_HEADER = "application/vnd.npm.install-v1+json";
|
|
1504
1504
|
async function probeLatestVersion(deps = {}) {
|
|
1505
1505
|
const env = deps.env;
|
|
1506
1506
|
if (env !== void 0 && isAutoUpdateDisabled(env)) {
|
|
@@ -1541,6 +1541,48 @@ async function probeLatestVersion(deps = {}) {
|
|
|
1541
1541
|
return { status: "error", message };
|
|
1542
1542
|
}
|
|
1543
1543
|
}
|
|
1544
|
+
async function probeLatestManifestVersion(deps = {}) {
|
|
1545
|
+
const env = deps.env;
|
|
1546
|
+
if (env !== void 0 && isAutoUpdateDisabled(env)) {
|
|
1547
|
+
return { status: "disabled" };
|
|
1548
|
+
}
|
|
1549
|
+
const currentVersion = deps.currentVersion;
|
|
1550
|
+
if (!currentVersion) {
|
|
1551
|
+
return { status: "unknown-version" };
|
|
1552
|
+
}
|
|
1553
|
+
const packageName = deps.packageName ?? DEFAULT_PACKAGE_NAME;
|
|
1554
|
+
const registryBaseUrl = deps.registryBaseUrl ?? DEFAULT_REGISTRY_BASE_URL;
|
|
1555
|
+
const timeoutMs = deps.timeoutMs ?? DEFAULT_UPDATE_CHECK_TIMEOUT_MS;
|
|
1556
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
1557
|
+
try {
|
|
1558
|
+
const response = await fetchImpl(`${registryBaseUrl}/${packageName}`, {
|
|
1559
|
+
headers: { accept: DEFAULT_PACKUMENT_ACCEPT_HEADER },
|
|
1560
|
+
signal: AbortSignal.timeout(timeoutMs)
|
|
1561
|
+
});
|
|
1562
|
+
if (!response.ok) {
|
|
1563
|
+
return {
|
|
1564
|
+
status: "error",
|
|
1565
|
+
message: `registry manifest responded with HTTP ${response.status}.`
|
|
1566
|
+
};
|
|
1567
|
+
}
|
|
1568
|
+
const payload = await response.json();
|
|
1569
|
+
const distTags = payload?.["dist-tags"];
|
|
1570
|
+
const latest = distTags !== null && typeof distTags === "object" ? distTags.latest : void 0;
|
|
1571
|
+
if (typeof latest !== "string" || latest.trim() === "") {
|
|
1572
|
+
return {
|
|
1573
|
+
status: "error",
|
|
1574
|
+
message: "registry manifest has no dist-tags.latest field."
|
|
1575
|
+
};
|
|
1576
|
+
}
|
|
1577
|
+
if (!isNewerVersion(latest, currentVersion)) {
|
|
1578
|
+
return { status: "current", currentVersion };
|
|
1579
|
+
}
|
|
1580
|
+
return { status: "newer", currentVersion, latestVersion: latest };
|
|
1581
|
+
} catch (error) {
|
|
1582
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1583
|
+
return { status: "error", message };
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1544
1586
|
function isAutoUpdateDisabled(env = process.env) {
|
|
1545
1587
|
const raw = env[AUTO_UPDATE_DISABLED_ENV];
|
|
1546
1588
|
return typeof raw === "string" && /^(1|true|yes)$/i.test(raw.trim());
|
|
@@ -1595,7 +1637,7 @@ async function probeLatestGitHubVersion(deps = {}) {
|
|
|
1595
1637
|
if (!version) {
|
|
1596
1638
|
return { status: "error", message: "GitHub release tag carries no version." };
|
|
1597
1639
|
}
|
|
1598
|
-
return { status: "ok", version };
|
|
1640
|
+
return { status: "ok", version, tag: payload.tag_name };
|
|
1599
1641
|
} catch (error) {
|
|
1600
1642
|
const message = error instanceof Error ? error.message : String(error);
|
|
1601
1643
|
return { status: "error", message };
|
|
@@ -1618,6 +1660,10 @@ var PACKAGE_UPGRADE_COMMAND = [
|
|
|
1618
1660
|
"-g",
|
|
1619
1661
|
`${DEFAULT_PACKAGE_NAME}@latest`
|
|
1620
1662
|
];
|
|
1663
|
+
var GITHUB_UPGRADE_REPOSITORY = "Ogekuri/mcp-google-api";
|
|
1664
|
+
function buildDevelopUpgradeCommand(tag) {
|
|
1665
|
+
return ["npm", "install", "-g", `github:${GITHUB_UPGRADE_REPOSITORY}#${tag}`];
|
|
1666
|
+
}
|
|
1621
1667
|
var PACKAGE_UNINSTALL_COMMAND = [
|
|
1622
1668
|
"npm",
|
|
1623
1669
|
"uninstall",
|
|
@@ -1724,15 +1770,25 @@ async function checkVersionIdle(deps = {}) {
|
|
|
1724
1770
|
return result;
|
|
1725
1771
|
}
|
|
1726
1772
|
function parseManagementCommand(args) {
|
|
1727
|
-
if (args.length
|
|
1773
|
+
if (args.length === 1) {
|
|
1774
|
+
const arg = args[0];
|
|
1775
|
+
if (arg === "--ver" || arg === "--version" || arg === "--upgrade" || arg === "--uninstall") {
|
|
1776
|
+
return arg;
|
|
1777
|
+
}
|
|
1728
1778
|
return void 0;
|
|
1729
1779
|
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1780
|
+
if (args.length === 2) {
|
|
1781
|
+
const hasUpgrade = args.includes("--upgrade");
|
|
1782
|
+
const hasDevelop = args.includes("--develop") || args.includes("--dev");
|
|
1783
|
+
if (hasUpgrade && hasDevelop) {
|
|
1784
|
+
return "--upgrade";
|
|
1785
|
+
}
|
|
1733
1786
|
}
|
|
1734
1787
|
return void 0;
|
|
1735
1788
|
}
|
|
1789
|
+
function parseUpgradeChannel(args) {
|
|
1790
|
+
return args.includes("--develop") || args.includes("--dev") ? "develop" : "npm";
|
|
1791
|
+
}
|
|
1736
1792
|
function runPackageManagerCommand(command, deps = {}) {
|
|
1737
1793
|
const logger = deps.logger ?? Logger;
|
|
1738
1794
|
const spawnImpl = deps.spawn ?? spawnSync;
|
|
@@ -1743,6 +1799,7 @@ function runPackageManagerCommand(command, deps = {}) {
|
|
|
1743
1799
|
};
|
|
1744
1800
|
try {
|
|
1745
1801
|
const result = spawnImpl(command[0], [...command.slice(1)], {
|
|
1802
|
+
cwd: homedir(),
|
|
1746
1803
|
stdio: "inherit",
|
|
1747
1804
|
shell: process.platform === "win32"
|
|
1748
1805
|
});
|
|
@@ -1755,6 +1812,50 @@ function runPackageManagerCommand(command, deps = {}) {
|
|
|
1755
1812
|
return reportSpawnFailure(message);
|
|
1756
1813
|
}
|
|
1757
1814
|
}
|
|
1815
|
+
var REIFY_ENOENT_SIGNATURE = /\bENOENT\b/;
|
|
1816
|
+
function toStreamText(value) {
|
|
1817
|
+
return typeof value === "string" ? value : value?.toString("utf8") ?? "";
|
|
1818
|
+
}
|
|
1819
|
+
function runCapturedPackageManagerCommand(command, deps) {
|
|
1820
|
+
const logger = deps.logger ?? Logger;
|
|
1821
|
+
const spawnImpl = deps.spawn ?? spawnSync;
|
|
1822
|
+
const reportSpawnFailure = (message) => {
|
|
1823
|
+
logger.error(`Error executing ${command[0]}: ${message}`);
|
|
1824
|
+
logger.log(`Warning: run this command manually: ${command.join(" ")}`);
|
|
1825
|
+
return { code: 1, stderr: "" };
|
|
1826
|
+
};
|
|
1827
|
+
try {
|
|
1828
|
+
const result = spawnImpl(command[0], [...command.slice(1)], {
|
|
1829
|
+
cwd: homedir(),
|
|
1830
|
+
stdio: ["inherit", "pipe", "pipe"],
|
|
1831
|
+
shell: process.platform === "win32",
|
|
1832
|
+
maxBuffer: 16 * 1024 * 1024
|
|
1833
|
+
});
|
|
1834
|
+
if (result.error) {
|
|
1835
|
+
return reportSpawnFailure(result.error.message);
|
|
1836
|
+
}
|
|
1837
|
+
const stdoutText = toStreamText(result.stdout).replace(/\n+$/, "");
|
|
1838
|
+
const stderrText = toStreamText(result.stderr).replace(/\n+$/, "");
|
|
1839
|
+
if (stdoutText.length > 0) {
|
|
1840
|
+
logger.log(stdoutText);
|
|
1841
|
+
}
|
|
1842
|
+
if (stderrText.length > 0) {
|
|
1843
|
+
logger.error(stderrText);
|
|
1844
|
+
}
|
|
1845
|
+
return { code: result.status ?? 1, stderr: toStreamText(result.stderr) };
|
|
1846
|
+
} catch (error) {
|
|
1847
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1848
|
+
return reportSpawnFailure(message);
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
function runPackageUpdateCommand(command, deps) {
|
|
1852
|
+
const first = runCapturedPackageManagerCommand(command, deps);
|
|
1853
|
+
if (first.code === 0 || !REIFY_ENOENT_SIGNATURE.test(first.stderr)) {
|
|
1854
|
+
return first.code;
|
|
1855
|
+
}
|
|
1856
|
+
runPackageManagerCommand(PACKAGE_UNINSTALL_COMMAND, deps);
|
|
1857
|
+
return runCapturedPackageManagerCommand(command, deps).code;
|
|
1858
|
+
}
|
|
1758
1859
|
function parsePostUpgradeCliOutcomes(raw) {
|
|
1759
1860
|
if (raw === void 0 || !raw.includes("install report:")) {
|
|
1760
1861
|
return void 0;
|
|
@@ -1853,7 +1954,7 @@ async function resolveUpdatedVersion(options, deps) {
|
|
|
1853
1954
|
}
|
|
1854
1955
|
async function runVersionCommand(options, deps = {}) {
|
|
1855
1956
|
const [npmProbe, githubProbe] = await Promise.all([
|
|
1856
|
-
|
|
1957
|
+
probeLatestManifestVersion({ ...deps.idleCheck, currentVersion: options.currentVersion }),
|
|
1857
1958
|
probeLatestGitHubVersion(deps.githubCheck)
|
|
1858
1959
|
]);
|
|
1859
1960
|
const installedVersion = options.currentVersion || "unknown";
|
|
@@ -1866,23 +1967,23 @@ GitHub latest: ${githubLatest}
|
|
|
1866
1967
|
`);
|
|
1867
1968
|
return 0;
|
|
1868
1969
|
}
|
|
1869
|
-
function isUpgradeNecessary(status) {
|
|
1870
|
-
return status !== "current";
|
|
1871
|
-
}
|
|
1872
1970
|
async function runUpgradeCommand(options, deps = {}) {
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1971
|
+
if ((options.channel ?? "npm") === "develop") {
|
|
1972
|
+
const githubProbe = await probeLatestGitHubVersion(deps.githubCheck);
|
|
1973
|
+
if (githubProbe.status !== "ok") {
|
|
1974
|
+
(deps.logger ?? Logger).error(`GitHub upgrade channel probe failed: ${githubProbe.message}`);
|
|
1975
|
+
return 1;
|
|
1976
|
+
}
|
|
1977
|
+
const upgraded2 = runPackageUpdateCommand(buildDevelopUpgradeCommand(githubProbe.tag), deps);
|
|
1978
|
+
if (upgraded2 !== 0) {
|
|
1979
|
+
return upgraded2;
|
|
1980
|
+
}
|
|
1981
|
+
const outcome2 = runPostUpgradeSkillInstall(options, deps);
|
|
1878
1982
|
const stdout2 = deps.stdout ?? process.stdout;
|
|
1879
|
-
stdout2.write(
|
|
1880
|
-
|
|
1881
|
-
`
|
|
1882
|
-
);
|
|
1883
|
-
return 0;
|
|
1983
|
+
stdout2.write(renderUpgradeSummary(options.currentVersion, githubProbe.version, outcome2));
|
|
1984
|
+
return outcome2.exitCode;
|
|
1884
1985
|
}
|
|
1885
|
-
const upgraded =
|
|
1986
|
+
const upgraded = runPackageUpdateCommand(PACKAGE_UPGRADE_COMMAND, deps);
|
|
1886
1987
|
if (upgraded !== 0) {
|
|
1887
1988
|
return upgraded;
|
|
1888
1989
|
}
|
|
@@ -2066,12 +2167,19 @@ var CLAUDE_TARGET = {
|
|
|
2066
2167
|
mcpConfigPath: (home) => join3(homeRoot(home), ".claude.json"),
|
|
2067
2168
|
skillsDir: (home) => join3(homeRoot(home), ".claude", "skills")
|
|
2068
2169
|
};
|
|
2170
|
+
var COPILOT_TARGET = {
|
|
2171
|
+
id: "copilot",
|
|
2172
|
+
configFormat: "json",
|
|
2173
|
+
mcpConfigPath: (home) => join3(homeRoot(home), ".copilot", "mcp.json"),
|
|
2174
|
+
skillsDir: (home) => join3(homeRoot(home), ".copilot", "skills")
|
|
2175
|
+
};
|
|
2069
2176
|
var CLI_TARGETS = {
|
|
2070
2177
|
pi: PI_TARGET,
|
|
2071
2178
|
openclaw: OPENCLAW_TARGET,
|
|
2072
2179
|
codex: CODEX_TARGET,
|
|
2073
2180
|
antigravity: ANTIGRAVITY_TARGET,
|
|
2074
|
-
claude: CLAUDE_TARGET
|
|
2181
|
+
claude: CLAUDE_TARGET,
|
|
2182
|
+
copilot: COPILOT_TARGET
|
|
2075
2183
|
};
|
|
2076
2184
|
function resolveCliTarget(name) {
|
|
2077
2185
|
return CLI_TARGETS[name.trim().toLowerCase()];
|
|
@@ -2570,24 +2678,24 @@ function installShutdownHandlers(servers) {
|
|
|
2570
2678
|
process.on("SIGTERM", () => void handler("SIGTERM"));
|
|
2571
2679
|
}
|
|
2572
2680
|
var EXEC_TOOLS = [
|
|
2573
|
-
"
|
|
2574
|
-
"
|
|
2575
|
-
"
|
|
2576
|
-
"
|
|
2577
|
-
"
|
|
2578
|
-
"
|
|
2579
|
-
"
|
|
2580
|
-
"
|
|
2581
|
-
"
|
|
2582
|
-
"
|
|
2583
|
-
"
|
|
2584
|
-
"
|
|
2585
|
-
"
|
|
2586
|
-
"
|
|
2587
|
-
"
|
|
2588
|
-
"
|
|
2589
|
-
"
|
|
2590
|
-
"
|
|
2681
|
+
"maps_geocode",
|
|
2682
|
+
"maps_reverse_geocode",
|
|
2683
|
+
"maps_search_nearby",
|
|
2684
|
+
"maps_search_places",
|
|
2685
|
+
"maps_place_details",
|
|
2686
|
+
"maps_directions",
|
|
2687
|
+
"maps_distance_matrix",
|
|
2688
|
+
"maps_elevation",
|
|
2689
|
+
"maps_timezone",
|
|
2690
|
+
"maps_weather",
|
|
2691
|
+
"maps_explore_area",
|
|
2692
|
+
"maps_plan_route",
|
|
2693
|
+
"maps_compare_places",
|
|
2694
|
+
"maps_air_quality",
|
|
2695
|
+
"maps_static_map",
|
|
2696
|
+
"maps_batch_geocode",
|
|
2697
|
+
"maps_search_along_route",
|
|
2698
|
+
"maps_local_rank_tracker"
|
|
2591
2699
|
];
|
|
2592
2700
|
function isExecFailureResponse(result) {
|
|
2593
2701
|
return typeof result === "object" && result !== null && "success" in result && result.success === false;
|
|
@@ -2604,17 +2712,12 @@ function getExecFailureMessage(toolName, result) {
|
|
|
2604
2712
|
async function execTool(toolName, params, apiKey) {
|
|
2605
2713
|
const searcher = new PlacesSearcher(apiKey);
|
|
2606
2714
|
switch (toolName) {
|
|
2607
|
-
case "geocode":
|
|
2608
2715
|
case "maps_geocode":
|
|
2609
2716
|
return searcher.geocode(params.address);
|
|
2610
|
-
case "reverse-geocode":
|
|
2611
2717
|
case "maps_reverse_geocode":
|
|
2612
2718
|
return searcher.reverseGeocode(params.latitude, params.longitude);
|
|
2613
|
-
case "search-nearby":
|
|
2614
|
-
case "search_nearby":
|
|
2615
2719
|
case "maps_search_nearby":
|
|
2616
2720
|
return searcher.searchNearby(params);
|
|
2617
|
-
case "search-places":
|
|
2618
2721
|
case "maps_search_places":
|
|
2619
2722
|
return searcher.searchText({
|
|
2620
2723
|
query: params.query,
|
|
@@ -2629,11 +2732,8 @@ async function execTool(toolName, params, apiKey) {
|
|
|
2629
2732
|
languageCode: params.languageCode,
|
|
2630
2733
|
includeRaw: params.includeRaw
|
|
2631
2734
|
});
|
|
2632
|
-
case "place-details":
|
|
2633
|
-
case "get_place_details":
|
|
2634
2735
|
case "maps_place_details":
|
|
2635
2736
|
return searcher.getPlaceDetails(params.placeId, params.maxPhotos || 0, params.includeRaw || false);
|
|
2636
|
-
case "directions":
|
|
2637
2737
|
case "maps_directions":
|
|
2638
2738
|
return searcher.getDirections(
|
|
2639
2739
|
params.origin,
|
|
@@ -2644,7 +2744,6 @@ async function execTool(toolName, params, apiKey) {
|
|
|
2644
2744
|
params.avoid_tolls,
|
|
2645
2745
|
params.avoid_highways
|
|
2646
2746
|
);
|
|
2647
|
-
case "distance-matrix":
|
|
2648
2747
|
case "maps_distance_matrix":
|
|
2649
2748
|
return searcher.calculateDistanceMatrix(
|
|
2650
2749
|
params.origins,
|
|
@@ -2654,13 +2753,10 @@ async function execTool(toolName, params, apiKey) {
|
|
|
2654
2753
|
params.avoid_tolls,
|
|
2655
2754
|
params.avoid_highways
|
|
2656
2755
|
);
|
|
2657
|
-
case "elevation":
|
|
2658
2756
|
case "maps_elevation":
|
|
2659
2757
|
return searcher.getElevation(params.locations);
|
|
2660
|
-
case "timezone":
|
|
2661
2758
|
case "maps_timezone":
|
|
2662
2759
|
return searcher.getTimezone(params.latitude, params.longitude, params.timestamp);
|
|
2663
|
-
case "weather":
|
|
2664
2760
|
case "maps_weather":
|
|
2665
2761
|
return searcher.getWeather(
|
|
2666
2762
|
params.latitude,
|
|
@@ -2669,16 +2765,12 @@ async function execTool(toolName, params, apiKey) {
|
|
|
2669
2765
|
params.forecastDays,
|
|
2670
2766
|
params.forecastHours
|
|
2671
2767
|
);
|
|
2672
|
-
case "explore-area":
|
|
2673
2768
|
case "maps_explore_area":
|
|
2674
2769
|
return searcher.exploreArea(params);
|
|
2675
|
-
case "plan-route":
|
|
2676
2770
|
case "maps_plan_route":
|
|
2677
2771
|
return searcher.planRoute(params);
|
|
2678
|
-
case "compare-places":
|
|
2679
2772
|
case "maps_compare_places":
|
|
2680
2773
|
return searcher.comparePlaces(params);
|
|
2681
|
-
case "air-quality":
|
|
2682
2774
|
case "maps_air_quality":
|
|
2683
2775
|
return searcher.getAirQuality(
|
|
2684
2776
|
params.latitude,
|
|
@@ -2686,10 +2778,8 @@ async function execTool(toolName, params, apiKey) {
|
|
|
2686
2778
|
params.includeHealthRecommendations,
|
|
2687
2779
|
params.includePollutants
|
|
2688
2780
|
);
|
|
2689
|
-
case "static-map":
|
|
2690
2781
|
case "maps_static_map":
|
|
2691
2782
|
return searcher.getStaticMap(params);
|
|
2692
|
-
case "batch-geocode-tool":
|
|
2693
2783
|
case "maps_batch_geocode": {
|
|
2694
2784
|
const results = await Promise.all(
|
|
2695
2785
|
params.addresses.map(async (address) => {
|
|
@@ -2707,10 +2797,8 @@ async function execTool(toolName, params, apiKey) {
|
|
|
2707
2797
|
data: { total: params.addresses.length, succeeded, failed: params.addresses.length - succeeded, results }
|
|
2708
2798
|
};
|
|
2709
2799
|
}
|
|
2710
|
-
case "search-along-route":
|
|
2711
2800
|
case "maps_search_along_route":
|
|
2712
2801
|
return searcher.searchAlongRoute(params);
|
|
2713
|
-
case "local-rank-tracker":
|
|
2714
2802
|
case "maps_local_rank_tracker":
|
|
2715
2803
|
return searcher.localRankTracker(params);
|
|
2716
2804
|
default:
|
|
@@ -2734,12 +2822,12 @@ async function runExecCommand(toolName, params, apiKey, runner = execTool, strea
|
|
|
2734
2822
|
}
|
|
2735
2823
|
}
|
|
2736
2824
|
var DOCTOR_PROBES = [
|
|
2737
|
-
{ id: "geocoding", name: "geocoding-api", tool: "
|
|
2738
|
-
{ id: "places-new", name: "places-api-new", tool: "
|
|
2825
|
+
{ id: "geocoding", name: "geocoding-api", tool: "maps_geocode", params: { address: "Tokyo Tower" } },
|
|
2826
|
+
{ id: "places-new", name: "places-api-new", tool: "maps_search_places", params: { query: "Tokyo Tower" } },
|
|
2739
2827
|
{
|
|
2740
2828
|
id: "routes",
|
|
2741
2829
|
name: "routes-api",
|
|
2742
|
-
tool: "
|
|
2830
|
+
tool: "maps_directions",
|
|
2743
2831
|
params: { origin: "Tokyo Tower", destination: "Tokyo Station", mode: "walking" }
|
|
2744
2832
|
}
|
|
2745
2833
|
];
|
|
@@ -3138,9 +3226,8 @@ function handleUndispatchedEntry(args, streams = process) {
|
|
|
3138
3226
|
);
|
|
3139
3227
|
return 1;
|
|
3140
3228
|
}
|
|
3141
|
-
var isRunDirectly = process.argv[1] && (process.argv[1].endsWith("cli.ts") || process.argv[1].endsWith("cli.js") || process.argv[1].endsWith("mcp-google-api") || process.argv[1].includes("mcp-google-api"));
|
|
3142
3229
|
var isMainModule = isEntryMainModule();
|
|
3143
|
-
if (
|
|
3230
|
+
if (isMainModule) {
|
|
3144
3231
|
let packageVersion = "0.0.0";
|
|
3145
3232
|
try {
|
|
3146
3233
|
const packageJsonPath = resolve5(__dirname, "../package.json");
|
|
@@ -3151,7 +3238,8 @@ if (isRunDirectly || isMainModule) {
|
|
|
3151
3238
|
}
|
|
3152
3239
|
const managementCommand = parseManagementCommand(hideBin(process.argv));
|
|
3153
3240
|
if (managementCommand !== void 0) {
|
|
3154
|
-
|
|
3241
|
+
const upgradeChannel = parseUpgradeChannel(hideBin(process.argv));
|
|
3242
|
+
void runManagementCommand(managementCommand, { currentVersion: packageVersion, channel: upgradeChannel }).then((code) => {
|
|
3155
3243
|
process.exitCode = code;
|
|
3156
3244
|
}).catch((error) => {
|
|
3157
3245
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -3164,11 +3252,11 @@ if (isRunDirectly || isMainModule) {
|
|
|
3164
3252
|
return yargs2.option("port", {
|
|
3165
3253
|
alias: "p",
|
|
3166
3254
|
type: "number",
|
|
3167
|
-
description: "Port to run the MCP server on (default:
|
|
3255
|
+
description: "Port to run the MCP server on (default: configured 'port' setting or 3000)",
|
|
3168
3256
|
default: settings.port
|
|
3169
3257
|
}).option("host", {
|
|
3170
3258
|
type: "string",
|
|
3171
|
-
description: "Hostname to bind the server to (default:
|
|
3259
|
+
description: "Hostname to bind the server to (default: configured 'host' setting or 127.0.0.1; 0.0.0.0 for all interfaces)",
|
|
3172
3260
|
default: settings.host
|
|
3173
3261
|
}).option("stdio", {
|
|
3174
3262
|
type: "boolean",
|
|
@@ -3241,7 +3329,7 @@ Usage: mcp-google-api <command> [options]
|
|
|
3241
3329
|
}).option("apikey", {
|
|
3242
3330
|
alias: "k",
|
|
3243
3331
|
type: "string",
|
|
3244
|
-
description: "Google Maps API key override for live probes (default:
|
|
3332
|
+
description: "Google Maps API key override for live probes (default: configured api-key setting)"
|
|
3245
3333
|
}).example([
|
|
3246
3334
|
["$0 doctor", "Check local runtime and API key configuration without network calls"],
|
|
3247
3335
|
["$0 doctor --live", "Also verify three Google Maps APIs with billable requests"],
|
|
@@ -3282,7 +3370,7 @@ Usage: mcp-google-api <command> [options]
|
|
|
3282
3370
|
description: "stdio launcher command"
|
|
3283
3371
|
}).option("command", {
|
|
3284
3372
|
type: "string",
|
|
3285
|
-
description: "Absolute path to
|
|
3373
|
+
description: "Absolute path to the CLI entry script (required for --launcher node)"
|
|
3286
3374
|
}).option("host", {
|
|
3287
3375
|
type: "string",
|
|
3288
3376
|
default: "127.0.0.1",
|
|
@@ -3319,7 +3407,7 @@ Usage: mcp-google-api <command> [options]
|
|
|
3319
3407
|
describe: `CLI name: ${supportedCliNames()}`
|
|
3320
3408
|
}).option("home", {
|
|
3321
3409
|
type: "string",
|
|
3322
|
-
description: "Home-directory override
|
|
3410
|
+
description: "Home-directory override (default: user home)"
|
|
3323
3411
|
}).example([["$0 enable pi", "Enable pi for install/uninstall/show"]]),
|
|
3324
3412
|
(argv) => {
|
|
3325
3413
|
process.exitCode = runEnableDisableCliCommand(argv.cli, true, {
|
|
@@ -3334,7 +3422,7 @@ Usage: mcp-google-api <command> [options]
|
|
|
3334
3422
|
describe: `CLI name: ${supportedCliNames()}`
|
|
3335
3423
|
}).option("home", {
|
|
3336
3424
|
type: "string",
|
|
3337
|
-
description: "Home-directory override
|
|
3425
|
+
description: "Home-directory override (default: user home)"
|
|
3338
3426
|
}).example([["$0 disable claude", "Disable claude for install/uninstall/show"]]),
|
|
3339
3427
|
(argv) => {
|
|
3340
3428
|
process.exitCode = runEnableDisableCliCommand(argv.cli, false, {
|
|
@@ -3343,16 +3431,16 @@ Usage: mcp-google-api <command> [options]
|
|
|
3343
3431
|
}
|
|
3344
3432
|
).command(
|
|
3345
3433
|
"auto-update <state>",
|
|
3346
|
-
"Enable or disable the automatic update check
|
|
3434
|
+
"Enable or disable the automatic update check at startup",
|
|
3347
3435
|
(yargs2) => yargs2.positional("state", {
|
|
3348
3436
|
type: "string",
|
|
3349
3437
|
describe: "New state: enable or disable (1 and 0 accepted)"
|
|
3350
3438
|
}).option("home", {
|
|
3351
3439
|
type: "string",
|
|
3352
|
-
description: "Home-directory override
|
|
3440
|
+
description: "Home-directory override (default: user home)"
|
|
3353
3441
|
}).example([[
|
|
3354
3442
|
"$0 auto-update disable",
|
|
3355
|
-
"Disable the automatic update check
|
|
3443
|
+
"Disable the automatic update check"
|
|
3356
3444
|
]]),
|
|
3357
3445
|
(argv) => {
|
|
3358
3446
|
process.exitCode = runAutoUpdateCommand(argv.state, {
|
|
@@ -3361,13 +3449,13 @@ Usage: mcp-google-api <command> [options]
|
|
|
3361
3449
|
}
|
|
3362
3450
|
).command(
|
|
3363
3451
|
"tools <tools>",
|
|
3364
|
-
"
|
|
3452
|
+
"Set the enabled tools ('*' = all 18 tools)",
|
|
3365
3453
|
(yargs2) => yargs2.positional("tools", {
|
|
3366
3454
|
type: "string",
|
|
3367
3455
|
describe: "Comma-separated tool names (e.g. maps_geocode,maps_search_places) or '*' for all"
|
|
3368
3456
|
}).option("home", {
|
|
3369
3457
|
type: "string",
|
|
3370
|
-
description: "Home-directory override
|
|
3458
|
+
description: "Home-directory override (default: user home)"
|
|
3371
3459
|
}).example([
|
|
3372
3460
|
["$0 tools '*'", "Expose every registered tool (default)"],
|
|
3373
3461
|
["$0 tools maps_geocode,maps_search_places", "Expose only the named tools"]
|
|
@@ -3379,13 +3467,13 @@ Usage: mcp-google-api <command> [options]
|
|
|
3379
3467
|
}
|
|
3380
3468
|
).command(
|
|
3381
3469
|
"host <host>",
|
|
3382
|
-
"
|
|
3470
|
+
"Set the HTTP bind host (default 127.0.0.1)",
|
|
3383
3471
|
(yargs2) => yargs2.positional("host", {
|
|
3384
3472
|
type: "string",
|
|
3385
3473
|
describe: "Bind hostname (e.g. 127.0.0.1 loopback; 0.0.0.0 for all interfaces)"
|
|
3386
3474
|
}).option("home", {
|
|
3387
3475
|
type: "string",
|
|
3388
|
-
description: "Home-directory override
|
|
3476
|
+
description: "Home-directory override (default: user home)"
|
|
3389
3477
|
}).example([["$0 host 0.0.0.0", "Bind the HTTP server on all interfaces"]]),
|
|
3390
3478
|
(argv) => {
|
|
3391
3479
|
process.exitCode = runHostCommand(argv.host, {
|
|
@@ -3394,13 +3482,13 @@ Usage: mcp-google-api <command> [options]
|
|
|
3394
3482
|
}
|
|
3395
3483
|
).command(
|
|
3396
3484
|
"port <port>",
|
|
3397
|
-
"
|
|
3485
|
+
"Set the HTTP listen port (default 3000)",
|
|
3398
3486
|
(yargs2) => yargs2.positional("port", {
|
|
3399
3487
|
type: "number",
|
|
3400
3488
|
describe: "Listen port (integer 1-65535)"
|
|
3401
3489
|
}).option("home", {
|
|
3402
3490
|
type: "string",
|
|
3403
|
-
description: "Home-directory override
|
|
3491
|
+
description: "Home-directory override (default: user home)"
|
|
3404
3492
|
}).example([["$0 port 3100", "Serve Streamable HTTP on port 3100"]]),
|
|
3405
3493
|
(argv) => {
|
|
3406
3494
|
process.exitCode = runPortCommand(argv.port === void 0 ? void 0 : String(argv.port), {
|
|
@@ -3409,13 +3497,13 @@ Usage: mcp-google-api <command> [options]
|
|
|
3409
3497
|
}
|
|
3410
3498
|
).command(
|
|
3411
3499
|
"api-key <key>",
|
|
3412
|
-
"Save the Google Maps API key
|
|
3500
|
+
"Save the Google Maps API key and refresh every enabled CLI registration",
|
|
3413
3501
|
(yargs2) => yargs2.positional("key", {
|
|
3414
3502
|
type: "string",
|
|
3415
3503
|
describe: "Google Maps API key (20-50 characters: letters, digits, hyphens, underscores)"
|
|
3416
3504
|
}).option("home", {
|
|
3417
3505
|
type: "string",
|
|
3418
|
-
description: "Home-directory override
|
|
3506
|
+
description: "Home-directory override (default: user home)"
|
|
3419
3507
|
}).example([["$0 api-key AIzaSy...", "Save the key and reinstall every enabled CLI"]]),
|
|
3420
3508
|
(argv) => {
|
|
3421
3509
|
process.exitCode = runApiKeyCommand(argv.key, {
|
|
@@ -3428,7 +3516,7 @@ Usage: mcp-google-api <command> [options]
|
|
|
3428
3516
|
"Register the mcp-google-api stdio server and install packaged skills for every enabled CLI",
|
|
3429
3517
|
(yargs2) => yargs2.option("home", {
|
|
3430
3518
|
type: "string",
|
|
3431
|
-
description: "Home-directory override
|
|
3519
|
+
description: "Home-directory override (default: user home)"
|
|
3432
3520
|
}).option("debug-skills", {
|
|
3433
3521
|
type: "boolean",
|
|
3434
3522
|
description: "Append each skill's packaged debug overlay to the installed SKILL.md",
|
|
@@ -3449,7 +3537,7 @@ Usage: mcp-google-api <command> [options]
|
|
|
3449
3537
|
"Remove the mcp-google-api server entry and managed skills from every enabled CLI",
|
|
3450
3538
|
(yargs2) => yargs2.option("home", {
|
|
3451
3539
|
type: "string",
|
|
3452
|
-
description: "Home-directory override
|
|
3540
|
+
description: "Home-directory override (default: user home)"
|
|
3453
3541
|
}).example([["$0 uninstall", "Reciprocal removal of install for every enabled CLI"]]),
|
|
3454
3542
|
(argv) => {
|
|
3455
3543
|
process.exitCode = runInstallUninstallCommand("uninstall", {
|
|
@@ -3462,7 +3550,7 @@ Usage: mcp-google-api <command> [options]
|
|
|
3462
3550
|
"Show CLI configuration and installation status tables (human-readable)",
|
|
3463
3551
|
(yargs2) => yargs2.option("home", {
|
|
3464
3552
|
type: "string",
|
|
3465
|
-
description: "Home-directory override
|
|
3553
|
+
description: "Home-directory override (default: user home)"
|
|
3466
3554
|
}).example([["$0 show", "Print CLI Configuration and Installation Status tables"]]),
|
|
3467
3555
|
(argv) => {
|
|
3468
3556
|
process.exitCode = runShowCommand({
|
|
@@ -3481,12 +3569,12 @@ Usage: mcp-google-api <command> [options]
|
|
|
3481
3569
|
type: "string",
|
|
3482
3570
|
describe: "JSON parameters string"
|
|
3483
3571
|
}).example([
|
|
3484
|
-
[`$0 exec
|
|
3572
|
+
[`$0 exec maps_geocode '{"address":"Tokyo Tower"}'`, "Geocode an address"],
|
|
3485
3573
|
[
|
|
3486
|
-
`$0 exec
|
|
3574
|
+
`$0 exec maps_search_nearby '{"center":{"value":"35.68,139.74","isCoordinates":true},"keyword":"restaurant"}'`,
|
|
3487
3575
|
"Search nearby"
|
|
3488
3576
|
],
|
|
3489
|
-
[`$0 exec
|
|
3577
|
+
[`$0 exec maps_search_places '{"query":"ramen in Tokyo"}'`, "Text search"]
|
|
3490
3578
|
]);
|
|
3491
3579
|
},
|
|
3492
3580
|
async (argv) => {
|
|
@@ -3623,10 +3711,11 @@ Usage: mcp-google-api <command> [options]
|
|
|
3623
3711
|
cli.showHelp("log");
|
|
3624
3712
|
}
|
|
3625
3713
|
).version(packageVersion).alias("version", "v").epilog(
|
|
3626
|
-
`Management commands (single flags
|
|
3627
|
-
--ver Print the installed
|
|
3714
|
+
`Management commands (single flags):
|
|
3715
|
+
--ver Print the installed, npmjs-latest, and GitHub-latest versions
|
|
3628
3716
|
--version Alias of --ver
|
|
3629
3717
|
--upgrade Upgrade the global package to the latest version and refresh installed skills
|
|
3718
|
+
--develop | --dev: install the latest tagged GitHub release (any branch)
|
|
3630
3719
|
--uninstall Remove the globally installed mcp-google-api package`
|
|
3631
3720
|
).help();
|
|
3632
3721
|
cli.parse();
|