# Stop LLMs from Hallucinating Old APIs: Fetch Exact-Version PyPI, npm & Rust Docs via MCP

> Source: <https://dev.to/thermn/stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via-mcp-45k>
> Published: 2026-12-04 22:34:26+00:00

**Key takeaway:** Expose a version-pinned package-docs MCP tool (Apify's hosted server or npx with APIFY_TOKEN) so coding agents fetch exact-version PyPI, npm or crates docs instead of hallucinating deprecated APIs.

Every developer using AI coding assistants (Cursor, Claude Desktop, Windsurf) or building RAG pipelines hits the same wall: **LLMs hallucinate deprecated methods** or mix up major library versions (like Pydantic v1 vs v2, NumPy 1.x vs 2.x, or fast-moving Rust crates).

And if you try pointing a generic "URL-to-Markdown" scraper at library documentation, two things usually break:

`numpy`, `pandas`, `scipy`, `openpyxl`, `scikit-learn`), and `docs.rs`` sitemap.xml`, hide behind `<meta http-equiv="refresh">` / version-hub splash pages, or dump noisy HTML navigation into your context window.
To solve this cleanly, I built **[Package Docs Finder](https://apify.com/thermn/package-docs-finder)** on Apify.

Instead of passing URLs, you pass a **package name**, **ecosystem** (`pypi`, `npm`, or `crates`), and optionally an exact **` version`** and **` topic`**:

`llms.txt`:` llms-full.txt` / `zod`, `express`, etc.).` robots.txt`, and Sphinx `searchindex.js` — prioritizing tutorials and user guides ahead of thousands of auto-generated API stubs.`2.4` -> `/doc/2.4/`) and extracts clean module/trait documentation from `tokio`, `serde`, `clap`, `reqwest`).` python`, `typescript`, `rust`).` DOCUMENTATION.md` file in Key-Value Store.
Because it runs on Apify with `Limited permissions`, you can expose it directly as an MCP tool using Apify's hosted MCP server (OAuth handles sign-in automatically — Apify's free tier includes $5/month of credits, which covers ~1,600 extracted doc pages for free):

```
{
  "mcpServers": {
    "package-docs": {
      "url": "https://mcp.apify.com/?tools=thermn/package-docs-finder"
    }
  }
}
```

Or via `npx` if you prefer `stdio` with an `APIFY_TOKEN`:

```
{
  "mcpServers": {
    "package-docs": {
      "command": "npx",
      "args": [
        "-y",
        "@apify/actors-mcp-server",
        "--tools",
        "thermn/package-docs-finder"
      ],
      "env": {
        "APIFY_TOKEN": "YOUR_APIFY_TOKEN"
      }
    }
  }
}
```

Once connected, you can prompt your agent directly:

*"Use package-docs-finder to fetch the `openpyxl` docs filtered by topic `chart` and build me a bar chart generator."*

*"Fetch `numpy` version `2.4` quickstart docs before refactoring this module."*

You can test it directly in the browser or plug it into n8n / Make / Python workflows here:

👉 [Package Docs Finder on Apify Store](https://apify.com/thermn/package-docs-finder)

If you know any tricky packages or custom documentation engines that usually break scrapers, drop them in the comments — I'd love to test them and add support!
