Repository navigation
Use the public-metadata API for papers outside the catalog - #28
Merged
Merged
Conversation
pwc-mcp's paper tools and pwc paper info/read now ask the Papers With Code
API's GET /papers/{identifier}/public-metadata endpoint (huggingface/
paperswithcode f80bc013) about a reference the catalog does not hold, so the
lookup has one implementation and both surfaces say where the paper lives.
MCP (0.2.7):
- get_paper_info, read_paper, and get_related_papers keep their
in_catalog=false outputs (data=None, abstract-as-Markdown read, related
search note) and add available_at: the endpoint's labelled links. The
note now says the paper is not indexed on Papers With Code, has no PwC
page, and lists the links to cite instead.
- A reference the endpoint maps to a catalog paper (an arXiv URL the
catalog lookup missed, say) is retried by arXiv ID, then catalog ID; one
that still misses keeps the original error instead of being shown as
outside the catalog.
- Identifiers go in the path with slashes kept (DOIs, URLs); 400 (titles)
and 404 are cached for an hour as misses, 429/503 are not cached.
- external.py (client-side HF Papers/arXiv/Crossref lookups) and its tests
are removed. The endpoint does not take titles, so a title the catalog
does not hold now keeps its plain not-found error.
CLI (0.4.6):
- On a 404 or "Paper title not found" from pwc paper info/read, stderr
shows "Not indexed on Papers With Code — available at:" with the links,
title, date, authors, source, and abstract before the unchanged error.
Stdout and exit statuses (3 for 404, 4 for titles) are unchanged for
scripts. An arXiv/HF URL the API maps to a catalog paper is read from
the catalog. Embedders calling the handlers (the MCP) are unaffected.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Collaborator
Author
|
Live check against production (2026-10-14). huggingface/paperswithcode#508 is deployed (b39aebba). Endpoint:
MCP (this branch, in-process, against production) for 2610.18869:
The output is identical to the "after" column in the description. CLI (this branch):
Still needed before merge: explicit approval to merge and release pwc-mcp 0.2.7 / pwc-cli 0.4.6. |
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.
Why
PR #27 added client-side HF Papers / arXiv / Crossref lookups (
external.py) for papers the catalog does not hold. The backend now serves the same data from one endpoint, which also returns labelledavailable_atlinks. This PR makes the MCP and the CLI use that endpoint. There is now one implementation, and both the agent and CLI users are told clearly that the paper is not indexed and where to read it.MCP (pwc-mcp 0.2.7)
get_paper_info,read_paper,get_related_papers: samein_catalog=falseoutputs as before (data=None, the abstract as Markdown for reads, a search fallback plus note for related papers). New: anavailable_atlist (label,url,kind). The note now tells the agent to link to those sources, not a PwC page.in_catalog=true), the tool retries with itsarxiv_id, thencatalog_id. If that still fails, the tool returns the original error rather than calling a catalogued paper "not indexed".{identifier:path}). 400 (titles) and 404 are cached for 1 h as misses. 429/503 are not cached and fall back to the original error.external.pyandtest_external.pyare removed.CLI (pwc-cli 0.4.6)
pwc paper info/pwc paper readon a 404 (or "Paper title not found") now print this to stderr, before the unchanged error:Stdout stays empty and the exit codes are unchanged (3 for a 404, 4 for an unknown title), so scripts behave exactly as before. An arXiv or HF URL that the API maps to a catalog paper is now read from the catalog. The fallback lives in
main(), so embedders that call the handlers (the MCP, viaqueries.query) never trigger it (covered by a test).Before / after for arXiv 2610.18869
The "after" run used the real response from #508's service code (f80bc013) against live arXiv, passed to this branch's MCP. Production catalog calls were live.
in_catalogfalsefalseavailable_at[{label: "arXiv abstract", kind: "abstract", …}, {label: "arXiv PDF", kind: "pdf", …}]read_papermarkdown**Paper:**/**PDF:**lines + abstract## Available atlink list + abstractget_related_papersavailable_at+available_atTests
uv run --project mcp_server pytest mcp_server/tests: 69 passed (endpoint client: path encoding and cached misses vs. transient errors; tool outputs withavailable_at; in-catalog retry; in-catalog-but-unreadable keeps the error)uv run --project standalone_cli --with pytest pytest standalone_cli/tests: 99 passed (stderr block for info/read × text/json, title miss exit 4, unknown everywhere unchanged, URL→catalog retry, embedded queries skip the endpoint)standalone_cli/scripts/check_contract.pyok; ruff shows no new findings vs. mainBefore merging
curl https://paperswithcode.co/api/v1/papers/2610.18869/public-metadatareturns 200 within_catalog: false🤖 Generated with Claude Code