Architecture
uShelf separates what runs on your machine from where your library lives.
flowchart TB
subgraph machine["Your machine"]
agent["Agent<br/>Claude Code, Codex"]
bridge["ushelf mcp<br/>stdio bridge"]
cli["ushelf CLI<br/>deploys and operates"]
browser["Browser"]
end
hosted["Claude and ChatGPT apps<br/>vendor cloud"]
subgraph server["uShelf server: local Docker, SSH host, Fly.io, or self-hosted"]
mcp["MCP endpoint<br/>/mcp"]
api["HTTP API<br/>/api"]
web["Web reader"]
core["Core<br/>ShelfService"]
md[("Markdown<br/>source of truth")]
db[("SQLite FTS5<br/>disposable index")]
end
agent -- stdio --> bridge
bridge -- "HTTPS, API token" --> mcp
hosted -- "HTTPS, OAuth" --> mcp
cli -.-> api
browser -- "HTTPS, password" --> web
web --> api
mcp --> core
api --> core
core --> md
core -. "rebuilt from Markdown" .-> db
- The server is one container. It owns the library and serves the web reader, the HTTP API, and the MCP endpoint at
/mcp. Exactly one server process writes a given library. - The CLI (
ushelf) deploys and operates servers, stores their connection details as contexts, and configures agent clients. - The MCP bridge (
ushelf mcp) is a small local process that agents launch over stdio. It relays each MCP message to the server over HTTPS with the context’s API token. Agents can also connect over HTTP directly. - Hosted AI apps such as Claude (web, desktop, mobile) and ChatGPT connect to
/mcpfrom their own cloud and sign in with OAuth, approved once with the app password.
Components
Section titled “Components”| Layer | What it does |
|---|---|
| CLI | Deployment contexts, updates, agent setup, and the local MCP bridge |
| Core | Capture, validation, Markdown storage, SQLite search, and domain rules |
| MCP | Agent tools for saving, enriching, searching, reading, and managing items |
| HTTP server | API, MCP endpoint, web hosting, index rebuilding, and Markdown import |
| Web reader | Search, filters, reading progress, and local Mermaid rendering |
| Agent skills | Guided ingestion and library workflows |
The HTTP and MCP adapters are thin: both delegate to ShelfService in Core, so business rules exist in one place.
Repository map
Section titled “Repository map”packages/core Shared domain and storage layerapps/cli Native Cobra CLI, deployment drivers, and MCP bridgeapps/server HTTP and CLI adapter, MCP endpoint hostapps/mcp MCP tool surface hosted by the serverapps/web React and Vite readerapps/docs This documentation siterecipes Versioned enrichment instructionsskills Agent ingestion and library workflowsEach package has a README with its runtime details. See CONTRIBUTING.md to work on the code.