@mushi-mushi/mcp 0.18.3 → 0.19.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.
Files changed (2) hide show
  1. package/dist/index.js +48 -10
  2. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -3,7 +3,10 @@
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 { readFileSync } from "fs";
7
+ import { join } from "path";
8
+ import { homedir } from "os";
9
+ import { createLogger as createLogger2, DEFAULT_API_ENDPOINT } from "@mushi-mushi/core";
7
10
 
8
11
  // src/catalog.ts
9
12
  var ALL_SCOPES = ["mcp:read", "mcp:write"];
@@ -3105,9 +3108,26 @@ console.warn = _writeStderr;
3105
3108
  var require2 = createRequire(import.meta.url);
3106
3109
  var VERSION = require2("../package.json").version;
3107
3110
  var log = createLogger2({ scope: "mushi:mcp", level: "info", destination: "stderr" });
3108
- var API_ENDPOINT = process.env.MUSHI_API_ENDPOINT ?? "";
3109
- var API_KEY = process.env.MUSHI_API_KEY ?? "";
3110
- var PROJECT_ID = process.env.MUSHI_PROJECT_ID ?? "";
3111
+ function readCliConfig() {
3112
+ try {
3113
+ const xdg = process.env.XDG_CONFIG_HOME;
3114
+ const appData = process.env.APPDATA;
3115
+ const base = xdg && xdg.length > 0 ? xdg : process.platform === "win32" && appData && appData.length > 0 ? appData : join(homedir(), ".config");
3116
+ const raw = readFileSync(join(base, "mushi", "config.json"), "utf8");
3117
+ const parsed = JSON.parse(raw);
3118
+ return {
3119
+ apiKey: typeof parsed.apiKey === "string" ? parsed.apiKey : void 0,
3120
+ projectId: typeof parsed.projectId === "string" ? parsed.projectId : void 0,
3121
+ endpoint: typeof parsed.endpoint === "string" ? parsed.endpoint : void 0
3122
+ };
3123
+ } catch {
3124
+ return {};
3125
+ }
3126
+ }
3127
+ var CLI_CONFIG = readCliConfig();
3128
+ var API_ENDPOINT = process.env.MUSHI_API_ENDPOINT?.trim() || CLI_CONFIG.endpoint?.trim() || DEFAULT_API_ENDPOINT;
3129
+ var API_KEY = process.env.MUSHI_API_KEY?.trim() || CLI_CONFIG.apiKey || "";
3130
+ var PROJECT_ID = process.env.MUSHI_PROJECT_ID?.trim() || CLI_CONFIG.projectId || "";
3111
3131
  var SCOPES_RAW = process.env.MUSHI_SCOPES ?? "";
3112
3132
  var parsedScopes = SCOPES_RAW ? SCOPES_RAW.split(",").map((s) => s.trim()).filter((s) => s === "mcp:read" || s === "mcp:write") : ALL_SCOPES;
3113
3133
  var SCOPES = SCOPES_RAW && parsedScopes.length === 0 ? ALL_SCOPES : parsedScopes;
@@ -3122,13 +3142,23 @@ if (MCP_SENTRY_DSN) {
3122
3142
  }
3123
3143
  async function main() {
3124
3144
  if (!API_KEY) {
3125
- log.fatal("MUSHI_API_KEY environment variable is required");
3145
+ log.fatal(
3146
+ "No API key found \u2014 set MUSHI_API_KEY, or run `mushi login` so the CLI config can supply it."
3147
+ );
3126
3148
  process.exit(1);
3127
3149
  }
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"
3131
- );
3150
+ if (!process.env.MUSHI_API_KEY && CLI_CONFIG.apiKey) {
3151
+ log.info("[mushi-mcp] Using API key from the CLI config (~/.config/mushi/config.json)");
3152
+ }
3153
+ log.info(`[mushi-mcp] Endpoint: ${API_ENDPOINT}`);
3154
+ if (!process.env.MUSHI_API_ENDPOINT?.trim()) {
3155
+ if (CLI_CONFIG.endpoint?.trim()) {
3156
+ log.info(`[mushi-mcp] Using endpoint from CLI config: ${API_ENDPOINT}`);
3157
+ } else {
3158
+ log.warn(
3159
+ `[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`
3160
+ );
3161
+ }
3132
3162
  }
3133
3163
  const mode = PROJECT_ID ? "single-project" : "account";
3134
3164
  if (!PROJECT_ID) {
@@ -3139,7 +3169,7 @@ async function main() {
3139
3169
  log.info("Starting Mushi MCP server", {
3140
3170
  version: VERSION,
3141
3171
  mode,
3142
- endpoint: API_ENDPOINT || "(unset)",
3172
+ endpoint: API_ENDPOINT,
3143
3173
  hasProjectId: !!PROJECT_ID,
3144
3174
  scopes: SCOPES.join(",")
3145
3175
  });
@@ -3165,6 +3195,14 @@ async function main() {
3165
3195
  process.stdin.on("close", () => shutdown(0));
3166
3196
  process.on("SIGINT", () => shutdown(0));
3167
3197
  process.on("SIGTERM", () => shutdown(0));
3198
+ process.stdout.on("error", (err) => {
3199
+ if (err.code === "EPIPE") {
3200
+ shutdown(0);
3201
+ return;
3202
+ }
3203
+ log.fatal("stdout write error", { err: String(err) });
3204
+ shutdown(1);
3205
+ });
3168
3206
  if (PROJECT_ID && API_ENDPOINT) {
3169
3207
  let lastInventoryAt = null;
3170
3208
  const POLL_INTERVAL_MS = 6e4;
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.3",
4
+ "version": "0.19.0",
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",
@@ -48,14 +48,14 @@
48
48
  "@modelcontextprotocol/sdk": "^1.29.0",
49
49
  "@sentry/node": "^10.57.0",
50
50
  "zod": "^4.4.3",
51
- "@mushi-mushi/core": "^1.22.5"
51
+ "@mushi-mushi/core": "^1.23.0"
52
52
  },
53
53
  "devDependencies": {
54
- "@types/node": "^22.19.21",
55
- "eslint": "^10.4.1",
54
+ "@types/node": "^22.20.0",
55
+ "eslint": "^10.6.0",
56
56
  "tsup": "^8.5.1",
57
57
  "typescript": "^6.0.3",
58
- "vitest": "^4.1.8",
58
+ "vitest": "^4.1.9",
59
59
  "@mushi-mushi/eslint-config": "0.0.0"
60
60
  },
61
61
  "repository": {