feat: Add Scopus search with ScienceDirect full-text support (optional) - #89
Draft
mildwall wants to merge 3 commits into
Draft
feat: Add Scopus search with ScienceDirect full-text support (optional)#89mildwall wants to merge 3 commits into
mildwall wants to merge 3 commits into
Conversation
Adds an optional Scopus (Elsevier) connector, activated by setting PAPER_SEARCH_MCP_SCOPUS_API_KEY (or legacy SCOPUS_API_KEY), following the same opt-in pattern as the IEEE/ACM connectors: without a key no tools are registered and the rest of the server is unaffected. Capabilities: - search_scopus: Scopus Search API with advanced query syntax (TITLE/ABS/KEY/AUTH/AFFILORG fields, boolean and proximity operators, wildcards), sort (relevance/coverDate/citedby-count/creator) and publication-date filters. Uses the COMPLETE view (max 25 results per request, enforced client-side). - read_scopus_paper: resolves the paper via the Scopus Abstract Retrieval API, then fetches full text through the ScienceDirect Search v2 + Article Retrieval APIs for entitled articles. - download_scopus: returns an explanatory message (the Scopus API does not provide direct PDF downloads). - Participates in the search_papers aggregate and the CLI when enabled. Robustness and API etiquette: - Honest client User-Agent (no browser spoofing). - Request timeouts on every call; exponential backoff on 429 honoring Retry-After; weekly-quota-exhausted 429s (X-RateLimit-Remaining: 0) fail fast instead of retrying. - Clear authorization message on 401/403: Elsevier grants subscriber views by network/IP, so the error suggests the institutional network/VPN instead of surfacing a bare HTTP error. - Paper IDs validated as numeric before URL interpolation; PII values URL-quoted; empty-result sentinel entries filtered out. Includes 19 fully mocked unit tests (no network, no real keys) and README/.env.example/smithery.yaml documentation. Live-verified against the Scopus API: search, date filters, citation sort, abstract retrieval, and quota handling, with identical behavior to the pre-port implementation. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The Scopus API only accepts closed date ranges (2002-2007) or single years; open-ended forms like 2024- or -2020 silently return an empty result set. Convert them to closed ranges before sending. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
API failures (rate limiting, authorization errors, malformed responses without a search-results envelope) were logged and swallowed, returning an empty list indistinguishable from a genuine zero-match search. Raise RuntimeError instead so MCP callers see the actual failure. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
HagiaHaya
added a commit
to HagiaHaya/paper-search-mcp
that referenced
this pull request
Jul 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional Scopus (Elsevier) connector with ScienceDirect full-text support. It follows the same opt-in pattern as the existing IEEE/ACM connectors: with no API key configured, no tools are registered and the rest of the server is completely unaffected.
Activated by setting
PAPER_SEARCH_MCP_SCOPUS_API_KEY(legacySCOPUS_API_KEYalso accepted).Motivation
Scopus is one of the largest curated abstract & citation databases. Adding it lets users run advanced field/boolean/proximity queries, filter and sort by citation count or date, and pull full text for entitled ScienceDirect articles — all through the existing
search_papersaggregate and CLI.New MCP tools (registered only when a key is present)
search_scopusTITLE/ABS/KEY/AUTH/AFFILORG, boolean + proximity operators, wildcards),sort(relevance / coverDate / citedby-count / creator) and publication-datefilters. Uses the COMPLETE view (Elsevier caps this at 25 results/request; enforced client-side).read_scopus_paperdownload_scopusAll three participate in the
search_papersaggregate and the CLI when enabled.Design & safety
429honoringRetry-After. Weekly-quota-exhausted429s (X-RateLimit-Remaining: 0) fail fast instead of retrying.401/403: Elsevier grants subscriber views by network/IP, so the error suggests the institutional network/VPN rather than surfacing a bare HTTP error.[]rather than a garbage record.2024-,-2020) are normalized to closed ranges, which the Scopus API requires (open forms silently return nothing).Configuration
# .env PAPER_SEARCH_MCP_SCOPUS_API_KEY=your_elsevier_api_keyDocumented in
README.md,.env.example, andsmithery.yaml.Testing
19 unit tests, fully mocked — no network, no real keys — so they run anywhere (including CI) without an Elsevier subscription.
Live-verified against the real Scopus API (2026-06-12, COMPLETE view entitled, quota healthy):
source == scopuscitedby-countmax_results > 25capped at 25 with no HTTP 400[]paper_id(../../article/pii/EVIL?x=1) rejected before any request firesFull-text retrieval (
read_scopus_paper) is covered by the mocked unit tests; live availability depends on the caller's per-article ScienceDirect entitlement.Reviewer notes
Commits
feat: Add Scopus search with ScienceDirect full-text support (opt-in)fix: normalize open-ended date ranges in Scopus search