mysharedbrain
This server exposes an MCP interface for managing a markdown knowledge vault and interacting with a librarian agent.
Create, read, update, delete, restore, and move notes in the vault.
List notes by folder prefix with pagination, or list directory contents.
Read multiple notes at once, with missing IDs reported gracefully.
Append content to a note or patch a section under a specific heading.
Get and set YAML frontmatter, including deleting keys with null values.
Search notes by name/content (ripgrep) or by frontmatter tag.
View note history, recent changes, backlinks, and outgoing links.
Give feedback to the librarian, queuing edits or questions for later review.
Ask the librarian questions, answered from the vault or filed for future retrieval.
Provides a Dockerfile to build a single runtime image that includes both the backend and the UI; images are published to ghcr.io and can be run with Docker.
Configuration uses a .env file (copied from .env.example) to set environment variables such as VAULT_DIR.
The backend is built with FastAPI, exposing a REST API for notes, search, feedback, capture, request, audit, and health endpoints.
Changes to the vault and feedback queue are recorded in an append-only JSONL audit log, analogous to git history for auditing purposes.
The project is hosted on GitHub and uses GitHub Actions for CI and Docker image publishing, with images pushed to GitHub Container Registry (ghcr.io).
Stores each note as a Markdown file in a vault, with folders represented as real directories, supporting flat or nested structures.
The project uses pytest for testing, following a TDD approach with tests run via uv.
Implemented in Python 3.13, using uv for dependency management and packaging.
MySharedBrain
A markdown vault with a librarian — an information system built for AI to read and write, where the writing is checked before it counts.
What it is
It is a knowledge vault. a shared context.
Notes are .md files in ordinary folders, flat or nested. A librarian agent
reads them, answers questions from them, and files what it cannot answer. A web
UI covers both sides: pages you can edit, and a queue of what the librarian wants
to change in them.
Related MCP server: Markdown Memory Context MCP Server
What problem it solves
Context. An agent can be excellent at the work and still fail, because what it was given is outdated, incomplete or simply gone. People fare no better: the document is two years old, the note no longer matches reality, and nobody knows which page is current. Capability is not the bottleneck — context is.
MySharedBrain maintains a wiki that holds that context:
Automated update. A librarian agent reads and writes the vault, so documents get corrected instead of rotting and gaps get filed instead of filled with guesses.
Context management. Every entry is a page, every change is reviewed and attributed, and what the vault cannot answer stays visible as a queued question.
A shared context. Built-in MCP, REST API and a web UI read and write the same vault, so agents and people work from one source instead of each keeping a private copy that drifts.
It is built to manage shared context for the many: several agents and humans on the same facts, where correcting something once corrects it for everyone — and where machine-written text is plausible before it is true, which is why nothing lands unreviewed.
Quick start
git clone https://github.com/hampusadamsson/mysharedbrain && cd mysharedbrain
uv sync # uv fetches Python 3.13
cp .env.example .env # VAULT_DIR, defaults to ./vault
uv run mysharedbrain # API + docs on http://localhost:8000The vault works without a model; the librarian does not:
export OPENAI_API_KEY=sk-… # any provider, see Configuration
curl -sX POST localhost:8000/api/request -H 'Content-Type: application/json' \
-d '{"question":"what runs on elitedesk?"}'No clone needed — run it straight from GitHub with uvx (API + MCP, no bundled UI):
uvx --from git+https://github.com/hampusadamsson/mysharedbrain mysharedbrain --help
VAULT_DIR=/path/to/vault uvx --from git+https://github.com/hampusadamsson/mysharedbrain mysharedbrainThen docs live at http://localhost:8000/docs. VAULT_DIR defaults to
./vault; BRAIN_CONFIG defaults to ./brain.yaml (missing file = defaults).
Pin a revision with git+https://github.com/hampusadamsson/mysharedbrain@<sha>.
The git checkout carries no built UI (/static/ is git-ignored), so uvx serves
the API only — pair it with docker below or cd frontend && pnpm dev for
the web UI.
Give it to an agent over MCP (stdio):
{ "mcpServers": { "mysharedbrain": {
"command": "uv", "args": ["run", "mysharedbrain", "--mcp"],
"cwd": "/path/to/mysharedbrain",
"env": { "VAULT_DIR": "/path/to/vault" }
} } }Same over uvx, no checkout (drop cwd, uvx resolves the package itself):
{ "mcpServers": { "mysharedbrain": {
"command": "uvx",
"args": ["--from", "git+https://github.com/hampusadamsson/mysharedbrain", "mysharedbrain", "--mcp"],
"env": { "VAULT_DIR": "/path/to/vault" }
} } }Or run the image, which serves API and UI from one process:
docker run -p 8000:8000 -v mysharedbrain-data:/data/vault \
-e OPENAI_API_KEY=… ghcr.io/hampusadamsson/mysharedbrain:latestHow to operate
Where | What you do there |
Pages | Read and edit the vault; a page shows its own history |
Ask | One question → one librarian run. A miss files a |
Capture | Review the queue: apply, approve or reject, or set any state |
Activity | The whole audit log, filterable by kind; filter on |
Settings | Agent, Ask, Jobs, Tools, MCP servers, Templates — plus export/import of the effective config |
Jobs run the same librarian on a schedule with narrower tools. The shipped
schedule is four disabled examples forming a pipeline: capture-triage rules
on pending entries, capture-apply incorporates the approved ones,
vault-layout reshapes notes to the layout template, vault-audit re-checks
sources and files requests. Every run is recorded (Settings → Jobs → History)
and audited.
Its reach is bounded on purpose: no shell, no local (stdio) MCP servers, no
multi-user auth. The tools it may use are vault notes, the capture queue, and
whichever remote MCP servers you enable — never more than a human reviewer has.
Configuration
One config document drives the agent, its tools, MCP servers and jobs. Copy
brain.example.yaml to brain.yaml, or point BRAIN_CONFIG at a mounted file.
Environment overrides use BRAIN__ with __ nesting, and always win:
BRAIN__AGENT__MODEL=openai:gpt-4o
BRAIN__AGENT__API_KEY=sk-… # from a secret, never committedPrecedence, lowest to highest: defaults → seed file → saved settings →
environment. The settings page saves into VAULT_DIR/.brain/brain.db, so the
seed file stops mattering once you save; delete that row to hand control back.
GET /api/settings/export prints the effective config as YAML with the token
masked.
agent:
model: openai:gpt-4o-mini
api_key_env: OPENAI_API_KEY
instructions_file: librarian.md # markdown the librarian may rewrite
temperature: 0.2
ask:
enabled: true
timeout_seconds: 60
scheduler:
enabled: true
tick_seconds: 30
jobs:
- id: capture-triage
every: 4h # or: cron: "0 3 */2 * *"
instructions: Group and resolve the pending capture queue.Any provider, any endpoint: agent.provider is optional — leave it empty and
the model string decides everything; fill in name, base_url, api_version
and options to point at a local server or a gateway.
GET /api/settings/providers lists what this install can import. Remote MCP
servers are declared in the same file (http/sse, with headers, enabled
and an insecure switch that skips TLS verification — only for a network you
trust).
Ignore rules hide vault paths from the brain. vault.ignore in the same file
plus a .brainignore file at the vault root (same syntax, # comments) apply
together. Gitignore-style, blocklist only (no ! negation): full file names
with the .md suffix, globs, or whole directories with a trailing slash:
vault:
ignore: [drafts/*, scratch.md, archive/]Ignored notes vanish from listings, search and backlinks, and any read or
write on them fails naming the matching rule. .brain/ is always ignored.
Where things live
The vault is VAULT_DIR: notes as .md files, and beside them
.brain/brain.db (SQLite, WAL) holding the audit log, the capture queue, job
runs and saved settings. If the database file cannot be opened (read-only
filesystem, …), sidecar state falls back to process memory with a warning —
survival, not storage: it dies on restart. Back the directory up and you have
everything. Note ids
are validated as paths and resolved, so a symlink inside the vault cannot reach
outside it.
API
Two interfaces over the same vault: REST for anything HTTP, MCP for agents. Every MCP tool maps to a route, so a client can reach the vault either way. The reverse has deliberate exceptions, listed below: configuration and queue moderation stay HTTP/UI-only, because an agent that could rewrite its own settings or approve its own queue entries would be checking its own work.
REST docs:
/docson a running instance — Swagger UI generated from the app, so it is never out of date — plus/redocand/openapi.json.MCP: stdio (
uv run mysharedbrain --mcp) or Streamable HTTP (POST /mcp/on a running instance; bare/mcp307-redirects), with tools, resources (vault://<id>,vault://index) and prompts (ask_librarian,file_feedback).
Task | REST | MCP |
Check it is up |
| — |
List pages |
|
|
Read a page / several |
|
|
Create a page |
|
|
Replace a page |
|
|
Append |
|
|
Replace a section |
|
|
Delete / restore |
|
|
Move or rename |
|
|
Browse a folder |
|
|
Search names + content |
|
|
Search by tag |
|
|
Read / merge frontmatter |
|
|
Links in / out |
|
|
One page's history |
|
|
Recent changes |
|
|
File feedback |
|
|
Ask the librarian |
|
|
Review the queue |
| — (UI, or the librarian's own tools) |
Settings, checks, jobs |
| — (UI) |
Deploy and develop
Images publish to ghcr.io/hampusadamsson/mysharedbrain: sha-<commit> and
latest on every main build, plus vX.Y.Z when a release is published.
Mount one volume at /data/vault, set the key from a secret, point the ingress
at port 8000; the probe is GET /health.
uv sync && uv run pytest src/tests/ -q # backend (TDD; main stays green)
uv run ruff check src/ && uv run basedpyright
cd frontend && pnpm dev # UI on :5173, proxying /api
pnpm check && pnpm lint && pnpm test && pnpm buildCommits follow Conventional Commits: Release Please reads them to cut versions, and CI vets them on every pull request.
License
MIT — see LICENSE.
Available Tools
21 toolsappend_noteAppend NoteA
Append content to the end of a note. Prefer over full rewrites.
Inputs: content (required), note_id (required). Returns: object
ask_questionAsk QuestionA
Ask the librarian. Answered from the vault when possible, otherwise filed as an automated question for future retrieval.
Inputs: question (required). Returns: object
create_noteCreate NoteA
Create a new markdown note. Folders are created from the id path.
Inputs: note_id (required), content. Returns: object
delete_noteDelete NoteA
Soft-delete a note to trash (restorable with restore_note).
Inputs: note_id (required). Returns: object
get_backlinksGet BacklinksB
Notes linking to this one via [[links]].
Inputs: note_id (required). Returns: object
get_frontmatterGet FrontmatterD
A note's YAML frontmatter (tags, etc.).
Inputs: note_id (required). Returns: object
get_outgoingGet OutgoingC
[[Link]] targets a note points to.
Inputs: note_id (required). Returns: object
give_feedbackGive FeedbackA
Teach the brain: queue feedback the librarian applies later.
This is the self-learning loop — the single most important tool here. Either hand over the information itself (a correction, a fact, content for a missing note) or say where to get it (a source to check, what is missing). The entry lands in the capture queue as pending and the librarian reviews it (applied/approved/rejected) before the vault changes.
"kind is one of: edit | missing | request | question.
Inputs: body (required), kind (required), note_id. Returns: object
list_directoryList DirectoryA
Direct children of a folder: subfolders and note ids.
Inputs: prefix. Returns: object
list_notesList NotesA
List note ids, sorted, with optional folder prefix and pagination.
Inputs: limit, offset, prefix. Returns: object
move_noteMove NoteC
Move/rename a note.
Inputs: new_id (required), note_id (required). Returns: object
note_historyNote HistoryB
Every logged interaction with one note (reads, finds, edits …).
kind filters to one category: read | find | write | move | delete | capture | job | other. Returned with per-kind counts for that file.
Inputs: note_id (required), kind, limit, offset. Returns: object
patch_notePatch NoteB
Replace (or append to) the section under a heading. Surgical edits.
Inputs: content (required), heading (required), note_id (required), mode. Returns: object
read_noteRead NoteB
Read a note by id.
Inputs: note_id (required). Returns: object
read_notesRead NotesA
Read several notes at once; missing ids are reported, not fatal.
Inputs: note_ids (required). Returns: object
recent_changesRecent ChangesA
Latest audited vault and capture changes, newest first (paged).
Returned with per-kind counts for the whole log, the same shape the per-note history reports for one file.
Inputs: limit, offset. Returns: object
restore_noteRestore NoteA
Restore a trashed note back into the vault.
Inputs: note_id (required). Returns: object
search_by_tagSearch By TagD
Notes carrying a frontmatter tag.
Inputs: tag (required). Returns: object
search_notesSearch NotesB
Search notes by name and content (ripgrep).
Inputs: query (required), limit, offset. Returns: object
set_frontmatterSet FrontmatterB
Merge keys into frontmatter (null value deletes a key).
Inputs: note_id (required), updates (required). Returns: object
update_noteUpdate NoteB
Replace a note's content by id.
Inputs: content (required), note_id (required). Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Most tools are clearly distinct (create/read/update/delete/move/list/append/patch), but read_note vs read_notes and list_notes vs list_directory could cause minor confusion. The descriptions help clarify the differences, so overall the set is well-disambiguated.
The majority follow a consistent verb_noun pattern (create_note, read_note, update_note, delete_note, restore_note, move_note, list_notes, search_notes). Minor deviations like get_frontmatter vs set_frontmatter and note_history vs recent_changes are still readable and mostly consistent.
21 tools is on the higher end but appropriate for a note/knowledge management server covering CRUD, frontmatter, links, search, history, and feedback. Each tool serves a distinct purpose, though a few could potentially be consolidated.
The tool surface is comprehensive: full note lifecycle (create/read/update/delete/restore/move), batch reads, surgical edits, frontmatter management, search, backlinks/outgoing links, history, recent changes, and a feedback loop. There are no obvious dead ends for the stated purpose of a shared brain/note vault.
Maintenance
Related MCP Connectors
Markdown notes and whiteboards your AI agent can read and write.
Markdown workspace for AI agents: read, write, organize, and share markdown documents.
Markdown notes in folders, with files, that your AI assistant can read, write and organise.
Markdown notes in folders, with files, that your AI assistant can read, write and organise.
Related MCP Servers
- FlicenseAqualityDmaintenanceEnables AI assistants to manage a personal markdown-based knowledge base with natural language interactions. Supports creating, searching, updating, and organizing notes across categories like people, recipes, meetings, and procedures.111-
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to maintain a structured Markdown or Obsidian memory vault with tools for reading, writing, searching, and organizing notes.MIT
- AlicenseAqualityBmaintenanceProvides an AI agent with a searchable markdown notes vault, offering tools to create, read, list, search, update, and delete notes stored as plain .md files.6MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to semantically search and retrieve content from a local Markdown vault. Provides tools for fetching specific notes and finding related ones via embeddings and wikilinks.MIT