MCP server for Harvard University Library catalog API
Project description
Harvard Library MCP Server
A Model Context Protocol (MCP) server for the Harvard University Library catalog API, providing stdio interface for comprehensive bibliographic search and metadata retrieval.
Features
- Comprehensive Search: Basic keyword search, advanced fielded search, collection-specific search
- Rich Metadata: Native MODS XML format support with structured JSON conversion
- Stdio Interface: MCP stdio transport for AI assistant integration
- Python Implementation: Robust async HTTP client with proper error handling
- Rate Limited: Respectful API usage with built-in rate limiting
Quick Start
Local Development
# Clone and install
git clone <repository-url>
cd harvard-library-mcp
pip install -e .
# Run as MCP server (stdio)
python -m harvard_library_mcp.server
MCP Tools
The MCP server provides the following tools:
Search Tools
search_catalog- Free-text search across catalogsearch_by_title- Search by titlesearch_by_author- Search by authorsearch_by_subject- Search by subject/keywordsadvanced_search- Multi-field search with filterssearch_by_collection- Search within specific collectionssearch_by_date_range- Search by publication date rangesearch_by_geographic_origin- Search by publication location
Utility Tools
get_record_details- Fetch complete record by IDget_collections_list- List available collectionsparse_mods_metadata- Extract structured data from MODS
Configuration
Environment variables:
HARVARD_API_BASE_URL: Base URL for Harvard Library API (default: https://api.lib.harvard.edu/v2)RATE_LIMIT_REQUESTS_PER_SECOND: API rate limit (default: 10)LOG_LEVEL: Logging level (default: INFO)
Development
Running Tests
pytest tests/
Code Formatting
black src/
isort src/
Release Process
This project uses automated releases with GitHub Actions and PyPI Trusted Publishing.
For Users
Install the latest version:
pip install harvard-library-mcp
Install a specific version:
pip install harvard-library-mcp==0.1.0
For Maintainers
Prerequisites
- PyPI Trusted Publishing must be configured (see
scripts/setup-pypi-trusted-publishing.md) - You must be a project owner on PyPI
- Repository permissions must allow workflow dispatch
Release Steps
-
Update Version Numbers
# Update version in both files consistently # pyproject.toml # src/harvard_library_mcp/__init__.py
-
Update Changelog
# Add release notes to CHANGELOG.md # Include new features, bug fixes, and breaking changes
-
Test Locally
# Run full test suite make test # Build package to verify python -m build # Test installation pip install dist/*.whl harvard-library-mcp --help
-
Commit Changes
git add . git commit -m "Release v0.1.0" git push
-
Trigger Release Workflow
- Go to Actions → Release to PyPI
- Click "Run workflow"
- Set version (e.g.,
0.1.0) - Set dry_run to
falsefor production release - Enable GitHub Release creation
-
Monitor Release
- Watch workflow progress for any issues
- Verify PyPI publishing completes
- Check GitHub Release creation
- Test installation from PyPI
Dry Run Testing
To test the release process without publishing:
# Trigger workflow with:
version: "0.1.0-test"
dry_run: true
create_github_release: false
Quality Gates
The automated release process ensures:
- ✅ All tests pass on Python 3.11, 3.12, 3.13
- ✅ Code quality checks (ruff, black, isort)
- ✅ Type checking (mypy)
- ✅ Security scanning (bandit, pip-audit)
- ✅ Package validation (twine check)
- ✅ Version consistency across files
- ✅ Semantic versioning compliance
Rollback Process
If a release has issues:
-
Yank PyPI Version (if dangerous):
- Go to PyPI project page
- Find the problematic version
- Click "Yank" (keeps downloads but marks as deprecated)
-
Fix Issues:
- Fix bugs in a new commit
- Increment version appropriately
- Release new version
-
Communicate:
- Update GitHub Release with notes
- Add entry to CHANGELOG.md
- Notify users if breaking changes
Release History
See CHANGELOG.md for detailed release notes.
License
MIT License - see LICENSE file for details.
Harvard Library API Documentation
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file harvard_library_mcp-0.1.0.tar.gz.
File metadata
- Download URL: harvard_library_mcp-0.1.0.tar.gz
- Upload date:
- Size: 40.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
017263787650aec332000af7f5052c49c27d1c4f4dc49cd4f2c1a07d9b65123f
|
|
| MD5 |
801241bd795f3fe728dae03acef5e8ab
|
|
| BLAKE2b-256 |
6d7da977dbf48d0cc42d59ed8c78b3d66bbb8819721ec1fbd6a5f73b5d6320ed
|
File details
Details for the file harvard_library_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: harvard_library_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9e5e28eae8827722835e1bfe3d292cdfcf93539df0d033aeb7d8706078c2574
|
|
| MD5 |
9b6158919012b2f9e00b0806b76320a9
|
|
| BLAKE2b-256 |
19bd168879ea86be4e3218044979da6fdbc70784746d284ba3596d8ef180b363
|