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/fumadocs-mcp

v0.1.1

Published

MCP server route handler for Fumadocs projects

Readme

@writechoice/fumadocs-mcp

MCP (Model Context Protocol) server route handler for Fumadocs projects. Exposes your documentation as an MCP endpoint that AI assistants can query directly — no separate indexing step, no static JSON file. It reads from the Fumadocs source API you already have.

Installation

npm install @writechoice/fumadocs-mcp

Setup

1. Add to next.config.ts

const config: NextConfig = {
  transpilePackages: ["@writechoice/fumadocs-mcp"],
  // ...rest of your config
};

2. Create the MCP route

// src/app/mcp/route.ts
import { createMCPHandler } from "@writechoice/fumadocs-mcp";
import { source } from "@/lib/source";

export const { GET, POST, OPTIONS } = createMCPHandler(source, {
  server: { name: "My Docs", version: "1.0.0" },
});

That's it. Your MCP server is live at /mcp.

Options

createMCPHandler(source, {
  server: {
    name: string;    // displayed in GET /mcp and MCP initialize response
    version: string; // semver string
  };
});

Endpoints

| Method | Path | Description | | --------- | ------ | ---------------------------------------- | | GET | /mcp | Server info and capabilities (tool list) | | POST | /mcp | MCP JSON-RPC 2.0 handler | | OPTIONS | /mcp | CORS preflight |

MCP Tools

list_docs

Lists all documentation pages grouped by section, with title, URL, and description.

{ "method": "tools/call", "params": { "name": "list_docs", "arguments": {} } }

get_doc

Fetches the full processed markdown content of one or more pages by URL path. Accepts a single path or an array for batch reads.

{
  "method": "tools/call",
  "params": {
    "name": "get_doc",
    "arguments": { "path": "/api-reference/charges/create-charge" }
  }
}
{
  "method": "tools/call",
  "params": {
    "name": "get_doc",
    "arguments": { "path": ["/documentation/introduction", "/api-reference/get-started/authentication"] }
  }
}

search_docs

Fast keyword search over page titles and descriptions. Good for finding a page by name.

{
  "method": "tools/call",
  "params": {
    "name": "search_docs",
    "arguments": { "query": "webhook", "limit": 5, "scoreThreshold": 0.1 }
  }
}

search_docs_fulltext

Full-text search using the Fumadocs Orama index. Searches page bodies, headings, and paragraphs. Use this when search_docs returns no results or you need to find mentions within content.

{
  "method": "tools/call",
  "params": {
    "name": "search_docs_fulltext",
    "arguments": { "query": "idempotency key", "limit": 10 }
  }
}

Testing

With your dev server running:

# Server info
curl http://localhost:3000/mcp

# Initialize MCP session
curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}'

# List all docs
curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"list_docs","arguments":{}}}'

# Full-text search
curl -X POST http://localhost:3000/mcp \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_docs_fulltext","arguments":{"query":"charges"}}}'

How it works

createMCPHandler closes over your Fumadocs source instance and uses it directly:

| MCP Tool | Fumadocs API | | ---------------------- | ---------------------------------------------------------------- | | list_docs | source.getPages() | | get_doc | source.getPage(slugs) + page.data.getText('processed') | | search_docs | Keyword scoring over page.data.title / page.data.description | | search_docs_fulltext | createFromSource(source) — same Orama index as /api/search |

No filesystem walking, no static JSON index. Content is always in sync with your docs at build time.

Requirements

  • fumadocs-core >= 16
  • next >= 15
  • source.config.ts must have postprocess: { includeProcessedMarkdown: true } for get_doc to return full content