npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iflow-mcp/mattzcarey-cloudflare-mcp

v0.1.0

Published

MCP server for the entire Cloudflare API using codemode

Readme

cloudflare-mcp

A smol MCP server for the complete Cloudflare API.

Deploy to Cloudflare Workers

Uses codemode to avoid dumping too much context to your agent.

Get Started

Create API Token

Create a Cloudflare API token with the permissions you need.

Both user tokens and account tokens are supported:

| Token Type | Description | Requirements | |------------|-------------|--------------| | User Token | Created at user level, can access multiple accounts | Requires account_id parameter on each execute call | | Account Token | Scoped to single account | account_id auto-detected, no parameter needed |

For account tokens, include the Account Resources : Read permission so the server can auto-detect your account ID.

Add to Agent

MCP URL: https://cloudflare-mcp.mattzcarey.workers.dev/mcp Bearer Token: Your Cloudflare API Token

Claude Code

export CLOUDFLARE_API_TOKEN="your-token-here"

claude mcp add --transport http cloudflare-api https://cloudflare-mcp.mattzcarey.workers.dev/mcp \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN"

OpenCode

Set your API token as an environment variable:

export CLOUDFLARE_API_TOKEN="your-token-here"

Then add to your opencode.json:

{
  "mcp": {
    "cloudflare-api": {
      "type": "remote",
      "url": "https://cloudflare-mcp.mattzcarey.workers.dev/mcp",
      "headers": {
        "Authorization": "Bearer {env:CLOUDFLARE_API_TOKEN}"
      }
    }
  }
}

The Problem

The Cloudflare OpenAPI spec is 2.3 million tokens in JSON format. Even compressed to TypeScript endpoint summaries, it's still ~50k tokens. Traditional MCP servers that expose every endpoint as a tool, or include the full spec in tool descriptions, leak this entire context to the main agent.

This server solves the problem by using code execution in a codemode pattern - the spec lives on the server, and only the results of queries are returned to the agent.

Tools

Two tools where the agent writes code to search the spec and execute API calls. Akin to ACI.dev's MCP server but with added codemode.

| Tool | Description | | --------- | ----------------------------------------------------------------------------- | | search | Write JavaScript to query spec.paths and find endpoints | | execute | Write JavaScript to call cloudflare.request() with the discovered endpoints |

Token usage: Only search results and API responses are returned. The 6MB spec stays on the server.

Agent                         MCP Server
  │                               │
  ├──search({code: "..."})───────►│ Execute code against spec.json
  │◄──[matching endpoints]────────│
  │                               │
  ├──execute({code: "..."})──────►│ Execute code against Cloudflare API
  │◄──[API response]──────────────│

Supported Products

Workers, KV, R2, D1, Pages, DNS, Firewall, Load Balancers, Stream, Images, AI Gateway, Vectorize, Access, Gateway, and more. See the full Cloudflare API schemas.

Usage

Once configured, just ask your agent to do things with Cloudflare:

  • "List all my Workers"
  • "Create a KV namespace called 'my-cache'"
  • "Add an A record for api.example.com pointing to 192.0.2.1"

The agent will search for the right endpoints and execute the API calls. Here's what happens behind the scenes:

// 1. Search for endpoints
search({
  code: `async () => {
    const results = [];
    for (const [path, methods] of Object.entries(spec.paths)) {
      for (const [method, op] of Object.entries(methods)) {
        if (op.tags?.some(t => t.toLowerCase() === 'workers')) {
          results.push({ method: method.toUpperCase(), path, summary: op.summary });
        }
      }
    }
    return results;
  }`,
});

// 2. Execute API call (user token - account_id required)
execute({
  code: `async () => {
    const response = await cloudflare.request({
      method: "GET",
      path: \`/accounts/\${accountId}/workers/scripts\`
    });
    return response.result;
  }`,
  account_id: "your-account-id",
});

// 2. Execute API call (account token - account_id auto-detected)
execute({
  code: `async () => {
    const response = await cloudflare.request({
      method: "GET",
      path: \`/accounts/\${accountId}/workers/scripts\`
    });
    return response.result;
  }`,
});

Token Comparison

| Content | Tokens | | ----------------------------- | ---------- | | Full OpenAPI spec (JSON) | ~2,352,000 | | Endpoint summary (TypeScript) | ~43,000 | | Typical search result | ~500 | | API response | varies |

Architecture

src/
├── index.ts      # MCP server entry point
├── server.ts     # Search + Execute tools
├── executor.ts   # Isolated worker code execution
├── truncate.ts   # Response truncation (10k token limit)
└── data/
    ├── types.generated.ts  # Generated endpoint types
    ├── spec.json           # OpenAPI spec for search
    └── products.ts         # Product list

Code execution uses Cloudflare's Worker Loader API to run generated code in isolated workers, following the codemode pattern.

Development

npm i
npm run deploy