Skip to content

[fix] Correct the env-var name in the MCP-disabled error (AGENTA_AGENT_MCP_SERVERS_ENABLED)#4899

Merged
mmabrouk merged 1 commit into
big-agentsfrom
fix/mcp-disabled-env-var-name
Jun 28, 2026
Merged

[fix] Correct the env-var name in the MCP-disabled error (AGENTA_AGENT_MCP_SERVERS_ENABLED)#4899
mmabrouk merged 1 commit into
big-agentsfrom
fix/mcp-disabled-env-var-name

Conversation

@mmabrouk

Copy link
Copy Markdown
Member

🤖 The AI agent says: I opened this PR on Mahmoud's behalf to preserve the F-047 fix found during agent-workflows QA.

Context

The MCP-disabled error and a runner SSRF-guard comment named the wrong env var. Both told users to set AGENTA_AGENT_ENABLE_MCP to turn MCP servers on. The runner does not read that variable. It gates MCP on AGENTA_AGENT_MCP_SERVERS_ENABLED (services/oss/src/agent/tools/resolver.py:24). A user who followed the remediation set a no-op variable, and MCP stayed off. QA flagged this as F-047.

Scope / risk

Text only, two files:

  • sdks/python/agenta/sdk/agents/mcp/errors.py — the MCPDisabledError message.
  • services/agent/src/engines/sandbox_agent/mcp.ts — the SSRF-guard comment.

No code path, gate, or default changes. The gate (AGENTA_AGENT_MCP_SERVERS_ENABLED, off by default) is untouched. Nothing reads the corrected string at runtime, so there is no behavior change.

Interface reference

This aligns user-facing remediation text with the real config gate. No interface field changes.

  • Real gate (unchanged): AGENTA_AGENT_MCP_SERVERS_ENABLED, read at services/oss/src/agent/tools/resolver.py:24; declared in the compose files (e.g. hosting/docker-compose/oss/docker-compose.dev.yml:456), default false.
  • Before: the message and comment named AGENTA_AGENT_ENABLE_MCP (no code reads this name).
  • After: both name AGENTA_AGENT_MCP_SERVERS_ENABLED.

How to QA

Prereqs: the SDK MCP resolver; MCP disabled.

  1. Leave AGENTA_AGENT_MCP_SERVERS_ENABLED unset (or falsey).
  2. Resolve a request that declares one or more mcp_servers.
  3. Expect MCPDisabledError. Its message now reads "...set AGENTA_AGENT_MCP_SERVERS_ENABLED to enable them...".

Test command:

cd services && uv run python -m pytest oss/tests/pytest/unit/agent/tools/test_resolution.py -k mcp_disabled

Edge cases: the existing test (services/oss/tests/pytest/unit/agent/tools/test_resolution.py:80) asserts only that the message contains "disabled" and the server names, so it stays green. It does not assert the var name. A one-line assertion (assert "AGENTA_AGENT_MCP_SERVERS_ENABLED" in message) would lock this fix against regression; left out here to keep the commit to the two user-facing files.

Out of scope: a QA helper at docs/design/agent-workflows/projects/qa/scripts/run_matrix.py:227 still mentions the old var in a comment string. Left for a separate change to keep this PR to the two user-facing files.

https://claude.ai/code/session_01GYo3UEfvsZpncagqb28Mbc

…T_MCP_SERVERS_ENABLED)

The MCPDisabledError message and the runner SSRF-guard comment told users to
set AGENTA_AGENT_ENABLE_MCP to enable MCP servers. The runner actually gates
MCP on AGENTA_AGENT_MCP_SERVERS_ENABLED (services/oss/src/agent/tools/resolver.py),
so a user following the remediation set a no-op var and MCP stayed disabled.
Correct the env-var name in both the error message and the comment. Text only,
no behavior change.

Claude-Session: https://claude.ai/code/session_01GYo3UEfvsZpncagqb28Mbc
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 28, 2026
@vercel

vercel Bot commented Jun 28, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Jun 28, 2026 3:29am

