
Context Keeper (remote)
io.github.jarmstrong158由 GitHub 账号 jarmstrong158 发布v0.2.0更新于 Oct 24, 2026
Cloudflare Worker remote backend for context-keeper (D1). MCP 2026-07-28, dual-era.
概览
部署在 Cloudflare Workers 上的远程 MCP 服务器,保存并检索项目的决策、约束与流程,让助手跨会话回忆决策依据。
- 可以做什么
- 记录决策、约束与流程条目,提供统一工具及旧版别名工具
- 按相关度检索上下文,或按 id、类型、标签、状态与文本做结构化筛选
- 生成项目摘要、列出所有项目及各自计数、重新加载生效中的约束
- 更新、弃用或清理条目,并标记缺少理由字段的条目
- 导出为 DECISIONS.md 风格文档,并从本地 JSON 存储格式批量导入或 upsert
- 读取或设置默认项目等配置项
- 适用场景
- 适合希望助手长期保存并查询“为何这样决定”“哪些规则必须遵守”的记录,并希望在任何会话(包括手机)中都能取用这些上下文、无需本机常开的情况。
- 运行要求
- 需要一个已部署的 Cloudflare Worker 实例及 D1 数据库,可用维护者的实例或通过一键部署自建。Worker 上必须设置 AUTH_TOKEN 密钥,连接器 URL 需把该令牌作为最后一段路径。可选的手机视图另需 VIEW_TOKEN,配置时还需克隆仓库并安装 Node 22 以上版本。
安装
在 SourceWeft 中
- 打开 控制台中的 Context Keeper (remote),将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
context-keeper-remote
Part of the xylem stack.
A remote MCP server on Cloudflare Workers that exposes context-keeper's rationale store (decisions, pipelines, constraints) over Streamable HTTP. It works as a claude.ai custom connector, including on mobile, so your project's decisions and constraints are available from any Claude session — no PC left running, no tunnel.
It also serves a phone app for reading that store yourself: install it to your home screen once and it opens with no login and no token in the URL. Tabs for recent activity, per-project counts, cambium knowledge, and store health — and tapping any entry gives you the full rationale, not just its title. Optional, opt-in, and on its own read-only credential.
Self-host your own copy in a few clicks with the button above — Cloudflare copies this repo into your GitHub account, creates a fresh D1 database for you, and deploys the Worker. Then you add one secret and paste a URL into Claude. Full walkthrough below; every step is a click, no command line anywhere.
The maintainer's own instance runs at
https://context-keeper-remote.jarmstrong158.workers.dev. Yours will be at your own subdomain after you deploy.
Why it's built this way
- Worker, not tunnel — no "PC must be on" dependency.
- D1, not KV — row-level writes and
WHEREqueries; two writers (desktop + mobile) don't clobber each other the way whole-file JSON read-modify-write does. - Stateless handler, no Durable Objects — the tools are stateless RPCs against D1, so the Worker runs on the Cloudflare free plan.
- Secret-path auth — claude.ai custom connectors don't reliably send custom bearer headers, so the token is the last path segment of the URL. The URL is the credential.
- Self-migrating — the Worker creates its own D1 schema at runtime, so a brand-new empty database needs no manual SQL (verified by a cold-start test).
Self-host it (one-click, no command line)
Step 1 — Click "Deploy to Cloudflare"
Click the Deploy to Cloudflare button at the top of this page. Cloudflare will:
- Ask you to authorize GitHub and pick an account — it copies this repo into your GitHub account (you get your own repo).
- Automatically create a new D1 database in your Cloudflare account and bind it to the Worker. (This works because the Worker's config declares the database binding without a hard-coded id, so Cloudflare provisions a fresh one for you.)
- Set up Workers Builds so every push to your new repo redeploys automatically.
- Build and deploy the Worker.
When it finishes, your Worker is live at
https://context-keeper-remote.<your-subdomain>.workers.dev. Note that URL — you'll
need it in Step 3. (You can always find it under Workers & Pages in the
dashboard.)
Nothing to configure in the repo, and no SQL to run — the database starts empty and the Worker creates its tables on the first request.
Step 2 — Add the AUTH_TOKEN secret (Cloudflare dashboard)
The Worker refuses every request until it has an auth token, so set one:
- Cloudflare dashboard → Workers & Pages → your context-keeper-remote Worker.
- Settings → Variables and Secrets → Add.
- Type: Secret. Name:
AUTH_TOKEN. Value: a long random string (32+ characters — treat it like a password). Save/Deploy.
That value is your connector's password. Keep it somewhere safe; you'll paste it in the next step.
Also deploying the companion agentsync-remote worker?
agentsync-remote uses the same AUTH_TOKEN scheme, and additionally needs, in
its Worker's Variables and Secrets:
- a Secret named
GH_PAT— a GitHub personal access token, and - a Variable named
REPO— set to theowner/repoit should sync.
Those two do not apply to context-keeper-remote (this repo) — it only needs
AUTH_TOKEN. See the agentsync-remote README for its specifics.
Step 3 — Add the custom connector in claude.ai
-
claude.ai → Settings → Connectors → Add custom connector.
-
Paste your Worker URL with the token as the final path segment:
Replace
<your-subdomain>with your Worker's subdomain (Step 1) and<AUTH_TOKEN>with the exact value you set (Step 2). -
Save. The tools (
record_entry,get_context,query_entries, …) are now available in your Claude sessions.
Check it works: ask Claude to call get_project_summary. If it answers, the
whole chain (deploy → auto-provisioned D1 → auto-migration → auth) is working.
Step 4 — Migrate existing local data (optional)
If you already run local context-keeper, ask Claude (with the connector enabled) to
call import_entries, pasting each file's contents:
decisions.json→import_entries(project, kind="decision", entries=[...])pipelines.json→import_entries(project, kind="pipeline", entries=[...])constraints.json→import_entries(project, kind="constraint", entries=[...])
Incoming ids are preserved; existing ids are reported, never overwritten.
Step 5 — Install the phone view (optional)
Everything above is the MCP connector, which is for Claude to read. Step 5 is for you to read it, from your phone. It needs a clone of this repo and Node 22+, which is the only part of the setup that touches a command line — the connector itself never does.
See the phone view below.
The phone view
/view is a read-only, server-rendered page of every project's decisions and
constraints. Install it to your home screen and it opens like an app: no login,
no token in the URL, nothing to remember.
Synthetic data. Every project and entry above is invented — see docs/screenshots for the dataset and how to regenerate these.
It has four tabs, matching the desktop dashboard:
Tap any row for the full entry: problem, why it was chosen, what was tried first, tradeoffs, alternatives with the reason each was rejected, and — for constraints — scope, hardness, and what enforces it. Search covers every field, including the reasoning, which is usually where the answer is. Superseded entries stay reachable, and each entry links to what it replaced and what replaced it.
Install
1. Create the credential. Double-click scripts/set-view-token.cmd
(macOS/Linux: scripts/set-view-token.sh). From a terminal use the absolute path
— not npm run, which needs the repo as your current directory:
One run generates the token, installs it, waits for the route to answer 200,
copies the URL, opens it in your browser, and prints a QR code.
2. Scan the QR with your phone, then install it:
- Android / Chrome — a banner offers Install, or use ⋮ → Install app. If the menu only says Add to Home screen, the manifest is failing Chrome's install criteria; the usual cause is a missing 192x192 icon, which makes Chrome degrade silently to a plain shortcut that opens in a browser tab.
- iPhone — must be Safari (Chrome on iOS cannot install web apps). Share → Add to Home Screen.
Then tap through Recent, Projects, Knowledge and Health once while you have signal — the offline cache only fills for pages you have actually opened.
Add -DryRun to run everything except the install, which is the fastest way to
check your setup before touching anything.
It works offline, and a tap is instant
A service worker caches every page you open, cache-first with a background revalidate. Measured on the live instance:
So it opens with no signal, and switching tabs is instant rather than a round-trip. A decision log is not a live feed — showing yesterday's answer immediately and correcting it a moment later beats showing nothing for 300ms, and the header carries an "8h ago" stamp so stale data is never presented as current.
Only 200s are cached. A 404 is what this Worker returns for an
unauthenticated or rotated credential, and caching one would mean a device that
rotated its token keeps being told it is signed out — from its own disk, with no
network involved and no obvious way to clear it. Verified in both directions.
The token still never reaches JavaScript. The cookie is HttpOnly, so the
service worker cannot read it; it only issues same-origin requests the browser
attaches it to. What was given up is "no client-side JS at all", not the
credential isolation. The CSP gains script-src 'self' and deliberately not
'unsafe-inline' — the registration lives in its own file so an inline
allowance, which would apply to the whole document including anything a recorded
entry smuggled past the escaper, is never needed.
How it stays logged in
The token URL is an enrolment step, not a daily one. Visiting it sets a
long-lived HttpOnly cookie, and from then on the bare /view path works from
that device — which is what the home-screen icon opens.
- Nothing is widened. The cookie carries the same secret the path did and is
compared the same way, so rotating
VIEW_TOKENstill revokes every device at once. There is one revocation path, no session table, and no expiry to track. - Its own credential. The view never accepts
AUTH_TOKEN, and/mcpnever acceptsVIEW_TOKEN. A leaked view URL discloses decision summaries; it cannot write, deprecate, or delete. - Unset means gone. With no
VIEW_TOKEN,/view/<anything>returns a bare404, indistinguishable from a route that was never deployed.
npm run view reopens it later (the URL is saved to .view-url, gitignored).
npm run view -- --qr enrols another device without rotating the token —
re-running setup would mint a new one and silently drop every device already
added.
Connect the Knowledge tab to cambium-remote (optional)
Only relevant if you also run cambium-remote.
It generates a status-only credential, installs it on cambium-remote as
STATUS_TOKEN, verifies the route answers with real counts, and only then sets
CAMBIUM_STATUS_URL here. Nothing to look up or paste.
Why a second credential rather than cambium's connector URL: that URL is
cambium-remote's AUTH_TOKEN, which grants recall over every promoted item —
on the Worker whose team scope reaches every repo under TEAM_OWNER, including
private ones. Copying it here to render three integers would mean a leak of this
Worker discloses cambium's entire reach. STATUS_TOKEN reads the counts and
nothing else. It is also generatable, which is what makes the setup automatic;
AUTH_TOKEN can only ever be re-typed by hand, since Cloudflare stores secrets
write-only.
Self-hosters must add a service binding. A Worker cannot reach another
Worker by fetching its workers.dev hostname — Cloudflare's edge answers 404
and the target never runs, which looks exactly like a rejected token. Add to your
wrangler.toml:
This repo declares it only under [env.production], deliberately: a service
binding names its target, so declaring it at the top level would break the
one-click deploy for anyone whose account has no cambium-remote.
The panel fails soft. If cambium is slow (10s budget), down, or unwired, the page still renders and says so. Only the Knowledge tab makes that call, so the other tabs never pay for it.
Deploy on push, with no API token
git push can deploy the Worker directly, using the wrangler login you already
have — no Cloudflare API token, no GitHub secret, no dashboard:
It installs a git pre-push hook. Deploy first, push second: if the deploy
fails the push is aborted, so origin never receives a commit that could not be
deployed. That is the inverse of the failure it replaces — cambium-remote's CI
was accepting every merge and deploying none of them, with main drifting ahead
of the running Worker and nothing to show it.
Main only, skips branch deletes, git push --no-verify skips it once, -Remove
uninstalls.
It refuses to install without -Env in a repo that has named environments,
and that refusal is load-bearing rather than fussy. A bare wrangler deploy uses
the top-level profile — which in this repo is the self-host profile, and that
one deliberately omits database_id so Cloudflare provisions a fresh empty
database. A hook installed without -Env here would bind the live Worker to an
empty D1 on the next push. So:
This repo does not need the hook at all — its GitHub Actions deploy works, and a hook would deploy twice per push.
Why not just fix the CI? Because that step genuinely cannot be automated.
GitHub Actions needs CLOUDFLARE_API_TOKEN, and minting a Cloudflare API token
through the API requires an existing token carrying User API Tokens: Edit.
Wrangler's OAuth login does not have it — its 29 scopes are workers/d1/pages/
queues operations plus account:read, with nothing token-management related. No
credential on your machine can create that credential. The paste is Cloudflare's
permission model, not a gap in the tooling. Deploying locally sidesteps the
question entirely.
If you want GitHub Actions CI anyway
connect-cambium deploys cambium-remote itself when it finds the status route
missing, using the wrangler login you already have — so you do not need its
GitHub Actions deploy working for the Knowledge tab to work.
You only need it if you want cambium-remote to auto-deploy on every push. Its workflow needs two Cloudflare secrets, and an empty one fails silently: every merge looks green and deploys nothing.
CLOUDFLARE_ACCOUNT_ID is read from wrangler whoami and set automatically — it
is an identifier, not a credential; it is in every dashboard URL.
CLOUDFLARE_API_TOKEN you paste once, and that step is genuinely irreducible:
creating a Cloudflare API token requires an existing token with
User API Tokens: Edit, and wrangler's OAuth login is not one. No credential on
your machine can mint that credential. Everything around it is automated — the
browser opens on the right page, the token is read without echoing, it is
verified against Cloudflare's API before being stored, both secrets go over
stdin rather than argv, and the previously failed run is re-triggered so you watch
it go green instead of taking the script's word for it.
Set your Worker URL (self-hosters)
No wrangler command reports the workers.dev host — not whoami,
deployments list, versions list, or deployments status — so it lives in
package.json:
The setup script reads it before installing anything and refuses to run without it. That ordering is deliberate: a token installed with no URL to put it in is unrecoverable, since Cloudflare cannot read a secret back.
Platform support, honestly
The three that aren't ported are thin wrappers around a handful of commands, so the manual equivalents are short. Connect cambium:
Deploy on push — write .git/hooks/pre-push in the target repo, LF endings,
chmod +x, running npx wrangler deploy (add --env <name> if that repo has
named environments — a bare deploy there targets the self-host profile and will
bind your live Worker to a fresh empty database).
Fix the CI — gh secret set CLOUDFLARE_ACCOUNT_ID and
gh secret set CLOUDFLARE_API_TOKEN against the repo, reading each from stdin.
Editing the setup scripts
They target Windows PowerShell 5.1 — the version that ships with Windows and
the one .cmd launches. Five things there are load-bearing and look like they
could be modernised:
RNGCryptoServiceProvider, notRandomNumberGenerator::Fill— the latter is .NET Core only and throws.- Manual
WebExceptionstatus extraction, not-SkipHttpErrorCheck— PowerShell 7 only. - No
??,?., or ternaries — all PowerShell 7 only, and a parse error here. - Every wrangler call goes through
Invoke-Wrangler. On 5.1,2>&1on a native command wraps each stderr line in an ErrorRecord, and under$ErrorActionPreference = 'Stop'the first is terminating — so an ordinary wrangler notice kills the run. - Confirmations gate on
[Console]::IsInputRedirected, never[Environment]::UserInteractive(which is always true), and castRead-Hostto[string]before matching —$null -notmatch '...'evaluates to empty, not$true, so the obvious guard fails open.
Every run writes a scrubbed log (.view-setup.log, .cambium-setup.log) with the
token masked, so a failure can be read after the window closes.
⚠️ Security: the connector URL is a credential
The URL you paste into Claude embeds AUTH_TOKEN as its last path segment.
Anyone who has the full …/mcp/<AUTH_TOKEN> URL can read and write your entire
store. Treat it exactly like a password:
- Don't share it, screenshot it, or paste it anywhere it could be logged.
- Requests to any other path, or with the wrong token, get a bare
404with no detail (a valid token used with a non-POST method gets405). - To rotate: change
AUTH_TOKENin the Cloudflare dashboard (Step 2). This immediately invalidates every old URL — any connector using the previous token starts getting404s until you update it in claude.ai (Step 3) with the new value.
Everything in this section applies to the view URL too, with one difference in
your favour: VIEW_TOKEN can only read. A leaked view URL exposes every decision
summary in every project on the instance, which may well be the more sensitive half
— but it cannot write, deprecate, or delete anything. That is the entire reason the
two are separate credentials rather than one.
Why the token is in the URL path, and what that costs you
This is a deliberate design choice, not an oversight. claude.ai custom
connectors do not reliably send custom headers, so an Authorization: header —
the obvious alternative — cannot be depended on. Putting the credential in the
path is what makes the connector work at all.
Be clear about the price, because it is not the same as a header:
- URLs get recorded in places request bodies never do. Browser history, shell history, proxy and CDN access logs, crash reports, bug reports, screenshots, "copy link" buttons, and agent session transcripts. During the audit that produced this section, the connector URLs for these Workers were found in ~54 occurrences across 13 local session transcripts on a single machine — none of them pasted deliberately; they were simply part of the tool configuration an agent echoed back.
- The Worker itself does not log it. Every log line records the route as
/mcp/***. The leak surface is everything around the Worker, which is exactly what you cannot audit. - A leaked token is full access, with no second factor and no per-caller identity. There is nothing to revoke except the token itself, and no log that will tell you who used it.
Practical guidance:
- Rotate on a schedule, not just on suspicion — assume the URL has been
recorded somewhere you don't control. Rotation is cheap: change
AUTH_TOKEN, update the connector. - Rotate immediately if you've shared a terminal recording, a transcript, a screen capture, or a bug report from a machine where the connector is configured.
- Use a long random token (32+ bytes, e.g.
openssl rand -hex 32). The comparison is constant-time in both content and length, so length is not observable — but entropy is still your only defence against guessing. - If you ever get the chance to use a header or OAuth instead, take it. This tradeoff is forced by the client, not preferred.
Tools
Every tool takes an optional project; if omitted it falls back to the configured
default_project (set it once with config — op='set', key default_project).
The unified tools (config, record_entry) are the current surface; the older
per-operation tools remain as deprecated aliases so existing callers keep
working. New work should prefer the unified tools.
Entry conventions
- Decisions use
summary,problem,why_chosen,what_we_tried,tradeoffs,tags. The deprecatedrationalefield is accepted on input and mapped towhy_chosenwhenwhy_chosenis absent. - Constraints use
rule,reason,tags. - Pipelines use
name,purpose,steps, plus any extra fields you pass. - ids are per project+kind:
dec-001,pipe-003,con-012. Because the same id recurs across projects, the D1 primary key is composite(project, id).
For maintainers / contributors
Everything above is for self-hosters. This section is for working on the code itself.
Config layout: how one repo serves both the button and CI
wrangler.toml has two profiles:
- Default (top level) — the D1 binding is declared without a
database_id. This is what the Deploy button,wrangler dev, and the local test suite use. With no id, Cloudflare auto-provisions a fresh database for each self-hoster. [env.production]— pins the maintainer's realdatabase_idand the Workername. The maintainer's CI deploys withwrangler deploy --env productionso it keeps hitting the same database and the same URL. Self-hosters never touch this env.
The cambium service binding lives only in [env.production], and that split is
load-bearing rather than tidy. A service binding names its target Worker, so a
top-level [[services]] service = "cambium-remote" would make the one-click deploy
fail in any account that has no such Worker — which is every account but the
maintainer's. Anything that names another Worker, another database by id, or
another account belongs in the named env for the same reason.
Named environments inherit nothing. Every binding the production deploy needs
has to be repeated under [env.production.*], including [observability]. A
binding that exists only at the top level is silently absent from the env CI
actually deploys.
Deploy pipeline (maintainer only)
.github/workflows/deploy.yml runs on push to main, and is gated with
if: github.repository == 'jarmstrong158/context-keeper-remote' so forks (which
deploy via Workers Builds instead) don't run failing Actions. Steps: checkout →
Node 22 (Wrangler needs ≥ 22) → npm ci → npm test → wrangler deploy --env production. Tests gate the deploy. It reads two GitHub repo secrets,
CLOUDFLARE_API_TOKEN (needs Workers Scripts: Edit) and CLOUDFLARE_ACCOUNT_ID
— distinct from the Worker's own AUTH_TOKEN.
Local development
No network and no Cloudflare credentials required — tests run against a local
workerd D1 via @cloudflare/vitest-pool-workers. Requires Node ≥ 22.
Live smoke test
After a deploy, from any machine with network access:
Runs initialize → tools/list → record_decision → query_entries against the live
worker.
Layout
Troubleshooting the maintainer deploy
Related
- context-keeper — the local stdio original this Worker hosts as a remote transport.
- xylem — the stack this is part of.
来源:README.md,提交 c227798
工具
0版本历史
1- v0.2.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通必需25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式必需10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分