Skip to main content

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 catalog
  • search_by_title - Search by title
  • search_by_author - Search by author
  • search_by_subject - Search by subject/keywords
  • advanced_search - Multi-field search with filters
  • search_by_collection - Search within specific collections
  • search_by_date_range - Search by publication date range
  • search_by_geographic_origin - Search by publication location

Utility Tools

  • get_record_details - Fetch complete record by ID
  • get_collections_list - List available collections
  • parse_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

  1. PyPI Trusted Publishing must be configured (see scripts/setup-pypi-trusted-publishing.md)
  2. You must be a project owner on PyPI
  3. Repository permissions must allow workflow dispatch

Release Steps

  1. Update Version Numbers

    # Update version in both files consistently
    # pyproject.toml
    # src/harvard_library_mcp/__init__.py
    
  2. Update Changelog

    # Add release notes to CHANGELOG.md
    # Include new features, bug fixes, and breaking changes
    
  3. 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
    
  4. Commit Changes

    git add .
    git commit -m "Release v0.1.0"
    git push
    
  5. Trigger Release Workflow

    • Go to Actions → Release to PyPI
    • Click "Run workflow"
    • Set version (e.g., 0.1.0)
    • Set dry_run to false for production release
    • Enable GitHub Release creation
  6. 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:

  1. Yank PyPI Version (if dangerous):

    • Go to PyPI project page
    • Find the problematic version
    • Click "Yank" (keeps downloads but marks as deprecated)
  2. Fix Issues:

    • Fix bugs in a new commit
    • Increment version appropriately
    • Release new version
  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

harvard_library_mcp-0.1.0.tar.gz (40.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

harvard_library_mcp-0.1.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

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

Hashes for harvard_library_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 017263787650aec332000af7f5052c49c27d1c4f4dc49cd4f2c1a07d9b65123f
MD5 801241bd795f3fe728dae03acef5e8ab
BLAKE2b-256 6d7da977dbf48d0cc42d59ed8c78b3d66bbb8819721ec1fbd6a5f73b5d6320ed

See more details on using hashes here.

File details

Details for the file harvard_library_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for harvard_library_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9e5e28eae8827722835e1bfe3d292cdfcf93539df0d033aeb7d8706078c2574
MD5 9b6158919012b2f9e00b0806b76320a9
BLAKE2b-256 19bd168879ea86be4e3218044979da6fdbc70784746d284ba3596d8ef180b363

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page