feat(connectors): surface MCP-consuming agents in the "Active for" panel (#1227)#1310
feat(connectors): surface MCP-consuming agents in the "Active for" panel (#1227)#1310alexey-tyurin wants to merge 2 commits into
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 |
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/).