← Blog

July 14, 2026 · 5 min read

How to Query Any npm Package's Documentation with AI

TL;DR: AI models hallucinate about npm packages because they work from outdated training snapshots. Fix this by indexing the package's docs site in AgentReady (paste the URL, done in 60 seconds), connecting AgentReady to your AI editor via MCP, and asking questions explicitly referencing AgentReady. The editor calls ask_site, retrieves cited documentation chunks, and answers from the actual current docs — not training data.

Most npm packages have a documentation site. Some are well-organized; most are a maze of sidebar links and API tables that you scan with Ctrl+F. Asking an AI to answer questions about them is often worse — the model either hallucinates or admits it doesn't know the package well enough.

The problem isn't the AI. It's that the AI has no reliable, up-to-date source to ground its answer in. This guide shows how to fix that with AgentReady, which indexes a package's docs site and exposes it as an MCP tool that your AI editor can query in real time.

Why models hallucinate about packages

Training data cutoffs mean models have no knowledge of packages released or significantly updated in the past year. Even for well-known packages, they're working from a snapshot — not from your installed version, not from the current docs, and definitely not from that changelog entry that explains the breaking change you hit this morning.

The right fix isn't a bigger model — it's grounding the model in the actual docs. That's what RAG (Retrieval Augmented Generation) does, and it's what AgentReady sets up automatically.

Step 1: Find the package's docs URL

Most packages link their docs site from npmjs.com/package/<name> in the README or homepage field. For example:

  • zodzod.dev
  • trpctrpc.io/docs
  • drizzle-ormorm.drizzle.team/docs
  • @tanstack/react-querytanstack.com/query/latest/docs

If the package only has a GitHub README and no separate docs site, you can index github.com/org/repo directly — AgentReady will crawl whatever is publicly accessible.

Step 2: Index the docs in AgentReady

Go to agentready.it.com, paste the docs URL, and hit Index. AgentReady crawls the site, extracts clean content from every page, and builds a searchable index — typically in under 60 seconds for most documentation sites.

You can also do this programmatically via the API:

curl -X POST https://www.agentready.it.com/api/submit \
  -H "Content-Type: application/json" \
  -d '{"url": "https://zod.dev"}'

Once indexed, the docs are queryable forever. You don't re-index on every session — just when the package releases a new major version or the docs change significantly (you can trigger a refresh anytime).

Step 3: Connect AgentReady to your AI editor

AgentReady exposes an MCP server at https://www.agentready.it.com/api/mcp. Add it to your editor's MCP config:

Claude Desktop — edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "agentready": {
      "command": "npx",
      "args": ["-y", "@agentreadyweb/mcp"]
    }
  }
}

Cursor — go to Settings → MCP → Add Server → HTTP and paste https://www.agentready.it.com/api/mcp.

Windsurf — open Windsurf Settings (JSON) and add:

{
  "mcpServers": {
    "agentready": {
      "url": "https://www.agentready.it.com/api/mcp"
    }
  }
}

Step 4: Ask questions

Once connected, ask your AI editor anything about the package. Be explicit about using AgentReady so the model knows where to look:

Using AgentReady, how do I define a discriminated union in Zod?
Ask AgentReady: what's the difference between useQuery and useSuspenseQuery in TanStack Query v5?
Look up in AgentReady how Drizzle handles many-to-many relations.

The AI calls AgentReady's ask_site tool, retrieves the relevant documentation chunks, and answers with citations. No hallucination, no training cutoff — just the actual docs.

Querying multiple packages at once

You can index as many packages as you need. AgentReady's list_sites tool shows every indexed domain. When you ask a question, specify which site to query with ask_site.

If you ask a cross-package question — "how do Zod and tRPC work together?" — the AI can call ask_site on both domains in sequence and synthesize the answer.

Packages with only a GitHub README

Not every package has a proper docs site. For GitHub-only packages, index the repo URL:

curl -X POST https://www.agentready.it.com/api/submit \
  -H "Content-Type: application/json" \
  -d '{"url": "https://github.com/sindresorhus/p-limit"}'

AgentReady crawls the README, any wiki pages, and linked markdown files. Smaller but still useful — you get the full README as a queryable source rather than hoping the model remembers it from training.

Keeping docs fresh after releases

When a package ships a new version and updates its docs, call the refresh endpoint:

curl -X POST https://www.agentready.it.com/api/webhook/refresh \
  -H "Content-Type: application/json" \
  -d '{"domain": "zod.dev"}'

Or just ask Cascade/Cursor to do it: "Refresh zod.dev in AgentReady." It calls refresh_site automatically.

One pattern that works well: when you bump a package version in package.json, add refreshing its docs as a step in your upgrade checklist. That way your AI editor always has the version you're actually running.

Frequently asked questions

Why do AI models hallucinate about npm packages?

Training data cutoffs mean models have no knowledge of packages released or significantly updated in the past year. Even for well-known packages, models work from a snapshot — not from the currently installed version or the latest changelog. The fix is grounding the model in the actual current docs through RAG, not using a bigger model.

How do I index an npm package's documentation in AgentReady?

Find the package's docs URL from npmjs.com (e.g. zod → zod.dev, trpc → trpc.io/docs), then paste it at agentready.it.com or call the API: curl -X POST https://www.agentready.it.com/api/submit with the URL in the body. The site is indexed in under 60 seconds and stays queryable until you refresh it.

How do I keep npm package docs current in AgentReady after a new release?

Call the refresh endpoint (POST /api/webhook/refresh with the domain) or ask your AI editor to run refresh_site. A practical approach is to add refreshing the docs to your upgrade checklist when bumping a package version in package.json — that way your AI editor always has the version you're actually running.

Index any npm docs site in 60 seconds — no account, no API key.

Try AgentReady free →