Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add commands/cloudflare/skills/build-mcpgit clone --depth 1 https://github.com/cloudflare/skillsWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00012 | $0.00706 |
| Opus 5 | $0.00006 | $0.00353 |
| Sonnet 5 | $0.00002 | $0.00141 |
| Haiku 4.5 | $0.00001 | $0.00071 |
Grade A, and why
build-mcp scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
fetch(request: Request, env: Env, ctx: ExecutionContext) { How it starts
The opening of the file, as written. The whole thing — 77 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Build MCP Server on Cloudflare
Arguments
The user invoked this command with: $ARGUMENTS
Instructions
When this command is invoked:
- Read the skill file at
agents-sdk/SKILL.mdfor core SDK guidance - Read
agents-sdk/references/mcp.mdfor MCP client and server APIs, transports, and securing - Read
agents-sdk/references/configuration.mdfor wrangler setup - Fetch https://developers.cloudflare.com/agents/api-reference/mcp-agent-api/ for the latest McpAgent API
- For OAuth/security, fetch https://developers.cloudflare.com/agents/api-reference/securing-mcp-servers/
Scaffold Steps
- Create project:
npx create-cloudflare@latest --template cloudflare/agents-starter(or start fresh) - Install MCP SDK:
npm install @modelcontextprotocol/sdk zod - Configure wrangler.jsonc: DO binding +
new_sqlite_classesmigration for the McpAgent class - Implement McpAgent: extend
McpAgent, createMcpServer, register tools ininit() - Serve transport:
MyMCP.serve("/mcp", { binding: "MyMCP" })(Streamable HTTP, recommended) - Test:
npx @modelcontextprotocol/inspector@latest - Deploy:
npx wrangler deploy
Quick Reference
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { McpAgent } from "agents/mcp";
import { z } from "zod";
export class MyMCP extends McpAgent<Env, State, {}> {
server = new McpServer({ name: "my-mcp", version: "1.0.0" });
initialState = { counter: 0 };
async init() {
this.server.registerTool("my_tool", {
description: "Does something useful",
inputSchema: { query: z.string() }
}, async ({ query }) => ({
content: [{ text: `Result: ${query}`, type: "text" }]
}));
}
}
// Entry point
export default {
fetch(request: Request, env: Env, ctx: ExecutionContext) {
return MyMCP.serve("/mcp", { binding: "MyMCP" }).fetch(request, env, ctx);
}
};
Transport Options
| Transport | Method | Use for |
|---|---|---|
| Streamable HTTP | MyMCP.serve("/mcp") |
External/public clients (recommended) |
| SSE | MyMCP.serveSSE("/sse") |
Legacy clients only (deprecated) |
| RPC | addMcpServer(name, env.Binding) |
Same-Worker internal calls |
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday First seen · 77 lines · 12 tokens per session scan A 265c29d38cd8
build-mcp is a command published in the GitHub repository cloudflare/skills (2,744 stars, last pushed 24d ago), licensed Apache-2.0. It adds 12 tokens to every session and 706 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other commands, from other repositories
devkit.github.review-pr
Provides comprehensive GitHub pull request review with code quality, security, and best practices analysis. Use when reviewing a PR before merging.
status
Prints a one-line project status (branch, dirty flag, ahead/behind).
demo-command
Example slash command that wraps the demo-skill. Showcases the command kind.
advisor
Get a second opinion from Codex (GPT-5) on your current plan, diff, or a specific question.
constatar-audit
Audit a constatar run — conformance, health trends, cost.
OPSX: Archive
Archive a completed change in the experimental workflow.