obsidian-memory-mcp
by vdeabreu
README.md
# obsidian-memory-mcp
A self-hosted MCP server that turns an Obsidian vault into **Claude's long-term memory**, shared by all
your Claude clients: claude.ai, the desktop app, the mobile apps (iPhone, Android) and Claude Code.
- Claude **searches and reads** the vault before rediscovering something.
- Claude **writes** what is worth keeping (setups, decisions, procedures, findings) to a dedicated folder of
the vault, as Markdown with frontmatter and `[[links]]`: you see it and fix it in Obsidian.
- A **skill** (`obsidian-memory`) tells Claude when to look things up and what to record.
```
claude.ai · desktop app · mobile Claude Code (any machine)
│ OAuth (password) │ static token (Bearer)
└───────────────┬─────────────────────────┘
▼ HTTPS
reverse proxy (Caddy, nginx…) https://memory.example.com/mcp
│ /mcp: Anthropic's IP ranges (+ yours) only
▼ http://127.0.0.1:8765
obsidian-memory-mcp (systemd or Docker, no root privileges)
▼
Obsidian vault ── read: the whole vault (configurable)
└─ write: only <vault>/Claude/
```
## Contents
1. [What the server does](#1-what-the-server-does)
2. [Requirements](#2-requirements)
3. [Install on a Linux server (systemd)](#3-install-on-a-linux-server-systemd)
4. [Alternative: install with Docker](#4-alternative-install-with-docker)
5. [Connect Claude](#5-connect-claude)
6. [Install the skill](#6-install-the-skill)
7. [Sync the vault with your devices](#7-sync-the-vault-with-your-devices)
8. [Backups](#8-backups)
9. [Security](#9-security)
10. [Upgrades, maintenance, troubleshooting](#10-upgrades-maintenance-troubleshooting)
11. [Configuration reference](#11-configuration-reference)
12. [Development](#12-development)
---
## 1. What the server does
### Tools given to Claude
| Tool | Effect |
| --- | --- |
| `memory_overview` | Every memory note (title, one-line summary, date), the latest changes, the vault's top-level folders |
| `search_notes` | Full-text search, ignoring accents and case |
| `read_note` | A note's content (by path or by name, like a `[[link]]`), its `sha256`, and whether Claude may write it |
| `list_notes` | Notes in a folder, with summary and date |
| `save_note` | Create a memory note, or update one |
| `append_to_note` | Add text at the end of a memory note |
| `archive_note` | Move an obsolete note to `_Archive/` |
### Rules it enforces, whatever Claude asks
- **Writes only in the memory folder** (`Claude/` by default). The rest of the vault is read-only, or even
invisible if you choose so (`READ_SCOPE=memory`, `EXCLUDE=...`).
- **Nothing is ever deleted.** Before each rewrite, the previous version is copied to `Claude/.history/`.
An obsolete note is moved to `Claude/_Archive/`.
- **No silent overwrites.** To update a note, Claude must pass the `sha256` it got when reading it. If you
edited the note in Obsidian in the meantime, the write is refused and Claude has to read it again.
- **No duplicates**: creating a note whose name already exists in the memory is refused.
- **No secrets**: a note containing a private key, an API key (Anthropic, OpenAI, GitHub, Slack, AWS, Google,
Stripe), a JWT or a `password: …` is refused.
- **Hidden files** (`.obsidian/`, `.trash/`…) and paths leading outside the vault are off limits.
- **`/mcp` answers only Anthropic's IP ranges** (plus the addresses you add): a leaked token is useless
from anywhere else. See [section 9](#9-security) for the rest of the hardening.
### What you see in Obsidian
```
MyVault/
└── Claude/
├── _Index.md ← kept up to date by the server: every note, by folder, with its summary
├── _Log.md ← log: what was created, updated, archived, and why
├── Home server.md
├── Projects/
│ └── Website.md
├── _Archive/ ← retired notes
└── .history/ ← previous versions (hidden folder, ignored by Obsidian)
```
A note written by Claude looks like this:
```markdown
---
summary: Debian home server, its services and how to reach them.
tags:
- infra
created: '2026-12-03'
updated: '2026-12-03'
source: claude
---
## Services
- `obsidian-memory-mcp`: systemd, port 8765, behind Caddy (`memory.example.com`)
...
```
You can edit these notes by hand: the server keeps the frontmatter keys it does not manage (`aliases`,
`cssclass`…).
## 2. Requirements
- **A Linux server** that is always on (a VPS, a mini PC, a NAS…) with **systemd and Python 3.11+**
(Debian 12+, Ubuntu 24.04+), **or Docker**.
- **The Obsidian vault on that server**, as plain files, synced with your devices
(see [section 7](#7-sync-the-vault-with-your-devices)).
- **For claude.ai and mobile: a public HTTPS address.** Anthropic's servers connect to your server, not your
phone. So you need:
- a domain (or subdomain) pointing to the server, for example `memory.example.com`;
- ports 80 and 443 open to the server (port forwarding on your router if it is at home);
- a reverse proxy that handles the HTTPS certificate: Caddy (simplest), nginx, Apache, Traefik…
If you **only use Claude Code**, private access is enough (Tailscale, WireGuard, local network), or even no
network at all if Claude Code runs on the vault's machine (`stdio` mode,
[section 5.3](#53-claude-code-on-the-vaults-machine-no-network)).
In what follows, replace:
| Example | With |
| --- | --- |
| `memory.example.com` | your subdomain |
| `alice` | the Linux user who owns the vault |
| `/home/alice/Obsidian/MyVault` | the path of the vault on the server |
## 3. Install on a Linux server (systemd)
Run every command **on the server**, over SSH.
### 3.1 Install the base packages
Debian / Ubuntu:
```bash
sudo apt update
sudo apt install -y git python3 python3-venv
python3 --version # must be 3.11 or later
```
### 3.2 Get the project
```bash
sudo git clone https://github.com/vdeabreu/obsidian-memory-mcp.git /opt/src/obsidian-memory-mcp
cd /opt/src/obsidian-memory-mcp
```
(Or copy the folder to the server with `scp -r` or `rsync`.)
### 3.3 Run the installer
```bash
sudo ./deploy/install.sh \
--user alice \
--vault /home/alice/Obsidian/MyVault \
--url https://memory.example.com
```
The script:
- installs the application in `/opt/obsidian-memory-mcp` (isolated Python environment) and the
`obsidian-memory-mcp` command in `/usr/local/bin`;
- creates the configuration `/etc/obsidian-memory-mcp/env` (readable by root only);
- generates a random **token** in `/etc/obsidian-memory-mcp/token`;
- installs and starts the `obsidian-memory-mcp` service, which runs **as `alice`**, without any privileges,
with the whole system read-only except the vault.
It must end with `Running`. Check:
```bash
curl -s http://127.0.0.1:8765/healthz # {"status":"ok","version":"0.1.0"}
systemctl status obsidian-memory-mcp
```
The `Claude/` folder is created in the vault on first start, with an empty `_Index.md`.
### 3.4 Set a password (for claude.ai and mobile)
claude.ai cannot send a static token: it connects with OAuth. In practice, when you add the connector, a page
of your server opens and asks for **a password**. Create it:
```bash
obsidian-memory-mcp hash-password | sudo tee /etc/obsidian-memory-mcp/password-hash >/dev/null
sudo systemctl restart obsidian-memory-mcp
```
The command asks for the password twice (20 characters minimum) and keeps only a hash (scrypt). Generate one
with `openssl rand -base64 30` and keep it in your password manager: it is what protects your memory on the
Internet.
### 3.5 Adjust the configuration (optional)
```bash
sudo nano /etc/obsidian-memory-mcp/env
sudo systemctl restart obsidian-memory-mcp
```
The most useful settings:
```bash
OBSIDIAN_MEMORY_DIR=Claude # folder where Claude writes
OBSIDIAN_MEMORY_READ_SCOPE=vault # "memory" so that Claude reads only its own folder
OBSIDIAN_MEMORY_EXCLUDE=Private/*,Journal/* # folders Claude must never read
OBSIDIAN_MEMORY_MCP_ALLOWED_IPS=160.79.104.0/21,153.61.208.0/20,100.64.0.0/10
# who may call /mcp: Anthropic + your machines (here Tailscale)
```
Every option is listed in [section 11](#11-configuration-reference).
### 3.6 Set up the HTTPS reverse proxy
First, point DNS: an `A` record (and `AAAA` for IPv6) `memory.example.com` → the server's public IP. Check
with `dig +short memory.example.com`.
Both sample configurations below **restrict `/mcp` to Anthropic's outbound IP ranges**, on top of the same
check inside the server (`OBSIDIAN_MEMORY_MCP_ALLOWED_IPS`). If Claude Code reaches the server from your own
machines over the Internet, add their addresses in both places (see [5.2](#52-claude-code-on-any-machine)).
Anthropic publishes its ranges under "Outbound IP addresses" on
<https://platform.claude.com/docs/en/api/ip-addresses>: check them now and then.
**With Caddy** (simplest: the certificate is automatic)
```bash
sudo apt install -y caddy
sudo cp deploy/Caddyfile /etc/caddy/Caddyfile # or add the block to your existing Caddyfile
sudo sed -i 's/memory.example.com/YOUR-DOMAIN/' /etc/caddy/Caddyfile
sudo mkdir -p /var/log/caddy && sudo chown caddy: /var/log/caddy
sudo systemctl reload caddy
```
**With nginx**
```bash
sudo apt install -y nginx certbot python3-certbot-nginx
sudo cp deploy/nginx.conf /etc/nginx/sites-available/obsidian-memory-mcp
sudo sed -i 's/memory.example.com/YOUR-DOMAIN/g' /etc/nginx/sites-available/obsidian-memory-mcp
# Get the certificate first (comment out the "listen 443" block during this step if nginx refuses to start)
sudo certbot certonly --nginx -d YOUR-DOMAIN
sudo ln -s ../sites-available/obsidian-memory-mcp /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
```
**With Apache**: `deploy/apache.conf` holds the steps and the virtual host (with the `/mcp` IP rule);
certbot adds the HTTPS part.
**With another proxy** (Traefik, Nginx Proxy Manager…): forward the whole subdomain to
`http://127.0.0.1:8765`, **keep the `Host` header**, set `X-Forwarded-For` to the client address and
`X-Forwarded-Proto: https`, **turn off response buffering**, and allow `/mcp` only from Anthropic's ranges. If
the proxy is not on the same machine (or runs in a container), put its IP in `OBSIDIAN_MEMORY_TRUSTED_PROXIES`,
and set `OBSIDIAN_MEMORY_HOST=0.0.0.0` with `OBSIDIAN_MEMORY_ALLOW_NON_LOOPBACK_LISTEN=true` only if a private
network or a firewall isolates the server: it speaks plain HTTP.
### 3.7 Check from the outside
From your computer:
```bash
curl -s https://memory.example.com/healthz
# {"status":"ok","version":"0.1.0"}
curl -s -o /dev/null -w "%{http_code}\n" -X POST https://memory.example.com/mcp
# 403 ← expected: your computer is not in Anthropic's ranges
# (401 if you added its address: then it is the missing token that is refused)
```
It is installed. Go on to [section 5](#5-connect-claude).
## 4. Alternative: install with Docker
```bash
git clone https://github.com/vdeabreu/obsidian-memory-mcp.git
cd obsidian-memory-mcp
# Secrets
mkdir -p secrets state
docker build -t obsidian-memory-mcp:local .
docker run --rm obsidian-memory-mcp:local gen-token > secrets/token
touch secrets/password_hash # empty = no password login (claude.ai)
# For claude.ai and mobile, store the password hash (the prompts stay on screen, only the hash is saved):
docker run --rm -it -u "$(id -u):$(id -g)" -v "$PWD/secrets:/out" --entrypoint sh obsidian-memory-mcp:local -c 'obsidian-memory-mcp hash-password > /out/password_hash'
chmod 600 secrets/*
# Configuration
cp deploy/env.example .env
nano .env
```
In `.env`, on top of the usual options, set:
```bash
VAULT_PATH=/home/alice/Obsidian/MyVault # the vault on the host
VAULT_UID=1000 # id -u alice
VAULT_GID=1000 # id -g alice
OBSIDIAN_MEMORY_PUBLIC_URL=https://memory.example.com
#HOST_PORT=8767 # if 8765 is already taken on the host
```
(The `OBSIDIAN_MEMORY_VAULT`, `..._TOKEN_FILE` and `..._PASSWORD_HASH_FILE` lines of `.env` are ignored:
`compose.yaml` sets them.)
```bash
sudo chown "$(id -u alice):$(id -g alice)" state
docker compose up -d --build
curl -s http://127.0.0.1:8765/healthz
```
The container listens only on `127.0.0.1:8765` (don't change that line to `8765:8765`: Docker publishes ports
past host firewalls such as ufw). Add the HTTPS reverse proxy as in [3.6](#36-set-up-the-https-reverse-proxy).
The server trusts `X-Forwarded-For` from the Docker bridge range `172.16.0.0/12`; if your Docker uses another
address pool, change `OBSIDIAN_MEMORY_TRUSTED_PROXIES` in `compose.yaml`. If your proxy itself runs in Docker, put both containers on the same
network and target `obsidian-memory-mcp:8765`.
## 5. Connect Claude
### 5.1 claude.ai, the desktop app and mobile
A connector added on claude.ai belongs to your account: it also shows up in the desktop app and in the mobile
apps. Your plan must allow custom connectors (Pro, Max, Team, Enterprise; on Team and Enterprise an admin may
have to allow it).
1. On **claude.ai**, open **Settings → Connectors** and choose **Add custom connector**.
2. Name: `Obsidian memory`. URL: `https://memory.example.com/mcp`. Leave the advanced OAuth settings empty.
3. Click **Connect**. A page of **your** server opens ("Connect to your memory"): type the password from
step 3.4, then **Allow**. Only ever type it right after clicking **Connect** yourself: if a link to that
page reaches you any other way, someone may be trying to connect *their* claude.ai account to your memory.
4. In a conversation, check in the tools menu that the connector is enabled, then ask for example:
"What is in my memory?".
The connection lasts as long as it is used: Claude renews its access by itself (one-hour access tokens,
renewed for 30 days after the last use).
### 5.2 Claude Code (on any machine)
With the static token (simplest):
```bash
# On the server, show the token:
sudo cat /etc/obsidian-memory-mcp/token
# On the machine running Claude Code:
claude mcp add --scope user --transport http obsidian-memory https://memory.example.com/mcp \
--header "Authorization: Bearer <the token>"
```
Then, in Claude Code, `/mcp` should show `obsidian-memory` as connected.
Claude Code connects from **your** machine, not from Anthropic's ranges, so `/mcp` refuses it (403) until you
allow its address. Either:
- allow your home's public IP: add it to `OBSIDIAN_MEMORY_MCP_ALLOWED_IPS` and to the proxy's rule (only if
that IP is fixed);
- or reach the proxy over Tailscale (for example by mapping `memory.example.com` to the server's Tailscale IP
in the client's `/etc/hosts`, or with Tailscale split DNS), and allow Tailscale's range `100.64.0.0/10` in
both places;
- or run Claude Code on the server itself in `stdio` mode ([5.3](#53-claude-code-on-the-vaults-machine-no-network)).
Without a token, Claude Code can also use the password: leave out `--header`, then run `/mcp` and choose to
authenticate; the same login page opens in the browser.
### 5.3 Claude Code on the vault's machine (no network)
```bash
claude mcp add --scope user obsidian-memory \
--env OBSIDIAN_MEMORY_VAULT=/home/alice/Obsidian/MyVault \
-- /opt/obsidian-memory-mcp/.venv/bin/obsidian-memory-mcp stdio
```
In `stdio` mode there is no network and no authentication: only Claude Code starts the server.
### 5.4 Avoid two competing memories
Claude also has its own memories (the claude.ai app memory, Claude Code's automatic memory). To make the vault
the reference, either:
- turn off the built-in memory in the claude.ai settings;
- or add to your **personal preferences** on claude.ai (Settings → Profile), and to your
`~/.claude/CLAUDE.md`: "My reference memory is my Obsidian vault, through the obsidian-memory connector:
look things up there and fill it with the obsidian-memory skill."
## 6. Install the skill
The connector provides the tools; the skill tells Claude **when** to use them (look before rediscovering, save
as you go, one note per subject, no secrets). It lives in
`plugin/obsidian-memory/skills/obsidian-memory/SKILL.md`.
**claude.ai, desktop app, mobile** — two ways:
- *As a plugin*: in claude.ai, open the customization menu, **Plugins** tab, **Add marketplace**, enter
`vdeabreu/obsidian-memory-mcp`, then install `obsidian-memory`.
- *As a standalone skill*: zip it and upload it in **Settings → Capabilities → Skills** (code execution must
be on):
```bash
cd plugin/obsidian-memory/skills && zip -r obsidian-memory.zip obsidian-memory
```
**Claude Code** — two ways:
```bash
# As a plugin:
/plugin marketplace add vdeabreu/obsidian-memory-mcp
/plugin install obsidian-memory@obsidian-memory
# Or by copying the folder:
cp -r plugin/obsidian-memory/skills/obsidian-memory ~/.claude/skills/
```
The skill asks Claude to write notes **in the language you speak to it**.
## 7. Sync the vault with your devices
The server works on plain files: the vault on the server and the vaults on your devices must stay in sync.
Some options:
| Tool | For | Notes |
| --- | --- | --- |
| **Syncthing** | PC, Mac, Linux, Android | Free, peer to peer, no third-party server. On iPhone, through a compatible third-party app. |
| **Obsidian Sync** | Every device, iPhone included | Paid, official. The server must be part of the sync too: check that a sync client can run on a headless server. |
| **Self-hosted LiveSync** (plugin) | Every device | Self-hosted (CouchDB), but the server's vault must also be kept up to date by a client. |
| **git** (Obsidian Git plugin) | People comfortable with git | Full history, but syncing is less immediate. |
Conflicts are rare (Claude only writes in `Claude/`), and the server refuses to overwrite a note that changed
since Claude read it.
## 8. Backups
Sync is not a backup: a note deleted or damaged on one device is deleted or damaged everywhere. Back the vault
up somewhere else, encrypted and versioned. Example with **restic** to any storage (disk, S3, Backblaze B2, or
a cloud drive through rclone):
```bash
sudo apt install -y restic
export RESTIC_REPOSITORY=sftp:backup@other-machine:/backups/obsidian # or s3:…, b2:…, rclone:…
export RESTIC_PASSWORD_FILE=/root/.restic-password # keep a copy of it elsewhere!
restic init
restic backup /home/alice/Obsidian/MyVault /var/lib/obsidian-memory-mcp
restic forget --keep-daily 7 --keep-weekly 4 --keep-monthly 12 --prune
```
Schedule it daily (systemd timer or cron), and **test a restore** now and then
(`restic restore latest --target /tmp/test`).
Inside the vault itself, `Claude/.history/` keeps the previous versions of every note Claude rewrote.
## 9. Security
**What is protected**
- **`/mcp` answers only allowed addresses**: Anthropic's outbound ranges by default, plus the ones you add,
checked both by the reverse proxy and by the server. A leaked token is useless from anywhere else. When the
proxy sends no client address, the server refuses (fail closed).
- No access without authentication: `/mcp` answers 401 without a valid token. Only `/healthz` and the OAuth
pages are public (your own browser uses them).
- The static token is compared in constant time and must be at least 32 characters.
- The password is at least 20 characters and stored only as a scrypt hash.
- OAuth: PKCE required, single-use codes valid for 5 minutes, one-hour access tokens, refresh tokens that
change on every use and cannot widen their scope. The server stores only **hashes** of tokens.
- Login page: a 2-second delay after each wrong password, and a 15-minute lockout after 5 (tokens already
issued keep working). It shows which client asks and where the code will go, warns against links sent by
someone else, cannot be framed, and runs no script.
- Clients can register only claude.ai's and claude.com's exact callback URLs, or `localhost` (Claude Code;
a code sent there only reaches the machine of whoever typed the password). At most 20 clients are kept
(the oldest idle ones are evicted) and 50 logins can wait at once, so registrations cannot fill the disk or
memory.
- The `Host` header is checked (protection against DNS rebinding).
- The server refuses to listen on anything but loopback unless you opt in: it speaks plain HTTP.
- Every tool call is logged (tool, arguments, duration, outcome) with note text replaced by its size:
`journalctl -u obsidian-memory-mcp | grep audit`.
- The service runs without privileges, with the whole system read-only except the vault and its state
directory.
Found a vulnerability? See [SECURITY.md](SECURITY.md).
**What to keep in mind**
- **The password and the token give access to the whole memory.** Keep them only in Claude and in your
password manager.
- **Known limit of the password login**: someone who adds *your* server URL as a connector in *their own*
claude.ai account gets a genuine claude.ai link to your login page. If you open it and type your password,
their account gets access. Only type the password right after clicking "Connect" yourself.
- **What Claude reads, Anthropic processes.** With `READ_SCOPE=vault`, Claude can read the whole vault: exclude
what is too personal (`EXCLUDE=Journal/*,Health/*`) or switch to `READ_SCOPE=memory`.
- **Prompt injection.** A note may contain text that came from elsewhere (an email, a web page). The server and
the skill tell Claude that notes are data, not instructions, but stay mindful of what goes into the vault.
- Secret detection is an extra safeguard, not a guarantee.
**Revoking access**
- Every device connected with the password:
`sudo systemctl stop obsidian-memory-mcp && sudo rm /var/lib/obsidian-memory-mcp/oauth.json && sudo systemctl start obsidian-memory-mcp`
- Change the static token:
`obsidian-memory-mcp gen-token | sudo tee /etc/obsidian-memory-mcp/token >/dev/null && sudo systemctl restart obsidian-memory-mcp`,
then update Claude Code (`claude mcp remove obsidian-memory`, then `claude mcp add …`).
- Change the password: redo step 3.4, then revoke the devices as above.
## 10. Upgrades, maintenance, troubleshooting
**Upgrade**
```bash
cd /opt/src/obsidian-memory-mcp
sudo git pull
sudo ./deploy/install.sh # the options from the first install are reused
```
With Docker: `git pull && docker compose up -d --build`.
**Status and logs**
```bash
systemctl status obsidian-memory-mcp
journalctl -u obsidian-memory-mcp -f # live
sudo obsidian-memory-mcp --env-file /etc/obsidian-memory-mcp/env check
```
**Common problems**
| Symptom | Likely cause | Fix |
| --- | --- | --- |
| The service does not start | Configuration error | `journalctl -u obsidian-memory-mcp -n 50`: the message says which variable to fix |
| `Permission denied` on the vault | The service does not run as the vault's owner | Run `install.sh --user <owner>` again |
| `403` on `/mcp` | The client's address is not allowed | Expected from your browser. For Claude Code, allow its address ([5.2](#52-claude-code-on-any-machine)); the server logs `Refused /mcp from <ip>` |
| claude.ai gets `403` | Anthropic added a range, or the proxy hides the client address | Update both lists from Anthropic's page; check the proxy sends `X-Forwarded-For` and `TRUSTED_PROXIES` matches it |
| `401` everywhere | Missing or wrong token | Check the `Authorization: Bearer …` header in `claude mcp add` |
| `421` or `400 Invalid Host` | The proxy drops the `Host` header, or `PUBLIC_URL` does not match the domain | Keep `Host` in the proxy; `PUBLIC_URL` = the exact address |
| claude.ai: "couldn't connect" | DNS, certificate, port 443 closed, or no password set | Test `curl https://…/healthz` from outside; redo step 3.4 |
| claude.ai: "redirect URI not allowed" | Anthropic changed its callback address | The server logs `Refused client registration, redirect_uris=…`: add that URI to `OBSIDIAN_MEMORY_ALLOWED_REDIRECTS` |
| Login page: "Too many failed attempts" | 5 wrong passwords in 15 minutes (maybe not yours: check the log) | Wait 15 minutes, or restart the service |
| Cut or very slow responses | The proxy buffers responses | `flush_interval -1` (Caddy) or `proxy_buffering off` (nginx) |
| Claude does not use the memory | Skill missing, or connector off in the conversation | Install the skill (section 6); enable the connector in the tools menu |
## 11. Configuration reference
Every variable starts with `OBSIDIAN_MEMORY_`. Secrets also accept a `_FILE` variant pointing to a file that
holds the value.
| Variable | Default | Purpose |
| --- | --- | --- |
| `VAULT` | — (required) | Path of the vault |
| `PUBLIC_URL` | — (required in HTTP mode) | Public HTTPS address, without a path: `https://memory.example.com` |
| `TOKEN` / `TOKEN_FILE` | — | Static token (32 characters minimum), for Claude Code |
| `PASSWORD_HASH` / `PASSWORD_HASH_FILE` | — | Password hash (`hash-password`, 20+ characters); enables OAuth for claude.ai and mobile |
| `DIR` | `Claude` | Vault folder where Claude writes |
| `READ_SCOPE` | `vault` | `vault`: Claude reads the whole vault; `memory`: only its own folder |
| `EXCLUDE` | — | Comma-separated globs Claude never reads: `Private/*,Journal/*` |
| `MCP_ALLOWED_IPS` | `160.79.104.0/21,153.61.208.0/20` (Anthropic) | IPs or CIDR ranges that may call `/mcp`; `*` = anyone with a valid token |
| `HOST` | `127.0.0.1` | Listen address; anything but loopback needs `ALLOW_NON_LOOPBACK_LISTEN=true` |
| `ALLOW_NON_LOOPBACK_LISTEN` | `false` | Allow listening on a non-loopback address (private container network) |
| `PORT` | `8765` | Listen port |
| `TRUSTED_PROXIES` | `127.0.0.1` | IPs of proxies whose `X-Forwarded-*` headers are trusted |
| `STATE_DIR` | `/var/lib/obsidian-memory-mcp` (systemd) or `~/.local/state/obsidian-memory-mcp` | OAuth sessions; must be outside the vault |
| `ALLOWED_REDIRECTS` | claude.ai's and claude.com's `/api/mcp/auth_callback`, `http://localhost`, `http://127.0.0.1` | OAuth redirect URIs a client may register (exact; `http://localhost` alone = any port) |
| `MAX_READ_CHARS` | `60000` | Size of a note chunk returned to Claude (longer notes are read in several calls) |
| `MAX_NOTE_CHARS` | `200000` | Maximum size of a note written by Claude |
| `LOG_LEVEL` | `INFO` | `DEBUG`, `INFO`, `WARNING`, `ERROR` |
Commands:
| Command | Effect |
| --- | --- |
| `obsidian-memory-mcp serve` | HTTP server (default) |
| `obsidian-memory-mcp stdio` | Local server for Claude Code, no network |
| `obsidian-memory-mcp check` | Check the configuration and count notes |
| `obsidian-memory-mcp gen-token` | Print a new random token |
| `obsidian-memory-mcp hash-password` | Ask for a password and print its hash |
| `--env-file FILE` | Read variables from a `KEY=value` file (the environment wins) |
## 12. Development
```bash
python3 -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/ruff check .
.venv/bin/pytest
```
CI runs the same on Python 3.11 to 3.13, plus `shellcheck` on the installer and a Docker build; dependabot keeps
dependencies, the Docker image and the actions up to date.
The tests create a temporary vault and start a real server: a full MCP session with the token, the full OAuth
flow (client registration, login page, code exchange, refresh), and every safeguard above (IP filter, redirect
allow-list, caps, lockout, audit log, listening address).
Layout:
```
src/obsidian_memory_mcp/
config.py configuration (environment variables)
vault.py reading the vault, writing the memory, history, index, log
auth.py static token and single-user OAuth server (login page)
server.py MCP tools, HTTP app, command line
plugin/obsidian-memory/ the skill, as a Claude plugin
deploy/ systemd, installer, Caddy, nginx, sample configuration
Dockerfile, compose.yaml Docker install
```
MIT license.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues