Skip to main content

MCP tool for resolving paper citations via Crossref API with multiple format support

Project description

crossref-cite-mcp

A Model Context Protocol (MCP) server for resolving paper citations via Crossref API. Supports multiple output formats including CSL-JSON, BibTeX, RIS, and formatted text.

Features

  • 🔍 Smart Input Parsing: Automatically detects DOIs, arXiv IDs, PMIDs, or falls back to bibliographic search
  • 📚 Multiple Citation Formats: CSL-JSON, BibTeX, RIS, and formatted text (APA, Chicago, IEEE, etc.)
  • Built-in Caching: Memory or JSON file cache with configurable TTL (default: 14 days)
  • 🔄 Retry Logic: Exponential backoff for rate limits (429) and server errors (5xx)
  • 🎯 Polite Pool Support: Uses mailto parameter for higher Crossref rate limits

Installation

# Clone the repository
git clone https://github.com/h-lu/crossref-cite-mcp.git
cd crossref-cite-mcp

Using uv (Recommended)

# Install dependencies
uv sync

# Install with dev dependencies
uv sync --extra dev

Using pip

# Install from source
pip install .

# Or install in editable mode (for development)
pip install -e ".[dev]"

Configuration

Set environment variables (or create a .env file):

# Required: Your email for Crossref polite pool
export CROSSREF_MAILTO=your-email@example.com

# Optional: Cache configuration
export CROSSREF_CACHE_BACKEND=json        # "memory" or "json"
export CROSSREF_CACHE_PATH=~/.crossref-cite/cache.json
export CROSSREF_CACHE_TTL=1209600         # 14 days in seconds

# Optional: Logging
export LOG_LEVEL=INFO

Usage

As MCP Server (Claude Desktop / Cursor)

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

Using uv

{
  "mcpServers": {
    "crossref-cite": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/crossref-cite-mcp", "python", "-m", "crossref_cite"],
      "env": {
        "CROSSREF_MAILTO": "your-email@example.com"
      }
    }
  }
}

Using pip (after pip install .)

{
  "mcpServers": {
    "crossref-cite": {
      "command": "python",
      "args": ["-m", "crossref_cite"],
      "env": {
        "CROSSREF_MAILTO": "your-email@example.com"
      }
    }
  }
}

Available Tools

resolve_citation

Resolve a paper and return citations in multiple formats.

Arguments:

  • query (required): Paper title, DOI, arXiv ID, or PMID
  • formats: List of formats (["csl-json", "bibtex", "ris", "formatted"])
  • style: CSL style for formatted output (default: "apa")
  • locale: Locale for formatted output (default: "en-US")
  • rows: Number of Crossref candidates (default: 5)

Example:

{
  "query": "Attention Is All You Need",
  "formats": ["bibtex", "formatted"],
  "style": "apa"
}

search_papers

Search Crossref for papers (metadata only, no citation fetching).

Arguments:

  • query (required): Search query
  • rows: Number of results (default: 10, max: 20)
  • filter_from_year: Publication year filter (start)
  • filter_to_year: Publication year filter (end)
  • filter_type: Work type filter (e.g., "journal-article")

Direct CLI Testing

# Test with JSON-RPC request
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"resolve_citation","arguments":{"query":"10.1038/nature12373","formats":["bibtex"]}}}' | python -m crossref_cite

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/ -v

# Run with coverage
pytest tests/ -v --cov=crossref_cite

# Lint
ruff check src tests

# Type check
mypy src/crossref_cite

Recording VCR Cassettes

To record new HTTP interaction cassettes for tests:

# Delete existing cassettes and re-record
rm -rf tests/cassettes/
pytest tests/ -v --vcr-record=new_episodes

Docker

# Build image
docker build -t crossref-cite-mcp .

# Run
docker run -e CROSSREF_MAILTO=your-email@example.com crossref-cite-mcp

API Reference

Crossref Best Practices

This implementation follows Crossref REST API best practices:

  • ✅ Uses mailto parameter for polite pool access
  • ✅ Implements exponential backoff for rate limits
  • ✅ Caches results to reduce redundant requests
  • ✅ Uses query.bibliographic for citation-like searches

Content Negotiation

Citation formats are fetched via DOI content negotiation:

Format Accept Header
CSL-JSON application/vnd.citationstyles.csl+json
BibTeX application/x-bibtex
RIS application/x-research-info-systems
Formatted text/x-bibliography; style=apa; locale=en-US

License

MIT

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

crossref_cite_mcp-0.1.0.tar.gz (142.2 kB view details)

Uploaded Source

Built Distribution

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

crossref_cite_mcp-0.1.0-py3-none-any.whl (15.6 kB view details)

Uploaded Python 3

File details

Details for the file crossref_cite_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: crossref_cite_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 142.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for crossref_cite_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 68adeae9828d49e0a45335f11eb95cdda421d1c46f2872e6c7787f0fa6c24610
MD5 65d416e4d690cb7571c461621770e983
BLAKE2b-256 1338bfe88d57a5145048e905687efb6e5824e12a8c8a4d656926ccd622a644cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for crossref_cite_mcp-0.1.0.tar.gz:

Publisher: publish.yml on h-lu/crossref-cite-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for crossref_cite_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19b74ba67f65b88204dbb755de1fbbf43583740f882b93404cbf90a9d331711c
MD5 c9a271df1307155aed41c6e8e072f3df
BLAKE2b-256 e63fb7fee021b38896c72397032fd5ae456e2c1958db3bc39c11255b5bf96c5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for crossref_cite_mcp-0.1.0-py3-none-any.whl:

Publisher: publish.yml on h-lu/crossref-cite-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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