Metadata-Version: 2.5
Name: second-brain-joplin
Version: 1.3.0
Summary: MCP server that connects Claude Code (and other MCP clients) to your Joplin knowledge base
Project-URL: Homepage, https://github.com/second-brain-tools/second-brain-joplin
Project-URL: Repository, https://github.com/second-brain-tools/second-brain-joplin
Project-URL: Documentation, https://github.com/second-brain-tools/second-brain-joplin/blob/main/docs/install.md
Project-URL: Changelog, https://github.com/second-brain-tools/second-brain-joplin/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/second-brain-tools/second-brain-joplin/issues
License-Expression: AGPL-3.0-or-later
License-File: LICENSE
Keywords: ai,claude,joplin,knowledge-base,mcp,second-brain
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Office/Business
Classifier: Topic :: Text Processing :: Indexing
Requires-Python: >=3.11
Requires-Dist: fastmcp<5,>=4.1
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2
Requires-Dist: python-dotenv>=1.0
Requires-Dist: second-brain-core<0.2,>=0.1
Provides-Extra: semantic
Requires-Dist: second-brain-core[semantic]<0.2,>=0.1; extra == 'semantic'
Provides-Extra: semantic-chroma
Requires-Dist: second-brain-core[semantic-chroma]<0.2,>=0.1; extra == 'semantic-chroma'
Provides-Extra: semantic-st
Requires-Dist: second-brain-core[semantic-st]<0.2,>=0.1; extra == 'semantic-st'
Provides-Extra: test
Requires-Dist: mypy>=1.11; extra == 'test'
Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
Requires-Dist: pytest-cov>=5.0; extra == 'test'
Requires-Dist: pytest>=8.0; extra == 'test'
Requires-Dist: respx>=0.21; extra == 'test'
Description-Content-Type: text/markdown

# second-brain-joplin

