doc-mcp

doc-mcp

Enables semantic search and AI-powered Q&A over ingested GitHub documentation repositories via MCP tools.

Category
Visit Server

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

Doc-MCP Banner

Python Gradio MongoDB Atlas Nebius AI MCP License

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

  1. Create a free cluster at cloud.mongodb.com
  2. Enable Vector Search in your cluster
  3. Run the database setup script:
python scripts/db_setup.py setup

This automatically creates:

  • doc_rag โ€” document chunks with embeddings
  • ingested_repos โ€” repository metadata
  • Vector search index on the embedding field

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

  1. Navigate to the ๐Ÿ“ฅ Documentation Ingestion tab
  2. Enter a GitHub repository URL:
    • langchain-ai/langchain
    • https://github.com/facebook/react
    • owner/repo
  3. Click Load Files โ€” the system fetches the full file tree
  4. Select which markdown files to include
  5. Click Ingest Selected Files โ€” watch the progress bar as files are chunked and embedded

2. Ask Questions

  1. Go to the ๐Ÿค– AI Documentation Assistant tab
  2. Select your ingested repository from the dropdown
  3. Type any natural language question
  4. 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_KEY to 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_SIZE in your .env (e.g., CHUNK_SIZE=1024).

MongoDB connection errors

  1. Verify your IP is whitelisted in Atlas Network Access
  2. Confirm Vector Search is enabled on your cluster tier (M10+)
  3. Double-check the connection string format in .env

Embedding API errors

Verify your NEBIUS_API_KEY is 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:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. 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

โฌ† Back to top

</div>

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured