PinRAG is a RAG (Retrieval-Augmented Generation) system built on LangChain, providing services as an MCP (Model Context Protocol) server for Cursor, VS Code (GitHub Copilot), and other AI assistants that support MCP. It targets scenarios where learning materials are scattered: PDFs and e-books, GitHub repositories, YouTube videos, Discord discussions, and ordinary notes. It can index these materials into a shared RAG index, then answer questions in the editor with citations.
Main capabilities:
- Multi-format indexing: supports PDFs, local text files or directories, Discord exports (.txt), YouTube (video/playlist URLs or video IDs), GitHub repository URLs, and web documentation site URLs.
- RAG with citations: answers cite source context, including PDF page numbers, YouTube timestamps, document names for plain text and Discord, chunk indices for GitHub repositories, and source URLs for web documentation.
- Document tags: tag documents during indexing (such as AMIGA, PI_PICO) for filtering searches.
- Metadata filtering: query_tool supports document_id, tag, document_type, PDF page_min/page_max, and response_style (thorough or concise).
- MCP tools: add_document_tool, query_tool, list_documents_tool, remove_document_tool, set_document_tag_tool, list_collections_tool; the optional collection on a tool can override PINRAG_COLLECTION_NAME for that call.
- MCP resources: pinrag://documents (indexed documents) and pinrag://server-config (environment variables and configuration).
- MCP prompts: use_pinrag (parameter request) for querying, indexing, listing, or deleting documents.
- Configurable LLM: supports OpenRouter (default, free openrouter/free routing), OpenAI, Anthropic, or Cerebras Inference (OpenAI-compatible API), configured via PINRAG_LLM_PROVIDER and PINRAG_LLM_MODEL.
- Local embeddings: uses Nomic (PINRAG_EMBEDDING_MODEL, default nomic-embed-text-v1.5), no API key required; the first run downloads the model weights (about 270 MB, cached).
- Retrieval and chunking options: structure-aware chunking (enabled by default); optional FlashRank reranking, multi-query expansion, and parent-child chunking for PDFs.
- Observability: MCP tool notifications (ctx.log) and optional LangSmith tracing.
- Tech stack: LangChain, Chroma; optional OpenRouter, OpenAI, Anthropic, FlashRank.
Usage: Add PinRAG as an MCP server in your editor. Install uv and make sure uvx is in PATH, then you can run PinRAG from PyPI without a prior pip install.
- Cursor: add the configuration under mcpServers in ~/.cursor/mcp.json.
- VS Code (GitHub Copilot): run MCP: Open User Configuration from the Command Palette (or add .vscode/mcp.json in the workspace), with the top-level key servers.
- HTTP server mode: run pinrag server to start a streamable HTTP MCP endpoint at http://<host>:<port>/mcp; use pinrag-cli --server http://127.0.0.1:8765/mcp to connect.
- Configure API keys and PinRAG settings in the env block of the MCP entry; the server does not load a .env file when the editor starts.
- Ask directly in chat, such as "Add /path/to/amiga-book.pdf with tag AMIGA", "Index https://youtu.be/xyz and ask what it says"、"Index https://github.com/owner/repo and ask about the codebase" or "Index https://docs.langchain.com/ and summarize its memory APIs", AI will call tools to complete it.
Use cases: When learning materials are scattered across multiple sources, you want to index and query these materials directly from within the editor, and answers need to be traceable back to specific page numbers, timestamps, files, or posts. Suitable for developers consulting GitHub repositories, learners organizing PDFs and videos, teams integrating Discord discussions, etc.
Limitations:
- YouTube transcription-intensive indexing (especially from cloud or high-traffic IPs) may return "YouTube is blocking requests from your IP", which needs to be resolved via a proxy; the yt-dlp step does not use that proxy.
- Some websites (such as pages protected by Cloudflare) may return 403 to pure Python clients.
- Changing PINRAG_EMBEDDING_MODEL requires reindexing, and the vector dimensions must match the model used at indexing time.
- Enabling parent-child chunking (PINRAG_USE_PARENT_CHILD=true) requires reindexing, and pure .txt is not supported.
- Toggling the YouTube visual feature setting requires reindexing the affected YouTube documents.
- Downloading videos may violate YouTube's Terms of Service or local regulations.
- No pricing information is provided.
- No effectiveness comparison with other tools is provided.