feat(connectors): surface MCP-consuming agents in the "Active for" panel (#1227)#1310
Conversation
|
Clean, focused implementation that closes a genuine UX gap — the chat agent's "Active for" panel invisibility — without touching any activation, ledger, or SSE logic. The flag-follows-data pattern (ClassVar → AgentRegistration → Pydantic → TS type → frontend filter) is the right shape for this kind of capability surface, and the test suite is unusually thorough. Issues🟢 Minor — Multi-line comments on the new ClassVar exceed the one-line-max CLAUDE.md standard (
|
|
Clean, well-scoped implementation. The design correctly separates the two inclusion paths (static Issues🟢 Minor — Unnecessary defensive
|
|
@kovtcharov-amd -- My original commit |
|
Clean, narrow feature that closes a real UX gap in the connectors panel. One nit worth a one-line fix; everything else is solid. Approve with suggestion. SummaryThe "Active for" panel previously only listed agents that declare Issues Found🟢 Minor — doc snippet missing
|
itomek
left a comment
There was a problem hiding this comment.
Approving — this is a clean, well-scoped contribution, @alexey-tyurin. Thanks for following the issue all the way through from report to fix.
I verified the whole chain locally on HEAD (3ec32bb):
- All four #1227 acceptance criteria hold end-to-end: builtin:chat now surfaces in the MCP Active-for panel, toggling round-trips through the existing ledger/SSE path (the PR reuses that logic rather than touching it), static REQUIRED_CONNECTORS agents render unchanged (
activatableAgentsis a superset ofrelevantAgents), and the docs are updated. pytest tests/unit/test_agent_required_connectors.py tests/unit/test_agent_hub_api.py-> 30 passed, including the sync guardtest_builtin_chat_registration_matches_class.pytest tests/unit/connectors/-> 436 passed, no regressions.python util/lint.py --black --isort-> clean.- Full CI on the fork PR is green across the board (unit 3.10-3.12, API, Security Linux+Windows, Chat Agent, CLI integration Linux+Windows, build-apps, doc cross-ref) — the earlier Windows Full Integration blip was transient and is now passing.
The capability-flag threading (CONSUMES_MCP_SERVERS through base Agent -> ChatAgent -> registry -> AgentInfo -> /api/agents -> the frontend filter) is a tidy way to model this, and keeping the hardcoded registry flag guarded by a test against the class is the right call.
One optional follow-up, not a blocker: the heart of the feature — the activatableAgents filter in ConnectorsSection.tsx — has no frontend unit test; it's currently exercised only by tsc/vite at build time (type-safety, not behavior). I'd normally suggest a small vitest case, but the webui has effectively no frontend-test culture today (a single pre-existing spec), so this is genuinely a nice-to-have rather than something I'd hold the PR on.
The two still-open bot nits (the redundant getattr at agents.py:115 and the missing from typing import ClassVar in the connectors.mdx snippet) are minor and fine to fold in or leave.
Nice work.
Generated by Claude Code
|
@kovtcharov-amd this PR is approved by @itomek. Can it be merged now? |
Yes, merged. Apologies for the delay. |
19 PRs merged to main after the v0.20.0 notes were drafted; merge main into the release branch and update the notes to match. - Multi-Device: note #1338 wired the selector end-to-end (it was a no-op after #1252 alone) and added loud runtime validation for unavailable devices. - PowerPoint RAG: note #1366 unblocked .pptx in the Agent UI file picker (backend already accepted it; the frontend rejected it pre-upload). - Activations: note #1310 widened the "Active for" panel to MCP-consuming agents (e.g. the chat agent), not just static REQUIRED_CONNECTORS. - New bug fixes: RAG embedding reuse (#1306), overlapping-chat-turn 409 (#1304), Memory/Settings mutual exclusivity (#1368). - Tooling/CI: doc-vs-code realignment (#1298/#1337/#1340), gaia-testing skill (#1372), Claude CI + Codecov hardening. - Full Changelog regenerated: 44 -> 63 commits.
Summary
Widens the Settings → Connectors "Active for" panel so it lists agents that consume MCP servers dynamically (like the chat agent), not only agents that statically declare
REQUIRED_CONNECTORS. The chat agent now appears as an activatable target for MCP-only connectors loaded from~/.gaia/mcp_servers.json.Why
Before this change, the "Active for" panel only listed agents whose class declared the connector in
REQUIRED_CONNECTORS. The chat agent (builtin:chat) declares none for MCP servers — it loads them at runtime and already gates their tools through the activation ledger (_active_mcp_servers→MCPClientManager.servers_for_agent→is_agent_active). So a user could activatebuiltin:chatfor an MCP connector via the CLI/SDK and it worked, but the Settings UI never showed the chat agent as eligible — a UI-only user had no way to toggle it. The runtime was correct; the panel just couldn't see these agents.This PR closes that surfacing gap by adding a
CONSUMES_MCP_SERVERScapability flag that flows from the agent class through the registry and API to the frontend, exactly the wayREQUIRED_CONNECTORSalready does. No activation, ledger, or SSE logic changes — those already work end-to-end (#1005, #1226).Follow-up to #1219, which introduced per-agent MCP tool-visibility activations.
Linked issue
Closes #1227
Changes
REQUIRED_CONNECTORS:Agent.CONSUMES_MCP_SERVERSClassVar (Falseby default), setTrueonChatAgent. The registry carries it asAgentRegistration.consumes_mcp_servers— hardcoded for the built-in chat (its lazy factory must not import the chat module at discovery time; a guard test keeps the two in sync) and read via class introspection on the custom-agent discovery path, so builder-scaffolded MCP agents surface automatically too.AgentInfo.consumes_mcp_servers(Pydantic) + the/api/agentsserializer (_reg_to_info), and the matching TypeScriptAgentInfofield.ConnectorsSection.tsxcomputes a separate, wideractivatableAgentsset for the "Active for" block (an agent is eligible if it declares the connector or setsconsumes_mcp_servers); the "Per-agent grants" credential section is unchanged.AgentActivationCardno longer bails when an agent has no static requirement, and its one-click auto-grant falls back to the canonical MCPusescope for dynamic consumers (named constant, not a magic string).docs/sdk/infrastructure/connectors.mdxdocuments the newCONSUMES_MCP_SERVERSflag in the agent-author guide and adds a "Which agents appear in the Active for panel" section covering both inclusion patterns.Trueand defaultFalse),AgentInforound-trip, and_reg_to_infoexposure for a consumer vs a non-consumer.Test plan
python util/lint.py --all— Black/isort clean, no new critical errors.pytest tests/unit/test_agent_required_connectors.py tests/unit/test_agent_hub_api.py -q— 30 passed.pytest tests/unit/connectors/ -q— 429 passed, 3 skipped (no regressions).cd src/gaia/apps/webui && npm run build—tsc && vite buildclean.~/.gaia/mcp_servers.jsonand configure it as an MCP connector →gaia chat --ui→ Settings → Connectors → open the MCP tile. Confirm Chat now appears under "Active for"; toggle it ON. Verifygaia connectors activations list <connector_id>showsbuiltin:chat: activeand the toggle survives a page reload (SSE refresh). Toggle OFF and confirm deactivation. Confirm an OAuth connector still shows no "Active for" section.Checklist
Closes #N/Fixes #N/Refs #N).python util/lint.py --all,pytest tests/unit/).