McpConfiguration#

Build extensions, choose hooks, and manage request-scoped state. See the guide.

class zett_agent.extensions.mcp.McpConfiguration(servers=(), skipped=<factory>)[source]#

Validated MCP servers loaded from a JSON configuration document.

MCP clients use both servers and mcpServers as their root key. Keeping that variation here prevents transport registration code from depending on a particular client’s file convention.

Parameters:
  • servers (tuple[McpServer, ...])

  • skipped (Mapping[str, str])

skipped: Mapping[str, str]#

Entries dropped by a non-strict load, mapping server name to the reason.

classmethod from_file(path, *, server_keys=('servers', 'mcpServers'), strict=True)[source]#

Read and validate one UTF-8 JSON configuration file.

Parameters:
  • path (str | Path) – File containing the MCP server mapping.

  • server_keys (Sequence[str]) – Accepted root keys in precedence-independent order. Exactly one of these keys may occur in the document.

  • strict (bool) – When true (the default) one invalid server entry fails the whole file. When false invalid entries are skipped, logged, and listed in skipped so the valid servers stay usable. A document that is not valid JSON or lacks a server mapping still raises: there is nothing to salvage.

Return type:

McpConfiguration

classmethod from_mapping(payload, *, server_keys=('servers', 'mcpServers'), strict=True)[source]#

Parse a server mapping under one of the configured root keys.

strict has the meaning described in from_file().

Parameters:
  • payload (object)

  • server_keys (Sequence[str])

  • strict (bool)

Return type:

McpConfiguration