Metadata-Version: 2.4
Name: inspire-mcp
Version: 0.5.3
Summary: Ask AI assistants about high energy physics literature in plain language: an MCP server for INSPIRE-HEP with measured semantic search
Keywords: mcp,model-context-protocol,inspire-hep,high-energy-physics,semantic-search,rag,llm
Author: Jacopo Torasso
License-Expression: MIT
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Dist: httpx>=0.27
Requires-Dist: mcp>=2.3,<3
Requires-Dist: starlette>=0.46
Requires-Dist: fastembed>=0.9.1 ; extra == 'eval'
Requires-Dist: numpy>=1.26 ; extra == 'eval'
Requires-Dist: anthropic>=1.0 ; extra == 'eval'
Requires-Dist: fastembed>=0.9.1 ; extra == 'semantic'
Requires-Dist: numpy>=1.26 ; extra == 'semantic'
Requires-Python: >=3.10
Project-URL: Repository, https://github.com/JacopoTorasso/inspire-mcp
Project-URL: Issues, https://github.com/JacopoTorasso/inspire-mcp/issues
Project-URL: Changelog, https://github.com/JacopoTorasso/inspire-mcp/blob/main/CHANGELOG.md
Provides-Extra: eval
Provides-Extra: semantic
Description-Content-Type: text/markdown

# inspire-mcp

