MCP Runtime
MCP support connects configured servers to Anyy toolsets. It is a runtime integration, not part of the inner agent loop.
Client Manager
internal/mcp/client owns sessions, discovery, keepalive, recovery, tool calls,
resources, prompts, sampling hooks, status, and diagnostics.
Runtime setup and gateway code should use the manager instead of manually starting server processes.
Transports
Transport implementations live in internal/mcp/transport. Current code covers
stdio, Streamable HTTP, event-stream response parsing, framing, and JSON-RPC
demux behavior.
Transport status must be bounded and redacted because command args, URLs, and headers can contain credentials.
Server Bridge
internal/mcp/server exposes Anyy as an MCP server/bridge for clients that
need MCP-shaped access to Anyy capabilities.
Keep bridge schemas aligned with protocol/tool descriptors. Do not invent new tool semantics only for MCP.
OAuth Manager
OAuth flow and token storage live in internal/mcp/oauth. Dashboard and CLI
setup commands call RPC/runtime helpers instead of managing tokens directly.
OAuth status output must report readiness without printing token values.
Policy
internal/mcp/policy maps discovered server tools into Anyy descriptors.
Policy owns include/exclude filtering, generated tool names, toolsets, risk,
approval policy, and execution policy.
Untrusted servers should not expose every discovered tool by default.
Redaction
Redaction lives in internal/mcp/redact and runtime audit helpers. Apply it to
server config, logs, probe output, reload errors, and action payloads.
Never echo MCP headers, OAuth tokens, command env, or URL secrets into user-visible diagnostics.