#3608·genkit

MCP server ignores environment variables and hardcodes /.genkit path

Author: sethchandlerCreated Sep 18, 2025Updated Sep 23, 2026
Labelsbugtooling

Bug Report: MCP server ignores environment variables and hardcodes /.genkit path Title genkit mcp command fails with hardcoded /.genkit path, ignores GENKIT_HOME environment variable Description Summary The genkit mcp command attempts to write to a hardcoded /.genkit directory in the root filesystem, causing permission errors. This occurs even when GENKIT_HOME is properly set to a writable location. Other genkit commands (genkit flow:run, etc.) correctly respect the environment variable. Environment

OS: macOS (ARM64) Node version: v23.11.0 Genkit version: 1.19.2 (installed via npm install -g genkit-cli) Installation method: npm global install

Steps to Reproduce

Install genkit: npm install -g genkit-cli Set environment variable: export GENKIT_HOME="$HOME/.genkit" Run MCP server: genkit mcp

Expected Behavior The MCP server should use $HOME/.genkit as specified by the GENKIT_HOME environment variable. Actual Behavior The MCP server attempts to create /.genkit in the root filesystem, resulting in: Error: ENOENT: no such file or directory, mkdir '/.genkit/traces' or (when compiled with Bun): EROFS: read-only file system, mkdir '/.genkit' Additional Context

Regular genkit commands (genkit flow:run) correctly respect GENKIT_HOME and write to $HOME/.genkit The issue appears to be in the telemetry module (LocalFileTraceStore) used by the MCP command Error originates from: /opt/homebrew/lib/node_modules/genkit-cli/node_modules/@genkit-ai/telemetry-server/lib/cjs/localFileTraceStore.js:27:22

Workaround Attempts (all failed)

Setting various environment variables: GENKIT_HOME, GENKIT_DIR, GENKIT_CONFIG_HOME, GENKIT_TRACE_STORE Creating wrapper scripts to modify environment Using temporary HOME directories

Impact This bug makes the MCP server completely unusable on systems where users cannot write to the root filesystem (standard configuration for most systems). Proposed Fix The MCP command should respect the same GENKIT_HOME environment variable that other genkit commands use, or provide a way to configure the telemetry/trace directory location.