CF ActivityPub MCP
Allows administering a CF ActivityPub Next instance through its administration API, exposing 30 tools to manage accounts and moderation (approve, silence, suspend, delete, verify), abuse reports, federation rules (domain blocks, instance registry, relays), content policy (licenses, custom emojis, announcements), instance settings and registration policy, media cache, email blocks, and the moderation audit log.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CF ActivityPub MCPlist the open reports on my instance and show the most recent one"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CF ActivityPub MCP
English | Español
A remote Model Context Protocol server that lets AI assistants administer a CF ActivityPub instance through its administration API — fully hosted on Cloudflare Workers.
Overview
CF ActivityPub MCP is the administration companion for CF ActivityPub Next, the Mastodon-compatible ActivityPub server built for Cloudflare Workers.
Point it at your instance with the same ADMIN_TOKEN operator secret, connect any MCP-capable assistant, and manage accounts, reports, federation rules, relays, media cache, settings and more through natural conversation. The worker:
Exposes the full administration surface as 35 well-described MCP tools.
Includes Centinela, an AI watchdog running on Cloudflare Durable Objects that reviews the instance on a schedule, asks Workers AI for an analysis and can propose or execute guarded actions.
Speaks Streamable HTTP (
/mcp, JSON responses) and an SSE-shaped endpoint (/sse) for clients that require it.Requires its own bearer token (
MCP_AUTH_TOKEN) on every MCP request, independent from the instance token.Publishes a public landing page and a
/healthJSON report with live metrics, including the Sentinel state.Runs with Cloudflare observability (traces, logs and real-time issues) enabled.
Deploys to a custom domain with a single
wrangler deploy.
The MCP never stores instance data: every tool call is a thin, authenticated proxy to the CF ActivityPub admin API, which keeps its own audit trail. Centinela stores only its own configuration, run history and decisions inside its Durable Object.
Related MCP server: BYOB MCP Server
Architecture
Layer | Technology |
Runtime | Cloudflare Workers |
MCP transport | Agents SDK |
Protocols | Streamable HTTP + SSE response shaping, JSON-RPC 2.0 |
Authentication | Bearer token ( |
Upstream | CF ActivityPub admin API ( |
AI Sentinel | Cloudflare Durable Objects (SQLite-backed) + Agents SDK scheduling + Workers AI |
Observability | Workers Logs, Traces and Issues |
Language | TypeScript, Zod schemas |
Endpoints
Path | Method | Auth | Description |
| GET | Public | Landing page with live health metrics |
| GET | Public | JSON health report (worker + instance) |
| POST | Bearer | Streamable HTTP MCP endpoint; JSON by default, SSE when needed |
| POST | Bearer | SSE-shaped MCP endpoint for SSE-first clients |
| OPTIONS | Public | CORS preflight handled by the MCP handler |
Modern protocol revisions (2026-07-28) receive JSON responses; legacy clients are served through the stateless compatibility lane. The deprecated HTTP+SSE session transport (a long-lived GET /sse stream plus POST /messages) is intentionally not implemented — point legacy clients at /mcp (or use a proxy such as mcp-remote).
Requirements
A deployed CF ActivityPub Next instance with
ADMIN_TOKENconfigured (wrangler secret put ADMIN_TOKENin that project).A Cloudflare account with the domain you want to use. Centinela additionally uses Workers AI (available on the free plan with a daily neuron allowance) and one Durable Object.
Node.js 20+ and npm.
Quick start
# 1. Install dependencies
npm install
# 2. Configure the instance URL (and optionally the custom domain)
# Edit `vars` in wrangler.jsonc: ACTIVITYPUB_URL=https://social.example.com
# 3. Create the two secrets
npx wrangler secret put ADMIN_TOKEN # same value as the instance's ADMIN_TOKEN
npx wrangler secret put MCP_AUTH_TOKEN # openssl rand -hex 32
# 4. Local development
npm run dev
# 5. Deploy
npm run deployFor local development, copy .dev.vars.example to .dev.vars and fill in both tokens.
Configuration
Plain-text variables (vars in wrangler.jsonc)
Variable | Required | Description |
| Yes | Public base URL of the CF ActivityPub instance, e.g. |
| No | Name reported by the MCP server (default |
| No | Version reported by the MCP server (default |
| No | Comma-separated Host allowlist for the MCP endpoints. Localhost and |
| No | Comma-separated browser Origin allowlist, or |
The SENTINEL_* variables that seed Centinela are documented in AI Sentinel (Centinela).
Secrets (wrangler secret put)
Secret | Description |
| The operator secret of the CF ActivityPub instance. Grants full administrator access to its API |
| Bearer token that MCP clients must present on |
Authentication
Two independent credentials are involved:
MCP clients → this worker. Every request to
/mcpor/ssemust includeAuthorization: Bearer <MCP_AUTH_TOKEN>. Requests are rejected with401otherwise, and the endpoint is closed with503when the secret is not configured. Token comparison hashes both values before comparing to avoid timing leaks.This worker → the ActivityPub instance. Tool calls send
Authorization: Bearer <ADMIN_TOKEN>to the instance admin API. The instance validates it with its ownadmin-authlogic and writes every mutation to the moderation log.
Rotate each token independently: changing MCP_AUTH_TOKEN only affects MCP access; changing ADMIN_TOKEN must be done in both workers.
Connecting an MCP client
Claude Desktop (via mcp-remote)
{
"mcpServers": {
"cf-activitypub": {
"command": "npx",
"args": [
"mcp-remote",
"https://mcp.example.com/mcp",
"--header",
"Authorization: Bearer <MCP_AUTH_TOKEN>"
]
}
}
}Clients with native remote transport (Cursor, VS Code, others)
{
"mcpServers": {
"cf-activitypub": {
"url": "https://mcp.example.com/mcp",
"headers": {
"Authorization": "Bearer <MCP_AUTH_TOKEN>"
}
}
}
}Use https://mcp.example.com/sse instead of /mcp when a client explicitly requires an SSE endpoint.
MCP Inspector
npx @modelcontextprotocol/inspector
# Transport: Streamable HTTP
# URL: https://mcp.example.com/mcp
# Header: Authorization: Bearer <MCP_AUTH_TOKEN>Tools
The server exposes 35 tools, grouped by administrative domain. Destructive actions (delete, reject, suspend, demote, purge, clear_all, remove, dismiss) require an explicit confirm: true argument, so an assistant cannot destroy data by accident.
Overview and health
Tool | Description |
| Reachability and latency of the instance plus its public metadata |
| Full public instance payload (version, languages, limits, registration policy) |
| Combined summary: metadata, account/report/moderation/federation/relay totals and media cache stats |
Instance settings
Tool | Description |
| Rules, policies, languages and registration settings |
| Updates any subset of the settings above |
Accounts and moderation
Tool | Description |
| Search/filter local and remote accounts (status, role, locality, query) |
| One account with moderation flags, role and profile |
| approve, unapprove, reject, silence, unsilence, suspend, unsuspend, promote, demote, delete |
| Forces a |
| Federated search for accounts, statuses, hashtags and collections |
Reports
Tool | Description |
| Abuse reports with statuses, accounts and notes |
| One report ticket |
| resolve, dismiss, reopen, delete, add_note |
Federation
Tool | Description |
| Instance-wide domain blocks |
| block / unblock a domain (severity, media/report rejection, comments) |
| Federation registry with status filters |
| add, refresh, reset, suspend, unsuspend, purge |
| Subscribed ActivityPub relays |
| add, enable, disable, remove |
Content and policy
Tool | Description |
| License catalogue (FEP-6757) |
| add, update, delete |
| Custom emojis, including disabled ones |
| upload (URL or base64), enable/disable, delete |
| create / delete instance announcements |
Operations
Tool | Description |
| Cache statistics, most served entries and effective config |
| enforce_budget, purge |
| Blocked mailboxes (canonical email hashes) |
| block / unblock a mailbox |
| Audit trail with target/action filters |
| delete_entry, clear_all |
AI Sentinel (Centinela)
Tool | Description |
| Configuration, AI usage ledger, last run, next check and decision totals |
| Mode, interval, model, thresholds, allow-list, protected domains, webhook |
| Runs an analysis immediately (respects the current mode) |
| Decision history with status, target, confidence and result |
| Deletes the decision and run history (requires confirmation) |
Known limitations
manage_reportwithaction: "add_note"needs an OAuth token owned by a local actor; the sharedADMIN_TOKENcannot author notes and the instance answers401.Announcement listing is actor-only on the instance, so this MCP can create and delete announcements but not list them.
The MCP never exposes the instance database directly; it is limited to what the admin API supports.
AI Sentinel (Centinela)
Centinela is an autonomous watchdog that lives in a SQLite-backed Durable Object and wakes up on a schedule managed by the Agents SDK (backed by Durable Object alarms).
On every check it:
Collects a compact snapshot through the admin API: instance health, counters, pending registrations, open reports, problem federated instances, domain blocks, media cache pressure and the recent moderation log.
Asks Workers AI (JSON mode) for a structured analysis: summary, severity, findings and proposed actions.
Applies deterministic guardrails in code — not in the prompt — and then records, proposes or executes the surviving actions depending on the configured mode.
Modes
Mode | Behavior |
| Analyses and records findings only. Nothing is proposed or executed. |
| Records proposed actions so the operator can review them, but never calls the instance API. |
| Executes actions that pass every guardrail. |
enforce is powerful: start in observe, review the decision history, then move to suggest and only then to enforce with a narrow allow-list.
Guardrails
Action allow-list. Only
resolve_report,dismiss_report,silence_account,suspend_account,block_domainandenforce_media_cacheexist, and the operator chooses which are enabled.Per-action confidence floors combined with the configured
minConfidence(for example, suspending an account or blocking a domain requires ≥ 0.9 by default).Per-run budget. At most
maxActionsPerRunactions are executed per check.Daily neuron budget. The Sentinel estimates the neuron cost of every Workers AI call from the provider token counts and the official per-model rates. When
dailyNeuronBudgetis reached (UTC day, matching Cloudflare's reset at 00:00 UTC), scheduled checks are skipped and recorded until the next day. Set it to0for unlimited usage.Cooldowns. The same action against the same target is not repeated within
cooldownHours(24 by default).Protected targets. Administrators and moderators can never be silenced or suspended; protected domains can never be blocked; already-blocked domains and already-moderated accounts are skipped.
Prompt-injection defense. Report comments, registration reasons and display names are treated as untrusted data, and the guardrails run in code so a manipulated model cannot exceed its mandate.
Audit trail. Every run and decision is stored in the Durable Object with status
observed,proposed,blocked,executedorfailed.
Configuration
The agent is seeded on first boot from wrangler.jsonc variables and can then be reconfigured live through configure_sentinel:
Variable | Default | Description |
|
| Start the periodic schedule |
|
|
|
|
| Seconds between checks (60 – 86400) |
|
| Workers AI model |
|
| Hard cap of executed actions per run |
|
| Minimum model confidence |
|
| Cooldown window per action+target |
|
| Workers AI budget in neurons per UTC day ( |
| all actions | Comma-separated allow-list |
| empty | Domains the Sentinel must never act against |
| empty | HTTPS webhook that receives a JSON summary after each run |
A typical first configuration from an MCP client:
configure_sentinel { "enabled": true, "mode": "suggest", "interval_seconds": 3600, "daily_neuron_budget": 10000 }
run_sentinel_check {}
get_sentinel_decisions { "limit": 20 }get_sentinel_status reports the live ledger: usage.neuronsUsed, usage.dailyNeuronBudget, usage.remaining, usage.runs and token totals for the current UTC day. The budget is a safety valve, not an exact invoice: usage is estimated from the token counts the model returns (or from text length when the model omits them) and the published per-model rates.
Local development: the local simulator cannot execute Workers AI bindings, so Sentinel checks in
wrangler devare recorded as errors and do not consume neurons. Deploy the worker (or usewrangler dev --remotewith a publicly reachableACTIVITYPUB_URL) to exercise the model.
Centinela complements the instance's own Guardian: the Guardian moderates content inside CF ActivityPub, while Centinela watches the instance as an operator would and acts through the admin API. Both keep their own audit trails.
Health and landing page
GET /renders a public landing page linking to both repositories and showing live metrics (worker status, instance status, latency, active users, tool count and Sentinel mode).GET /healthreturns the same data as JSON, suitable for uptime monitors:
{
"status": "ok",
"service": { "name": "cf-activitypub-mcp", "version": "1.0.0", "tools": 35, "authentication": "bearer" },
"instance": { "url": "https://social.example.com", "reachable": true, "latency_ms": 42, "users": 128 },
"sentinel": { "enabled": true, "mode": "suggest", "last_run_at": "2026-10-04T04:00:00.000Z", "last_run_status": "ok", "decisions_total": 12, "neurons_today": 843, "daily_neuron_budget": 10000 }
}No secrets or administrative details are exposed by either endpoint. The Sentinel section is read through its Durable Object and cached for a minute so health polling does not keep the agent awake.
Security
Fail closed. MCP endpoints refuse to serve when
MCP_AUTH_TOKENis missing.Least privilege. The MCP only knows the instance admin API; it cannot reach Cloudflare account resources.
Auditability. Every mutation performed through the MCP is recorded by the instance in its moderation log; Centinela keeps its own decision history.
Confirmation guards. Destructive tools require
confirm: true; the model must be told explicitly.Sentinel guardrails. The AI never executes an action outside the allow-list, below the confidence floor, over the per-run budget or against protected accounts and domains. Guardrails run in code, not in the prompt.
Prompt-injection defense. Snapshot content is treated as untrusted data and never as instructions.
Constant-time token comparison. Candidate and expected tokens are hashed and compared with an XOR accumulator.
Origin/Host allowlists. Optional
MCP_ALLOWED_ORIGINS/MCP_ALLOWED_HOSTNAMESrestrict browser and Host access.Source maps.
upload_source_mapskeeps stack traces readable in the dashboard without shipping them to clients.
If you find a security issue, please open a private report through GitHub rather than a public issue.
Development
Script | Purpose |
| Start the local Workers dev server |
| Deploy to Cloudflare (custom domain from |
| Run the Vitest suite inside the Workers runtime |
| Watch mode |
| Strict TypeScript check |
| Regenerate |
Project structure
src/
index.ts Worker entry: routing, auth, endpoints, DO export
config.ts Environment parsing and defaults
auth.ts Bearer authentication and secret comparison
activitypub/
client.ts Authenticated client for the instance API
types.ts Shared API payload shapes
mcp/
server.ts MCP server factory and tool catalogue
context.ts Per-request tool context (lazy clients + env)
result.ts Tool result helpers
tools/ One module per administrative domain
sentinel/
agent.ts Centinela: SQLite-backed Durable Object agent
analyze.ts Workers AI prompt and structured analysis
snapshot.ts Instance snapshot collection
policy.ts Deterministic guardrails and settings validation
defaults.ts Environment-seeded configuration
types.ts Sentinel types and action catalogue
web/
health.ts Health report collection (includes Sentinel)
index-page.ts Public landing page renderer
test/
index.spec.ts Worker routes and MCP protocol tests
config.spec.ts Config and auth unit tests
client.spec.ts ActivityPub client unit tests
sentinel.spec.ts Sentinel policy, analysis and Durable Object testsDeployment notes
Set
routes[0].patterninwrangler.jsoncto your subdomain (for examplemcp.example.com). Wrangler creates the DNS record and certificate automatically on deploy.Set
ACTIVITYPUB_URLto the public URL of your instance.Configure both secrets with
wrangler secret put.Run
npm run deploy, then openhttps://mcp.example.com/to verify the health metrics.Observability is already enabled: traces, logs and real-time issues are available in the Cloudflare dashboard under the worker's Observability tab.
The first deploy applies the v1 migration and creates the SQLite-backed SentinelAgent Durable Object class. The MCP tool endpoints themselves stay stateless and work entirely through the instance API; only Centinela uses Durable Object storage, Workers AI and alarms.
License
MIT © 2026 manalejandro
CF ActivityPub MCP is not affiliated with Cloudflare, Inc. or the Mastodon project. The author is not responsible for the use of this software, nor for any charges Cloudflare may apply.
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote streamable-HTTP MCP server running on a single Cloudflare Worker. Your assistant gets live Airbnb, Amazon, Booking.com, Google Flights, Maps and Reddit data, social search on X, Instagram and TikTok, the Meta Ad Library, and image/video generation without any keys. Connect your own accounts to let it send WhatsApp or Telegram messages, work an IMAP inbox, manage Meta Ads campaigns and publish to X and LinkedIn. OAuth 2.1 with PKCE; stored credentials are AES-256-GCM encrypted.
Schedule and analyze posts on 12 networks, incl. Bluesky, Mastodon and Telegram, from any AI agent
OAuth 2.1 short-link tools for AI agents with scoped tokens, approvals, audit logs, and revocation.
214 tools for AI agents over one MCP endpoint: image, video, audio, 3D, data, storage, mail, GPUs.
Related MCP Servers
- AlicenseAqualityBmaintenanceEnables AI assistants to manage Cloudflare resources through natural language, including DNS records, zone management, Workers KV storage, cache purging, and analytics. Supports comprehensive Cloudflare operations with secure API token authentication.132MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to dynamically discover and invoke containerized tools that can be registered at runtime without redeployment. Built on Cloudflare Workers with scale-to-zero containers for secure, isolated tool execution.-
- AlicenseNot gradedqualityAmaintenanceAn MCP server that gives AI agents full admin control over Discord servers with 59 tools for messaging, moderation, roles, channels, forums, reactions, files, and more, deployed on Cloudflare Workers.6MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to administrate WHMCS installations through the External API, providing ~50 tools for clients, billing, orders, services, domains, support, and aggregators with safety features and governance.25 npm3ISC