Skip to content

fix: MCP_API_KEY to avoid Railway shared variable conflict#286

Merged
DevanshuNEU merged 1 commit into
OpenCodeIntel:mainfrom
DevanshuNEU:hotfix/mcp-api-key-conflict
Mar 7, 2026
Merged

fix: MCP_API_KEY to avoid Railway shared variable conflict#286
DevanshuNEU merged 1 commit into
OpenCodeIntel:mainfrom
DevanshuNEU:hotfix/mcp-api-key-conflict

Conversation

@DevanshuNEU

@DevanshuNEU DevanshuNEU commented Mar 7, 2026

Copy link
Copy Markdown
Collaborator

Railway shares env vars across services in the same project. The backend's API_KEY was overriding the MCP server's ci_ key at runtime.

Fix: MCP server now reads MCP_API_KEY first, falls back to API_KEY.

After merge, add MCP_API_KEY on Railway MCP service with the ci_ key value.

Summary by CodeRabbit

  • New Features
    • Added MCP_API_KEY environment variable support. When both MCP_API_KEY and API_KEY are configured, MCP_API_KEY takes precedence. Existing API_KEY configurations remain fully compatible.

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.
@vercel

vercel Bot commented Mar 7, 2026

Copy link
Copy Markdown

@DevanshuNEU is attempting to deploy a commit to the Dev's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Mar 7, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c4ab16d0-7b39-405e-b4e2-b70307d59af2

📥 Commits

Reviewing files that changed from the base of the PR and between 76af000 and f7de41b.

📒 Files selected for processing (1)
  • mcp-server/config.py

📝 Walkthrough

Walkthrough

The change modifies the API key configuration logic in mcp-server/config.py to prioritize the MCP_API_KEY environment variable over the standard API_KEY variable, allowing the MCP-specific key to override the generic one when both are defined.

Changes

Cohort / File(s) Summary
Environment Variable Precedence
mcp-server/config.py
Updated API_KEY assignment to check MCP_API_KEY first, then fall back to API_KEY, enabling MCP-specific key override.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Poem

🐰 A little key, now wearing a hat,
MCP comes first, imagine that!
Environment dancing, one take the lead,
Config so clever, for all that we need! 🔑

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating API_KEY configuration to prioritize MCP_API_KEY, which directly addresses the Railway shared variable conflict described in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@vercel

vercel Bot commented Mar 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
opencodeintel Ignored Ignored Preview Mar 7, 2026 8:33pm

@DevanshuNEU DevanshuNEU merged commit c20384e into OpenCodeIntel:main Mar 7, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant