MCP RAG Server
MCP RAG Server
Servidor MCP para RAG com Embeddings Vetoriais e Chunking Inteligente
Servidor MCP completo para Retrieval Augmented Generation — embeddings vetoriais, chunking inteligente e busca semantica.
Funcionalidades | Screenshots | Instalacao | Uso | API
Stack Tecnologica
Tecnologia | Versao | Uso |
3.11+ | Backend async | |
0.104+ | API REST | |
24+ | Containerizacao |
Screenshots
Swagger UI — Endpoints da API
Qdrant Dashboard — Busca Semantica
Nota: Substitua as imagens por screenshots reais do servidor.
Funcionalidades
Tools MCP
ingest_document— Ingerir documentorag_query— Busca semanticalist_documents— Listar docsdelete_document— Remover dochealth_check— Status
Recursos
Chunking inteligente (paragrafos, sentencas)
Embeddings locais ou OpenAI
Cache de embeddings
CLI para testes rapidos
API REST complementar
Providers de Embedding
Provider | Modelo | Dimensoes | Custo |
Local | all-MiniLM-L6-v2 | 384 | Gratuito |
OpenAI | text-embedding-3-small | 1536 | Pago |
Instalacao
Pre-requisitos
Requisito | Versao Minima | Como verificar |
Python | 3.11+ |
|
Docker | 24+ |
|
Opcao 1 — Docker (Recomendado)
# Clonar
git clone https://github.com/amaralphp/mcp-rag-server.git
cd mcp-rag-server
# Configurar
cp .env.example .env
# Iniciar (Qdrant + Server)
docker compose up -d
# Acessar
# API: http://localhost:8000
# Swagger: http://localhost:8000/docs
# Qdrant: http://localhost:6333/dashboardOpcao 2 — Instalacao Manual
# Clonar
git clone https://github.com/amaralphp/mcp-rag-server.git
cd mcp-rag-server
# Ambiente virtual
python -m venv venv
source venv/bin/activate # Linux/Mac
.\venv\Scripts\Activate.ps1 # Windows
# Dependencias
pip install -e .
# Qdrant (Docker separado)
docker run -d --name qdrant -p 6333:6333 -p 6334:6334 qdrant/qdrant
# Iniciar servidor MCP
python -m src.mcp_server
# OU API REST
uvicorn src.api.main:app --reload --port 8000Variaveis de Ambiente
Variavel | Padrao | Descricao |
|
|
|
| — | Chave OpenAI (se usar) |
|
| Host do Qdrant |
|
| Porta HTTP Qdrant |
|
| Tamanho do chunk |
|
| Overlap entre chunks |
Uso
Via MCP
# Ingerir documento
result = await ingest(
content="Texto do documento...",
source="arquivo.md",
chunk_size=500
)
# Buscar contexto
result = await query(
query="Qual e a pergunta?",
top_k=5
)Via CLI
mcp-rag ingest --file documento.md
mcp-rag query "minha pergunta"
mcp-rag list
mcp-rag delete <doc_id>
mcp-rag healthVia API REST
# Ingerir
curl -X POST http://localhost:8000/ingest \
-H "Content-Type: application/json" \
-d '{"content": "Texto...", "source": "doc.md"}'
# Buscar
curl -X POST http://localhost:8000/query \
-H "Content-Type: application/json" \
-d '{"query": "minha pergunta", "top_k": 5}'API
Metodo | Endpoint | Descricao |
|
| Ingerir documento |
|
| Busca semantica |
|
| Listar documentos |
|
| Remover documento |
|
| Health check |
Estrutura do Projeto
mcp-rag-server/
├── src/
│ ├── mcp_server.py
│ ├── cli.py
│ ├── tools/
│ ├── chunking/
│ ├── embeddings/
│ ├── vectorstore/
│ └── api/
│ ├── main.py
│ ├── routes/
│ └── schemas.py
├── tests/
├── docker-compose.yml
├── Dockerfile
├── requirements.txt
├── pyproject.toml
├── .env.example
├── .github/workflows/ci.yml
├── LICENSE
└── README.mdTestes
pytest -v
pytest --cov=src --cov-report=htmlCI/CD
flowchart LR
A[Push/PR] --> B[Ruff Lint]
B --> C[MyPy]
C --> D[Pytest]
D --> E[Docker Build]
E --> F{Branch main?}
F -->|Sim| G[Push Image]
F -->|Nao| H[Pronto]Roadmap
Hugging Face embeddings
Cohere embeddings
Reranking de resultados
Suporte a PDF/DOCX
Dashboard de metricas
Contribuindo
Fork o repositorio
Crie uma branch (
git checkout -b feature/minha-feature)Commit (
git commit -m 'feat: novo provider')Push (
git push origin feature/minha-feature)Abra um Pull Request
Licenca
Este projeto esta licenciado sob a MIT License.
Veja o arquivo LICENSE para detalhes.
Feito com :heart: para a comunidade de AI/ML
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/amaralphp/mcp-rag-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server