[![ci](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/ci.yml)
[![eval](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/eval.yml/badge.svg)](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/eval.yml)
[![PyPI](https://img.shields.io/pypi/v/inspire-mcp)](https://pypi.org/project/inspire-mcp/)
[![python](https://img.shields.io/pypi/pyversions/inspire-mcp)](https://pypi.org/project/inspire-mcp/)
[![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

**Ask your AI assistant about high energy physics literature, in plain language.**

inspire-mcp connects assistants such as Claude to [INSPIRE-HEP](https://inspirehep.net), the database
of high energy physics papers, authors, conferences and jobs. Describe the paper you are looking for
in your own words. On 40 random papers set aside before any measurement, Claude with the server puts
the right one first 85% of the time, against 62% when it searches INSPIRE by itself, and needs under a
third of the searches. Without an assistant the server gets 60%, against 40% for INSPIRE's own ranking
of the question's keywords ([how this is measured](docs/evaluation.md)).

## What you can ask

* *"Find the paper that introduced GANs for calorimeter shower simulation, and who cites it lately"*
* *"What are Michela Paganini's most cited papers outside large collaborations? What is her h-index?"*
* *"Which neutrino conferences are coming up, and where?"*
* *"Are there open postdoc positions in lattice QCD in Europe?"*
* *"Show me the figures of arXiv:1705.02355 and give me its BibTeX"*
* *"Papers similar to the Randall–Sundrum paper"*
* *"Recent LHCb papers on pentaquarks"*

Every answer comes with INSPIRE links, so you can check the sources.

## Try it in one minute

You need [uv](https://docs.astral.sh/uv/), a small Python tool runner:

```bash
# macOS and Linux
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
```

Then search straight from the terminal, no AI client needed:

```console
$ uvx --from "inspire-mcp[semantic]" inspire-mcp search "neural networks to speed up calorimeter shower simulation"

 1. Quantum Invertible Neural Networks for Fast Calorimetry as Quantum Generative Model with high
    interpretability at Future Colliders
     Corchia, Federico 2026  ·  0 citations  ·  https://inspirehep.net/literature/3221332
 2. CaloShowerGAN, a generative adversarial network model for fast calorimeter shower simulation
     Faucci Giannelli, Michele 2024  ·  33 citations  ·  https://inspirehep.net/literature/2697185
 3. On the use of neural networks for energy reconstruction in high-granularity calorimeters
     Akchurin, N. 2021  ·  38 citations  ·  https://inspirehep.net/literature/1889423
 ...
ranked by cross-encoder:ms-marco-MiniLM-L-6-v2 from 50 INSPIRE candidates in 2.7s
```

The first run downloads the package and a small ranking model (about 100 MB); later runs start in
seconds. Other commands: `inspire-mcp paper 1705.02355` shows one paper, `inspire-mcp doctor` checks
your setup.

## Use it with your AI assistant

**Claude Code**, one command:

```bash
claude mcp add inspire -- uvx --from "inspire-mcp[semantic]" inspire-mcp
```

**Claude Desktop**: open *Settings → Developer → Edit Config* (the file is
`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS and
`%APPDATA%\Claude\claude_desktop_config.json` on Windows), add the server and restart Claude:

```json
{
  "mcpServers": {
    "inspire": {
      "command": "uvx",
      "args": ["--from", "inspire-mcp[semantic]", "inspire-mcp"]
    }
  }
}
```

**Cursor, VS Code, and other MCP clients** use the same `command` and `args`. Run
`inspire-mcp config` to print the snippets.

## Tools

The assistant picks the right tool by itself; this is what it has available.

| | Tool | What it does |
|---|---|---|
| **Papers** | `semantic_search` | finds papers from a description in plain language |
| | `search_literature` | precise search in INSPIRE syntax (`t higgs and cn atlas and date > 2020`) |
| | `get_paper` | full record: abstract, authors, journal, keywords, arXiv PDF, open-access full text |
| | `find_similar_papers` | papers on the same subject as a given one |
| | `get_citing_papers` | who cites a paper, newest or most cited first |
| | `get_references` | what a paper cites |
| | `get_paper_figures` | figures with captions and download links |
| | `export_citations` | BibTeX or LaTeX (`\bibitem`, EU or US style) entries |
| | `search_collaboration` | papers of ATLAS, CMS, LHCb, ALICE, Belle II... |
| **People** | `search_authors` | find an author profile |
| | `get_author_profile` | papers, citations, h-index, citation distribution |
| | `get_author_papers` | an author's papers, optionally only those written in small teams |
| **Community** | `search_conferences` | upcoming (or past) conferences and workshops |
| | `search_seminars` | upcoming seminars and online talks, with link to join |
| | `search_jobs` | open positions: postdocs, faculty, PhD, staff |
| | `search_institutions` | research institutions, location and output |
| | `search_experiments` | experiments: accelerator, dates, number of papers |
| | `ping` | checks the server is up |

Lists are paginated and can return compact results to save the assistant's context. Also included:
a resource, `inspire://literature/{recid}`, and a prompt, `literature_review`, that writes a short cited
overview of a topic.

## How good is the search?

Measured on papers with 20 to 200 citations picked at random from INSPIRE, each described by a
question that does not repeat its title. Two sets of 40: the **development** set guided every design
choice; the **held-out** set was frozen beforehand and used only to confirm, so it is the honest estimate.

| Approach | Right paper first, development | Right paper first, held out |
|---|---|---|
| Question typed into INSPIRE's search | 7% | 12% |
| Keywords of the question, INSPIRE's ranking | 38% | 40% |
| **inspire-mcp semantic search**, one call | **70%** | **60%** |
| Claude Sonnet 5.5 searching INSPIRE by itself | 60% | 62% |
| **Claude Sonnet 5.5 with inspire-mcp** | **85%** | **85%** |
| Claude Haiku 5.5 searching INSPIRE by itself | 55% | 53% |
| **Claude Haiku 5.5 with inspire-mcp** | **80%** | **82%** |

With the server, an assistant finds the paper far more often and with fewer searches: Claude Sonnet 5.5
needs 1.3 to 1.5 searches per question instead of 5 to 6, and the small Claude Haiku 5.5 with the
server does better than Claude Sonnet 5.5 without it. On the held-out set the server alone (60%) is
level with Claude Sonnet 5.5 searching by itself (62%): the large gain comes from using them together.

The questions were written from the papers' abstracts, which is also the text the server's reranker
reads, so these figures are likely an upper bound for questions written from memory
([limits](docs/evaluation.md#limits)).

A second benchmark of 60 famous papers, the significance tests and the design choices that were
tried and rejected are in [docs/evaluation.md](docs/evaluation.md).

## How it works

```mermaid
flowchart LR
    Q[your question] --> K["keywords joined with OR<br/>(INSPIRE needs all words to match otherwise)"]
    K --> P[(50 candidate papers<br/>from live INSPIRE)]
    P --> R["cross-encoder reads the question<br/>with each title and abstract"]
    R --> A[best matches, with links<br/>and how they were found]
```

Nothing is copied or indexed: every search runs against the live INSPIRE database, and only the
ranking happens locally, on CPU. For questions about foundational work the assistant can ask for
highly cited candidates (`prefer_influential`), which helps find famous papers buried under their
follow-ups.

<details>
<summary><b>Run it as a service</b> (Docker, Kubernetes, configuration)</summary>

```bash
docker build --build-arg EXTRAS=semantic -t inspire-mcp:semantic .   # models included, no download at runtime
docker run -p 8000:8000 -e INSPIRE_MCP_ALLOWED_HOSTS=mcp.example.org inspire-mcp:semantic
kubectl apply -f deploy/k8s/deployment.yaml                           # non-root, read-only filesystem, probes
```

Release tags publish `ghcr.io/jacopotorasso/inspire-mcp:<version>` (no models, 364 MB) and
`:<version>-semantic` (about 1 GB).

| Endpoint | Purpose |
|---|---|
| `/mcp` | MCP over Streamable HTTP, rate limited per client |
| `/healthz` | liveness |
| `/readyz` | readiness: 503 until the ranking model is loaded |
| `/metrics` | Prometheus: calls by tool and outcome, latency histogram, readiness |

Every option is a flag or an environment variable:

| Variable | Default | |
|---|---|---|
| `INSPIRE_MCP_TRANSPORT` | `stdio` | `streamable-http` to serve over HTTP |
| `INSPIRE_MCP_HOST`, `INSPIRE_MCP_PORT` | `127.0.0.1`, `8000` | also honours `PORT` |
| `INSPIRE_MCP_ALLOWED_HOSTS` | | public host names (DNS rebinding protection when binding to `0.0.0.0`) |
| `INSPIRE_MCP_RATE_LIMIT` | `120` | MCP requests per minute per client, `0` disables |
| `INSPIRE_MCP_TRUST_PROXY` | `false` | identify clients by `X-Forwarded-For` behind a trusted proxy |
| `INSPIRE_MCP_RERANKER` | `auto` | `cross-encoder`, `dense` or `bm25` |
| `INSPIRE_MCP_CACHE_TTL` | `300` | seconds INSPIRE answers stay cached in memory |
| `INSPIRE_MCP_MIN_INTERVAL` | `0.35` | seconds between requests to INSPIRE |
| `INSPIRE_MCP_CACHE` | `~/.cache/inspire-mcp` | embedding cache |
| `INSPIRE_MCP_LOG_FORMAT`, `INSPIRE_MCP_LOG_LEVEL` | `text`, `INFO` | `json` for log aggregation |

The HTTP endpoint has no authentication; see [SECURITY.md](SECURITY.md).

</details>

<details>
<summary><b>Troubleshooting</b></summary>

* **`uvx: command not found`**: install uv (above) and open a new terminal.
* **The first search is slow**: the ranking model is downloaded once (about 100 MB).
* **The assistant does not see the tools**: restart the client after editing its configuration, then
  run `inspire-mcp doctor` in a terminal.
* **Behind a corporate proxy**: set `HTTPS_PROXY`; the server needs to reach `https://inspirehep.net`.
* **Lighter install**: `uvx inspire-mcp` (without `[semantic]`) skips the models and ranks with BM25,
  which is noticeably less accurate.

</details>

## Development

```bash
uv sync --extra semantic
uv run pytest                                  # 68 tests, offline, about 90% coverage
uv run ruff check . && uv run mypy
uv run --extra eval python eval/run_eval.py    # benchmark against live INSPIRE
```

CI runs lint, types, tests, both container images with a health probe and Kubernetes manifest
validation; the benchmark runs weekly to catch regressions. See [CONTRIBUTING.md](CONTRIBUTING.md)
and [CHANGELOG.md](CHANGELOG.md).

## License

MIT. Data comes from [INSPIRE-HEP](https://inspirehep.net) under its terms of use. This is an
independent project, not affiliated with CERN or INSPIRE.
