doc-mcp
Enables semantic search and AI-powered Q&A over ingested GitHub documentation repositories via MCP tools.
README
title: Doc-MCP Documentation RAG System emoji: 📚 colorFrom: indigo colorTo: purple sdk: gradio sdk_version: "5.34.2" app_file: app.py pinned: true license: mit short_description: GitHub docs into queryable RAG knowledge bases
Doc-MCP — Documentation RAG System
<div align="center">
Transform any GitHub documentation repository into an intelligent, queryable knowledge base — in minutes.
Live Demo · Report Bug · Request Feature
</div>
What is Doc-MCP?
Doc-MCP is an open-source Retrieval-Augmented Generation (RAG) system purpose-built for software documentation. Point it at any public GitHub repository, and within minutes you can ask natural language questions and receive precise, cited answers — all powered by state-of-the-art vector embeddings and large language models.
It also exposes its search capabilities as MCP (Model Context Protocol) tools, meaning any MCP-compatible AI assistant (like Claude Desktop) can query your documentation knowledge base directly, without manual copy-paste.
Features
| Feature | Description |
|---|---|
| Semantic Search | Find answers across thousands of docs using natural language — no keyword matching required |
| AI-Powered Q&A | Get intelligent, contextual responses with exact source file citations |
| Batch Processing | Ingest entire repositories with real-time progress tracking |
| Incremental Updates | SHA-based change detection — only re-embeds files that actually changed |
| Repository Management | Full CRUD: view stats, delete repositories, manage ingested content |
| MCP Integration | Expose documentation search as tools for any MCP-compatible AI agent |
| Gradio Web UI | Clean, intuitive browser interface — no CLI knowledge required |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Gradio Web UI │
│ (Ingestion Tab | Q&A Tab | Management Tab | MCP Info) │
└─────────────────┬───────────────────────────────────────────┘
│
┌────────▼────────┐
│ GitHub Loader │ ← Async file fetching with rate-limit handling
└────────┬────────┘
│ Markdown files
┌────────▼────────┐
│ Text Chunker │ ← Header-aware recursive splitting (CHUNK_SIZE=3072)
└────────┬────────┘
│ Text chunks
┌────────▼────────┐
│ Nebius AI │ ← BAAI/bge-en-icl embeddings (4096 dims)
│ Embeddings │
└────────┬────────┘
│ Vectors
┌────────▼────────┐
│ MongoDB Atlas │ ← Vector Search index (cosine similarity)
│ Vector Store │
└────────┬────────┘
│ Top-K results
┌────────▼────────┐
│ Nebius LLM │ ← Meta-Llama-3.1-70B-Instruct
│ (Answer Gen) │
└─────────────────┘
Quick Start
Prerequisites
- Python 3.13+
- MongoDB Atlas account with Vector Search enabled
- Nebius AI API key (for embeddings + LLM)
- GitHub Personal Access Token (optional — increases rate limit from 60 to 5,000 req/hr)
Installation
# Clone the repository
git clone https://github.com/tirth1263/doc-mcp.git
cd doc-mcp
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/Mac
# .venv\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
Configuration
# Copy environment template
cp .env.example .env
Edit .env with your credentials:
# Required
NEBIUS_API_KEY=your_nebius_api_key_here
MONGODB_URI=mongodb+srv://username:password@cluster.mongodb.net/
# Optional
GITHUB_API_KEY=your_github_token_here
CHUNK_SIZE=3072
SIMILARITY_TOP_K=5
GITHUB_CONCURRENT_REQUESTS=10
MongoDB Atlas Setup
- Create a free cluster at cloud.mongodb.com
- Enable Vector Search in your cluster
- Run the database setup script:
python scripts/db_setup.py setup
This automatically creates:
doc_rag— document chunks with embeddingsingested_repos— repository metadata- Vector search index on the
embeddingfield
Launch
python main.py
Visit http://localhost:7860 to access the web interface.
MCP SSE endpoint: http://127.0.0.1:7860/gradio_api/mcp/sse
Usage Guide
1. Ingest Documentation
- Navigate to the 📥 Documentation Ingestion tab
- Enter a GitHub repository URL:
langchain-ai/langchainhttps://github.com/facebook/reactowner/repo
- Click Load Files — the system fetches the full file tree
- Select which markdown files to include
- Click Ingest Selected Files — watch the progress bar as files are chunked and embedded
2. Ask Questions
- Go to the 🤖 AI Documentation Assistant tab
- Select your ingested repository from the dropdown
- Type any natural language question
- Get an AI-generated answer with source file citations
Example questions:
- "How do I set up authentication?"
- "What are the available configuration options?"
- "Show me an example of streaming responses"
- "What's the difference between X and Y?"
3. Manage Repositories
Use the 🗂️ Repository Management tab to:
- View statistics (file count, chunk count, last ingested date)
- Delete repositories to free up storage
- Refresh the repository list
MCP Integration
Connect any MCP-compatible AI assistant to query your documentation:
Claude Desktop Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"doc-mcp": {
"url": "http://127.0.0.1:7860/gradio_api/mcp/sse"
}
}
}
Available MCP Tools
search_documentation
Semantic similarity search across ingested documentation.
{
"repo": "langchain-ai/langchain",
"query": "how to use memory in chains",
"top_k": 5
}
ask_documentation
AI-powered Q&A with source citations.
{
"repo": "langchain-ai/langchain",
"question": "What is the difference between LLMChain and ConversationChain?"
}
list_available_repos
List all ingested repositories.
{}
Configuration Reference
| Variable | Default | Description |
|---|---|---|
NEBIUS_API_KEY |
— | Required. Nebius AI API key |
MONGODB_URI |
— | Required. MongoDB Atlas connection string |
GITHUB_API_KEY |
— | Optional. GitHub token for higher rate limits |
CHUNK_SIZE |
3072 |
Maximum characters per text chunk |
SIMILARITY_TOP_K |
5 |
Number of chunks retrieved per query |
GITHUB_CONCURRENT_REQUESTS |
10 |
Parallel GitHub API requests |
Project Structure
doc-mcp/
├── app.py # Hugging Face Spaces entry point
├── main.py # Local development entry point
├── requirements.txt
├── .env.example
├── scripts/
│ └── db_setup.py # Database initialization & status utility
└── src/
├── config.py # Environment & constants
├── github_loader.py # Async GitHub file fetching
├── embeddings.py # Nebius embeddings + LLM answer generation
├── vector_store.py # MongoDB Atlas vector operations
├── mcp_server.py # MCP tool definitions
└── ui.py # Gradio web interface
Troubleshooting
Rate limit errors from GitHub
Add a
GITHUB_API_KEYto your.env. Authenticated requests get 5,000/hr vs 60/hr unauthenticated.
No results returned from search
The MongoDB Atlas Vector Search index may still be building (can take 2-5 minutes after first setup). Check status with:
python scripts/db_setup.py status
Memory / OOM errors during ingestion
Reduce
CHUNK_SIZEin your.env(e.g.,CHUNK_SIZE=1024).
MongoDB connection errors
- Verify your IP is whitelisted in Atlas Network Access
- Confirm Vector Search is enabled on your cluster tier (M10+)
- Double-check the connection string format in
.env
Embedding API errors
Verify your
NEBIUS_API_KEYis valid and has sufficient credits.
Tech Stack
| Component | Technology |
|---|---|
| Web UI | Gradio 5 |
| Embeddings | BAAI/bge-en-icl via Nebius AI |
| LLM | Meta-Llama-3.1-70B-Instruct via Nebius AI |
| Vector DB | MongoDB Atlas Vector Search |
| GitHub API | aiohttp (async) |
| Protocol | Model Context Protocol (MCP) |
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
Distributed under the MIT License. See LICENSE for details.
<div align="center">
Built with Python, Gradio, MongoDB Atlas, and Nebius AI
</div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。