Skip to content

Commit f7de41b

Browse files
committed
fix: read MCP_API_KEY to avoid Railway shared variable conflict
Railway shares env vars across services in the same project. The backend's API_KEY (dev-secret-key) was overriding the MCP service's ci_ key at runtime, causing 401 on every tool call. MCP_API_KEY takes precedence over API_KEY when both are set.
1 parent 76af000 commit f7de41b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

mcp-server/config.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
BACKEND_BASE_URL = os.getenv("BACKEND_API_URL", "http://localhost:8000")
1212
BACKEND_API_URL = f"{BACKEND_BASE_URL}{API_PREFIX}"
13-
API_KEY = os.getenv("API_KEY", "")
13+
# MCP_API_KEY takes precedence over API_KEY to avoid conflicts
14+
# when Railway shares env vars across services in the same project
15+
API_KEY = os.getenv("MCP_API_KEY", "") or os.getenv("API_KEY", "")
1416

1517
SERVER_NAME = "codeintel-mcp"
1618
SERVER_VERSION = "0.5.0"

0 commit comments

Comments
 (0)