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

read-mcp-server

v0.2.0

Published

MCP server that searches and reads documentation from a single docs website

Downloads

23

Readme

read-mcp-server

A small Model Context Protocol server that lets an AI assistant (Claude Code, Claude Desktop, Cursor, …) search and read documentation from a single docs website. Point it at a docs site's base URL; it reads that site's sitemap.xml as its index — no search engine, no API key, no crawler.

Tools

| Tool | Input | What it does | |------|-------|--------------| | search_docs | query (string), limit (number, optional, default 10) | Ranks pages from the site's sitemap against the query and returns candidate titles + URLs. Does not return page content. | | read_doc | url (string) | Fetches one page on the configured site, strips navigation/footer/scripts, and returns the main content as Markdown. Off-site URLs are refused. |

The intended flow is search_docs → pick a URL → read_doc.

How it finds pages

On the first search_docs call the server fetches the site's sitemap.xml (following a <sitemapindex> if present) and caches the URL list in memory. Searching scores each URL's title and path slug against the query — whole-word matches beat prefix matches, title matches beat slug matches, and shallower pages win ties. If the site has no sitemap, it falls back to an llms.txt index at the site root.

This means matching is against page titles and URL slugs, not full page text. It is deterministic and self-contained, but a term that appears only in a page's body won't be found.

Requirements

  • Node.js ≥ 20
  • A documentation site that publishes a sitemap.xml (or an llms.txt)

Protocol support

Speaks MCP revision 2026-07-28 and the 2025 revisions (2024-10-07 … 2025-11-25) from the same process, over stdio. Which one a connection uses is the client's choice: hosts that predate 2026-07-28 open with the usual initialize handshake and see no change, so no config below needs updating. Hosts that negotiate 2026-07-28 get the stateless request model, and a tools/list result they may cache for an hour.

Install & build

npm install
npm run build

Configuration

Configured entirely through environment variables:

| Variable | Required | Default | Purpose | |----------|----------|---------|---------| | DOCS_BASE_URL | ✅ | — | Root of the docs site. Only URLs under it are searched or read. | | DOCS_SITEMAP_URL | | <origin>/sitemap.xml | Override when the sitemap isn't at the site root. | | DOCS_INDEX_TTL_MS | | 3600000 (1h) | How long the in-memory index is cached before refetching. | | DOCS_MAX_CONTENT_CHARS | | 15000 | Max characters returned by read_doc before truncation. | | DOCS_USER_AGENT | | read-mcp-server/<version> | User-Agent sent with every request. |

Use with an MCP client

Add to your client's MCP config (e.g. .mcp.json for Claude Code, or claude_desktop_config.json for Claude Desktop). The simplest way is to run the published package with npx — no clone or build required:

{
  "mcpServers": {
    "docs": {
      "command": "npx",
      "args": ["-y", "read-mcp-server"],
      "env": {
        "DOCS_BASE_URL": "https://modelcontextprotocol.io"
      }
    }
  }
}

Prefer to run a local checkout instead? Build it (see Install & build) and point the client at the built entry:

{
  "mcpServers": {
    "docs": {
      "command": "node",
      "args": ["/absolute/path/to/read-mcp-server/dist/index.js"],
      "env": {
        "DOCS_BASE_URL": "https://modelcontextprotocol.io"
      }
    }
  }
}

Restart the client; the search_docs and read_doc tools should appear.

Try it locally

Inspect the tools interactively with the MCP Inspector:

DOCS_BASE_URL=https://modelcontextprotocol.io \
  npx @modelcontextprotocol/inspector node dist/index.js

Security

read_doc refuses any URL whose origin differs from DOCS_BASE_URL. Because the URL it receives comes from the model — whose context may include text from the docs pages themselves — this origin check is a deliberate guard against a prompt injection turning the tool into an SSRF vector (e.g. cloud metadata endpoints or internal services).

Project docs

This repo tracks its own work as structured documentation with @koniverse/koni-docs. Stories live in docs/sprints/stories/; the generated roll-up is docs/sprints/STATUS.md.

npm run docs:status     # regenerate docs/sprints/STATUS.md from story frontmatter
npm run docs:validate   # check the epic/sprint reference graph (exits non-zero on error)

STATUS.md is generated — edit stories, not the roll-up. It embeds a "Last generated" timestamp, so re-running docs:status always produces a diff even when no story changed; a timestamp-only change is expected.

Development

npm test          # run the test suite (vitest)
npm run test:watch
npm run typecheck
npm run dev        # run from source with tsx, e.g. DOCS_BASE_URL=… npm run dev

License

MIT