RAG MCP Server
Enables document indexing and question answering with Retrieval-Augmented Generation, providing cited answers from user-supplied documents.
README
MCP RAG com Python, LangChain, LangGraph e LlamaIndex
Projeto de servidor Model Context Protocol (MCP) para indexar documentos e responder perguntas com RAG (Retrieval-Augmented Generation). O servidor usa FastMCP via SSE, LlamaIndex + ChromaDB para recuperação, LangGraph para orquestração e LangChain para geração.
Arquitetura
Cliente MCP -> SSE (/sse) -> FastMCP
-> ingest_documents(paths)
-> ask_rag(question)
-> LangGraph
-> recuperar contexto (LlamaIndex/Chroma)
-> gerar resposta (LangChain/OpenAI)
-> validar citações
Início rápido
cp .env.example .env
# Edite .env e informe OPENAI_API_KEY
docker compose up --build
O endpoint MCP SSE fica em http://localhost:8000/sse.
Documentos
Para tornar uma pasta local disponível ao contêiner, descomente o volume ./docs:/workspace/docs:ro no docker-compose.yml. Em seguida, chame a ferramenta com um caminho como /workspace/docs/manual.md.
Ferramentas MCP
ingest_documents
Indexa arquivos .txt, .md e .pdf.
{"paths": ["/workspace/docs/manual.md"]}
ask_rag
Recupera os trechos mais relevantes e responde com referências [S1], [S2].
{"question": "Quais são os procedimentos de backup?", "top_k": 5}
Variáveis de ambiente
| Variável | Uso |
|---|---|
OPENAI_API_KEY |
Chave da API compatível com OpenAI |
OPENAI_MODEL |
Modelo de geração LangChain |
OPENAI_EMBEDDING_MODEL |
Modelo de embeddings LlamaIndex |
OPENAI_BASE_URL |
URL-base opcional de endpoint compatível |
RAG_DATA_DIR |
Diretório persistente do ChromaDB |
RAG_COLLECTION |
Nome da coleção vetorial |
RAG_CHUNK_SIZE |
Tamanho dos trechos indexados |
RAG_CHUNK_OVERLAP |
Sobreposição entre trechos |
Segurança
Não exponha o SSE publicamente sem TLS e autenticação. Monte somente diretórios de documentos autorizados, pois a ferramenta de ingestão lê os caminhos informados.
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.