nfilho1989/mcp_server
3.1
If you are the rightful owner of mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Model Context Protocol (MCP) server is a crucial component in integrating various AI and data retrieval technologies, facilitating seamless communication and data exchange between systems.
MCP + Elasticsearch + LangChain Demo
Este projeto demonstra a integraΓ§Γ£o entre Model Context Protocol (MCP), Elasticsearch e LangChain para criar um sistema de RAG (Retrieval-Augmented Generation).
π Como executar
1. Acessar o container
docker exec -it mcp-elasticsearch-server /bin/bash
2. Executar o aplicativo principal
cd /app
python src/init_app.py
3. OpΓ§Γ΅es disponΓveis
- Testar Elasticsearch: Verifica se a conexΓ£o e busca estΓ£o funcionando
- Iniciar servidor MCP: Inicia o servidor MCP (ainda nΓ£o conectado ao agente)
- Iniciar agente de IA: Chat interativo com o assistente
- Exemplo completo: DemonstraΓ§Γ£o de todas as funcionalidades
- Limpar dados: Remove todos os dados do Γndice
π Exemplos de perguntas para o agente
- "Quais posts existem sobre usuΓ‘rios?"
- "Me mostre os posts mais recentes"
- "Quantos documentos existem por categoria?"
- "Busque posts que mencionam email"
- "Me dΓͺ detalhes do post com ID post_1"
π οΈ Instalando Ollama (para o modelo LLM gratuito)
Para usar o agente de IA, vocΓͺ precisa instalar o Ollama no container:
# Dentro do container
curl -fsSL https://ollama.ai/install.sh | sh
# Baixar o modelo Llama2 (ou mistral para algo menor)
ollama pull llama2
# ou
ollama pull mistral
# Iniciar o servidor Ollama em background
ollama serve &
π Arquitetura
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββ
β β β β β β
β LangChain ββββββΆβ MCP Server ββββββΆβ Elasticsearch β
β Agent β β β β β
β β β β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββ
β β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββ
Direct ES Access (for now)
π§ Estrutura do Projeto
/app/
βββ src/
β βββ mcp_server/
β β βββ mcp_config.json
β β βββ server.py
β βββ elasticsearch_client/
β β βββ es_client.py
β βββ agents/
β β βββ elasticsearch_agent.py
β βββ init_app.py
βββ data/
βββ notebooks/
βββ requirements.txt
βββ .env