English | 日本語
An AI-first knowledge base co-managed by AI and humans.
A place where AI can search, read, and write the information it needs on its own. No more manually pasting context into prompts.
After my personal projects surpassed 20, using documents stored in Notion from AI tools became painful.
Even a small edit incurred latency, and repeated read/write cycles consumed non-trivial tokens. I looked at other services and apps, but couldn't find one that was both accessible from chat apps and CLI agent tools, and designed with AI in mind.
Notion is great as a tool for humans to read. But its rich block structure gets in the way for AI — you can only retrieve information per page, so fetching a single paragraph costs the tokens of the entire page.
Context Mixer is a knowledge base designed with AI explorability as the top priority.
Access directly from Claude Desktop or Claude Code via MCP. Just say "check this project's design policy" and the AI will search and fetch the relevant documents for you. No need to paste context into prompts.
Choose "how much" of a document to read:
GET /docs/:id?view=meta → title + summary only (tens of tokens)
GET /docs/:id?view=outline → heading structure
GET /docs/:id?view=section → specific section only
GET /docs/:id?view=full → full text
The AI first checks meta to judge relevance, then fetches only the needed parts via section. Since it doesn't ingest the full text every time, token consumption drops dramatically.
Browse the collection tree, edit documents in Markdown, and full-text search — all from the browser. Built lightweight with HTMX, running on server-side rendering only.
| Who | Auth Method | Use Case |
|---|---|---|
| Human (browser) | Clerk session auth | Web UI login |
| AI (REST API) | API key (scope + collection restrictions) | Access from external services |
| AI (MCP) | OAuth 2.1 | Connections from Claude.ai, ChatGPT, etc. |
API keys support policies like "this key can only read this project." You can restrict permissions for keys handed to less trusted external services, giving you peace of mind.
- Full-text search — Fast search via D1's FTS5 (trigram). Handles hyphenated terms
- Document links —
[[doc_xxx]]syntax for inter-document links. Backlinks auto-generated - Revision history — Signed revisions recorded for every write. Track who (human/AI/OAuth) changed what
- File attachments — Upload images etc. to R2, embed in documents
- Inbox — Ingest external submissions via an approval flow
| Component | Choice | Reason |
|---|---|---|
| Runtime | Hono on Cloudflare Workers | Runs on edge, generous free tier |
| DB | D1 (SQLite-compatible) | Workers integration, FTS5 full-text search |
| Storage | R2 | Free egress, image storage |
| Frontend | HTMX + Workers Assets | No build step, server-side rendering |
| Auth | Clerk + API key + OAuth 2.1 | Three auth systems for humans, AI, and MCP clients |
| MCP | workers-oauth-provider | Cloudflare official, Streamable HTTP |
Everything is on Cloudflare for cost reasons. A knowledge base is something you use for years once built, so having running costs near zero (within the free tier for personal use) is quietly significant.
9 tools available to AI via MCP:
| Tool | Description | Scope |
|---|---|---|
search_docs |
Keyword full-text search with snippets | read |
get_doc |
Get document (meta/outline/full/section) | read |
list_collections |
List collections (tree structure) | read |
list_docs |
List documents in a collection (lightweight, no body) | read |
get_entrypoint |
Get entrypoint document | read |
write_doc |
Create or update document | write |
append_doc |
Append content to end of document | write |
delete_doc |
Delete document | write |
create_collection |
Create collection | write |
| Client | Connection Method |
|---|---|
| Claude.ai | Settings → Connectors → Custom Connector → Enter URL |
| Claude Code | Register as remote MCP server via claude mcp add |
| ChatGPT | Settings → Connectors → Add connector (beta) |
| MCP Inspector | Debug with npx @modelcontextprotocol/inspector |
- Node.js 18+
- Wrangler CLI (
npm install -g wrangler) - Cloudflare account (free tier is fine)
- Clerk account (for auth, free tier is fine)
git clone https://github.com/iwabuchi404/context-mixer.git
cd context-mixer
npm install# Log in to Cloudflare
npx wrangler login
# Create D1 database
npm run d1:create
# → Note the outputted database_id
# Create R2 bucket
npm run r2:create
# Create KV namespace (for MCP OAuth)
npx wrangler kv namespace create OAUTH_KV
# → Note the outputted idDo not write the obtained IDs into wrangler.toml — use them as environment variables or CI/CD Secrets as described below.
- Create an app at Clerk
- Obtain the following values:
CLERK_SECRET_KEYCLERK_PUBLISHABLE_KEYCLERK_FRONTEND_API(e.g.https://your-app.clerk.accounts.dev)CLERK_SIGN_IN_URL(e.g.https://your-app.clerk.accounts.dev/sign-in)
For local development (.dev.vars):
ENVIRONMENT=development
CLERK_SECRET_KEY=sk_test_xxxx
CLERK_PUBLISHABLE_KEY=pk_test_xxxx
CLERK_FRONTEND_API=https://your-clerk-app.clerk.accounts.dev
CLERK_SIGN_IN_URL=https://your-clerk-app.clerk.accounts.dev/sign-inFor production:
npx wrangler secret put ENVIRONMENT
# value: production
npx wrangler secret put CORS_ORIGIN
# value: your production URL (e.g. https://your-app.example.com)
npx wrangler secret put CLERK_SECRET_KEY
npx wrangler secret put CLERK_PUBLISHABLE_KEY
npx wrangler secret put CLERK_FRONTEND_API
npx wrangler secret put CLERK_SIGN_IN_URLNote: Do not put Clerk values and
CORS_ORIGINin[vars]inwrangler.toml. Every deploy will overwrite the production dashboard Secrets.Dev/Prod switching: Previously, production was detected by the presence of
CLERK_FRONTEND_API, but since.dev.varscan have the same variable name, the detection was ambiguous. Use theENVIRONMENTvariable explicitly to switch. You can check the current value via theenvironmentfield inGET /auth/configorGET /health/config.
# Local
npm run d1:migrate-local
# Production
npm run d1:migrateConfigure the following in the dashboard:
| Setting | Value |
|---|---|
| Deploy command | npm run deploy |
| Build variables | D1_DATABASE_ID, OAUTH_KV_ID |
Pushing to the main branch triggers automatic deployment.
Set environment variables, then run:
# macOS/Linux
export D1_DATABASE_ID="your-d1-database-id"
export OAUTH_KV_ID="your-oauth-kv-id"
npm run deploy
# Windows PowerShell
$env:D1_DATABASE_ID="your-d1-database-id"
$env:OAUTH_KV_ID="your-oauth-kv-id"
npm run deploynpm run deploy runs scripts/make-wrangler-toml.js, which generates wrangler.toml from environment variables before deploying. The local wrangler.toml remains with placeholders.
Note: The generated
wrangler.tomlincludes only D1/KV/R2/ASSETS. If you have customroutesorvarsconfigured in the Cloudflare dashboard, they may be overwritten on deploy. If you use custom domains or additionalvars, reconfigure them in the dashboard or forkscripts/make-wrangler-toml.jsto extend it.
Create .github/workflows/deploy.yml and register the following in GitHub Secrets:
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDD1_DATABASE_IDOAUTH_KV_ID- Clerk-related Secrets as needed
See the official docs for detailed setup: GitHub Actions · Cloudflare Workers
After deployment, access via the Workers URL (e.g. https://context-mixer.<your-subdomain>.workers.dev).
Register the /mcp endpoint of your deployment as the MCP server URL in each client.
Example — Claude Code:
claude mcp add context-mixer --transport http https://context-mixer.<your-subdomain>.workers.dev/mcpnpm run devThe dev server starts at http://localhost:8787.
GET /health— Health checkGET /— API info
GET /auth/login— Redirect to Clerk login
GET /collections— List collections (tree)POST /collections— Create collectionPATCH /collections/:id— Update collectionDELETE /collections/:id— Delete collection
GET /docs— List documentsGET /docs/:id?view=meta|outline|full— Get documentPOST /docs— Create documentPATCH /docs/:id— Update documentDELETE /docs/:id— Delete documentPOST /docs/:id/append— Append to endGET /docs/:id/history— Revision history
GET /search?q=— Full-text searchPOST /files— File uploadPOST /inbox/:token— Post to InboxGET /entrypoint— Workspace entrypointGET /me/entrypoint— User's personal entrypointPOST /mcp— MCP JSON-RPC endpoint (OAuth auth)
See docs/design-doc.md for details.
- docs/USAGE.md — Usage guide (Web UI, API keys, MCP connection)
- docs/design-doc.md — Detailed design
- docs/MCP.md — MCP implementation policy
- docs/STATUS.md — Development progress and handoff
MIT