Request Review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Summary by CodeRabbit

  • Bug Fixes
    • Updated MCP-related guidance to reference the correct environment variable for enabling MCP servers.
    • Error messages now point users to the right setting when MCP is disabled.
    • Internal messaging was also aligned with the updated MCP flag name.

Walkthrough

Two files rename the MCP capability flag from AGENTA_AGENT_ENABLE_MCP to AGENTA_AGENT_MCP_SERVERS_ENABLED: the user-facing error message in MCPDisabledError.__init__ and an SSRF guard comment in mcp.ts.

MCP Flag Rename

Layer / File(s) Summary
Update flag name in error message and SSRF guard comment
sdks/python/agenta/sdk/agents/mcp/errors.py, services/agent/src/engines/sandbox_agent/mcp.ts
MCPDisabledError error message and sandbox agent SSRF guard comment both updated to reference AGENTA_AGENT_MCP_SERVERS_ENABLED.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 60.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: correcting the MCP-disabled env-var name.
Description check ✅ Passed The description is directly related to the changeset and accurately explains the text-only MCP env-var fix.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mcp-disabled-env-var-name

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.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says:

Preserving the F-047 fix from agent-workflows QA. The MCP-disabled error and the runner SSRF-guard comment told users to set AGENTA_AGENT_ENABLE_MCP. Nothing reads that variable. The runner gates MCP on AGENTA_AGENT_MCP_SERVERS_ENABLED (services/oss/src/agent/tools/resolver.py:24). So a user who followed the remediation set a no-op var and MCP stayed off. This PR corrects both strings. Text only, no behavior change.

Changed (2 files):

  • sdks/python/agenta/sdk/agents/mcp/errors.py — the MCPDisabledError message.
  • services/agent/src/engines/sandbox_agent/mcp.ts — the SSRF-guard comment.

ruff format and ruff check pass on the Python.

What I need from you: a quick code review of a text-only fix. Confirm AGENTA_AGENT_MCP_SERVERS_ENABLED is the right gate to send users to.

One call to make: I kept the commit to the two user-facing files. So the existing test (test_resolution.py:80) still asserts only "disabled", not the var name, and a QA helper (run_matrix.py:227) still names the old var. Tell me whether to fold the one-line test assertion and the script fix into this PR or a follow-up.

Please do not merge. This is left for the orchestrator to fold back into big-agents.

@mmabrouk mmabrouk added the needs-review Agent updated; awaiting Mahmoud's review label Jun 28, 2026
super().__init__(
"MCP servers are disabled on this deployment "
"(set AGENTA_AGENT_ENABLE_MCP to enable them), but the request declared "
"(set AGENTA_AGENT_MCP_SERVERS_ENABLED to enable them), but the request declared "

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 The AI agent says: F-047 fix. This MCPDisabledError message named AGENTA_AGENT_ENABLE_MCP, which nothing reads. It now names the real gate AGENTA_AGENT_MCP_SERVERS_ENABLED (read at services/oss/src/agent/tools/resolver.py:24).

* as request headers to this author-supplied URL, so an attacker-controlled config could point it
* at an internal/metadata endpoint and exfiltrate a credential (a classic server-side request
* forgery). The capability is flag-gated (`AGENTA_AGENT_ENABLE_MCP`, off by default) and
* forgery). The capability is flag-gated (`AGENTA_AGENT_MCP_SERVERS_ENABLED`, off by default) and

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 The AI agent says: Same F-047 fix in the runner SSRF-guard comment: the flag is AGENTA_AGENT_MCP_SERVERS_ENABLED, not AGENTA_AGENT_ENABLE_MCP. Comment text only, no behavior change.

@mmabrouk

Copy link
Copy Markdown
Member Author

🤖 The AI agent says: @coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Find target files =="
fd -a 'resolver.py|errors.py|mcp.ts|test_resolution.py|run_matrix.py' .

echo
echo "== Outline resolver.py =="
ast-grep outline services/oss/src/agent/tools/resolver.py --view expanded || true

echo
echo "== Relevant slice: services/oss/src/agent/tools/resolver.py =="
sed -n '1,120p' services/oss/src/agent/tools/resolver.py

