Metadata-Version: 2.5
Name: annotheca
Version: 0.1.3
Summary: A local, bilingual reference manager for research projects: BibTeX, PDFs, highlights and sticky notes.
Project-URL: Homepage, https://github.com/melissa-colin/annotheca
Author: Melissa Colin
License-Expression: MIT
License-File: LICENSE
Keywords: annotation,bibliography,bibtex,pdf,reference-manager,research
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
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: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Requires-Dist: fastapi>=0.110
Requires-Dist: httpx>=0.27
Requires-Dist: mcp<3,>=2
Requires-Dist: uvicorn>=0.29
Provides-Extra: test
Requires-Dist: pytest>=8; extra == 'test'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/src/annotheca/static/favicon.svg" width="72" alt="">
</p>

<h1 align="center">Annotheca</h1>

<p align="center">
  <b>A calm, local home for the bibliography of your research projects.</b><br>
  Paste a reference, get the BibTeX and the PDF, highlight, take notes, export one clean <code>.bib</code>.<br>
  Let Claude and other AI assistants file the papers they find, with verified metadata.
</p>

<p align="center">
  <a href="https://pypi.org/project/annotheca/"><img src="https://img.shields.io/pypi/v/annotheca" alt="PyPI"></a>
  <a href="https://pypi.org/project/annotheca/"><img src="https://img.shields.io/pypi/pyversions/annotheca" alt="Python versions"></a>
  <a href="https://github.com/melissa-colin/annotheca/actions/workflows/tests.yml"><img src="https://github.com/melissa-colin/annotheca/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/library.png" alt="The library view of Annotheca" width="900">
</p>

## Why

Research projects live in stages (state of the art, method, experiments,
writing) and the same paper often matters in several of them, for different
reasons. Annotheca organises references the way the project is organised:

- **Projects and stage folders.** Every project starts with a `SoA` (state of
  the art) folder; add as many folders as your project has stages.
- **Paste anything.** BibTeX (one or many entries), DOIs, arXiv IDs, links to
  paper pages (publishers, HAL, IACR ePrint...), or a formatted citation
  copied from a paper (APA, IEEE, ...). Annotheca resolves it into clean
  BibTeX through doi.org, arXiv, Crossref and the page's own metadata, and
  refuses a citation it cannot match with certainty rather than guess.
- **PDFs found for you.** Open-access PDFs are downloaded automatically from
  arXiv, Semantic Scholar and OpenAlex, following repository landing pages to
  their PDF. Otherwise, drop the PDF on the paper.
- **Highlights, sticky notes and general notes.** Highlight passages in five
  colours, pin draggable post-its on the page, and keep general notes on each
  paper, next to it in the list or beside the PDF.
- **One paper, several folders, separate notes.** A paper filed in two folders
  is stored once, but its highlights and notes are specific to each folder:
  what you underline for the state of the art is not what you underline for
  the method.
- **Share a project.** *Share* downloads the project, with its folders,
  notes, highlights and PDFs, as one `.annotheca` file; whoever receives it
  opens it with the import button of the sidebar.
- **Works with AI assistants.** Claude (or any MCP client) can file the papers
  it finds into your projects, add notes, read yours and get the `.bib`. See
  [AI assistants](#ai-assistants).
- **One clean `.bib`.** Export the whole project in one click; papers filed in
  several folders appear only once, with stable, unique citation keys.
- **English and French**, light and dark themes, everything stored locally.

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/reader.png" alt="Reading a paper with highlights and a sticky note" width="900">
</p>

## Install

Three steps, about a minute. You do not need Python installed: the installer
below takes care of it.

**1. Install [uv](https://docs.astral.sh/uv/)**, the tool that installs
Annotheca and the Python it needs. Copy this into a terminal:

- Linux and macOS:

  ```sh
  curl -LsSf https://astral.sh/uv/install.sh | sh
  ```

- Windows (PowerShell):

  ```powershell
  powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
  ```

Then **close the terminal and open a new one**, so that it finds `uv`.

**2. Install Annotheca:**

```sh
uv tool install annotheca
```

**3. Start it:**

```sh
annotheca
```

Your browser opens on Annotheca. That's it.

Optional, to let Claude use your library (see [AI assistants](#ai-assistants)):

```sh
annotheca connect
```

To update later: `uv tool upgrade annotheca`.

<details>
<summary>Something went wrong?</summary>

- **`uv: command not found`** right after step 1: open a new terminal, or run
  `source $HOME/.local/bin/env` (Linux and macOS).
- **`annotheca: command not found`** after step 2: run
  `uv tool update-shell`, then open a new terminal.
- **Already using pipx?** `pipx install annotheca` works too.

</details>

## Use

```sh
annotheca
```

The interface opens in your browser at <http://127.0.0.1:8737>. Running the
command again while Annotheca is running simply reopens it.

| Option or command | Effect |
| --- | --- |
| `--port PORT` | Serve on another local port (default `8737`). |
| `--data-dir DIR` | Keep the library somewhere else. |
| `--no-browser` | Do not open the browser. |
| `connect` | Make Annotheca available to Claude (see below). |
| `mcp` | Serve the tools for AI assistants over stdio (used by `connect`). |

Tips:

- `Ctrl+Enter` adds what you pasted.
- Click a citation key to copy `\cite{key}`.
- Drop a PDF file on a paper to attach it.
- In the reader, select text to highlight it; switch to *Sticky note* and
  click on the page to pin a note; click a highlight to recolour or delete it;
  `Esc` goes back.

## AI assistants

When an assistant writes references itself, it can get a title, an author or a
year wrong. With Annotheca, the assistant only says *which* paper it means (a
DOI, an arXiv ID, a citation); Annotheca fetches the metadata from doi.org,
arXiv and Crossref, files the paper with its PDF, and answers with the exact
citation key, title and authors to use. Every paper an assistant adds is marked
with its name, so you can always see, and filter, what it relied on.

`annotheca connect` registers Annotheca as an
[MCP](https://modelcontextprotocol.io) server for **Claude Code** (in every
project) and **Claude Desktop** when they are installed, and prints the
configuration to paste into other MCP clients (Cursor, Codex, Gemini CLI...).
The assistant then just needs to be asked:

> Find recent papers on contact-implicit trajectory optimisation and add the
> three most relevant to the SoA of my PhysProx project, with a note on each.

> What did I highlight in posa2013direct? Write the related-work paragraph
> citing the papers of the Method folder.

| Tool | What the assistant can do |
| --- | --- |
| `list_projects` | See the projects and their folders. |
| `create_project`, `create_folder` | Create them. |
| `add_references` | File papers from DOIs, arXiv IDs, BibTeX or citations, with a note; get back verified metadata. |
| `list_papers` | List the papers of a project with your notes. |
| `read_paper` | Read a paper's BibTeX, your notes, highlights and sticky notes, and the path of its PDF. |
| `add_note` | Add a signed paragraph to a paper's notes. |
| `get_bibtex` | Get the project's `.bib`. |

Nothing else is needed: the server explains itself to the assistant. Papers it
adds appear in the interface as soon as you come back to the window.

## Your data

Everything stays on your machine, in `~/.local/share/annotheca` (or
`$XDG_DATA_HOME/annotheca`, or `$ANNOTHECA_HOME`):

```
library.db   SQLite database: projects, folders, BibTeX, notes, annotations
pdfs/        one PDF per paper
```

Back it up by copying that directory. The only network requests are the
lookups of references and PDFs, sent to doi.org, arXiv, Crossref, Semantic
Scholar, OpenAlex and the repositories they point to.

<p align="center">
  <img src="https://raw.githubusercontent.com/melissa-colin/annotheca/main/docs/library-dark.png" alt="Dark theme" width="700">
</p>

## Development

```sh
git clone https://github.com/melissa-colin/annotheca
cd annotheca
uv venv && uv pip install -e '.[test]'
.venv/bin/pytest
.venv/bin/annotheca --data-dir /tmp/annotheca-dev
```

Releases are made by the maintainer: only accounts with write access to this
repository can push tags, and PyPI only accepts packages built by this
repository's release workflow from a `v*` tag. To release, set the new
`version` in `pyproject.toml`, commit, then push a matching tag; the tests run
and the package is published:

```sh
git tag v0.2.0 && git push origin v0.2.0
```

The code follows the Google Python and JavaScript style guides. The backend is
a small [FastAPI](https://fastapi.tiangolo.com/) app over SQLite
(`src/annotheca`); the interface is dependency-free JavaScript modules with
[pdf.js](https://mozilla.github.io/pdf.js/) vendored, so there is no build
step.

```
src/annotheca/
  cli.py         command line entry point
  api.py         HTTP API and static files
  library.py     storage: projects, folders, papers, placements, annotations
  bundle.py      .annotheca files to share a project
  mcp_server.py  tools for AI assistants (Model Context Protocol)
  models.py      validated shapes shared by the API and the bundles
  bibtex.py      BibTeX parsing, formatting, citation keys, identifiers
  sources.py     doi.org, arXiv, Crossref, Semantic Scholar, OpenAlex lookups
  static/        web interface
```

## License

MIT. pdf.js is distributed under the Apache License 2.0
(`src/annotheca/static/vendor/pdfjs/LICENSE`).
