From 00b89ec1f632a93d55e58f1ab99f0b646ba8fec5 Mon Sep 17 00:00:00 2001 From: MudassarTariq Date: Thu, 7 May 2026 19:48:41 +0500 Subject: [PATCH 1/2] Fix Glama hosting entrypoints --- README.md | 2 +- src/index.ts | 17 +++++++++++++++++ tests/mcp.protocol.test.mjs | 29 +++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a0348cf..0b90b50 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ [![npm version](https://img.shields.io/npm/v/ipgeolocation-io-mcp?logo=npm&label=npm&color=CB3837)](https://www.npmjs.com/package/ipgeolocation-io-mcp) [![GitHub release](https://img.shields.io/github/v/release/IPGeolocation/ipgeolocation-io-mcp?logo=github&label=release&color=181717)](https://github.com/IPGeolocation/ipgeolocation-io-mcp/releases) [![MCP Registry](https://img.shields.io/badge/MCP%20Registry-live-0A7CFF?logo=modelcontextprotocol&logoColor=white)](https://registry.modelcontextprotocol.io/?q=ipgeolocation) -[![Glama](https://glama.ai/mcp/servers/IPGeolocation/ipgeolocation-io-mcp/badges/score.svg)](https://glama.ai/mcp/servers/IPGeolocation/ipgeolocation-io-mcp) +[![Glama](https://img.shields.io/badge/Glama-listed-0A7CFF)](https://glama.ai/mcp/servers/IPGeolocation/ipgeolocation-io-mcp) [![Node.js](https://img.shields.io/badge/node-%3E%3D18-5FA04E?logo=node.js&logoColor=white)](https://nodejs.org/) [![License](https://img.shields.io/badge/license-MIT-16A34A)](https://github.com/IPGeolocation/ipgeolocation-io-mcp/blob/main/LICENSE) diff --git a/src/index.ts b/src/index.ts index 14dfe42..e59bfab 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,5 +1,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; import { z } from "zod"; import { registerGeolocationTools } from "./tools/geolocation.js"; import { registerSecurityTools } from "./tools/security.js"; @@ -104,3 +106,18 @@ export async function startStdioServer(): Promise { process.exit(0); }); } + +function isDirectEntrypoint(): boolean { + if (!process.argv[1]) { + return false; + } + + return path.resolve(process.argv[1]) === fileURLToPath(import.meta.url); +} + +if (isDirectEntrypoint()) { + startStdioServer().catch((error) => { + console.error(error); + process.exit(1); + }); +} diff --git a/tests/mcp.protocol.test.mjs b/tests/mcp.protocol.test.mjs index 205639c..b8ee003 100644 --- a/tests/mcp.protocol.test.mjs +++ b/tests/mcp.protocol.test.mjs @@ -3,6 +3,8 @@ import assert from "node:assert/strict"; import { readFile } from "node:fs/promises"; import { fileURLToPath } from "node:url"; import path from "node:path"; +import { Client } from "@modelcontextprotocol/sdk/client/index.js"; +import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"; const repoRoot = path.resolve(fileURLToPath(new URL("..", import.meta.url))); @@ -86,6 +88,33 @@ test("server entrypoint exports Smithery-compatible config without auto-starting assert.ok(entrypoint.default({ config: { apiKey: "test-key" } })); }); +test("package main can run as a stdio server for generic hosts", async () => { + const packageJson = JSON.parse(await readRepoFile("package.json")); + const transport = new StdioClientTransport({ + command: process.execPath, + args: [path.join(repoRoot, "dist/index.js")], + cwd: repoRoot, + env: { + IPGEOLOCATION_API_KEY: "test-key", + }, + stderr: "pipe", + }); + const client = new Client({ + name: "entrypoint-test", + version: "1.0.0", + }); + + try { + await client.connect(transport, { timeout: 5000 }); + assert.deepEqual(client.getServerVersion(), { + name: "ipgeolocation-io-mcp", + version: packageJson.version, + }); + } finally { + await client.close(); + } +}); + test("Dockerfile starts the stdio CLI entrypoint", async () => { const dockerfile = await readRepoFile("Dockerfile"); From 19adbb3b3999083ad91d02566af694b6e436a2a0 Mon Sep 17 00:00:00 2001 From: MudassarTariq Date: Thu, 7 May 2026 20:00:30 +0500 Subject: [PATCH 2/2] Update audit override pins --- package-lock.json | 22 ++++++++++++---------- package.json | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/package-lock.json b/package-lock.json index 77ad6ec..7bee359 100644 --- a/package-lock.json +++ b/package-lock.json @@ -401,11 +401,12 @@ } }, "node_modules/express-rate-limit": { - "version": "8.2.2", - "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.2.2.tgz", - "integrity": "sha512-Ybv7bqtOgA914MLwaHWVFXMpMYeR1MQu/D+z2MaLYteqBsTIp9sY3AU7mGNLMJv8eLg8uQMpE20I+L2Lv49nSg==", + "version": "8.5.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.5.1.tgz", + "integrity": "sha512-5O6KYmyJEpuPJV5hNTXKbAHWRqrzyu+OI3vUnSd2kXFubIVpG7ezpgxQy76Zo5GQZtrQBg86hF+CM/NX+cioiQ==", + "license": "MIT", "dependencies": { - "ip-address": "10.1.0" + "ip-address": "^10.2.0" }, "engines": { "node": ">= 16" @@ -550,9 +551,9 @@ } }, "node_modules/hono": { - "version": "4.12.15", - "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.15.tgz", - "integrity": "sha512-qM0jDhFEaCBb4TxoW7f53Qrpv9RBiayUHo0S52JudprkhvpjIrGoU1mnnr29Fvd1U335ZFPZQY1wlkqgfGXyLg==", + "version": "4.12.18", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.18.tgz", + "integrity": "sha512-RWzP96k/yv0PQfyXnWjs6zot20TqfpfsNXhOnev8d1InAxubW93L11/oNUc3tQqn2G0bSdAOBpX+2uDFHV7kdQ==", "license": "MIT", "engines": { "node": ">=16.9.0" @@ -598,9 +599,10 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" }, "node_modules/ip-address": { - "version": "10.1.0", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", - "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.2.0.tgz", + "integrity": "sha512-/+S6j4E9AHvW9SWMSEY9Xfy66O5PWvVEJ08O0y5JGyEKQpojb0K0GKpz/v5HJ/G0vi3D2sjGK78119oXZeE0qA==", + "license": "MIT", "engines": { "node": ">= 12" } diff --git a/package.json b/package.json index 2e504c5..9d85120 100644 --- a/package.json +++ b/package.json @@ -83,8 +83,8 @@ }, "overrides": { "@hono/node-server": "1.19.14", - "express-rate-limit": "8.2.2", - "hono": "4.12.15", + "express-rate-limit": "8.5.1", + "hono": "4.12.18", "path-to-regexp": "8.4.2" }, "devDependencies": {