{"slug": "stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via", "title": "Stop LLMs from Hallucinating Old APIs: Fetch Exact-Version PyPI, npm & Rust Docs via MCP", "summary": "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.", "body_md": "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).\n\nAnd if you try pointing a generic \"URL-to-Markdown\" scraper at library documentation, two things usually break:\n\n`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.\nTo solve this cleanly, I built **[Package Docs Finder](https://apify.com/thermn/package-docs-finder)** on Apify.\n\nInstead of passing URLs, you pass a **package name**, **ecosystem** (`pypi`, `npm`, or `crates`), and optionally an exact **` version`** and **` topic`**:\n\n`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.\nBecause 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):\n\n```\n{\n  \"mcpServers\": {\n    \"package-docs\": {\n      \"url\": \"https://mcp.apify.com/?tools=thermn/package-docs-finder\"\n    }\n  }\n}\n```\n\nOr via `npx` if you prefer `stdio` with an `APIFY_TOKEN`:\n\n```\n{\n  \"mcpServers\": {\n    \"package-docs\": {\n      \"command\": \"npx\",\n      \"args\": [\n        \"-y\",\n        \"@apify/actors-mcp-server\",\n        \"--tools\",\n        \"thermn/package-docs-finder\"\n      ],\n      \"env\": {\n        \"APIFY_TOKEN\": \"YOUR_APIFY_TOKEN\"\n      }\n    }\n  }\n}\n```\n\nOnce connected, you can prompt your agent directly:\n\n*\"Use package-docs-finder to fetch the `openpyxl` docs filtered by topic `chart` and build me a bar chart generator.\"*\n\n*\"Fetch `numpy` version `2.4` quickstart docs before refactoring this module.\"*\n\nYou can test it directly in the browser or plug it into n8n / Make / Python workflows here:\n\n👉 [Package Docs Finder on Apify Store](https://apify.com/thermn/package-docs-finder)\n\nIf 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!", "url": "https://wpnews.pro/news/stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via", "canonical_source": "https://dev.to/thermn/stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via-mcp-45k", "published_at": "2026-12-04 22:34:26+00:00", "updated_at": "2026-12-04 22:44:05.923422+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-tools", "developer-tools"], "entities": ["Apify", "Package Docs Finder", "Cursor", "Claude Desktop", "Windsurf", "PyPI", "npm", "docs.rs"], "also_reported_by": [], "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.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via", "markdown": "https://wpnews.pro/news/stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via.md", "text": "https://wpnews.pro/news/stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via.txt", "jsonld": "https://wpnews.pro/news/stop-llms-from-hallucinating-old-apis-fetch-exact-version-pypi-npm-rust-docs-via.jsonld"}}