Capsid
Provides tools for reading and writing files, creating branches, and opening pull requests on GitHub repositories, using a dedicated GitHub App for authentication and access.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Capsid
Capsid is a Model Context Protocol (MCP) server and control plane for AI coding agents. It runs as a single Cloudflare Worker and provides these functions to the agents that connect to it:
a versioned knowledge base of project documents, stored in D1 and searchable by keyword and by meaning;
per-agent credentials with explicit scopes, enforced at a single authorization point, and an audit log of every call;
mediated access to GitHub repositories through a GitHub App, with an automatic pull request reviewer;
messaging between AI agents from different vendors: Claude sessions and Grok Bots send each other messages through Capsid.
The repository contains the source of one production deployment, operated by its owner and the co-owners listed in CO_OWNER_EMAILS. It is published under the MIT license for reference. It is not a hosted service and is not supported for third-party use; Installation describes how to run a separate instance.

The public system explorer at capsid.dustinedwards.info, generated daily from Capsid's public data.
Contents
Related MCP server: MCP Knowledge Server
Architecture
Runtime and storage
Capsid is written in TypeScript and deployed as one Cloudflare Worker. It uses the following bindings:
Binding | Type | Purpose |
| D1 | Documents, document versions, agents, namespaces and the audit log. Full-text search uses SQLite FTS5. |
| KV | Cached GitHub installation tokens, switches and short-lived state. |
| KV | OAuth grants and client registrations. |
| R2 | Daily database exports and the Markdown mirror of every document. |
| R2 | Locked copies of the tool-call log. |
| Durable Object | Per-caller rate limits on the MCP routes and public documents. |
| Durable Object | Append-only, hash-chained log of every tool call. |
| Durable Object | One lease per scheduled job. |
| Durable Object | Runs the tick when Cloudflare stops firing its trigger. |
| AI Search | A derived semantic index of the documents, used for hybrid search. D1 remains the source of record. |
| Static assets | The built Capsid Portal's browser files ( |
Hosts
The Worker answers on two hosts, each restricted to its own set of paths:
MCP host (
mcp.dustinedwards.info): the MCP endpoints, OAuth sign-in, agent and operator routes under/ops/, and the public read-only documents. The permitted paths are listed insrc/mcp-host.ts.Portal host (
portal.dustinedwards.info): the Capsid Portal, the administrative web application. Seesrc/portal-host.ts.
The system explorer at capsid.dustinedwards.info is a separate, assets-only Worker built from explorer/. It is prerendered from Capsid's public documents and makes no requests to Capsid at read time.
Authentication
Caller | Mechanism |
Owner and co-owners, through an MCP client or the Portal | Cloudflare Access for SaaS (OIDC), issued as an OAuth access token by |
Agents and scheduled clients | A per-agent bearer key on |
Capsid, towards GitHub | A GitHub App. The Worker signs an RS256 JWT and exchanges it for a short-lived installation token; no long-lived GitHub token is stored. |
Every caller resolves to an agent record with a name, a set of scopes and an audit identity. Authorization is checked in one function, checkScope in src/scope.ts.
Scheduled work
Two Cron Triggers are declared, and their expressions are defined once in src/index.ts:
Schedule (UTC) | Task |
| The tick: site watcher, search indexing, phone alerts, the daily email digest, and the daily build of the public model and statistics. |
| Database backup to R2, followed by pruning of old document versions and audit rows. |
Each job runs under its own CronLock lease, so a trigger, a run now and the fallback ticker never run one job twice at once. The CronTicker alarm runs the tick when Cloudflare stops firing its trigger.
Components
Knowledge base
A document is a row in D1 identified by namespace and path, with a title, a Markdown body, a type, a status and tags. A namespace corresponds to one project and maps to one or more GitHub repositories; that mapping is also the boundary for repository access. Document types include core, concept, decision, spec, protocol, procedural, task and reference (docs/schema.md).
Every overwrite or delete stores the previous body in document_versions and writes a row to audit_log. Search combines FTS5 keyword matching with semantic matching from an AI Search index. The index is filled from D1 by the five-minute tick, and every semantic result is re-checked against D1 before it is returned.
Authorization
An agent's scopes have five axes: namespaces, repos, tools, grants (read, or read and write) and flags. Two flags control operations with a wide effect: merging, closing, tagging or releasing (can_merge), and writing the policy documents under capsid/policy/ (can_touch_protected). A new agent receives read access to its named namespaces and no flags. Scopes that fail to parse resolve to no access. The required grant for each tool is declared in TOOL_GRANTS (src/scope.ts), and a tool absent from that table requires the write grant. See docs/auth.md.
GitHub integration
Repository tools resolve the target repository from the namespace mapping and check the resolved repository against the caller's repos axis (docs/repo-access.md). Capsid reads repositories and ends or publishes work: merging, closing, tagging and releasing require the can_merge flag. Agents push branches and open pull requests with their own GitHub access.
Capsid runs no merge loop: a pull request merges on green, by the session that opened it or by GitHub's native auto-merge (docs/autonomy.md). A reviewer reads each pull request on Claude Haiku 5.5 and its verdict is the required check checks / Reviewer (src/review.ts).
Messaging between AI agents
Capsid lets agents from different vendors talk to each other. A Claude session sends a message to a Grok Bot with capsid_message_grokbot, which calls the bot's webhook: Front by default, which routes to the right bot, or a named bot directly. The bot answers once with capsid_reply_grokbot, and the sender reads the answer with capsid_message_grokbot. A bot can also start a conversation: it stores a message with capsid_reply_grokbot, and a Claude session takes it with the inbox action of capsid_message_grokbot. Sends are capped at 30 an hour, 40 a day and 10 a day per conversation, and a bot's key can call only the reply tool. Each side's words are data, never approval: only the owner approves merges, deploys, spending or deletions. Messages live in the grokbot_replies table, which is excluded from backups and pruned a week after it expires.
Capsid Portal
The Portal is a React Router app in dashboard/, rendered on the server by the Worker and restricted to the administrator's Cloudflare Access session. Its pages are Board (what awaits the owner, open handoffs, pull request trouble), Health, Memory, Pull requests, Projects, Sites, Packages, Agents and Settings. It exposes the administrative controls defined in src/controls.ts (docs/portal.md).

Portal Health view, rendered from sample data.
Site monitoring
The watcher, which runs on the tick, reads each registered site's health route, CI status, deploys and live responses (docs/health-format.md, docs/live-checks.md). Search performance is read from Google Search Console and Bing Webmaster Tools (docs/search-console.md, docs/bing-webmaster.md).
Public data
Once a day the Worker builds a public system model and a set of aggregate statistics, after a privacy filter, and serves them without authentication (docs/public-data.md). Current figures are available at mcp.dustinedwards.info/public/stats/v1.json. The system explorer is built from these documents (explorer/README.md).
Backups and recovery
D1 Time Travel provides 30-day point-in-time recovery. In addition, the daily backup writes one JSON export per table and a Markdown mirror of every document to R2, and the exports of every site are copied to a locked Amazon S3 bucket outside the Cloudflare account. A scheduled workflow rehearses a restore (docs/backups.md). Rolling back a faulty deploy is described in docs/rollback.md.
MCP tools
Capsid serves 17 tools over two MCP servers. The count is derived from TOOL_GRANTS by src/counts.ts, and the registrations are in src/tools/surface.ts. Most tools take an action argument that selects what the call does.
Capsid (/mcp, /ops/mcp): 11 tools for project work.
Tool | Grant | Function |
| read | Session briefing for a namespace. |
| read | List, glob or full-text search documents; list reachable namespaces. |
| read | Read a document, its versions or its edges. |
| write | Create, change, restore or move a document. |
| write | Delete a document, retaining its last version. |
| per action | Gather, finalize and report on a namespace's documents (docs/consolidation.md). |
| read | List directories, read files and search code in a mapped repository. |
| read | Branches, tags, pull requests, history, CI runs, live site checks and search-console data. |
| write | Merge or close a pull request, delete a branch, tag a commit or publish a release. |
| read | Capsid status per namespace: the lint report, maintenance and items awaiting the owner. |
| write | A Grok Bot's message to Claude: one answer, or a new conversation. |
Capsid Admin (/mcp/admin): 6 tools, available to the administrator identity only.
Tool | Grant | Function |
| admin read | Items awaiting the owner across every namespace. |
| admin | Register or remap a namespace. |
| admin | Mint, revoke and re-scope agent credentials. |
| admin read | Watcher state, Cloudflare Access and Email Routing configuration, Workers Builds. |
| admin | Preview and perform administrative controls with a single-use token. |
| admin | Message the Grok Bots, read an answer, or take the messages a bot started. |
Adding a tool requires a recorded ruling (CLAUDE.md, Tool surface).
HTTP interface
The router is defaultHandler in src/routes.ts. The principal routes are:
Route | Authentication | Purpose |
| OAuth | MCP over Streamable HTTP for the owner and co-owners. |
| Bearer key | MCP for agents and scheduled clients. |
| None | OAuth sign-in and discovery. |
| Bearer key | Items awaiting the owner, per application. |
| None | Deploy provenance and a store probe; returns 503 when D1 or FTS5 fails. |
| None | Public system model, statistics, code maps and package versions. |
| Access session | The Capsid Portal and its API. |
The complete list, including the signed backup routes, is in docs/auth.md.
Repository layout
Path | Contents |
| Worker source. |
| D1 schema migrations, applied in order. |
| The Capsid Portal (Vite) and its Playwright tests. |
| The public system explorer, a separate assets-only Worker. |
| The hand-written public system model and its JSON Schema. |
| Deploy, agent minting, backup and verification scripts. |
| Unit tests and lint checks. |
| Integration tests run in workerd through |
| Reference documentation. |
| Template for the Worker configuration. The real |
Installation
An installation requires a Cloudflare account and a GitHub App. The procedure is given in full in docs/bootstrap.md, section 8. In outline:
Install dependencies with
npm install. Node.js 26.11.1 or later is required.Create a D1 database, two KV namespaces and an R2 bucket with Wrangler.
Copy
wrangler.jsonc.exampletowrangler.jsoncand enter the resource identifiers.APP_KVandOAUTH_KVmust be different namespaces.Apply the migrations:
npx wrangler d1 migrations apply capsid --remote.Create a Cloudflare Access for SaaS (OIDC) application and a GitHub App, and set the required secrets.
Run
npm run checkandnpm run deploy.Add
https://<worker-host>/mcpas a custom connector in the MCP client.
wrangler.jsonc, .dev.vars, .env, keys and real document content must never be committed. Optional features, including site monitoring, Cloudflare reads and phone alerts, remain inactive until configured.
Development
Command | Purpose |
| Type-check the Worker. |
| Unit tests. |
| Integration tests in workerd. |
| The shared Oxlint config, type-aware (dashboard included). |
| The repository's own lint: documentation drift. |
| Build the Portal and enforce its size budget. |
| Portal browser tests (Playwright). |
| Serve the Portal locally against sample data. |
| Verify the deployed Worker. |
The full pre-push sequence is in docs/bootstrap.md. Continuous integration runs these checks on every pull request, and a merge to master deploys to production.
Documentation
Setup and access
docs/bootstrap.md: installation, agent minting, switches and pre-push checks.
docs/auth.md: authentication, scopes, roles, co-owners and endpoints.
docs/repo-access.md: the GitHub App and repository resolution.
Agents
docs/autonomy.md: what runs unattended, and the watcher.
Sites and public data
docs/portal.md: the Capsid Portal.
docs/health-format.md: the health route format.
docs/live-checks.md: checks against deployed sites.
docs/search-console.md: Google Search Console data.
docs/bing-webmaster.md: Bing Webmaster Tools data.
docs/public-data.md: the public model, statistics and code maps.
explorer/README.md: the system explorer.
Data and recovery
docs/schema.md: document types and database tables.
docs/consolidation.md: namespace maintenance and destructive writes.
docs/backups.md: backup contents and restore procedure.
docs/rollback.md: reverting a deploy.
docs/reliability.md: the uptime target and what happens when a site spends its error budget.
License
MIT. See LICENSE. Citation metadata is in CITATION.cff.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Cloudflare Workers MCP server: agent-memory
Search and manage your team's knowledge from MCP clients.
Cloudflare Workers MCP server: agent-workflow-engine
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI agents to search, read, and contribute to a structured markdown knowledge base with citations, freshness tracking, and a safe write path, providing a shared, auditable company memory.5 npmMIT
- AlicenseNot gradedqualityDmaintenanceA remote MCP server that indexes Markdown knowledge from GitHub into Cloudflare KV, enabling AI assistants to perform fast keyword searches and retrieve documents with low latency.1ISC
- AlicenseNot gradedqualityNot gradedmaintenanceA Cloudflare Workers-based MCP server for Notion knowledge base management, enabling intelligent search, automatic recording of code snippets, and statistics analysis through natural language.MIT
- AlicenseNot gradedqualityCmaintenanceMCP server for a personal knowledge graph running on Cloudflare, enabling note-taking, task management, and cross-domain recall via Claude.MIT