@scorehub/mcp-server 0.1.4 → 0.1.5

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.
Files changed (2) hide show
  1. package/dist/index.js +26 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -20,6 +20,9 @@ const AUTHORIZE_URL = `${REMOTE_MCP_URL}/authorize`;
20
20
  // ── Auth State ──────────────────────────────────────────────
21
21
  const auth_js_1 = require("./auth.js");
22
22
  const node_child_process_1 = require("node:child_process");
23
+ const node_os_1 = require("node:os");
24
+ const node_path_1 = require("node:path");
25
+ const node_fs_1 = require("node:fs");
23
26
  const HOST = new URL(REMOTE_MCP_URL).host;
24
27
  const CLIENT_ID = "scorehub-mcp";
25
28
  // ── Remote Tool Proxy ───────────────────────────────────────
@@ -191,6 +194,29 @@ server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
191
194
  });
192
195
  // ── Start ───────────────────────────────────────────────────
193
196
  async function main() {
197
+ // ── Clean up orphaned previous instance ────────────────────
198
+ const pidFile = (0, node_path_1.join)((0, node_os_1.homedir)(), ".scorehub", HOST, "pid");
199
+ try {
200
+ if ((0, node_fs_1.existsSync)(pidFile)) {
201
+ const oldPid = parseInt((0, node_fs_1.readFileSync)(pidFile, "utf-8").trim(), 10);
202
+ if (oldPid && oldPid !== process.pid) {
203
+ try {
204
+ process.kill(oldPid, 0); // check if process exists (cross-platform)
205
+ process.kill(oldPid); // SIGTERM on POSIX, TerminateProcess on Windows
206
+ }
207
+ catch { /* process already dead */ }
208
+ }
209
+ }
210
+ }
211
+ catch { /* ignore PID file read errors */ }
212
+ // Write current PID
213
+ try {
214
+ const dir = (0, node_path_1.dirname)(pidFile);
215
+ if (!(0, node_fs_1.existsSync)(dir))
216
+ (0, node_fs_1.mkdirSync)(dir, { recursive: true });
217
+ (0, node_fs_1.writeFileSync)(pidFile, String(process.pid), "utf-8");
218
+ }
219
+ catch { /* ignore PID file write errors */ }
194
220
  try {
195
221
  remoteTools = await fetchRemoteTools();
196
222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scorehub/mcp-server",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "ScoreHub local MCP proxy — OAuth login, token caching, and tool forwarding to remote MCP endpoint",
5
5
  "main": "dist/index.js",
6
6
  "bin": {