Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Local DeepWiki MCP Serverexplain how the authentication module works in my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Local DeepWiki MCP Server
A local, privacy-focused MCP server that generates DeepWiki-style documentation for private repositories with RAG-based Q&A capabilities.
Features
Multi-language code parsing using tree-sitter (Python, TypeScript/JavaScript, Go, Rust, Java, C/C++, Swift, Ruby, PHP, Kotlin, C#)
AST-based chunking that respects code structure (functions, classes, methods)
Semantic search using LanceDB vector database
LLM-powered wiki generation with support for Ollama (local), Anthropic, and OpenAI
Configurable embeddings - local (sentence-transformers) or OpenAI
Incremental indexing - only re-process changed files
RAG-based Q&A - ask questions about your codebase
Deep Research mode - multi-step reasoning for complex architectural questions
Web UI - browse generated wiki in your browser
Export to HTML - generate static HTML site for sharing
Export to PDF - generate printable PDF documentation with mermaid diagrams
Interactive Codemap - cross-file execution-flow visualization with Mermaid diagrams
Lazy page generation - missing wiki pages generated on demand when visited
Installation
Using uv (recommended)
cd local-deepwiki-mcp
uv syncUsing pip
cd local-deepwiki-mcp
pip install -e .Configuration
Run the init wizard to generate a config file automatically:
deepwiki init # Interactive wizard
deepwiki init --non-interactive # Auto-detect defaults (CI/CD)Or create one manually at ~/.config/local-deepwiki/config.yaml:
embedding:
provider: "local" # or "openai"
local:
model: "all-MiniLM-L6-v2"
openai:
model: "text-embedding-3-small"
llm:
provider: "ollama" # or "anthropic" or "openai"
ollama:
model: "qwen3-coder:30b"
base_url: "http://localhost:11434"
anthropic:
model: "claude-sonnet-4-20250514"
openai:
model: "gpt-4o"
parsing:
languages:
- python
- typescript
- javascript
- go
- rust
- java
- c
- cpp
max_file_size: 1048576
exclude_patterns:
- "node_modules/**"
- "venv/**"
- ".git/**"
chunking:
max_chunk_tokens: 512
overlap_tokens: 50
output:
wiki_dir: ".deepwiki"
vector_db_name: "vectors.lance"Claude Code Integration
Add to your Claude Code MCP config (~/.claude/claude_code_config.json):
{
"mcpServers": {
"local-deepwiki": {
"command": "uv",
"args": ["run", "--directory", "/path/to/local-deepwiki-mcp", "local-deepwiki"],
"env": {
"ANTHROPIC_API_KEY": "${ANTHROPIC_API_KEY}",
"OPENAI_API_KEY": "${OPENAI_API_KEY}"
}
}
}
}MCP Tools (43 tools)
The server exposes 43 MCP tools across 8 categories. Below are the most commonly used tools with examples, followed by the full tool reference.
Core Tools
index_repository
Index a repository and generate wiki documentation.
{
"repo_path": "/path/to/repo",
"full_rebuild": false,
"llm_provider": "ollama",
"embedding_provider": "local"
}ask_question
Ask a question about the codebase using RAG.
{
"repo_path": "/path/to/repo",
"question": "How does the authentication system work?",
"max_context": 5
}deep_research
Multi-step reasoning for complex architectural questions. Performs query decomposition, parallel retrieval, gap analysis, and comprehensive synthesis.
{
"repo_path": "/path/to/repo",
"question": "How does the authentication system interact with the database layer?",
"max_chunks": 30
}Tool | Description |
| Index a repository and generate wiki documentation |
| RAG-based Q&A about the codebase |
| Multi-step reasoning with query decomposition and synthesis |
| Get the wiki table of contents |
| Read a specific wiki page |
| Semantic search across the codebase |
| Export wiki to a static HTML site |
| Export wiki to PDF with mermaid diagram rendering |
Generator Tools (12)
Tool | Description |
| Generate Mermaid diagrams (class, dependency, module, sequence) |
| Function call graph analysis |
| Searchable code entity glossary |
| Class hierarchy tree |
| Documentation coverage analysis |
| Git-based changelog generation |
| Parameter and return type extraction |
| Extract test examples for entities |
| Detect outdated wiki pages |
| Scan for hardcoded credentials |
| Repository index status and health |
| List all indexed repositories |
Analysis & Search Tools (10)
Tool | Description |
| Full-text search across wiki pages and code entities |
| Levenshtein-based name matching ("Did you mean?") |
| Imports, callers, and related files for a source file |
| Composite: glossary + call graph + inheritance + tests + API docs |
| Blast radius analysis with reverse call graph and risk level |
| Cyclomatic complexity and nesting depth via tree-sitter AST |
| Map git diff to affected wiki pages and entities |
| RAG-based Q&A about code changes |
| Parsed metadata from pyproject.toml, package.json, etc. |
| Wiki health dashboard: index, pages, coverage, status |
Codemap Tools (2)
Tool | Description |
| Cross-file execution-flow maps with Mermaid diagrams and LLM narrative |
| Discover interesting entry points from call graph hubs |
Research & Progress Tools (4)
Tool | Description |
| List saved deep research checkpoints |
| Resume a previously checkpointed research session |
| Cancel an in-progress research operation |
| Check progress of long-running operations |
Agentic Tools (5)
Tool | Description |
| Context-aware suggestions for next tools to use based on recent actions |
| Run predefined multi-step workflows (e.g., full analysis, quick review) |
| Batch version of |
| Agentic RAG: grades chunk relevance, rewrites queries for better results |
| Discover relevant tools based on a natural language query |
Web Server Tools (2)
Tool | Description |
| Start the wiki web server for browsing documentation |
| Stop a running wiki web server |
CLI Commands
All commands are subcommands of the unified deepwiki CLI. Legacy entry points (deepwiki-serve, deepwiki-export, etc.) still work for backwards compatibility.
Command | Description |
| Interactive setup wizard for configuration |
| Show index health, freshness, and wiki coverage |
| Index repo and regenerate wiki (incremental) |
| Start the MCP server (for IDE integration) |
| Serve wiki with web UI |
| Watch mode - auto-reindex on file changes |
| Export wiki to static HTML |
| Export wiki to PDF |
| Configuration management (validate, show, health-check, profile) |
| Interactive fuzzy code search |
| Cache management (stats, clear, cleanup) |
# Setup
deepwiki init # Interactive wizard
deepwiki init --non-interactive # Auto-detect defaults (CI/CD)
deepwiki init --non-interactive --force # Overwrite existing config
# Indexing & status
deepwiki update # Index repo and regenerate wiki
deepwiki update --full-rebuild # Force full rebuild
deepwiki update --dry-run # Preview what would change
deepwiki status # Show index health dashboard
deepwiki status --json # Machine-readable output
deepwiki status --verbose # Detailed file-level info
# MCP server
deepwiki mcp # Start MCP server (stdio)
# Web UI & export
deepwiki serve .deepwiki --port 8080 # Browse wiki in browser
deepwiki export .deepwiki --output ./html-export # Export to static HTML
deepwiki export-pdf .deepwiki -o docs.pdf # Export to single PDF
deepwiki export-pdf .deepwiki --separate -o dir/ # Export each page as PDF
# Configuration
deepwiki config show # Show effective configuration
deepwiki config show --raw # Show raw YAML
deepwiki config validate # Check config for errors
deepwiki config health-check # Verify provider connectivity
deepwiki config profile list # List saved config profiles
deepwiki config profile save dev # Save current config as profile
deepwiki config profile use prod # Switch to a profile
# Utilities
deepwiki search # Interactive fuzzy code search
deepwiki watch /path/to/repo # Auto-reindex on file changes
deepwiki cache stats # Show cache hit rates and sizes
deepwiki cache clear --llm --embedding # Clear caches
deepwiki cache cleanup # Remove expired entriesEnvironment Variables
ANTHROPIC_API_KEY- Required for Anthropic LLM providerOPENAI_API_KEY- Required for OpenAI LLM/embedding providers
Prerequisites
For local LLM support:
Ollama installed and running
A model pulled (e.g.,
ollama pull llama3.2)
For PDF export:
System libraries:
pango,cairo,gdk-pixbuf(WeasyPrint dependencies)macOS:
brew install pangoUbuntu/Debian:
apt install libpango-1.0-0 libpangocairo-1.0-0
Optional for mermaid diagrams:
npm install -g @mermaid-js/mermaid-cli
Troubleshooting
Ollama Connection Errors
If you see "Failed to connect to Ollama":
Ensure Ollama is running:
ollama serveVerify the model is pulled:
ollama listCheck if the default URL works:
curl http://localhost:11434/api/tagsIf using a custom port, update
config.yamlwith the correctbase_url
PDF Export Fails
"pango not found" or similar Cairo/Pango errors:
macOS:
brew install pango cairo gdk-pixbufUbuntu/Debian:
apt install libpango-1.0-0 libpangocairo-1.0-0 libgdk-pixbuf2.0-0Fedora:
dnf install pango cairo gdk-pixbuf2
Mermaid diagrams not rendering in PDF:
Install mermaid-cli:
npm install -g @mermaid-js/mermaid-cliVerify with:
mmdc --versionWithout mermaid-cli, diagrams show as code blocks
Memory Issues on Large Repositories
For repositories with 100k+ lines of code:
Increase batch size limits in config if you have more RAM
Use
full_rebuild: falsefor incremental updates after initial indexingConsider excluding large generated files via
exclude_patternsin config
LLM Quality Issues
If wiki content has hallucinations or low quality:
Switch from Ollama to Anthropic or OpenAI for better results
Try a larger local model (e.g.,
qwen3-coder:30binstead ofllama3.2)Ensure source files are properly parsed (check supported languages)
Web UI Not Loading
Check if port 8080 is in use:
lsof -i :8080Try a different port:
deepwiki serve .deepwiki --port 8081Ensure
.deepwikidirectory exists and contains generated wiki
Example Configurations
The examples/ directory contains sample configuration files:
config-local.yaml- Fully local setup with Ollama and sentence-transformersconfig-cloud.yaml- Cloud-based setup using Anthropic/OpenAIconfig-hybrid.yaml- Local embeddings with cloud LLMroles.yaml- RBAC role configuration example
Development
# Install dev dependencies
uv sync --extra dev
# Run tests
pytest
# Run the server directly
uv run local-deepwikiArchitecture
┌─────────────────────────────────────────────────────────────────────┐
│ MCP Server (Python/FastMCP) │
├─────────────────────────────────────────────────────────────────────┤
│ 43 tools across 8 categories: │
│ Core (8) · Generators (12) · Analysis & Search (10) · Codemap (2) │
│ Research & Progress (4) · Agentic (5) · Web Server (2) │
└─────────────────────────────────────────────────────────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐
│ Tree-sitter │ │ LanceDB │ │ LLM Provider │
│ (Code Parsing) │ │ (Vector Store) │ │ (Doc Generation) │
└──────────────────┘ └──────────────────┘ └──────────────────┘
│ │ │
▼ ▼ ▼
┌──────────────────────────────────────────────────────────────────┐
│ Flask Web UI │
│ Wiki Browser · Chat (RAG Q&A) · Codemap Explorer · Search │
└──────────────────────────────────────────────────────────────────┘License
MIT