If you're tired of retyping project context every time you open Claude or Cursor, this gives your AI a persistent memory layer. It exposes eight MCP tools for managing "books" and "pages" of context with full text and semantic search via Voyage embeddings. Create books for different projects, insert pages of documentation or preferences, then let your agent search and retrieve exactly what it needs mid-conversation. The backend runs two Go servers: one for OAuth and a web dashboard, another for the MCP protocol itself with bearer token auth. Everything lives in Postgres with pgvector. Useful when you're jumping between projects or working with agents that need to remember your coding standards, API patterns, or domain knowledge without stuffing it all into every prompt.
Public tool metadata for what this MCP can expose to an agent.
book_create_or_updateCreate a new Book or update an existing one. All fields (title, source, tags) are required. If book_id is omitted a new book is created and the new book_id is returned. If book_id is provided and exists, its metadata is replaced atomically. If book_id is provided but not found...3 paramsCreate a new Book or update an existing one. All fields (title, source, tags) are required. If book_id is omitted a new book is created and the new book_id is returned. If book_id is provided and exists, its metadata is replaced atomically. If book_id is provided but not found...
tagsarraytitlestringbook_idstringbook_getRetrieve all pages of a Book in order by its book_id.1 paramsRetrieve all pages of a Book in order by its book_id.
book_idstringbook_listList available Books. Returns metadata including book_id, title, and tags.2 paramsList available Books. Returns metadata including book_id, title, and tags.
limitintegeroffsetintegerpage_deletePermanently remove a page from a Book using its book_id and page_index. Note: Page indices will not be re-indexed after deletion (gaps are normal).2 paramsPermanently remove a page from a Book using its book_id and page_index. Note: Page indices will not be re-indexed after deletion (gaps are normal).
book_idstringpage_indexintegerpage_insertInsert a page of text (≤1000 words) into a Book. Each page is an atomic, semantically meaningful chunk. Maintains retrieval quality via meaningful splitting and overlap.2 paramsInsert a page of text (≤1000 words) into a Book. Each page is an atomic, semantically meaningful chunk. Maintains retrieval quality via meaningful splitting and overlap.
book_idstringcontentstringpage_searchPerform semantic search across all Books using a natural language query. Returns matching pages with their book_id and page_index.3 paramsPerform semantic search across all Books using a natural language query. Returns matching pages with their book_id and page_index.
tagsarraylimitintegerquerystringpage_updateUpdate a specific page within a Book using its book_id and page_index. Max content size: 1000 words.3 paramsUpdate a specific page within a Book using its book_id and page_index. Max content size: 1000 words.
book_idstringcontentstringpage_indexintegerreadmeReturns the ContextBook usage guide. Call this once at the start of a session if you have not already loaded the instructions.Returns the ContextBook usage guide. Call this once at the start of a session if you have not already loaded the instructions.
No parameter schema in public metadata yet.
Stop re-explaining yourself to Agents. Give it the right context, right when needed.
LLMs are stateless — each conversation starts from scratch. ContextBook gives your AI tools a persistent, searchable knowledge library to draw the right context when they need it. No bloatware, no pre-loaded junk. Just the right information, at the right time.
flowchart LR
AI["🤖 AI Clients\nClaude · Cursor · Windsurf"]
Browser["🌐 Browser Dashboard"]
MCP["🔌 MCP Server :8081\n8 Bearer-authenticated tools"]
API["⚙️ REST API :8080\nOAuth 2.0 · Books · Pages · Search"]
DB["🗄️ PostgreSQL\npgvector · pg_trgm"]
VOYAGE["🧠 Voyage AI\nvoyage-4 (1024-dim)"]
AI -- "MCP · Bearer Token" --> MCP
Browser -- "Session · HTTP JSON" --> API
MCP --- DB
API --- DB
API -- "OAuth 2.0 PKCE" --> AI
DB --- VOYAGE
Two Go binaries share a PostgreSQL database:
cmd/api) — the control plane: user login, OAuth 2.0, dashboard, book/page CRUDcmd/mcp) — the data plane: 8 MCP tools for AI agents, protected by Bearer tokensAll tools require a valid Bearer token and are scoped to the authenticated user.
| Tool | Description |
|---|---|
book_create_or_update | Create a Book or update its metadata |
book_list | Paginated list of Book metadata |
book_get | Retrieve all pages of a Book |
page_insert | Push an atomic page into a Book; embeds immediately |
page_update | Replace a page's content; re-embeds |
page_delete | Remove a page (indices not re-numbered) |
page_search | Semantic search across all Books |
readme | Returns the usage guide (call once per session) |
CREATE DATABASE contextbook_db;
\c contextbook_db
CREATE EXTENSION IF NOT EXISTS vector;
CREATE EXTENSION IF NOT EXISTS pg_trgm;
Migrations run automatically on API server startup.
cp .env.example backend/.env
# Edit backend/.env — set DATABASE_URL, API_KEY_SALT, VOYAGE_API_KEY
cd backend
go run ./cmd/api/main.go # API + dashboard (:8080)
go run ./cmd/mcp/main.go # MCP server (:8081)
cd frontend
npm install && npm run dev # Vite dev server on :5173
For Cursor (.cursor/mcp.json):
{
"mcpServers": {
"contextbook": {
"url": "http://localhost:8081/mcp"
}
}
}
For any MCP-compatible client, point the server URL to http://localhost:8081/mcp.
context-book/
├── backend/
│ ├── cmd/api/main.go REST API + auth server
│ ├── cmd/mcp/main.go MCP tool server
│ └── internal/
│ ├── api/ REST handlers + routes
│ ├── auth/ OAuth 2.0 PKCE, sessions, SSO
│ ├── context/ Book/Page business logic
│ ├── db/ pgx queries + migrations
│ ├── embedding/ Voyage AI client
│ ├── logger/ slog + HTTP access logging
│ └── mcp/ 8 MCP tool handlers
├── frontend/ React 19 + Vite + TypeScript SPA
│ └── src/
│ ├── App.tsx Router + app shell
│ ├── lib/api.ts HTTP client
│ └── components/ UI components
├── Dockerfile API server container
├── Dockerfile.mcp MCP server container
└── go.work Go workspace
git checkout -b feature/my-feature)cd backend && go build ./cmd/api ./cmd/mcp)cd frontend && npm run build)MIT — see the LICENSE file for details.