inspire-mcp 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- inspire_mcp-0.5.0/PKG-INFO +251 -0
- inspire_mcp-0.5.0/README.md +221 -0
- inspire_mcp-0.5.0/pyproject.toml +91 -0
- inspire_mcp-0.5.0/pyproject.toml.orig +77 -0
- inspire_mcp-0.5.0/src/inspire_mcp/__init__.py +8 -0
- inspire_mcp-0.5.0/src/inspire_mcp/__main__.py +5 -0
- inspire_mcp-0.5.0/src/inspire_mcp/cli.py +178 -0
- inspire_mcp-0.5.0/src/inspire_mcp/client.py +403 -0
- inspire_mcp-0.5.0/src/inspire_mcp/community.py +188 -0
- inspire_mcp-0.5.0/src/inspire_mcp/http.py +101 -0
- inspire_mcp-0.5.0/src/inspire_mcp/metrics.py +56 -0
- inspire_mcp-0.5.0/src/inspire_mcp/py.typed +0 -0
- inspire_mcp-0.5.0/src/inspire_mcp/semantic.py +350 -0
- inspire_mcp-0.5.0/src/inspire_mcp/server.py +555 -0
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: inspire-mcp
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Ask AI assistants about high energy physics literature in plain language: an MCP server for INSPIRE-HEP with measured semantic search
|
|
5
|
+
Keywords: mcp,model-context-protocol,inspire-hep,high-energy-physics,semantic-search,rag,llm
|
|
6
|
+
Author: Jacopo Torasso
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
11
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Typing :: Typed
|
|
15
|
+
Requires-Dist: httpx>=0.27
|
|
16
|
+
Requires-Dist: mcp>=2.3,<3
|
|
17
|
+
Requires-Dist: starlette>=0.46
|
|
18
|
+
Requires-Dist: fastembed>=0.9.1 ; extra == 'eval'
|
|
19
|
+
Requires-Dist: numpy>=2.5.5 ; extra == 'eval'
|
|
20
|
+
Requires-Dist: anthropic>=1.0 ; extra == 'eval'
|
|
21
|
+
Requires-Dist: fastembed>=0.9.1 ; extra == 'semantic'
|
|
22
|
+
Requires-Dist: numpy>=2.5.5 ; extra == 'semantic'
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Project-URL: Repository, https://github.com/JacopoTorasso/inspire-mcp
|
|
25
|
+
Project-URL: Issues, https://github.com/JacopoTorasso/inspire-mcp/issues
|
|
26
|
+
Project-URL: Changelog, https://github.com/JacopoTorasso/inspire-mcp/blob/main/CHANGELOG.md
|
|
27
|
+
Provides-Extra: eval
|
|
28
|
+
Provides-Extra: semantic
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# inspire-mcp
|
|
32
|
+
|
|
33
|
+
[](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/ci.yml)
|
|
34
|
+
[](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/eval.yml)
|
|
35
|
+
[](LICENSE)
|
|
36
|
+
|
|
37
|
+
**Ask your AI assistant about high energy physics literature, in plain language.**
|
|
38
|
+
|
|
39
|
+
inspire-mcp connects assistants such as Claude to [INSPIRE-HEP](https://inspirehep.net), the database
|
|
40
|
+
of high energy physics papers, authors, conferences and jobs. Describe the paper you are looking for
|
|
41
|
+
in your own words. On 40 random papers set aside before any measurement, the server puts the right one
|
|
42
|
+
first 60% of the time on its own and 85% when Claude drives it, against 12% for the same question typed
|
|
43
|
+
into INSPIRE's search box ([how this is measured](docs/evaluation.md)).
|
|
44
|
+
|
|
45
|
+
## What you can ask
|
|
46
|
+
|
|
47
|
+
* *"Find the paper that introduced GANs for calorimeter shower simulation, and who cites it lately"*
|
|
48
|
+
* *"What are Michela Paganini's most cited papers outside large collaborations? What is her h-index?"*
|
|
49
|
+
* *"Which neutrino conferences are coming up, and where?"*
|
|
50
|
+
* *"Are there open postdoc positions in lattice QCD in Europe?"*
|
|
51
|
+
* *"Show me the figures of arXiv:1705.02355 and give me its BibTeX"*
|
|
52
|
+
* *"Papers similar to the Randall–Sundrum paper"*
|
|
53
|
+
* *"Recent LHCb papers on pentaquarks"*
|
|
54
|
+
|
|
55
|
+
Every answer comes with INSPIRE links, so you can check the sources.
|
|
56
|
+
|
|
57
|
+
## Try it in one minute
|
|
58
|
+
|
|
59
|
+
You need [uv](https://docs.astral.sh/uv/), a small Python tool runner:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# macOS and Linux
|
|
63
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
64
|
+
# Windows (PowerShell)
|
|
65
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then search straight from the terminal, no AI client needed:
|
|
69
|
+
|
|
70
|
+
```console
|
|
71
|
+
$ uvx --from "inspire-mcp[semantic]" inspire-mcp search "neural networks to speed up calorimeter shower simulation"
|
|
72
|
+
|
|
73
|
+
1. Quantum Invertible Neural Networks for Fast Calorimetry as Quantum Generative Model with high
|
|
74
|
+
interpretability at Future Colliders
|
|
75
|
+
Corchia, Federico 2026 · 0 citations · https://inspirehep.net/literature/3221332
|
|
76
|
+
2. CaloShowerGAN, a generative adversarial network model for fast calorimeter shower simulation
|
|
77
|
+
Faucci Giannelli, Michele 2024 · 33 citations · https://inspirehep.net/literature/2697185
|
|
78
|
+
3. On the use of neural networks for energy reconstruction in high-granularity calorimeters
|
|
79
|
+
Akchurin, N. 2021 · 38 citations · https://inspirehep.net/literature/1889423
|
|
80
|
+
...
|
|
81
|
+
ranked by cross-encoder:ms-marco-MiniLM-L-6-v2 from 50 INSPIRE candidates in 2.7s
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The first run downloads the package and a small ranking model (about 100 MB); later runs start in
|
|
85
|
+
seconds. Other commands: `inspire-mcp paper 1705.02355` shows one paper, `inspire-mcp doctor` checks
|
|
86
|
+
your setup.
|
|
87
|
+
|
|
88
|
+
## Use it with your AI assistant
|
|
89
|
+
|
|
90
|
+
**Claude Code**, one command:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
claude mcp add inspire -- uvx --from "inspire-mcp[semantic]" inspire-mcp
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Claude Desktop**: open *Settings → Developer → Edit Config* (the file is
|
|
97
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS and
|
|
98
|
+
`%APPDATA%\Claude\claude_desktop_config.json` on Windows), add the server and restart Claude:
|
|
99
|
+
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"mcpServers": {
|
|
103
|
+
"inspire": {
|
|
104
|
+
"command": "uvx",
|
|
105
|
+
"args": ["--from", "inspire-mcp[semantic]", "inspire-mcp"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Cursor, VS Code, and other MCP clients** use the same `command` and `args`. Run
|
|
112
|
+
`inspire-mcp config` to print the snippets.
|
|
113
|
+
|
|
114
|
+
> Until the first release is on PyPI, replace `inspire-mcp[semantic]` with
|
|
115
|
+
> `inspire-mcp[semantic] @ git+https://github.com/JacopoTorasso/inspire-mcp`.
|
|
116
|
+
|
|
117
|
+
## Tools
|
|
118
|
+
|
|
119
|
+
The assistant picks the right tool by itself; this is what it has available.
|
|
120
|
+
|
|
121
|
+
| | Tool | What it does |
|
|
122
|
+
|---|---|---|
|
|
123
|
+
| **Papers** | `semantic_search` | finds papers from a description in plain language |
|
|
124
|
+
| | `search_literature` | precise search in INSPIRE syntax (`t higgs and cn atlas and date > 2020`) |
|
|
125
|
+
| | `get_paper` | full record: abstract, authors, journal, keywords, arXiv PDF, open-access full text |
|
|
126
|
+
| | `find_similar_papers` | papers on the same subject as a given one |
|
|
127
|
+
| | `get_citing_papers` | who cites a paper, newest or most cited first |
|
|
128
|
+
| | `get_references` | what a paper cites |
|
|
129
|
+
| | `get_paper_figures` | figures with captions and download links |
|
|
130
|
+
| | `export_citations` | BibTeX or LaTeX (`\bibitem`, EU or US style) entries |
|
|
131
|
+
| | `search_collaboration` | papers of ATLAS, CMS, LHCb, ALICE, Belle II... |
|
|
132
|
+
| **People** | `search_authors` | find an author profile |
|
|
133
|
+
| | `get_author_profile` | papers, citations, h-index, citation distribution |
|
|
134
|
+
| | `get_author_papers` | an author's papers, optionally only those written in small teams |
|
|
135
|
+
| **Community** | `search_conferences` | upcoming (or past) conferences and workshops |
|
|
136
|
+
| | `search_seminars` | upcoming seminars and online talks, with link to join |
|
|
137
|
+
| | `search_jobs` | open positions: postdocs, faculty, PhD, staff |
|
|
138
|
+
| | `search_institutions` | research institutions, location and output |
|
|
139
|
+
| | `search_experiments` | experiments: accelerator, dates, number of papers |
|
|
140
|
+
| | `ping` | checks the server is up |
|
|
141
|
+
|
|
142
|
+
Lists are paginated and can return compact results to save the assistant's context. Also included:
|
|
143
|
+
a resource, `inspire://literature/{recid}`, and a prompt, `literature_review`, that writes a short cited
|
|
144
|
+
overview of a topic.
|
|
145
|
+
|
|
146
|
+
## How good is the search?
|
|
147
|
+
|
|
148
|
+
Measured on papers with 20 to 200 citations picked at random from INSPIRE, each described by a
|
|
149
|
+
question that does not repeat its title. Two sets of 40: the **development** set guided every design
|
|
150
|
+
choice; the **held-out** set was frozen beforehand and used only to confirm, so it is the honest estimate.
|
|
151
|
+
|
|
152
|
+
| Approach | Right paper first, development | Right paper first, held out |
|
|
153
|
+
|---|---|---|
|
|
154
|
+
| Question typed into INSPIRE's search | 7% | 12% |
|
|
155
|
+
| Keywords of the question, INSPIRE's ranking | 38% | 40% |
|
|
156
|
+
| **inspire-mcp semantic search**, one call | **70%** | **60%** |
|
|
157
|
+
| Claude Sonnet 5.5 searching INSPIRE by itself | 60% | 62% |
|
|
158
|
+
| **Claude Sonnet 5.5 with inspire-mcp** | **85%** | **85%** |
|
|
159
|
+
| Claude Haiku 5.5 searching INSPIRE by itself | 55% | 53% |
|
|
160
|
+
| **Claude Haiku 5.5 with inspire-mcp** | **80%** | **82%** |
|
|
161
|
+
|
|
162
|
+
With the server, an assistant finds the paper far more often and with fewer searches: Claude Sonnet 5.5
|
|
163
|
+
needs 1.3 to 1.5 searches per question instead of 5 to 6, and the small Claude Haiku 5.5 with the
|
|
164
|
+
server does better than Claude Sonnet 5.5 without it.
|
|
165
|
+
|
|
166
|
+
A second benchmark of 60 famous papers, the significance tests and the design choices that were
|
|
167
|
+
tried and rejected are in [docs/evaluation.md](docs/evaluation.md).
|
|
168
|
+
|
|
169
|
+
## How it works
|
|
170
|
+
|
|
171
|
+
```mermaid
|
|
172
|
+
flowchart LR
|
|
173
|
+
Q[your question] --> K["keywords joined with OR<br/>(INSPIRE needs all words to match otherwise)"]
|
|
174
|
+
K --> P[(50 candidate papers<br/>from live INSPIRE)]
|
|
175
|
+
P --> R["cross-encoder reads the question<br/>with each title and abstract"]
|
|
176
|
+
R --> A[best matches, with links<br/>and how they were found]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Nothing is copied or indexed: every search runs against the live INSPIRE database, and only the
|
|
180
|
+
ranking happens locally, on CPU. For questions about foundational work the assistant can ask for
|
|
181
|
+
highly cited candidates (`prefer_influential`), which helps find famous papers buried under their
|
|
182
|
+
follow-ups.
|
|
183
|
+
|
|
184
|
+
<details>
|
|
185
|
+
<summary><b>Run it as a service</b> (Docker, Kubernetes, configuration)</summary>
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
docker build --build-arg EXTRAS=semantic -t inspire-mcp:semantic . # models included, no download at runtime
|
|
189
|
+
docker run -p 8000:8000 -e INSPIRE_MCP_ALLOWED_HOSTS=mcp.example.org inspire-mcp:semantic
|
|
190
|
+
kubectl apply -f deploy/k8s/deployment.yaml # non-root, read-only filesystem, probes
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Release tags publish `ghcr.io/jacopotorasso/inspire-mcp:<version>` (no models, 364 MB) and
|
|
194
|
+
`:<version>-semantic` (about 1 GB).
|
|
195
|
+
|
|
196
|
+
| Endpoint | Purpose |
|
|
197
|
+
|---|---|
|
|
198
|
+
| `/mcp` | MCP over Streamable HTTP, rate limited per client |
|
|
199
|
+
| `/healthz` | liveness |
|
|
200
|
+
| `/readyz` | readiness: 503 until the ranking model is loaded |
|
|
201
|
+
| `/metrics` | Prometheus: calls by tool and outcome, latency histogram, readiness |
|
|
202
|
+
|
|
203
|
+
Every option is a flag or an environment variable:
|
|
204
|
+
|
|
205
|
+
| Variable | Default | |
|
|
206
|
+
|---|---|---|
|
|
207
|
+
| `INSPIRE_MCP_TRANSPORT` | `stdio` | `streamable-http` to serve over HTTP |
|
|
208
|
+
| `INSPIRE_MCP_HOST`, `INSPIRE_MCP_PORT` | `127.0.0.1`, `8000` | also honours `PORT` |
|
|
209
|
+
| `INSPIRE_MCP_ALLOWED_HOSTS` | | public host names (DNS rebinding protection when binding to `0.0.0.0`) |
|
|
210
|
+
| `INSPIRE_MCP_RATE_LIMIT` | `120` | MCP requests per minute per client, `0` disables |
|
|
211
|
+
| `INSPIRE_MCP_TRUST_PROXY` | `false` | identify clients by `X-Forwarded-For` behind a trusted proxy |
|
|
212
|
+
| `INSPIRE_MCP_RERANKER` | `auto` | `cross-encoder`, `dense` or `bm25` |
|
|
213
|
+
| `INSPIRE_MCP_CACHE_TTL` | `300` | seconds INSPIRE answers stay cached in memory |
|
|
214
|
+
| `INSPIRE_MCP_MIN_INTERVAL` | `0.35` | seconds between requests to INSPIRE |
|
|
215
|
+
| `INSPIRE_MCP_CACHE` | `~/.cache/inspire-mcp` | embedding cache |
|
|
216
|
+
| `INSPIRE_MCP_LOG_FORMAT`, `INSPIRE_MCP_LOG_LEVEL` | `text`, `INFO` | `json` for log aggregation |
|
|
217
|
+
|
|
218
|
+
The HTTP endpoint has no authentication; see [SECURITY.md](SECURITY.md).
|
|
219
|
+
|
|
220
|
+
</details>
|
|
221
|
+
|
|
222
|
+
<details>
|
|
223
|
+
<summary><b>Troubleshooting</b></summary>
|
|
224
|
+
|
|
225
|
+
* **`uvx: command not found`**: install uv (above) and open a new terminal.
|
|
226
|
+
* **The first search is slow**: the ranking model is downloaded once (about 100 MB).
|
|
227
|
+
* **The assistant does not see the tools**: restart the client after editing its configuration, then
|
|
228
|
+
run `inspire-mcp doctor` in a terminal.
|
|
229
|
+
* **Behind a corporate proxy**: set `HTTPS_PROXY`; the server needs to reach `https://inspirehep.net`.
|
|
230
|
+
* **Lighter install**: `uvx inspire-mcp` (without `[semantic]`) skips the models and ranks with BM25,
|
|
231
|
+
which is noticeably less accurate.
|
|
232
|
+
|
|
233
|
+
</details>
|
|
234
|
+
|
|
235
|
+
## Development
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
uv sync --extra semantic
|
|
239
|
+
uv run pytest # 68 tests, offline, about 90% coverage
|
|
240
|
+
uv run ruff check . && uv run mypy
|
|
241
|
+
uv run --extra eval python eval/run_eval.py # benchmark against live INSPIRE
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
CI runs lint, types, tests, both container images with a health probe and Kubernetes manifest
|
|
245
|
+
validation; the benchmark runs weekly to catch regressions. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
246
|
+
and [CHANGELOG.md](CHANGELOG.md).
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
MIT. Data comes from [INSPIRE-HEP](https://inspirehep.net) under its terms of use. This is an
|
|
251
|
+
independent project, not affiliated with CERN or INSPIRE.
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# inspire-mcp
|
|
2
|
+
|
|
3
|
+
[](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/ci.yml)
|
|
4
|
+
[](https://github.com/JacopoTorasso/inspire-mcp/actions/workflows/eval.yml)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
**Ask your AI assistant about high energy physics literature, in plain language.**
|
|
8
|
+
|
|
9
|
+
inspire-mcp connects assistants such as Claude to [INSPIRE-HEP](https://inspirehep.net), the database
|
|
10
|
+
of high energy physics papers, authors, conferences and jobs. Describe the paper you are looking for
|
|
11
|
+
in your own words. On 40 random papers set aside before any measurement, the server puts the right one
|
|
12
|
+
first 60% of the time on its own and 85% when Claude drives it, against 12% for the same question typed
|
|
13
|
+
into INSPIRE's search box ([how this is measured](docs/evaluation.md)).
|
|
14
|
+
|
|
15
|
+
## What you can ask
|
|
16
|
+
|
|
17
|
+
* *"Find the paper that introduced GANs for calorimeter shower simulation, and who cites it lately"*
|
|
18
|
+
* *"What are Michela Paganini's most cited papers outside large collaborations? What is her h-index?"*
|
|
19
|
+
* *"Which neutrino conferences are coming up, and where?"*
|
|
20
|
+
* *"Are there open postdoc positions in lattice QCD in Europe?"*
|
|
21
|
+
* *"Show me the figures of arXiv:1705.02355 and give me its BibTeX"*
|
|
22
|
+
* *"Papers similar to the Randall–Sundrum paper"*
|
|
23
|
+
* *"Recent LHCb papers on pentaquarks"*
|
|
24
|
+
|
|
25
|
+
Every answer comes with INSPIRE links, so you can check the sources.
|
|
26
|
+
|
|
27
|
+
## Try it in one minute
|
|
28
|
+
|
|
29
|
+
You need [uv](https://docs.astral.sh/uv/), a small Python tool runner:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# macOS and Linux
|
|
33
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
34
|
+
# Windows (PowerShell)
|
|
35
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Then search straight from the terminal, no AI client needed:
|
|
39
|
+
|
|
40
|
+
```console
|
|
41
|
+
$ uvx --from "inspire-mcp[semantic]" inspire-mcp search "neural networks to speed up calorimeter shower simulation"
|
|
42
|
+
|
|
43
|
+
1. Quantum Invertible Neural Networks for Fast Calorimetry as Quantum Generative Model with high
|
|
44
|
+
interpretability at Future Colliders
|
|
45
|
+
Corchia, Federico 2026 · 0 citations · https://inspirehep.net/literature/3221332
|
|
46
|
+
2. CaloShowerGAN, a generative adversarial network model for fast calorimeter shower simulation
|
|
47
|
+
Faucci Giannelli, Michele 2024 · 33 citations · https://inspirehep.net/literature/2697185
|
|
48
|
+
3. On the use of neural networks for energy reconstruction in high-granularity calorimeters
|
|
49
|
+
Akchurin, N. 2021 · 38 citations · https://inspirehep.net/literature/1889423
|
|
50
|
+
...
|
|
51
|
+
ranked by cross-encoder:ms-marco-MiniLM-L-6-v2 from 50 INSPIRE candidates in 2.7s
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
The first run downloads the package and a small ranking model (about 100 MB); later runs start in
|
|
55
|
+
seconds. Other commands: `inspire-mcp paper 1705.02355` shows one paper, `inspire-mcp doctor` checks
|
|
56
|
+
your setup.
|
|
57
|
+
|
|
58
|
+
## Use it with your AI assistant
|
|
59
|
+
|
|
60
|
+
**Claude Code**, one command:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
claude mcp add inspire -- uvx --from "inspire-mcp[semantic]" inspire-mcp
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Claude Desktop**: open *Settings → Developer → Edit Config* (the file is
|
|
67
|
+
`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS and
|
|
68
|
+
`%APPDATA%\Claude\claude_desktop_config.json` on Windows), add the server and restart Claude:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"inspire": {
|
|
74
|
+
"command": "uvx",
|
|
75
|
+
"args": ["--from", "inspire-mcp[semantic]", "inspire-mcp"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
**Cursor, VS Code, and other MCP clients** use the same `command` and `args`. Run
|
|
82
|
+
`inspire-mcp config` to print the snippets.
|
|
83
|
+
|
|
84
|
+
> Until the first release is on PyPI, replace `inspire-mcp[semantic]` with
|
|
85
|
+
> `inspire-mcp[semantic] @ git+https://github.com/JacopoTorasso/inspire-mcp`.
|
|
86
|
+
|
|
87
|
+
## Tools
|
|
88
|
+
|
|
89
|
+
The assistant picks the right tool by itself; this is what it has available.
|
|
90
|
+
|
|
91
|
+
| | Tool | What it does |
|
|
92
|
+
|---|---|---|
|
|
93
|
+
| **Papers** | `semantic_search` | finds papers from a description in plain language |
|
|
94
|
+
| | `search_literature` | precise search in INSPIRE syntax (`t higgs and cn atlas and date > 2020`) |
|
|
95
|
+
| | `get_paper` | full record: abstract, authors, journal, keywords, arXiv PDF, open-access full text |
|
|
96
|
+
| | `find_similar_papers` | papers on the same subject as a given one |
|
|
97
|
+
| | `get_citing_papers` | who cites a paper, newest or most cited first |
|
|
98
|
+
| | `get_references` | what a paper cites |
|
|
99
|
+
| | `get_paper_figures` | figures with captions and download links |
|
|
100
|
+
| | `export_citations` | BibTeX or LaTeX (`\bibitem`, EU or US style) entries |
|
|
101
|
+
| | `search_collaboration` | papers of ATLAS, CMS, LHCb, ALICE, Belle II... |
|
|
102
|
+
| **People** | `search_authors` | find an author profile |
|
|
103
|
+
| | `get_author_profile` | papers, citations, h-index, citation distribution |
|
|
104
|
+
| | `get_author_papers` | an author's papers, optionally only those written in small teams |
|
|
105
|
+
| **Community** | `search_conferences` | upcoming (or past) conferences and workshops |
|
|
106
|
+
| | `search_seminars` | upcoming seminars and online talks, with link to join |
|
|
107
|
+
| | `search_jobs` | open positions: postdocs, faculty, PhD, staff |
|
|
108
|
+
| | `search_institutions` | research institutions, location and output |
|
|
109
|
+
| | `search_experiments` | experiments: accelerator, dates, number of papers |
|
|
110
|
+
| | `ping` | checks the server is up |
|
|
111
|
+
|
|
112
|
+
Lists are paginated and can return compact results to save the assistant's context. Also included:
|
|
113
|
+
a resource, `inspire://literature/{recid}`, and a prompt, `literature_review`, that writes a short cited
|
|
114
|
+
overview of a topic.
|
|
115
|
+
|
|
116
|
+
## How good is the search?
|
|
117
|
+
|
|
118
|
+
Measured on papers with 20 to 200 citations picked at random from INSPIRE, each described by a
|
|
119
|
+
question that does not repeat its title. Two sets of 40: the **development** set guided every design
|
|
120
|
+
choice; the **held-out** set was frozen beforehand and used only to confirm, so it is the honest estimate.
|
|
121
|
+
|
|
122
|
+
| Approach | Right paper first, development | Right paper first, held out |
|
|
123
|
+
|---|---|---|
|
|
124
|
+
| Question typed into INSPIRE's search | 7% | 12% |
|
|
125
|
+
| Keywords of the question, INSPIRE's ranking | 38% | 40% |
|
|
126
|
+
| **inspire-mcp semantic search**, one call | **70%** | **60%** |
|
|
127
|
+
| Claude Sonnet 5.5 searching INSPIRE by itself | 60% | 62% |
|
|
128
|
+
| **Claude Sonnet 5.5 with inspire-mcp** | **85%** | **85%** |
|
|
129
|
+
| Claude Haiku 5.5 searching INSPIRE by itself | 55% | 53% |
|
|
130
|
+
| **Claude Haiku 5.5 with inspire-mcp** | **80%** | **82%** |
|
|
131
|
+
|
|
132
|
+
With the server, an assistant finds the paper far more often and with fewer searches: Claude Sonnet 5.5
|
|
133
|
+
needs 1.3 to 1.5 searches per question instead of 5 to 6, and the small Claude Haiku 5.5 with the
|
|
134
|
+
server does better than Claude Sonnet 5.5 without it.
|
|
135
|
+
|
|
136
|
+
A second benchmark of 60 famous papers, the significance tests and the design choices that were
|
|
137
|
+
tried and rejected are in [docs/evaluation.md](docs/evaluation.md).
|
|
138
|
+
|
|
139
|
+
## How it works
|
|
140
|
+
|
|
141
|
+
```mermaid
|
|
142
|
+
flowchart LR
|
|
143
|
+
Q[your question] --> K["keywords joined with OR<br/>(INSPIRE needs all words to match otherwise)"]
|
|
144
|
+
K --> P[(50 candidate papers<br/>from live INSPIRE)]
|
|
145
|
+
P --> R["cross-encoder reads the question<br/>with each title and abstract"]
|
|
146
|
+
R --> A[best matches, with links<br/>and how they were found]
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Nothing is copied or indexed: every search runs against the live INSPIRE database, and only the
|
|
150
|
+
ranking happens locally, on CPU. For questions about foundational work the assistant can ask for
|
|
151
|
+
highly cited candidates (`prefer_influential`), which helps find famous papers buried under their
|
|
152
|
+
follow-ups.
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary><b>Run it as a service</b> (Docker, Kubernetes, configuration)</summary>
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
docker build --build-arg EXTRAS=semantic -t inspire-mcp:semantic . # models included, no download at runtime
|
|
159
|
+
docker run -p 8000:8000 -e INSPIRE_MCP_ALLOWED_HOSTS=mcp.example.org inspire-mcp:semantic
|
|
160
|
+
kubectl apply -f deploy/k8s/deployment.yaml # non-root, read-only filesystem, probes
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Release tags publish `ghcr.io/jacopotorasso/inspire-mcp:<version>` (no models, 364 MB) and
|
|
164
|
+
`:<version>-semantic` (about 1 GB).
|
|
165
|
+
|
|
166
|
+
| Endpoint | Purpose |
|
|
167
|
+
|---|---|
|
|
168
|
+
| `/mcp` | MCP over Streamable HTTP, rate limited per client |
|
|
169
|
+
| `/healthz` | liveness |
|
|
170
|
+
| `/readyz` | readiness: 503 until the ranking model is loaded |
|
|
171
|
+
| `/metrics` | Prometheus: calls by tool and outcome, latency histogram, readiness |
|
|
172
|
+
|
|
173
|
+
Every option is a flag or an environment variable:
|
|
174
|
+
|
|
175
|
+
| Variable | Default | |
|
|
176
|
+
|---|---|---|
|
|
177
|
+
| `INSPIRE_MCP_TRANSPORT` | `stdio` | `streamable-http` to serve over HTTP |
|
|
178
|
+
| `INSPIRE_MCP_HOST`, `INSPIRE_MCP_PORT` | `127.0.0.1`, `8000` | also honours `PORT` |
|
|
179
|
+
| `INSPIRE_MCP_ALLOWED_HOSTS` | | public host names (DNS rebinding protection when binding to `0.0.0.0`) |
|
|
180
|
+
| `INSPIRE_MCP_RATE_LIMIT` | `120` | MCP requests per minute per client, `0` disables |
|
|
181
|
+
| `INSPIRE_MCP_TRUST_PROXY` | `false` | identify clients by `X-Forwarded-For` behind a trusted proxy |
|
|
182
|
+
| `INSPIRE_MCP_RERANKER` | `auto` | `cross-encoder`, `dense` or `bm25` |
|
|
183
|
+
| `INSPIRE_MCP_CACHE_TTL` | `300` | seconds INSPIRE answers stay cached in memory |
|
|
184
|
+
| `INSPIRE_MCP_MIN_INTERVAL` | `0.35` | seconds between requests to INSPIRE |
|
|
185
|
+
| `INSPIRE_MCP_CACHE` | `~/.cache/inspire-mcp` | embedding cache |
|
|
186
|
+
| `INSPIRE_MCP_LOG_FORMAT`, `INSPIRE_MCP_LOG_LEVEL` | `text`, `INFO` | `json` for log aggregation |
|
|
187
|
+
|
|
188
|
+
The HTTP endpoint has no authentication; see [SECURITY.md](SECURITY.md).
|
|
189
|
+
|
|
190
|
+
</details>
|
|
191
|
+
|
|
192
|
+
<details>
|
|
193
|
+
<summary><b>Troubleshooting</b></summary>
|
|
194
|
+
|
|
195
|
+
* **`uvx: command not found`**: install uv (above) and open a new terminal.
|
|
196
|
+
* **The first search is slow**: the ranking model is downloaded once (about 100 MB).
|
|
197
|
+
* **The assistant does not see the tools**: restart the client after editing its configuration, then
|
|
198
|
+
run `inspire-mcp doctor` in a terminal.
|
|
199
|
+
* **Behind a corporate proxy**: set `HTTPS_PROXY`; the server needs to reach `https://inspirehep.net`.
|
|
200
|
+
* **Lighter install**: `uvx inspire-mcp` (without `[semantic]`) skips the models and ranks with BM25,
|
|
201
|
+
which is noticeably less accurate.
|
|
202
|
+
|
|
203
|
+
</details>
|
|
204
|
+
|
|
205
|
+
## Development
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
uv sync --extra semantic
|
|
209
|
+
uv run pytest # 68 tests, offline, about 90% coverage
|
|
210
|
+
uv run ruff check . && uv run mypy
|
|
211
|
+
uv run --extra eval python eval/run_eval.py # benchmark against live INSPIRE
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
CI runs lint, types, tests, both container images with a health probe and Kubernetes manifest
|
|
215
|
+
validation; the benchmark runs weekly to catch regressions. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
216
|
+
and [CHANGELOG.md](CHANGELOG.md).
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT. Data comes from [INSPIRE-HEP](https://inspirehep.net) under its terms of use. This is an
|
|
221
|
+
independent project, not affiliated with CERN or INSPIRE.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "inspire-mcp"
|
|
3
|
+
version = "0.5.0"
|
|
4
|
+
description = "Ask AI assistants about high energy physics literature in plain language: an MCP server for INSPIRE-HEP with measured semantic search"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
keywords = [
|
|
8
|
+
"mcp",
|
|
9
|
+
"model-context-protocol",
|
|
10
|
+
"inspire-hep",
|
|
11
|
+
"high-energy-physics",
|
|
12
|
+
"semantic-search",
|
|
13
|
+
"rag",
|
|
14
|
+
"llm",
|
|
15
|
+
]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
20
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
21
|
+
"Programming Language :: Python :: 3.12",
|
|
22
|
+
"Programming Language :: Python :: 3.13",
|
|
23
|
+
"Typing :: Typed",
|
|
24
|
+
]
|
|
25
|
+
requires-python = ">=3.12"
|
|
26
|
+
dependencies = [
|
|
27
|
+
"httpx>=0.27",
|
|
28
|
+
"mcp>=2.3,<3",
|
|
29
|
+
"starlette>=0.46",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[[project.authors]]
|
|
33
|
+
name = "Jacopo Torasso"
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
semantic = [
|
|
37
|
+
"fastembed>=0.9.1",
|
|
38
|
+
"numpy>=2.5.5",
|
|
39
|
+
]
|
|
40
|
+
eval = [
|
|
41
|
+
"fastembed>=0.9.1",
|
|
42
|
+
"numpy>=2.5.5",
|
|
43
|
+
"anthropic>=1.0",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.urls]
|
|
47
|
+
Repository = "https://github.com/JacopoTorasso/inspire-mcp"
|
|
48
|
+
Issues = "https://github.com/JacopoTorasso/inspire-mcp/issues"
|
|
49
|
+
Changelog = "https://github.com/JacopoTorasso/inspire-mcp/blob/main/CHANGELOG.md"
|
|
50
|
+
|
|
51
|
+
[project.scripts]
|
|
52
|
+
inspire-mcp = "inspire_mcp.server:main"
|
|
53
|
+
|
|
54
|
+
[build-system]
|
|
55
|
+
requires = ["uv_build>=0.12.21,<0.13.0"]
|
|
56
|
+
build-backend = "uv_build"
|
|
57
|
+
|
|
58
|
+
[dependency-groups]
|
|
59
|
+
dev = [
|
|
60
|
+
"mypy>=2.4.1",
|
|
61
|
+
"numpy>=2.5.5",
|
|
62
|
+
"pytest>=9.2.0",
|
|
63
|
+
"pytest-asyncio>=1.5.0",
|
|
64
|
+
"pytest-cov>=7.1.0",
|
|
65
|
+
"respx>=0.23.1",
|
|
66
|
+
"ruff>=0.17.6",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
[tool.pytest.ini_options]
|
|
70
|
+
asyncio_mode = "auto"
|
|
71
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
72
|
+
testpaths = ["tests"]
|
|
73
|
+
|
|
74
|
+
[tool.ruff]
|
|
75
|
+
line-length = 120
|
|
76
|
+
target-version = "py312"
|
|
77
|
+
|
|
78
|
+
[tool.ruff.lint]
|
|
79
|
+
select = [
|
|
80
|
+
"E",
|
|
81
|
+
"F",
|
|
82
|
+
"I",
|
|
83
|
+
"UP",
|
|
84
|
+
"B",
|
|
85
|
+
]
|
|
86
|
+
|
|
87
|
+
[tool.mypy]
|
|
88
|
+
python_version = "3.12"
|
|
89
|
+
ignore_missing_imports = true
|
|
90
|
+
warn_unused_ignores = true
|
|
91
|
+
files = ["src"]
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "inspire-mcp"
|
|
3
|
+
version = "0.5.0"
|
|
4
|
+
description = "Ask AI assistants about high energy physics literature in plain language: an MCP server for INSPIRE-HEP with measured semantic search"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
keywords = ["mcp", "model-context-protocol", "inspire-hep", "high-energy-physics", "semantic-search", "rag", "llm"]
|
|
8
|
+
classifiers = [
|
|
9
|
+
"Development Status :: 4 - Beta",
|
|
10
|
+
"Intended Audience :: Science/Research",
|
|
11
|
+
"Topic :: Scientific/Engineering :: Physics",
|
|
12
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
13
|
+
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Programming Language :: Python :: 3.13",
|
|
15
|
+
"Typing :: Typed",
|
|
16
|
+
]
|
|
17
|
+
authors = [
|
|
18
|
+
{ name = "Jacopo Torasso" }
|
|
19
|
+
]
|
|
20
|
+
requires-python = ">=3.12"
|
|
21
|
+
dependencies = [
|
|
22
|
+
"httpx>=0.27",
|
|
23
|
+
"mcp>=2.3,<3",
|
|
24
|
+
"starlette>=0.46",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
semantic = [
|
|
29
|
+
"fastembed>=0.9.1",
|
|
30
|
+
"numpy>=2.5.5",
|
|
31
|
+
]
|
|
32
|
+
eval = [
|
|
33
|
+
"fastembed>=0.9.1",
|
|
34
|
+
"numpy>=2.5.5",
|
|
35
|
+
"anthropic>=1.0",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["uv_build>=0.12.21,<0.13.0"]
|
|
40
|
+
build-backend = "uv_build"
|
|
41
|
+
|
|
42
|
+
[dependency-groups]
|
|
43
|
+
dev = [
|
|
44
|
+
"mypy>=2.4.1",
|
|
45
|
+
"numpy>=2.5.5",
|
|
46
|
+
"pytest>=9.2.0",
|
|
47
|
+
"pytest-asyncio>=1.5.0",
|
|
48
|
+
"pytest-cov>=7.1.0",
|
|
49
|
+
"respx>=0.23.1",
|
|
50
|
+
"ruff>=0.17.6",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[project.urls]
|
|
54
|
+
Repository = "https://github.com/JacopoTorasso/inspire-mcp"
|
|
55
|
+
Issues = "https://github.com/JacopoTorasso/inspire-mcp/issues"
|
|
56
|
+
Changelog = "https://github.com/JacopoTorasso/inspire-mcp/blob/main/CHANGELOG.md"
|
|
57
|
+
|
|
58
|
+
[project.scripts]
|
|
59
|
+
inspire-mcp = "inspire_mcp.server:main"
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
asyncio_mode = "auto"
|
|
63
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
64
|
+
testpaths = ["tests"]
|
|
65
|
+
|
|
66
|
+
[tool.ruff]
|
|
67
|
+
line-length = 120
|
|
68
|
+
target-version = "py312"
|
|
69
|
+
|
|
70
|
+
[tool.ruff.lint]
|
|
71
|
+
select = ["E", "F", "I", "UP", "B"]
|
|
72
|
+
|
|
73
|
+
[tool.mypy]
|
|
74
|
+
python_version = "3.12"
|
|
75
|
+
ignore_missing_imports = true
|
|
76
|
+
warn_unused_ignores = true
|
|
77
|
+
files = ["src"]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"""INSPIRE-HEP MCP server."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.5.0"
|
|
4
|
+
|
|
5
|
+
from .client import Author, InspireClient, InspireError, Paper # noqa: E402
|
|
6
|
+
from .server import build_server # noqa: E402
|
|
7
|
+
|
|
8
|
+
__all__ = ["Author", "InspireClient", "InspireError", "Paper", "build_server", "__version__"]
|