Stop re-explaining yourself to Agents. Give it the right context, right when needed.
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.
This listing does not have a supported local package template. Use the maintainerβs documentation for its hosted endpoint, authentication, and client-specific setup. No install command has been inferred.