[![CI](https://github.com/second-brain-tools/second-brain-joplin/actions/workflows/ci.yml/badge.svg)](https://github.com/second-brain-tools/second-brain-joplin/actions/workflows/ci.yml)
[![PyPI](https://img.shields.io/pypi/v/second-brain-joplin)](https://pypi.org/project/second-brain-joplin/)

An MCP server that turns your [Joplin](https://joplinapp.org/) knowledge base into searchable memory for any MCP-capable AI client — Claude Code, Cursor, and others.

Inspired by [second-brain-mcp](https://github.com/noesskeetit/second-brain-mcp) (for Obsidian). This project covers the same use case for Joplin: your AI assistant reads, searches, and files notes directly, without leaving the tool you already use.

> **Status:** stable. From 1.0 the tools (names, arguments, results), the settings and the command line follow [semantic versioning](https://semver.org/): nothing you rely on changes without a new major version. Tested on Linux, macOS and Windows.

---

## How it works

Joplin Desktop exposes a local REST API on `localhost:41184` (the Web Clipper service). This server wraps that API as MCP tools, so your AI client can read your notes in real time, and add new ones where you allow it — no export step, no sync lag.

```
Claude Code / Cursor
       │  MCP
       ▼
second-brain-joplin (this server)
       │  HTTP + token
       ▼
Joplin Desktop (localhost:41184)
       │
       ▼
Your notes
```

---

## Prerequisites

- **Joplin Desktop** running with the Web Clipper service enabled:  
  **Tools → Options → Web Clipper → Enable Web Clipper Service**
- **API token** — copy it from the Web Clipper settings panel
- [`uvx`](https://docs.astral.sh/uv/) (recommended — no install needed), or Python ≥ 3.11

---

## Quickstart

### Claude Code

```bash
claude mcp add -s user second-brain-joplin \
  -e JOPLIN_API_TOKEN=your-token-here \
  -- uvx second-brain-joplin serve
```

### Other MCP clients

| Setting | Value |
|---|---|
| Command | `uvx second-brain-joplin serve` |
| `JOPLIN_API_TOKEN` | token from Joplin Web Clipper settings |
| `JOPLIN_BASE_URL` | `http://localhost:41184` (default) |

See [docs/install.md](docs/install.md) for step-by-step setup, including Claude Desktop and Cursor, and [docs/troubleshooting.md](docs/troubleshooting.md) if something doesn't work.

### Remote: a Claude custom connector

`serve --transport http` runs the server over streamable HTTP so Claude's custom
connectors (claude.ai, the Claude apps, Cowork) can reach it through a tunnel. See
[docs/remote-access.md](docs/remote-access.md).

---

## MCP Tools

| Tool | Description | Writes? |
|---|---|---|
| `joplin_overview` | List all notebooks with note counts | No |
| `joplin_search` | Keyword search with Joplin's search words; each hit says its notebook and where the match is (`limit` 1–100) | No |
| `joplin_read` | Read a note by ID or link, a page at a time (`offset`, `max_chars` up to 100,000), or its outline, or one section (`outline`, `section`); with its notebook, tags, to-do state, attachments and a checksum | No |
| `joplin_read_notes` | Read up to 20 notes in one call, sharing 40,000 characters | No |
| `joplin_list_notes` | List the notes in one notebook, a page at a time (`limit` 1–100, newest first or by title) | No |
| `joplin_changes` | List the changes the server made to notes, with no text | No. Only with `SBJ_EDIT_NOTEBOOKS` |
| `joplin_recent` | Notes modified in the last N days (`days` 1–3650, `limit` 1–100) | No |
| `joplin_semantic_search` | Find notes by meaning (embeddings; `limit` 1–50) | No |
| `joplin_reindex` | Build/refresh the semantic index | The local index only, never Joplin |
| `joplin_create_note` | Add a new markdown note to a notebook you allow (`title`, `body`, `notebook` by title or id) | A new note, nothing else. Off by default |
| `joplin_create_notes` | Add up to 20 new notes in one call | New notes, nothing else. Off by default (`SBJ_CREATE_NOTES_MAX`) |
| `joplin_edit_note` | Change part of a note (exact text replaced), or add to a section, its start or its end | Changes a note, after keeping a copy of it. Off by default (`SBJ_EDIT_NOTEBOOKS`) |
| `joplin_replace_note` | Replace the whole text of a short note that is rebuilt each time | Rewrites a note, after keeping a copy of it. Off by default (`SBJ_EDIT_NOTEBOOKS` and `SBJ_REPLACE`) |

[docs/tools.md](docs/tools.md) describes each tool's arguments, results and
errors. Every tool carries MCP annotations (read-only; for `joplin_reindex`
local and non-destructive; for `joplin_create_note` and `joplin_create_notes`
a write that only adds; for `joplin_edit_note` and `joplin_replace_note` a
destructive write, since a change can remove text), so clients can tell what
each one does.

`joplin_create_note` exists only once you set `SBJ_WRITE_NOTEBOOKS` to the
notebooks that may receive notes (ids or titles, or `*` for every visible one).
Your client's approval prompt is the check on each note, and the call carries the
note in readable form so the prompt shows what will be written. Clients differ
in when they ask: see
[Who confirms each note](docs/remote-access.md#who-confirms-each-note) and
[Creating notes](docs/remote-access.md#creating-notes).

To limit which notebooks these tools can see, set `SBJ_NOTEBOOKS` (only these) or
`SBJ_EXCLUDE_NOTEBOOKS` (not these) to notebook ids or titles;
`second-brain-joplin notebooks` lists the ids and shows what a filter hides. See
[Choosing which notebooks are exposed](docs/remote-access.md#choosing-which-notebooks-are-exposed).

> Semantic search (`joplin_semantic_search` / `joplin_reindex`) needs the
> optional `[semantic]` extra (see [Semantic search](#semantic-search)).

---

## Semantic search

Semantic search finds notes by *meaning*, complementing the keyword
`joplin_search`. It embeds your notes locally and stores the vectors in a
persistent on-disk index; queries return the closest notes with a similarity
score.

It ships behind an optional extra so the base install stays light:

```bash
# Claude Code (note the quotes around the package+extra)
claude mcp add -s user second-brain-joplin \
  -e JOPLIN_API_TOKEN=your-token-here \
  -- uvx --python 3.13 --from "second-brain-joplin[semantic]" second-brain-joplin serve
```

Keep `--python 3.13`: the embedding runtime has no build for Python 3.15 yet,
so without it the install fails on a computer whose own Python is 3.15
([Which Python](docs/install.md#which-python)).

The default stack is [FastEmbed](https://github.com/qdrant/fastembed) (ONNX, no
PyTorch) with [`sqlite-vec`](https://github.com/asg017/sqlite-vec). You can swap
either backend via env vars (e.g. `bge-m3` via `sentence-transformers`, or a
ChromaDB store) — see [docs/semantic-search.md](docs/semantic-search.md).

Build the index once with `second-brain-joplin reindex` (or the `joplin_reindex`
tool); this downloads the embedding model the first time. After that, `joplin_semantic_search` keeps the index
fresh incrementally — only notes changed since the last sync are re-embedded.

---

## vs. Joplin's built-in MCP server

Since 3.7, Joplin Desktop has an MCP server of its own (Settings → AI → "Enable
MCP server", a beta feature, off by default). If your AI client runs on the same
computer as Joplin and may see every notebook, it is the simplest choice:
nothing to install, and it can already edit notes, move them to the trash and
manage tags. second-brain-joplin is for the cases it doesn't cover:

| | Joplin's built-in server | second-brain-joplin |
|---|---|---|
| Where the client can be | The same computer only | The same computer, or anywhere: a Claude custom connector for the web and phone apps |
| Sign-in | Joplin's Web Clipper token, in the address of each request | The token locally; remotely, GitHub sign-in limited to the accounts you list |
| Which notebooks | All of them | The ones you choose; hidden notebooks are left out of every tool |
| Where it can write | Anywhere, one switch per tool | Only the notebooks you list |
| What it can change | Create, edit, trash, tags, notebooks | New notes, and edits to notes in the notebooks you list, each checked against the version read, with a copy kept first and a daily limit |
| A record of calls | Joplin's Web Clipper log has one line per request: its address, token included, not which tool ran. No rate limit | In HTTP mode, one log line per call (tool, caller, outcome, time), never the token, and a rate limit per caller. On any transport, a kept copy of every changed note, listed by `joplin_changes` and put back with `second-brain-joplin restore` |
| Search by meaning | Joplin's AI features must be on | A local index of its own |
| Clients | Ones that speak MCP over HTTP | stdio and HTTP |

Compared with Joplin 3.7.24 (November 2026). Joplin's server is in beta and
changing quickly, so check its own documentation. The two can run side by side.

The aim is that everything the built-in server can do, this one can do too,
under the same filter, sign-in and log. Editing, richer search and reading by
section came in 1.2; the trash, moving notes, tags, to-dos and new notebooks come
in 1.4 (see the [Roadmap](#roadmap)).

---

## vs. second-brain-mcp (Obsidian)

| | [second-brain-mcp](https://github.com/noesskeetit/second-brain-mcp) | second-brain-joplin |
|---|---|---|
| Note app | Obsidian | Joplin |
| Storage | Plain `.md` files on disk | Joplin REST API |
| Requires app running | No | Yes (Joplin + Web Clipper) |
| Semantic search | Yes (bge-m3) | Yes (FastEmbed / bge-m3) |
| Write support | Human-gated | New notes and edits, where you allow, with a copy kept before each change |
| Install | `uvx second-brain-mcp` | `uvx second-brain-joplin` |

---

## Notebook structure

The [PARA method](https://fortelabs.com/blog/para/) works well with Joplin. See [docs/notebook-structure.md](docs/notebook-structure.md) for a recommended setup, and [templates/](templates/README.md) for project, area, resource and weekly-review notes to import.

---

## Documentation

| Guide | What it covers |
|---|---|
| [Installation](docs/install.md) | Joplin's local API, each client's setup, which Python, updating |
| [Tool reference](docs/tools.md) | Every tool: arguments, results, errors |
| [Configuration](docs/configuration.md) | Every setting and where it is read from; the command line |
| [Troubleshooting](docs/troubleshooting.md) | What each error means and what to do |
| [Semantic search](docs/semantic-search.md) | Searching by meaning: install, index, backends |
| [Remote access](docs/remote-access.md) | A Claude custom connector: HTTP mode, sign-in, notebook filter, creating notes |
| [Notebook structure](docs/notebook-structure.md) and [templates](templates/README.md) | A PARA layout and starter notes |
| [Changelog](CHANGELOG.md) · [Security](SECURITY.md) · [Contributing](CONTRIBUTING.md) | |

---

## Roadmap

| Milestone | Theme | Status |
|---|---|---|
| [v0.1 — Bootstrap](https://github.com/second-brain-tools/second-brain-joplin/milestone/1) | Repo, CI, package skeleton | Done |
| [v0.2 — Core Read Tools](https://github.com/second-brain-tools/second-brain-joplin/milestone/2) | All read MCP tools working | Done |
| [v0.3 — Semantic Search](https://github.com/second-brain-tools/second-brain-joplin/milestone/3) | Embedding index, semantic search | Done |
| [v0.4 — Remote Access](https://github.com/second-brain-tools/second-brain-joplin/milestone/6) | Streamable HTTP, GitHub sign-in, Claude custom connector | Done |
| [v0.5 — Write Workflow](https://github.com/second-brain-tools/second-brain-joplin/milestone/4) | Notebook filter; note creation you allow and approve | Done |
| [v1.0 — Publish](https://github.com/second-brain-tools/second-brain-joplin/milestone/5) | PyPI, full docs, templates | Done |
| [v1.2 — Edit](https://github.com/second-brain-tools/second-brain-joplin/milestone/7) | Change notes safely; search results that say where the match is; reading by section | Done |
| [v1.3 — Core](https://github.com/second-brain-tools/second-brain-joplin/milestone/9) | Sign-in, logging, serving and the search engine shared with the other Second Brain servers; the client named in the log | Done |
| [v1.4 — Organise](https://github.com/second-brain-tools/second-brain-joplin/milestone/8) | Move, trash, tags, to-dos, notebooks and attachments | Planned |

---

## Security & privacy

By default (stdio) this server keeps your notes local: it talks only to Joplin's Web Clipper REST API on `localhost` and runs on your own machine. HTTP mode, for a Claude custom connector, deliberately sends what Claude reads to Anthropic, behind GitHub sign-in limited to your account ([remote access](docs/remote-access.md)). Anything an MCP client can read, the connected AI can read — so apply least privilege and don't expose notebooks with credentials or other sensitive data; a notebook filter (`SBJ_NOTEBOOKS` / `SBJ_EXCLUDE_NOTEBOOKS`) keeps chosen notebooks out of every tool. The server is read-only until you list the notebooks that may receive notes (`SBJ_WRITE_NOTEBOOKS`) or whose notes may change (`SBJ_EDIT_NOTEBOOKS`). A change is checked against the version of the note that was read, the note is copied to the server's disk first, and a daily limit bounds the changes ([Changing notes](docs/remote-access.md#changing-notes)); your client's approval prompt, where the client asks, is the check on each call.

Two caveats apply once you enable semantic search: it writes a **local index** (under your XDG data dir by default) that stores note text excerpts and titles alongside the embeddings, and it downloads the embedding model **once over the network** on the first reindex. Your note *content* is embedded locally and never leaves your machine. See [SECURITY.md](SECURITY.md) for details and how to report a vulnerability.

---

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md). Issues and PRs welcome — especially for testing against different Joplin versions and OS platforms.

---

## License

Copyright (C) 2026 John McKenzie

second-brain-joplin is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See [LICENSE](LICENSE) for the full text.

In short: run it and change it as you like. If you pass copies on, or change it and let other people use your version over a network, you must offer them the source under the same license.

- **Releases up to 1.1.0** were published under the MIT License and stay under it.
- **The note templates** in [`templates/`](templates/) are not under the AGPL. They are dedicated to the public domain ([CC0 1.0](templates/LICENSE)), so the notes you make from them carry no conditions.
