McpConfiguration#
Build extensions, choose hooks, and manage request-scoped state. See the guide.
- class zett_agent.extensions.mcp.McpConfiguration(servers=(), skipped=<factory>)[源代码]#
Validated MCP servers loaded from a JSON configuration document.
MCP clients use both
serversandmcpServersas their root key. Keeping that variation here prevents transport registration code from depending on a particular client's file convention.- 参数:
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)[源代码]#
Read and validate one UTF-8 JSON configuration file.
- 参数:
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
skippedso the valid servers stay usable. A document that is not valid JSON or lacks a server mapping still raises: there is nothing to salvage.
- 返回类型:
- classmethod from_mapping(payload, *, server_keys=('servers', 'mcpServers'), strict=True)[源代码]#
Parse a server mapping under one of the configured root keys.
stricthas the meaning described infrom_file().- 参数:
payload (object)
server_keys (Sequence[str])
strict (bool)
- 返回类型: