MCP Consult Tools Now Install Themselves — Zero Setup, Just Launch PorkiCoder and Talk to Kimi from Claude Code
1.8.0 shipped consult_kimi / consult_grok / consult_gemini / consult_gpt5 as an MCP server, but actually using them required two manual steps most users never made it through: running claude mcp add porkicoder-consult … in the right shell with the right path, and remembering to export KIMI_API_KEY=… in every terminal that hosted a Claude Code session. 1.8.1 closes both gaps. Open PorkiCoder, open a terminal, run claude — Claude already sees the consult tools and already has your Kimi key. Nothing to configure.
- Auto-registration into
~/.claude.json on every launch — On app.whenReady PorkiCoder writes a porkicoder-consult entry under mcpServers pointing at the bundled mcp-consult/index.js with ELECTRON_RUN_AS_NODE=1 set so the same Electron binary runs the MCP server as Node 20. Subsequent launches no-op when the entry already matches; dev↔packaged switches and node_modules reinstalls rewrite the entry to the current binary so claude mcp list never reports a stale path.
- KIMI_API_KEY injected into every PorkiCoder terminal — The
terminal:create handler reads the encrypted key from safeStorage and threads it into the spawned PTY's environment. Two-hop env flow does the rest: terminal env → Claude Code CLI inherits it → MCP server subprocess spawned by Claude Code inherits it too. Set the key once in Settings, never touch a shell rc-file again. The other three providers (Grok / Gemini / GPT-5) still need their env vars set manually until a future release ports them.
- Concurrency-safe writes to
~/.claude.json — The Claude Code CLI rewrites the same file after every turn, without a lock. A naive read-modify-rename would silently clobber a CLI write that landed between our read and our rename — losing whatever turn the CLI just persisted. The new flow snapshots the file's inode+mtime+size at read time from a single fd, re-stats just before the atomic rename, and retries up to three times on mismatch. Per-pid .tmp filenames mean two simultaneous PorkiCoder launches can't truncate each other's in-progress writes either.
- Non-destructive on every malformed-config path — If
~/.claude.json is unparseable JSON, has mcpServers set to an array or string, or is anything other than a plain object, PorkiCoder now logs and skips the registration instead of rewriting the file with a default-empty {mcpServers: {}}. Any custom hand-edits or third-party MCP entries in unusual shapes are preserved untouched.
- Indent + trailing-newline preserved when rewriting — The writer sniffs the existing file's indent (tab vs. 2-space vs. 4-space) and trailing-newline style and round-trips whatever it found, so updating our entry doesn't produce a noisy whitespace diff against whatever format the CLI's own writer uses.
Kimi Consults No Longer Return Empty Answers
The MCP consult tool capped Kimi's output at max_tokens: 4000. Kimi K2.6 counts thinking tokens against that budget — so a question that triggered a few thousand tokens of reasoning would burn the entire budget reasoning and emit zero visible content. The tool surfaced only the cost footer (— Kimi K2.6 (… in, 4000 out, $…)) with an empty answer above it, leaving Claude Code with nothing actionable. Bumped to 32768 — Moonshot's documented default and the highest doc-blessed cap — so even thinking-heavy questions have ample room to both reason and answer.
API Keys Survive Transient Decrypt Failures
Two key-lookup paths (chat orchestrator and Cmd+K inline-edit service) used to store.delete() the encrypted key whenever safeStorage.decryptString threw — on the theory that an undecryptable key was a corrupted key. That's wrong in the common cases: a Keychain reissue, a login migration, copying the store across machines, or running PorkiCoder under a different macOS user account all produce decrypt failures with a perfectly intact ciphertext. The new behaviour is to log the failure, return null, and leave the stored value in place — the user can re-enter the key in Settings to overwrite it whenever convenient, instead of silently re-entering it from scratch after every machine migration. Bug surfaced because 1.8.0's KIMI_API_KEY injection now runs that decrypt on every terminal-create.
Smaller fixes
- Decrypted Kimi key cached in-process — Per-terminal-create file I/O + decrypt is now a single hit, invalidated when the user saves a new key in Settings. Negligible for occasional terminal opens; matters if a future flow spawns terminals in a loop (multi-tab restore, test harnesses).
- Dev-mode
process.execPath staleness diagnosable from logs — When a registered entry points at an electron binary that no longer exists on disk (after a node_modules wipe or an Electron version bump), startup logs the prior path and the new one, so claude mcp list's "failed to start" line is no longer mysterious.
- Registration completion now logged with a restart hint — Because the read-write happens fire-and-forget from
app.whenReady, a terminal opened in the first few hundred milliseconds may launch a claude session before the entry lands. The post-write log now explicitly warns that any in-flight session won't see the entry until restarted — so the gap is diagnosable rather than mysterious.
- Disabled provider blocks switched from
/* */ to if (false) { … } — The three commented-out provider registrations in mcp-consult/index.js are now syntax-checked by node --check instead of hidden behind comment delimiters, so a typo while the block is "off" still trips the syntax checker.
- Bundled
mcp-consult/.git/** excluded from packaged builds — Forward-looking: if a future restructure makes mcp-consult/ a vendored repo or submodule, its .git/ won't bloat the DMG.