Modules and compatibility
Existing notebooks continue to use:
from perseus_mcp import server
from fastmcp import Client
client = Client(server.mcp)
All 23 tool names, argument defaults, descriptions, return formats, and the
perseus-mcp / python -m perseus_mcp entry points remain unchanged.
Direct calls such as await server.get_passage(urn) and the notebook’s
server._normalize_query_for_search(...) helper still work.
Responsibilities
serverpreserves the old import surface and validates startup settings._appowns the single FastMCP instance and the tool error adapter.httpowns the shared HTTP client, streaming limits, and transport errors.cacheowns memory/disk entries, expiry, atomic writes, and cache removal.ctsrequests and parses CTS XML and constructs navigation fallback XML.scaifebuilds URLs, caches the catalogue, and filters search results.greekhandles Beta Code and Unicode search normalization.discoveryparses and merges author/work inventories._commonnormalizes XML text, languages, and pagination arguments.upstreamvalidates payloads and defines safe errors and retry hints.validationbounds input strings and checks CTS syntax before cache/network use.toolscontains the async MCP entry points grouped by responsibility.
Implementation modules import their dependencies directly; none imports
server. Importing server loads the tool modules, which register with the
shared application once under normal Python import semantics. Importing or
documenting the package starts no transport and fetches no upstream data.
Compatibility details
The facade forwards moved attributes to their owning module, including writes
used by existing notebook/test monkeypatches. HTTP client and cache state have
one owner, so server._HTTP_CLIENT reflects client creation and cleanup even
when the operation was performed through perseus_mcp.http.
Internal dependencies are accessed through their owning modules. The explicit __all__ lists
identify historical names re-exported by the facade. Private helpers remain
available for compatibility but are implementation details. Function
__module__ values now identify their implementation modules; source inspection reflects those implementation paths.
Cache fetchers must return already validated text (production fetchers use
http._get). cache._cached_text runs disk_validator only for untrusted
disk loads; validated memory entries and fresh fetches avoid repeated parsing.