Sponsored by Deepsite.site

Context Book

Created By
Adityaa month ago
Stop re-explaining yourself to agents. Give it the right context right when it is 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.
Overview

ContextBook

smithery badge License: MIT

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.

How It Works

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:

  • API server (cmd/api) — the control plane: user login, OAuth 2.0, dashboard, book/page CRUD
  • MCP server (cmd/mcp) — the data plane: 8 MCP tools for AI agents, protected by Bearer tokens

MCP Tools

All tools require a valid Bearer token and are scoped to the authenticated user.

ToolDescription
book_create_or_updateCreate a Book or update its metadata
book_listPaginated list of Book metadata
book_getRetrieve all pages of a Book
page_insertPush an atomic page into a Book; embeds immediately
page_updateReplace a page's content; re-embeds
page_deleteRemove a page (indices not re-numbered)
page_searchSemantic search across all Books
readmeReturns the usage guide (call once per session)

Quick Start

Prerequisites

1. Set up the database

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.

2. Configure environment

cp .env.example backend/.env
# Edit backend/.env — set DATABASE_URL, API_KEY_SALT, VOYAGE_API_KEY

3. Run the backend

cd backend
go run ./cmd/api/main.go    # API + dashboard (:8080)
go run ./cmd/mcp/main.go     # MCP server (:8081)

4. Run the frontend (optional)

cd frontend
npm install && npm run dev    # Vite dev server on :5173

5. Connect an AI client

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.

Documentation

  • Backend README — API routes, auth flows, database schema, MCP tools, configuration
  • Frontend README — components, routing, design system, development setup
  • Architecture — full system overview with Mermaid diagrams

Project Structure

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

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/my-feature)
  3. Make your changes
  4. Ensure the backend compiles (cd backend && go build ./cmd/api ./cmd/mcp)
  5. Ensure the frontend builds (cd frontend && npm run build)
  6. Commit and push
  7. Open a Pull Request

License

MIT — see the LICENSE file for details.

Server Config

{
  "mcpServers": {
    "context-book": {
      "url": "https://context-book-mcp-production.up.railway.app"
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
Amap Maps高德地图官方 MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
ChatWiseThe second fastest AI chatbot™
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
Tavily Mcp
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
Playwright McpPlaywright MCP server
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
DeepChatYour AI Partner on Desktop
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
CursorThe AI Code Editor
Serper MCP ServerA Serper MCP Server
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
WindsurfThe new purpose-built IDE to harness magic