Skip to content

Commit 0237ed9

Browse files
committed
Load per-version wire packages lazily from the methods surface maps
mcp_types.methods imported both generated wire packages (_v2025_11_25 and _v2026_07_28, roughly 200 pydantic models each) at module import solely to fill the surface maps' values, although a connection negotiates exactly one protocol version and nothing reads a value at import time. The map rows now record the wire type's attribute name; the package a row lives in follows from the key's protocol version and is imported by a cached lookup on the first row read, then cached per row. The public maps stay MappingProxyType objects over the resolved rows (same protocol, repr and equality as before), so importing mcp_types.methods - and therefore mcp, mcp.types and every entry point above them - no longer builds any wire package; the first message parsed for a version builds that version once. The elicitation module's single wire-schema import moves into the function that uses it for the same reason.
1 parent 3ac881f commit 0237ed9

3 files changed

Lines changed: 365 additions & 220 deletions

File tree

0 commit comments

Comments
 (0)