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
mailtoparameter for higher Crossref rate limits
Installation
From PyPI (recommended)
# Using uv (recommended)
uv pip install crossref-cite-mcp
# Or using pip
pip install crossref-cite-mcp
From Source (for development)
# Clone the repository
git clone https://github.com/h-lu/crossref-cite-mcp.git
cd crossref-cite-mcp
# Install with uv
uv pip install -e .
# Or use pip
pip install -e .
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
Configure Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
Using uvx (recommended, no pre-installation required)
{
"mcpServers": {
"crossref-cite": {
"command": "uvx",
"args": ["crossref-cite-mcp"],
"env": {
"CROSSREF_MAILTO": "your-email@example.com"
}
}
}
}
Using pip installed package
{
"mcpServers": {
"crossref-cite": {
"command": "crossref-cite-mcp",
"args": [],
"env": {
"CROSSREF_MAILTO": "your-email@example.com"
}
}
}
}
For Development (from source with 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"
}
}
}
}
Usage
Available Tools
resolve_citation
Resolve a paper and return citations in multiple formats.
Arguments:
query(required): Paper title, DOI, arXiv ID, or PMIDformats: 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 queryrows: 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
mailtoparameter for polite pool access - ✅ Implements exponential backoff for rate limits
- ✅ Caches results to reduce redundant requests
- ✅ Uses
query.bibliographicfor 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
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 crossref_cite_mcp-0.1.2.tar.gz.
File metadata
- Download URL: crossref_cite_mcp-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20a4c95e2bd5c446bde1fa780c95fd059ab14aa9658f684d359d44670ac305a9
|
|
| MD5 |
17c4490514c9256e28c76b2688f72ea4
|
|
| BLAKE2b-256 |
fafda7756785dcea2973e2aecc11a36cca77ce6e9699c46cec8fb8f20d1eb525
|
Provenance
The following attestation bundles were made for crossref_cite_mcp-0.1.2.tar.gz:
Publisher:
publish.yml on h-lu/crossref-cite-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crossref_cite_mcp-0.1.2.tar.gz -
Subject digest:
20a4c95e2bd5c446bde1fa780c95fd059ab14aa9658f684d359d44670ac305a9 - Sigstore transparency entry: 773812039
- Sigstore integration time:
-
Permalink:
h-lu/crossref-cite-mcp@dad25021777c2fad372f00d7888f6161d43e7cf4 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/h-lu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dad25021777c2fad372f00d7888f6161d43e7cf4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file crossref_cite_mcp-0.1.2-py3-none-any.whl.
File metadata
- Download URL: crossref_cite_mcp-0.1.2-py3-none-any.whl
- Upload date:
- Size: 15.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7a97263fdbb43cda8fb7e9cd14b334462482b11cfd4dd0fe08541917cb05feb
|
|
| MD5 |
63aa5f9be01ae476ab51771d3a42a667
|
|
| BLAKE2b-256 |
7108c981eee5b35dc70db46aad12835a8b4e55e2dd2333f445b8f3c1d4693af6
|
Provenance
The following attestation bundles were made for crossref_cite_mcp-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on h-lu/crossref-cite-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
crossref_cite_mcp-0.1.2-py3-none-any.whl -
Subject digest:
f7a97263fdbb43cda8fb7e9cd14b334462482b11cfd4dd0fe08541917cb05feb - Sigstore transparency entry: 773812042
- Sigstore integration time:
-
Permalink:
h-lu/crossref-cite-mcp@dad25021777c2fad372f00d7888f6161d43e7cf4 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/h-lu
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@dad25021777c2fad372f00d7888f6161d43e7cf4 -
Trigger Event:
push
-
Statement type: