@mushi-mushi/mcp 0.18.2 → 0.18.4

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 +29 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/index.ts
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { createRequire } from "module";
6
- import { createLogger as createLogger2 } from "@mushi-mushi/core";
6
+ import { createLogger as createLogger2, DEFAULT_API_ENDPOINT } from "@mushi-mushi/core";
7
7
 
8
8
  // src/catalog.ts
9
9
  var ALL_SCOPES = ["mcp:read", "mcp:write"];
@@ -3105,7 +3105,7 @@ console.warn = _writeStderr;
3105
3105
  var require2 = createRequire(import.meta.url);
3106
3106
  var VERSION = require2("../package.json").version;
3107
3107
  var log = createLogger2({ scope: "mushi:mcp", level: "info", destination: "stderr" });
3108
- var API_ENDPOINT = process.env.MUSHI_API_ENDPOINT ?? "";
3108
+ var API_ENDPOINT = process.env.MUSHI_API_ENDPOINT?.trim() || DEFAULT_API_ENDPOINT;
3109
3109
  var API_KEY = process.env.MUSHI_API_KEY ?? "";
3110
3110
  var PROJECT_ID = process.env.MUSHI_PROJECT_ID ?? "";
3111
3111
  var SCOPES_RAW = process.env.MUSHI_SCOPES ?? "";
@@ -3125,9 +3125,9 @@ async function main() {
3125
3125
  log.fatal("MUSHI_API_KEY environment variable is required");
3126
3126
  process.exit(1);
3127
3127
  }
3128
- if (!API_ENDPOINT) {
3129
- console.error(
3130
- "[mushi-mcp] MUSHI_API_ENDPOINT is not set. All tool calls will fail.\nSet MUSHI_API_ENDPOINT to your Supabase edge function URL, e.g. https://xyz.supabase.co/functions/v1/api"
3128
+ if (!process.env.MUSHI_API_ENDPOINT?.trim()) {
3129
+ log.info(
3130
+ `[mushi-mcp] MUSHI_API_ENDPOINT not set \u2014 using the hosted Mushi Cloud endpoint (${DEFAULT_API_ENDPOINT}). Self-hosted deployments must set MUSHI_API_ENDPOINT to their Supabase edge function URL, e.g. https://xyz.supabase.co/functions/v1/api`
3131
3131
  );
3132
3132
  }
3133
3133
  const mode = PROJECT_ID ? "single-project" : "account";
@@ -3139,7 +3139,7 @@ async function main() {
3139
3139
  log.info("Starting Mushi MCP server", {
3140
3140
  version: VERSION,
3141
3141
  mode,
3142
- endpoint: API_ENDPOINT || "(unset)",
3142
+ endpoint: API_ENDPOINT,
3143
3143
  hasProjectId: !!PROJECT_ID,
3144
3144
  scopes: SCOPES.join(",")
3145
3145
  });
@@ -3153,10 +3153,31 @@ async function main() {
3153
3153
  });
3154
3154
  const transport = new StdioServerTransport();
3155
3155
  await server.connect(transport);
3156
+ let shuttingDown = false;
3157
+ let pollTimer;
3158
+ const shutdown = (exitCode) => {
3159
+ if (shuttingDown) return;
3160
+ shuttingDown = true;
3161
+ if (pollTimer) clearInterval(pollTimer);
3162
+ void transport.close().finally(() => process.exit(exitCode));
3163
+ };
3164
+ process.stdin.on("end", () => shutdown(0));
3165
+ process.stdin.on("close", () => shutdown(0));
3166
+ process.on("SIGINT", () => shutdown(0));
3167
+ process.on("SIGTERM", () => shutdown(0));
3168
+ process.stdout.on("error", (err) => {
3169
+ if (err.code === "EPIPE") {
3170
+ shutdown(0);
3171
+ return;
3172
+ }
3173
+ log.fatal("stdout write error", { err: String(err) });
3174
+ shutdown(1);
3175
+ });
3156
3176
  if (PROJECT_ID && API_ENDPOINT) {
3157
3177
  let lastInventoryAt = null;
3158
3178
  const POLL_INTERVAL_MS = 6e4;
3159
3179
  const pollInventory = async () => {
3180
+ if (shuttingDown) return;
3160
3181
  try {
3161
3182
  const res = await fetch(`${API_ENDPOINT}/v1/admin/inventory/${PROJECT_ID}`, {
3162
3183
  headers: {
@@ -3180,9 +3201,10 @@ async function main() {
3180
3201
  }
3181
3202
  };
3182
3203
  void pollInventory();
3183
- setInterval(() => {
3204
+ pollTimer = setInterval(() => {
3184
3205
  void pollInventory();
3185
3206
  }, POLL_INTERVAL_MS);
3207
+ pollTimer.unref();
3186
3208
  }
3187
3209
  }
3188
3210
  main().catch((err) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mushi-mushi/mcp",
3
3
  "mcpName": "io.github.kensaurus/mushi-mushi",
4
- "version": "0.18.2",
4
+ "version": "0.18.4",
5
5
  "license": "MIT",
6
6
  "description": "MCP server for Mushi Mushi — triage user-felt bugs, pull evidence (screenshots, console logs, network requests), check blast radius, and dispatch fix PRs, all from your AI coding agent",
7
7
  "type": "module",