Skip to main content
Glama

Agentic RAG Assistant with FastAPI + MCP

내부 문서용 어시스턴트로, 채용 담당자들이 현재 평가하는 네 가지 요소를 결합합니다:

  • Agentic AI — LLM이 지식 베이스를 검색할지, 계산을 실행할지, 아니면 직접 답변할지 결정하는 도구 사용 루프입니다.

  • FastAPI — 자동 생성된 Swagger 문서를 갖춘 깔끔한 REST 백엔드(/ingest, /query, /agent/chat)입니다.

  • RAG — 문서는 청크되고, 인덱싱되고, LLM이 답변하기 전에 의미적 관련성으로 검색됩니다.

  • MCP (Model Context Protocol) — 동일한 도구(RAG 검색 + 비즈니스 로직)가 MCP 서버로 노출되어, 이 API뿐만 아니라 모든 MCP 호환 클라이언트(Claude Desktop, Claude Code 등)가 직접 사용할 수 있습니다.

Architecture

                     ┌────────────────────┐
                     │   FastAPI Service   │
                     │  (app/main.py)      │
                     └─────────┬───────────┘
                               │
                     ┌─────────▼───────────┐
                     │   Agent Loop         │◄──── Groq API (tool use)
                     │  (app/agent.py)      │
                     └─────────┬───────────┘
                               │ calls
                 ┌─────────────┼──────────────┐
                 ▼                             ▼
        ┌────────────────┐           ┌──────────────────┐
        │  RAG Engine      │           │  Business Tools    │
        │  (app/rag.py)    │           │  (app/tools.py)     │
        └────────────────┘           └──────────────────┘
                 ▲                             ▲
                 └─────────────┬───────────────┘
                                │  same tools, exposed via
                     ┌──────────▼───────────┐
                     │   MCP Server           │
                     │  (app/mcp_server.py)   │
                     └────────────────────────┘

Setup

python -m venv venv
source venv/bin/activate       # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env           # add your GROQ_API_KEY

Run the API

uvicorn app.main:app --reload --port 8000

http://localhost:8000/docs를 열면 대화형 Swagger 문서를 볼 수 있습니다.

Try it

# Pure retrieval, no LLM call
curl -X POST http://localhost:8000/query \
  -H "Content-Type: application/json" \
  -d '{"query": "how many days of leave do I get?"}'

# Full agentic chat — LLM decides which tool(s) to call
curl -X POST http://localhost:8000/agent/chat \
  -H "Content-Type: application/json" \
  -d '{"message": "I joined in March and have taken 4 days off. How much leave do I have left, and what is the WFH policy?"}'

두 번째 호출은 다중 도구 추론을 보여줍니다: 모델이 한 대화에서 WFH 정책에 대해 rag_search를 호출하고, 계산을 위해 calculate_leave_balance를 호출합니다.

Run as an MCP server

python -m app.mcp_server

stdio를 통해 이 스크립트를 어떤 MCP 호스트에든 연결하면(예: Claude Desktop의 claude_desktop_config.json에 사용자 지정 MCP 서버로 추가), rag_search, get_current_datetime, calculate_leave_balance를 호출 가능한 도구로 노출합니다.

인터뷰에서 이 프로젝트에 대해 말할 내용

  • 기본적으로 임베딩 대신 TF-IDF를 사용하는 이유: API 키와 외부 다운로드가 전혀 없이 데모를 실행할 수 있기 때문입니다. VectorStore 클래스는 FAISS/Chroma + 실제 임베딩으로 교체하는 것이 재작성이 아닌 드롭인 변경이 되도록 작성되어 있습니다.

  • 도구가 하나의 파일(tools.py)에 있고 두 번 노출되는 이유(agent.py와 mcp_server.py): 단일 소스로, HTTP 경로와 MCP 경로 사이에 로직 중복이 없습니다.

  • 에이전트 루프는 도구 사용 패턴의 수동 구현입니다(블랙박스 프레임워크가 아님). 따라서 모든 단계를 설명할 수 있습니다: 모델이 도구를 요청 → 서버가 실행 → 결과가 피드백 → 모델이 계속하거나 답변.

가능한 확장 ("무엇을 개선하겠는가"에 대한 좋은 답변)

  • TF-IDF를 실제 임베딩(OpenAI/Voyage/로컬 sentence-transformers) + 영구 벡터 DB로 교체.

  • 대화 간 메모리 추가(현재 각 /agent/chat 호출은 무상태).

  • Server-Sent Events를 통한 스트리밍 응답 추가.

  • 공개 배포 전 인증(API 키 또는 JWT) 추가.

  • Docker + docker-compose로 컨테이너화하여 한 번의 명령으로 시작.

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Agentic search over your Dewey document collections from any MCP-compatible client.

  • Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.

  • MCP server exposing the Backtest360 engine API as tools for AI agents.

View all MCP Connectors

Latest Blog Posts

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/snehaharurkar/agentic-rag-mcp-assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server