Agentic RAG Assistant
FastAPI + MCP によるエージェント型 RAG アシスタント
採用担当者が現在チェックしている4つの要素を組み合わせた社内ドキュメント用アシスタントです:
エージェント型 AI — LLM がナレッジベースを検索するか、計算を実行するか、直接回答するかを判断するツール使用ループ。
FastAPI — 自動生成される Swagger ドキュメントを備えたクリーンな REST バックエンド(
/ingest、/query、/agent/chat)。RAG — ドキュメントはチャンク化・インデックス化され、LLM が回答する前に意味的関連性によって検索されます。
MCP(Model Context Protocol) — 同じツール(RAG 検索+ビジネスロジック)が MCP サーバーとして公開され、この API だけでなく、MCP 互換の任意のクライアント(Claude Desktop、Claude Code など)が直接利用できます。
アーキテクチャ
┌────────────────────┐
│ 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) │
└────────────────────────┘セットアップ
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_KEYAPI の実行
uvicorn app.main:app --reload --port 8000対話型の Swagger ドキュメントは http://localhost:8000/docs を開いてください。
試してみる
# 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?"}'2回目の呼び出しはマルチツール推論を示しています。モデルが1つの会話の中で、WFH ポリシーについては rag_search を、計算については calculate_leave_balance を呼び出します。
MCP サーバーとして実行
python -m app.mcp_server任意の MCP ホストを stdio 経由でこのスクリプトに接続すると(例:Claude Desktop の claude_desktop_config.json にカスタム MCP サーバーとして追加)、rag_search、get_current_datetime、calculate_leave_balance が呼び出し可能なツールとして公開されます。
面接でこのプロジェクトについて話すポイント
デフォルトで埋め込みではなく TF-IDF を使う理由:API キーも外部ダウンロードも不要でデモを実行可能に保てるため。
VectorStoreクラスは、FAISS/Chroma+実際の埋め込みへの差し替えが書き直しではなくドロップインで済むように設計されています。ツールが1つのファイル(
tools.py)にあり、2回公開される理由(agent.py と mcp_server.py):単一の情報源であり、HTTP パスと MCP パスの間でロジックの重複がありません。エージェントループはツール使用パターンの手動実装であり(ブラックボックスフレームワークではありません)、すべてのステップを説明できます:モデルがツールを要求 → サーバーが実行 → 結果がフィードバックされる → モデルが続行または回答。
考えられる拡張(「どう改善しますか」への良い回答)
TF-IDF を実際の埋め込み(OpenAI/Voyage/ローカルの sentence-transformers)+永続的なベクターデータベースに置き換える。
ターン間の会話メモリを追加する(現在、各
/agent/chat呼び出しはステートレス)。Server-Sent Events によるストリーミング応答を追加する。
公開デプロイ前に認証(API キーまたは JWT)を追加する。
Docker + docker-compose でコンテナ化し、ワンコマンドで起動できるようにする。
This server cannot be installed
Maintenance
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.
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/snehaharurkar/agentic-rag-mcp-assistant'
If you have feedback or need assistance with the MCP directory API, please join our Discord server