name: deepwiki-context description: > Fetches AI-generated documentation from DeepWiki (deepwiki.com) for any public GitHub repository and injects it as context during coding workflows. Activates when working with third-party libraries, exploring unfamiliar codebases, debugging dependency issues, needing architectural understanding of open-source projects, or when a developer mentions understanding a library's internals, asks "how does X work under the hood", raises architecture questions about dependencies, references deepwiki.com, requests documentation for a GitHub repo, says "pull docs for", "get context on", "explain the architecture of", "how is X structured", or references a GitHub org/repo being integrated with. Also activates when additional context about a dependency would improve the current task. Do NOT activate for general coding questions, private repositories, writing original documentation, or when the user already has the information they need. license: Apache-2.0 compatibility: > Requires Python 3.8+. Works in Claude.ai, Claude Code, and API. Uses requests if available, falls back to urllib (no pip installs needed). allowed-tools: "Bash(python3:*)" metadata: author: Boris Polania version: 1.0.0 category: developer-tools tags: [documentation, github, mcp, deepwiki]
DeepWiki Context Fetcher
Fetch structured documentation from DeepWiki for any public GitHub repository and use it as working context. DeepWiki auto-generates architecture overviews, component breakdowns, dependency maps, and API references from source code analysis.
When to Use
- Developer is integrating a third-party library and needs to understand its architecture
- Debugging an issue that requires understanding how a dependency works internally
- Exploring an unfamiliar codebase before contributing or forking
- Need a quick architectural overview without reading raw source code
- Working with a library whose official docs are sparse or outdated
Quick Start
The primary interface is the fetch script:
# Get wiki structure (table of contents) for a repo
python3 scripts/deepwiki_fetch.py structure facebook/react
# Get a specific wiki page
python3 scripts/deepwiki_fetch.py page facebook/react "Component Lifecycle"
# Get the full wiki (all pages concatenated)
python3 scripts/deepwiki_fetch.py full facebook/react
# Ask a targeted question about a repo
python3 scripts/deepwiki_fetch.py ask pallets/flask "How does the request context stack work?"
Workflow
1. Identify the Target Repository
Determine the GitHub owner/repo from context. Sources:
- Direct user mention ("pull deepwiki docs for expressjs/express")
package.json,requirements.txt,Cargo.toml,go.mod, or similar dependency files- Import statements in the code being worked on
- Error messages referencing a library
2. Choose Your Approach
For browsing/targeted reading — fetch structure first (lightweight, ~1KB):
python3 scripts/deepwiki_fetch.py structure {owner}/{repo}
This returns a hierarchical table of contents. Use it to pick a specific page
to fetch with the page command. This avoids downloading the full wiki (~300KB+).
Use page over ask when you need comprehensive reference material (full API
surfaces, code examples, diagrams) rather than a concise synthesized answer.
For a specific question — skip structure and go straight to ask:
python3 scripts/deepwiki_fetch.py ask {owner}/{repo} "Your question"
This is faster when you already know what you need.
3. Fetch Targeted Content
For most tasks, fetch only the relevant sections rather than the full wiki:
# Fetch a specific page by title (fuzzy-matched)
python3 scripts/deepwiki_fetch.py page {owner}/{repo} "Architecture"
# Or ask a focused question to get a synthesized answer
python3 scripts/deepwiki_fetch.py ask {owner}/{repo} "How does routing work?"
When to use page vs ask:
- Use
pagewhen you need comprehensive reference material on a topic - Use
askwhen you have a specific question and want a concise, targeted answer - Use
fullonly when you need a complete architectural understanding (large output)
4. Apply the Context
Once fetched, use the documentation to:
- Understand API surfaces before writing integration code
- Identify the right extension points or hooks
- Debug issues with informed knowledge of internal behavior
- Make architectural decisions that align with the library's design patterns
Handling Edge Cases
Repo not indexed by DeepWiki: The script will report this clearly. Fallback options:
- Try fetching — DeepWiki indexes repos on first request (may take a moment)
- Use the repo's README and official docs instead
- Clone and read source directly for smaller repos
Large wikis:
Some repos generate 20+ pages. Always fetch structure first and pull only what's needed.
The page command with a targeted title is almost always sufficient.
Rate limiting: The DeepWiki MCP server is free and public. If you hit rate limits, wait briefly and retry. The script includes automatic retry with backoff.
Script Reference
For full script options and technical details on the MCP protocol integration, see references/api-details.md.
Auto-Detection Pattern
When working in a project, consider proactively fetching DeepWiki context for key dependencies. Check the project's dependency manifest and fetch architecture docs for the 2-3 most critical dependencies before diving into implementation work. This front-loads understanding and reduces context-switching later.
Example for a Node.js project:
# Parse package.json for key deps, then fetch context for each
python3 scripts/deepwiki_fetch.py structure expressjs/express
python3 scripts/deepwiki_fetch.py page expressjs/express "Middleware System"