Skip to content

Add OpenAlex API key configuration - #92

Open
pikaqiu2333 wants to merge 1 commit into
openags:mainfrom
pikaqiu2333:codex/openalex-api-key
Open

Add OpenAlex API key configuration#92
pikaqiu2333 wants to merge 1 commit into
openags:mainfrom
pikaqiu2333:codex/openalex-api-key

Conversation

@pikaqiu2333

Copy link
Copy Markdown

Summary

  • Add PAPER_SEARCH_MCP_OPENALEX_API_KEY / OPENALEX_API_KEY support to OpenAlexSearcher and pass it as the OpenAlex api_key query parameter.
  • Add PAPER_SEARCH_MCP_OPENALEX_EMAIL / OPENALEX_EMAIL support for the OpenAlex User-Agent contact string while preserving the existing default.
  • Document the OpenAlex env vars in the README and .env.example.
  • Add mocked OpenAlex unit coverage so this does not depend on live API calls.

Context

OpenAlex now documents API keys as the replacement for the old polite-pool approach and notes that free keys improve daily request limits. This complements #81 without changing arXiv pacing or venue handling.

Docs: https://docs.openalex.org/how-to-use-the-api/api-keys

Validation

  • python -m pytest tests\\test_openalex.py
  • python -m py_compile paper_search_mcp\\academic_platforms\\openalex.py tests\\test_openalex.py

@pikaqiu2333
pikaqiu2333 marked this pull request as ready for review July 5, 2026 13:16
HagiaHaya added a commit to HagiaHaya/paper-search-mcp that referenced this pull request Jul 27, 2026
George930502 added a commit to George930502/paper-search-mcp that referenced this pull request Aug 3, 2026
New MCP tools, all key-less via OpenAlex:
  get_citing_papers      forward snowballing (papers citing a paper)
  get_referenced_papers  backward snowballing (papers a paper cites)
  find_open_access_pdf   OA copy resolution without an Unpaywall email

search_papers gains enrich_citations (default on): citation counts are
backfilled from OpenAlex for sources that report none (arXiv, dblp,
PubMed), one request per 100 papers, reported as citations_enriched.

In the OpenAlex connector, the parsing inside search() is extracted into
_parse_work() so the graph lookups share it; it now tolerates JSON null
fields, falls back to best_oa_location for a PDF link, and records
references plus is_oa / pdf_is_direct. All requests go through a _get()
helper that retries 429/5xx with backoff and honours Retry-After, but
does not retry an exhausted OpenAlex request budget.

OpenAlex contact/key configuration is deliberately left alone here, so
this does not collide with openags#92.

Closes the "Citation graph & Paper relation context feature" TODO.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant