Repository navigation
feat(mcp): Use Official Jira MCP - #990
syntaxsdev wants to merge 2 commits into
Conversation
WalkthroughReplaces the local Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
components/runners/ambient-runner/ambient_runner/bridges/claude/mcp.py (1)
227-234:⚠️ Potential issue | 🟠 MajorAvoid false-positive auth for
atlassianby requiring the new headerLine 227 currently routes
atlassianthrough legacy Jira fallback checks (Lines 231-234). That can report “configured” even whenATLASSIAN_AUTH_HEADERis missing, while the HTTP MCP config still fails auth.Proposed fix
- if server_name in ("atlassian", "mcp-atlassian", "jira"): - if os.getenv("ATLASSIAN_AUTH_HEADER", "").strip(): - return True, "Atlassian credentials configured" + if server_name == "atlassian": + if os.getenv("ATLASSIAN_AUTH_HEADER", "").strip(): + return True, "Atlassian credentials configured" + return False, "Atlassian not configured - missing ATLASSIAN_AUTH_HEADER" + + if server_name in ("mcp-atlassian", "jira"): + if os.getenv("ATLASSIAN_AUTH_HEADER", "").strip(): + return True, "Atlassian credentials configured" jira_url = os.getenv("JIRA_URL", "").strip() jira_token = os.getenv("JIRA_API_TOKEN", "").strip() if jira_url and jira_token: return True, "Jira credentials configured"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/runners/ambient-runner/ambient_runner/bridges/claude/mcp.py` around lines 227 - 234, The current check treats server_name == "atlassian" as satisfied if legacy JIRA env vars (JIRA_URL/JIRA_API_TOKEN) exist, causing a false-positive; change the logic so that when server_name is "atlassian" (or "mcp-atlassian"/"jira") you require ATLASSIAN_AUTH_HEADER to be present and non-empty to return True/"Atlassian credentials configured" and do not fall back to checking JIRA_URL or JIRA_API_TOKEN for that branch (leave the legacy Jira fallback only for non-Atlassian server_name cases or remove the fallback entirely for the Atlassian names).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/runners/ambient-runner/ambient_runner/platform/auth.py`:
- Around line 279-299: The ATLASSIAN_AUTH_HEADER can persist from a previous
successful fetch because the current try/except only sets it on the happy path;
change the Jira refresh logic in the block surrounding fetch_jira_credentials so
that when jira_creds lacks email or apiToken you explicitly delete/clear
os.environ["ATLASSIAN_AUTH_HEADER"] (or set it to empty) and also clear it in
the except Exception handler; locate the code around fetch_jira_credentials,
jira_creds, and the ATLASSIAN_AUTH_HEADER assignment to implement these clears
to avoid reusing stale credentials.
---
Outside diff comments:
In `@components/runners/ambient-runner/ambient_runner/bridges/claude/mcp.py`:
- Around line 227-234: The current check treats server_name == "atlassian" as
satisfied if legacy JIRA env vars (JIRA_URL/JIRA_API_TOKEN) exist, causing a
false-positive; change the logic so that when server_name is "atlassian" (or
"mcp-atlassian"/"jira") you require ATLASSIAN_AUTH_HEADER to be present and
non-empty to return True/"Atlassian credentials configured" and do not fall back
to checking JIRA_URL or JIRA_API_TOKEN for that branch (leave the legacy Jira
fallback only for non-Atlassian server_name cases or remove the fallback
entirely for the Atlassian names).
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7396e338-6a81-4b4c-930f-0c1c0cfa7e0c
📒 Files selected for processing (4)
components/runners/ambient-runner/.mcp.jsoncomponents/runners/ambient-runner/ambient_runner/bridges/claude/mcp.pycomponents/runners/ambient-runner/ambient_runner/platform/auth.pycomponents/runners/ambient-runner/pyproject.toml
6b63b27 to
5049092
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
components/runners/ambient-runner/ambient_runner/platform/auth.py (1)
325-347:⚠️ Potential issue | 🟠 Major
ATLASSIAN_AUTH_HEADERlifecycle is still incomplete (stale credential risk).The header is only managed inside the
apiTokenbranch. If Jira refresh errors or returns no token, an oldATLASSIAN_AUTH_HEADERcan persist. Also ensure turn cleanup removes this env var.Proposed fix
# Jira / Atlassian credentials + os.environ.pop("ATLASSIAN_AUTH_HEADER", None) if isinstance(jira_creds, Exception): logger.warning(f"Failed to refresh Jira credentials: {jira_creds}") elif jira_creds.get("apiToken"): os.environ["JIRA_URL"] = jira_creds.get("url", "") os.environ["JIRA_API_TOKEN"] = jira_creds.get("apiToken", "") os.environ["JIRA_EMAIL"] = jira_creds.get("email", "") logger.info("Updated Jira credentials in environment") @@ else: os.environ.pop("ATLASSIAN_AUTH_HEADER", None) logger.info("Cleared ATLASSIAN_AUTH_HEADER: missing email or apiToken") + else: + logger.info("No Jira apiToken returned; ATLASSIAN_AUTH_HEADER cleared")def clear_runtime_credentials() -> None: @@ for key in [ "GITHUB_TOKEN", "GITLAB_TOKEN", "JIRA_API_TOKEN", "JIRA_URL", "JIRA_EMAIL", + "ATLASSIAN_AUTH_HEADER", "USER_GOOGLE_EMAIL", ]:As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@components/runners/ambient-runner/ambient_runner/platform/auth.py` around lines 325 - 347, jira_creds handling currently only sets/clears ATLASSIAN_AUTH_HEADER inside the apiToken branch, leaving a stale ATLASSIAN_AUTH_HEADER when jira_creds is an Exception or missing apiToken; update the logic so that whenever jira_creds is an Exception or jira_creds does not contain an "apiToken" you explicitly os.environ.pop("ATLASSIAN_AUTH_HEADER", None) and log the action (use the same logger used around jira_creds), and also add removal of ATLASSIAN_AUTH_HEADER in the turn/cleanup routine (the function that runs at end of a turn/session—add a single os.environ.pop("ATLASSIAN_AUTH_HEADER", None) with an info log) so the header is always cleared on failures and at cleanup; reference jira_creds, ATLASSIAN_AUTH_HEADER, and the turn cleanup function when making these edits.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@components/runners/ambient-runner/ambient_runner/bridges/claude/mcp.py`:
- Around line 228-230: The current server_name check in the tuple ("atlassian",
"mcp-atlassian", "jira") allows ATLASSIAN_AUTH_HEADER to mark auth successful
for jira and mcp-atlassian; update the condition in the function in mcp.py that
evaluates server_name so that the ATLASSIAN_AUTH_HEADER success path runs only
when server_name == "atlassian" (leave other branches for mcp-atlassian/jira to
use their existing auth checks), and keep the existing
os.getenv("ATLASSIAN_AUTH_HEADER", "").strip() guard and the returned message
"Atlassian credentials configured".
---
Duplicate comments:
In `@components/runners/ambient-runner/ambient_runner/platform/auth.py`:
- Around line 325-347: jira_creds handling currently only sets/clears
ATLASSIAN_AUTH_HEADER inside the apiToken branch, leaving a stale
ATLASSIAN_AUTH_HEADER when jira_creds is an Exception or missing apiToken;
update the logic so that whenever jira_creds is an Exception or jira_creds does
not contain an "apiToken" you explicitly os.environ.pop("ATLASSIAN_AUTH_HEADER",
None) and log the action (use the same logger used around jira_creds), and also
add removal of ATLASSIAN_AUTH_HEADER in the turn/cleanup routine (the function
that runs at end of a turn/session—add a single
os.environ.pop("ATLASSIAN_AUTH_HEADER", None) with an info log) so the header is
always cleared on failures and at cleanup; reference jira_creds,
ATLASSIAN_AUTH_HEADER, and the turn cleanup function when making these edits.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4152ce26-31bd-4eac-bf3a-241eb1e5dbe9
📒 Files selected for processing (6)
components/runners/ambient-runner/.mcp.jsoncomponents/runners/ambient-runner/ambient_runner/bridges/claude/mcp.pycomponents/runners/ambient-runner/ambient_runner/platform/auth.pycomponents/runners/ambient-runner/pyproject.tomlcomponents/runners/ambient-runner/tests/test_mcp_auth.pycomponents/runners/ambient-runner/tests/test_observability_metrics.py
| if server_name in ("atlassian", "mcp-atlassian", "jira"): | ||
| if os.getenv("ATLASSIAN_AUTH_HEADER", "").strip(): | ||
| return True, "Atlassian credentials configured" |
There was a problem hiding this comment.
Limit ATLASSIAN_AUTH_HEADER success path to the atlassian server only.
Right now, jira and mcp-atlassian can be marked authenticated from ATLASSIAN_AUTH_HEADER alone, which can misreport auth readiness for legacy Jira-style configs.
Proposed fix
- if server_name in ("atlassian", "mcp-atlassian", "jira"):
- if os.getenv("ATLASSIAN_AUTH_HEADER", "").strip():
- return True, "Atlassian credentials configured"
+ if server_name == "atlassian":
+ if os.getenv("ATLASSIAN_AUTH_HEADER", "").strip():
+ return True, "Atlassian credentials configured"
+
+ if server_name in ("atlassian", "mcp-atlassian", "jira"):
jira_url = os.getenv("JIRA_URL", "").strip()
jira_token = os.getenv("JIRA_API_TOKEN", "").strip()As per coding guidelines, "Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity."
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@components/runners/ambient-runner/ambient_runner/bridges/claude/mcp.py`
around lines 228 - 230, The current server_name check in the tuple ("atlassian",
"mcp-atlassian", "jira") allows ATLASSIAN_AUTH_HEADER to mark auth successful
for jira and mcp-atlassian; update the condition in the function in mcp.py that
evaluates server_name so that the ATLASSIAN_AUTH_HEADER success path runs only
when server_name == "atlassian" (leave other branches for mcp-atlassian/jira to
use their existing auth checks), and keep the existing
os.getenv("ATLASSIAN_AUTH_HEADER", "").strip() guard and the returned message
"Atlassian credentials configured".
|
i want to hold this until we test it. have u tested it working in a cluster yet? can u run a workflow for triage and show that. with bug bash rn this might be risky |
Review Queue Status
Action needed: Fix failing CI checks
|
Atlassian Remote MCP Server as an HTTP endpoint (https://mcp.atlassian.com/v1/mcp) with Basic auth header
env var for the HTTP header
This Eliminates local Python process + community dependency, uses first-party Atlassian server with Jira + Confluence + Compass