echo
echo "== Outline errors.py =="
ast-grep outline sdks/python/agenta/sdk/agents/mcp/errors.py --view expanded || true

echo
echo "== Full file: sdks/python/agenta/sdk/agents/mcp/errors.py =="
sed -n '1,200p' sdks/python/agenta/sdk/agents/mcp/errors.py

echo
echo "== Outline mcp.ts =="
ast-grep outline services/agent/src/engines/sandbox_agent/mcp.ts --view expanded || true

echo
echo "== Full file: services/agent/src/engines/sandbox_agent/mcp.ts =="
sed -n '1,220p' services/agent/src/engines/sandbox_agent/mcp.ts

echo
echo "== Relevant slice: services/oss/tests/pytest/unit/agent/tools/test_resolution.py =="
sed -n '1,160p' services/oss/tests/pytest/unit/agent/tools/test_resolution.py

echo
echo "== Relevant slice: docs/design/agent-workflows/projects/qa/scripts/run_matrix.py =="
sed -n '210,245p' docs/design/agent-workflows/projects/qa/scripts/run_matrix.py

echo
echo "== Search for both env vars in repo =="
rg -n -C2 'AGENTA_AGENT_(ENABLE_MCP|MCP_SERVERS_ENABLED)' .

Length of output: 75081



@mmabrouk Quick review done for #4899 — this looks correct.

I verified that AGENTA_AGENT_MCP_SERVERS_ENABLED is the real gate:

  • services/oss/src/agent/tools/resolver.py Line 24 reads AGENTA_AGENT_MCP_SERVERS_ENABLED
  • the service docstrings in that same file also name it
  • the updated SDK error in sdks/python/agenta/sdk/agents/mcp/errors.py Line 39 now matches runtime
  • the updated SSRF-guard comment in services/agent/src/engines/sandbox_agent/mcp.ts Line 36 also matches runtime
  • hosting/config surfaces also use AGENTA_AGENT_MCP_SERVERS_ENABLED (compose/helm examples)

So: no blocking concerns on the two-file text fix.

My recommendation on scope:

  • Fold the one-line test assertion into this PR. It is tightly scoped to the bug, very low risk, and would pin the exact regression in services/oss/tests/pytest/unit/agent/tools/test_resolution.py.
  • Keep docs/design/agent-workflows/projects/qa/scripts/run_matrix.py for a follow-up if you want to preserve the tight scope. Repo search shows a lot of older design/docs references still mention AGENTA_AGENT_ENABLE_MCP, so pulling doc/comment cleanup into this PR could easily broaden it.

If you want the minimal assertion, it would be:

assert "AGENTA_AGENT_MCP_SERVERS_ENABLED" in message
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
sdks/python/agenta/sdk/agents/mcp/errors.py (1)

39-39: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider locking in the env-var name with a one-line test assertion.

The existing unit test checks "disabled" and server names in the message, but does not assert the exact env-var string. Adding assert "AGENTA_AGENT_MCP_SERVERS_ENABLED" in message would directly guard against regression to the old incorrect name AGENTA_AGENT_ENABLE_MCP. This is low-risk and matches the prior review recommendation.

# In services/oss/tests/pytest/unit/agent/tools/test_resolution.py ~line 89
assert "AGENTA_AGENT_MCP_SERVERS_ENABLED" in message

As per coding guidelines, API or SDK changes require running ruff format then ruff check --fix before committing, and all errors must be fixed before committing.

Source: Coding guidelines


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: a21156fa-3c7b-4981-8178-ddde2690c8ae

📥 Commits

Reviewing files that changed from the base of the PR and between 7521444 and c5db878.

📒 Files selected for processing (2)
  • sdks/python/agenta/sdk/agents/mcp/errors.py
  • services/agent/src/engines/sandbox_agent/mcp.ts

@mmabrouk mmabrouk left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mmabrouk mmabrouk added lgtm This PR has been approved by a maintainer and removed needs-review Agent updated; awaiting Mahmoud's review labels Jun 28, 2026
@mmabrouk mmabrouk merged commit d54a8b3 into big-agents Jun 28, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant