How plaban1981/rag-mcp works
Project type and purpose
• This is a full-stack Python application combining:
• A local “MCP” (Managed Composition Pattern) server (FastAPI/Uvicorn)
• A LangChain-based client library for orchestrating queries via SSE
• A retrieval-augmented‐generation (RAG) pipeline using web search + vector store
• A Streamlit frontend for interactive querying and display
• Purpose: accept a user query in a browser UI, invoke web search & RAG over search results, generate an LLM answer via an agent pattern, and stream results back to the UI.
File structure analysis
• mcp_server.py – FastAPI app exposing:
– SSE endpoint (/sse) to register sessions
– HTTP POST (/messages) to receive user messages and drive agent tooling
• langchain_client.py – Python client that:
– Connects to the MCP server via HTTP & SSE
– Discovers available tools and posts user queries
– Receives streamed LLM responses
• search.py – Module for web search (Exa API) and parsing results
• rag.py – Constructs RAG pipeline:
– Embeddings via HTTP embedding service (localhost:11434)
– FAISS vector store for retrieval
– LLM summarization/generation
• streamlit_app.py – Frontend:
– Uses LangChainMCPClient under the hood
– Displays streamed output and logs
• requirements.txt, README.md, LICENSE – metadata & dependencies
Insights from README
• Shows MCP server startup and log traces (Uvicorn + FastAPI + SSE + agent “tools” calls)
• Illustrates Streamlit logs demonstrating client connecting to server, SSE registration, message posting, tool initialization, and RAG processing