cd /news/ai-agents/stop-llms-from-hallucinating-old-api… · home › topics › ai-agents › article
[ARTICLE · art-182128] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

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

A developer built Package Docs Finder, an Apify-hosted tool that fetches exact-version documentation for PyPI, npm and Rust crates packages and exposes it as an MCP tool for AI coding assistants and RAG pipelines. The tool takes a package name, ecosystem and optional version and topic, then extracts clean docs from sources like llms.txt, docs.rs and Sphinx searchindex.js to reduce LLM hallucination of deprecated or mismatched library APIs. It can be connected to Cursor, Claude Desktop or Windsurf via Apify's hosted MCP server or npx with an APIFY_TOKEN.

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.

by read2 min views10 publishedDec 4, 2026

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 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

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!

── more in #ai-agents 4 stories · sorted by recency
── more on @apify 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/stop-llms-from-hallu…] indexed:0 read:2min 2026-12-04 · —