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

@writechoice/docmcp

v0.1.2

Published

Index MDX docs and serve them as an MCP server via Cloudflare Workers

Downloads

339

Readme

@writechoice/docmcp

Turns any MDX documentation site into an MCP server.

Works with Docusaurus, Fumadocs, Mintlify, or any folder of .md/.mdx files.


How it works

your project/
  docs/             ← your MDX files
  mcp/              ← generated by docmcp init
    src/
      index.js      ← Cloudflare Worker
      mcp.js
    docs-data.json  ← generated by docmcp index, updated by CI
    wrangler.toml
    package.json
  .github/
    workflows/
      docmcp.yml    ← generated by docmcp action

The CLI scaffolds the mcp/ folder inside your project. From there you deploy the Worker yourself. CI keeps docs-data.json up to date automatically on every docs change.


Setup

1. Install the CLI

npm install -g @writechoice/docmcp

Or use npx @writechoice/docmcp anywhere without installing.

2. Choose your Cloudflare deployment

Option A — Standalone Worker (any project):

docmcp cf workers my-project-docs

Creates ./mcp/ with the Worker source, wrangler.toml, and an empty docs-data.json.

Option B — Pages Function (site already on Cloudflare Pages):

docmcp cf pages

Creates functions/mcp.js in your project. Deploys automatically with your next Pages push — no separate Worker needed.

3. Index your docs

docmcp index ./docs

This writes ./mcp/docs-data.json with all your parsed pages.

4. Deploy to Cloudflare

If you used cf workers:

cd mcp
npm install
wrangler login    # one time
wrangler deploy

You'll get a URL like https://my-project-docs.yourname.workers.dev.

If you used cf pages: just push — Pages deploys the function automatically. Your endpoint is https://your-site.pages.dev/mcp.

5. Set up CI (optional)

docmcp action

Creates .github/workflows/docmcp.yml. Every time you push changes to your docs, the action re-indexes and commits the updated docs-data.json. You deploy to Cloudflare manually whenever you're ready.


Connecting AI clients

Claude Code

Add to .claude/settings.json:

{
  "mcpServers": {
    "docs": {
      "url": "https://my-project-docs.yourname.workers.dev/mcp"
    }
  }
}

Cursor

Settings → MCP → Add server → paste the /mcp URL.

Claude.ai

Settings → Integrations → Add → paste the /mcp URL.


CLI reference

docmcp init [worker-name]

Scaffolds ./mcp/ in the current directory. worker-name defaults to the current folder name and becomes the CF Worker name.

docmcp init my-project-docs

docmcp index <docs-dir>

Parses all .md/.mdx files and writes ./mcp/docs-data.json.

docmcp index ./docs

| Option | Default | Description | | ------------------------ | ---------------------- | -------------------------------------------------- | | -o, --output <path> | ./mcp/docs-data.json | Where to write the index | | -f, --framework <type> | auto | docusaurus | fumadocs | mintlify | auto | | --base-url <url> | (empty) | Public URL of your docs site | | --max-content <chars> | 8000 | Max characters stored per page |

docmcp cf workers [worker-name]

Scaffolds ./mcp/ with a standalone Cloudflare Worker. Use when your project isn't on Pages, or when you want a separate deployment.

docmcp cf workers my-project-docs

docmcp cf pages

Adds functions/mcp.js to your project. Use when your site is already on Cloudflare Pages — the /mcp route deploys automatically with the site, no separate Worker needed.

docmcp cf pages

Use one or the other, not both.

docmcp action

Creates .github/workflows/docmcp.yml. Re-indexes docs on every push and commits the result.

docmcp action

| Option | Default | Description | | ------------------- | --------- | ------------------------------------ | | --docs-dir <path> | docs | Docs directory to index | | --branch <branch> | main | Branch that triggers the workflow | | --paths <glob> | docs/** | File paths that trigger the workflow |


MCP tools exposed

| Tool | Description | | ---------------------------- | ------------------------------------------- | | list_docs | Lists all indexed pages with title and path | | get_doc(path) | Returns the full content of a page | | search_docs(query, limit?) | Keyword search across all pages |


Bundle size

docs-data.json is bundled into the Worker at deploy time. Cloudflare's free tier allows up to 1 MB. If your docs are large, lower --max-content:

docmcp index ./docs --max-content 3000