Architecture
- Split
server.py(4,800 lines) intotools/subpackage — search, retrieval, annotations, write, connectors, and shared helpers are now separate modules.server.pyis a 109-line re-export shim. - Removed
_ServerModulesys.modules hack — tool modules use module-level attribute access; tests patch canonical locations directly. - Optional dependency groups —
[semantic](ChromaDB, embeddings),[pdf](PyMuPDF, EPUB),[all]. Base install is lightweight with no ML dependencies.
Refactored
- Deduplicated 7 item-formatting functions into single
format_item_result()with configurable abstract length, tags, and extra fields. - Extracted
_normalize_limit()helper replacing 12 copy-pasted blocks. - Consolidated
suppress_stdout(),_strip_xml_tags(), and creator formatting duplicates. - Modernized typing in 5 modules:
Optional[X]→X | None,Dict→dict,List→list. - Removed dead code across 7 modules.
Fixed
- Stale embedding model detection — ChromaDB collections created with a deprecated model (e.g.,
text-embedding-004) are now auto-detected and recreated. - Bare
except:clauses — replaced with specific exception types. - PDF outline import order — defers PyMuPDF import until after attachment check.
- Suppressed noisy pdfminer warnings during PDF text extraction.
Docs
- README documents optional extras (
[semantic],[pdf],[all]), write operations, and embedding model troubleshooting.
Full Changelog: https://github.com/54yyyu/zotero-mcp/blob/main/CHANGELOG.md