**λλ§μ λΉμ λλΉ(Nabi)**λ LangGraph ReAct μμ΄μ νΈμ MCP(Model Context Protocol)λ₯Ό νμ©νμ¬ μ¬μ©μμ μΌμμ λλ AI λΉμ μ ν리μΌμ΄μ μ λλ€. StreamlitμΌλ‘ ꡬμΆλ μΉ μΈν°νμ΄μ€λ₯Ό ν΅ν΄ μ¬μ©μμ μνΈμμ©νλ©°, Upstage Solar LLMμ κΈ°λ°μΌλ‘ μλν©λλ€.
λλΉλ MCPλ₯Ό ν΅ν΄ λ€μν λꡬμ μ°λλ©λλ€:
- λ μ¨ μ 보: μ¬μ©μμ νμ¬ μμΉλ₯Ό κΈ°λ°μΌλ‘ λ μ¨λ₯Ό μλ €μ€λλ€ (
mcp_server_local.py). - Google Workspace μ°λ: Google κ³μ μΈμ¦μ ν΅ν΄ Gmail νμΈ/κ²μ/μ μ‘ λ° Google Calendar μΌμ μ‘°ν/μΆκ° κΈ°λ₯μ μ 곡ν©λλ€ (
gsuite_mcp_server.py). - μ 보 κ²μ λ° λΈλ¦¬ν: Perplexity AIλ₯Ό μ¬μ©νμ¬ μΉ κ²μμ μννκ³ , μ¬μ©μκ° μ€μ ν κ΄μ¬ λΆμΌμ λν μ΅μ μ 보 λ³΄κ³ μλ₯Ό μ 곡ν©λλ€ (
pplx_search_mcp_server.py).
- λνν AI λΉμ: Upstage Solar LLM κΈ°λ°μ μμ°μ€λ¬μ΄ λν κΈ°λ₯
- λ μ¨ μ 보 μ‘°ν: νμ¬ μμΉ κΈ°λ° μ€μκ° λ μ¨ μ 보 μ 곡
- Google κ³μ μ°λ (OAuth):
- Gmail: λ°μ νΈμ§ν¨ νμΈ, μ΄λ©μΌ κ²μ, μ΄λ©μΌ μμ± λ° μ μ‘
- Google Calendar: λ€κ°μ€λ μΌμ νμΈ, μλ‘μ΄ μΌμ μΆκ°
- κ΄μ¬ λΆμΌ λ³΄κ³ μ: μ€μ λ κ΄μ¬μ¬μ λν μ΅μ μ 보 μλ λΈλ¦¬ν
- μ§μ μΉ κ²μ: Perplexity AIλ₯Ό ν΅ν μ€μκ° μ 보 κ²μ
- Streamlit κΈ°λ° μΉ μΈν°νμ΄μ€: μ¬μ©μ μΉνμ μΈ UI μ 곡
- Streamlit UI (
app_KOR.py): μ¬μ©μμ μνΈμμ©νλ μΉ νλ‘ νΈμλ. - LangGraph ReAct Agent: μ¬μ©μμ μμ²μ μ΄ν΄νκ³ μ μ ν λꡬλ₯Ό μ ν λ° μ€ννλ ν΅μ¬ λ‘μ§ (Upstage Solar LLM μ¬μ©).
- MCP ν΄λΌμ΄μΈνΈ (
langchain-mcp-adapters): LangGraph μμ΄μ νΈμ MCP μλ² κ°μ ν΅μ μ μ€κ°. - MCP μλ² (
mcp_server_*.py): νΉμ κΈ°λ₯μ μ 곡νλ λ 립μ μΈ νλ‘μΈμ€.weather: λ μ¨ μ 보 μ 곡 (OpenWeatherMap API μ¬μ©)gsuite: Gmail λ° Google Calendar κΈ°λ₯ μ 곡 (Google API μ¬μ©)pplx_search: μΉ κ²μ κΈ°λ₯ μ 곡 (Perplexity AI API μ¬μ©)- μ°Έκ³ : νμ¬ κ΅¬νμμλ Streamlit μ±μ΄ μμλ λ
MultiServerMCPClientλ₯Ό ν΅ν΄ μ΄ μλ²λ€μ λ‘컬μμstdioμ μ‘ λ°©μμΌλ‘ μλ μ€ννλ €κ³ μλν©λλ€.
-
μ μ₯μ ν΄λ‘ :
git clone https://github.com/Minhokei/langgraph-mcp-agents.git # μ€μ μ μ₯μ URLλ‘ λ³κ²½νμΈμ cd langgraph-mcp-agents
-
κ°μ νκ²½ μμ± λ° μμ‘΄μ± μ€μΉ (
uvμ¬μ© κΆμ₯):uvκ° μ€μΉλμ΄ μμ§ μλ€λ©΄ λ¨Όμ μ€μΉν©λλ€:pip install uv- κ°μ νκ²½μ μμ±νκ³ νμ±νν©λλ€:
uv venv source .venv/bin/activate # Linux/macOS # .venv\Scripts\activate # Windows
requirements.txtνμΌμ μμ‘΄μ±μ μ€μΉν©λλ€:uv pip install -r requirements.txt
μ ν리μΌμ΄μ μ μ€ννκΈ° μ μ νμν API ν€μ Google Cloud μ€μ μ μλ£ν΄μΌ ν©λλ€.
-
Google Cloud μ€μ :
- Google Cloud Console (https://console.cloud.google.com/)μμ μ νλ‘μ νΈλ₯Ό μμ±νκ±°λ κΈ°μ‘΄ νλ‘μ νΈλ₯Ό μ¬μ©ν©λλ€.
- Gmail APIμ Google Calendar APIλ₯Ό κ²μνμ¬ "μ¬μ© μ€μ "ν©λλ€.
- "API λ° μλΉμ€" > "μ¬μ©μ μΈμ¦ μ 보"λ‘ μ΄λν©λλ€.
- "+ μ¬μ©μ μΈμ¦ μ 보 λ§λ€κΈ°" > "OAuth ν΄λΌμ΄μΈνΈ ID"λ₯Ό μ νν©λλ€.
- "μ ν리μΌμ΄μ μ ν"μΌλ‘ **"μΉ μ ν리μΌμ΄μ "**μ μ νν©λλ€.
- "μΉμΈλ 리λλ μ
URI" μΉμ
μμ "+ URI μΆκ°"λ₯Ό ν΄λ¦νκ³ λ€μ URIλ₯Ό λͺ¨λ μΆκ°ν©λλ€(νλλ λ‘컬 κ°λ°μ©, λ€λ₯Έ νλλ λ°°ν¬ μ νμν μ μμ):
http://localhost:8501/callback- (λ°°ν¬ μ μ¬μ©ν URI, μ:
https://your-app-domain.com/callback)
- "λ§λ€κΈ°"λ₯Ό ν΄λ¦νλ©΄ ν΄λΌμ΄μΈνΈ IDμ ν΄λΌμ΄μΈνΈ 보μ λΉλ°μ΄ νμλ©λλ€. JSON λ€μ΄λ‘λ λ²νΌμ ν΄λ¦νμ¬
credentials.jsonνμΌμ λ€μ΄λ‘λνκ³ νλ‘μ νΈ λ£¨νΈ λλ ν 리μ μ μ₯ν©λλ€. - "OAuth λμ νλ©΄"μ μ€μ ν΄μΌ ν μλ μμ΅λλ€. ν μ€νΈ μ¬μ©μλ₯Ό μΆκ°νκ±°λ μ±μ κ²μν΄μΌ ν©λλ€.
-
API ν€ μ€λΉ:
- Upstage AI API ν€: https://console.upstage.ai/ μμ κ°μ νκ³ API ν€λ₯Ό λ°κΈλ°μ΅λλ€.
- OpenWeatherMap API ν€: https://openweathermap.org/ μμ κ°μ νκ³ API ν€λ₯Ό λ°κΈλ°μ΅λλ€ (λ¬΄λ£ νλ κ°λ₯).
- Perplexity AI API ν€: https://docs.perplexity.ai/ μμ κ°μ νκ³ API ν€λ₯Ό λ°κΈλ°μ΅λλ€.
νλ‘μ νΈ λ£¨νΈ λλ ν 리μ .env νμΌμ μμ±νκ³ , λ€μκ³Ό κ°μ΄ API ν€μ μ€μ μ μ
λ ₯ν©λλ€.
# .env
# Upstage API Key
UPSTAGE_API_KEY="μ¬λ¬λΆμ Upstage API ν€"
# OpenWeatherMap API Key
WEATHERMAP_API_KEY="μ¬λ¬λΆμ OpenWeatherMap API ν€"
# Perplexity AI API Key
PERPLEXITY_API_KEY="μ¬λ¬λΆμ Perplexity AI API ν€"
# Google OAuth Credentials File Path
# Google Cloud Consoleμμ λ€μ΄λ‘λν credentials.json νμΌμ κ²½λ‘
# μ: GOOGLE_CREDENTIALS_PATH="./credentials.json" (νλ‘μ νΈ λ£¨νΈμ μ μ₯ν κ²½μ°)
GOOGLE_CREDENTIALS_PATH="μ¬λ¬λΆμ credentials.json νμΌ κ²½λ‘"
# Google OAuth Redirect URI
# λ‘컬 κ°λ° μ: http://localhost:8501/callback
# λ°°ν¬ μ: λ°°ν¬λ μ±μ callback URI (Google Cloud Consoleμ λ±λ‘ν URIμ μΌμΉν΄μΌ ν¨)
REDIRECT_URI="http://localhost:8501/callback"-
κ°μ νκ²½ νμ±ν:
source .venv/bin/activate # Linux/macOS # .venv\Scripts\activate # Windows
-
Streamlit μ ν리μΌμ΄μ μ€ν:
streamlit run app_KOR.py
μ±μ΄ μ€νλλ©΄ μλμΌλ‘ MCP μλ²λ€(
weather,gsuite,pplx_search)μ λ‘컬 νλ‘μΈμ€λ‘ μ€ννλ €κ³ μλν©λλ€. -
μΉ λΈλΌμ°μ μμ μ± μ μ: ν°λ―Έλμ νμλ URL(κΈ°λ³Έκ°:
http://localhost:8501)λ‘ μ μν©λλ€. -
Google κ³μ μ°λ (νμμ):
- μ¬μ΄λλ°μ "Google κ³μ μ°λ" μΉμ μμ "Google κ³μ μ°λνκΈ°" λ²νΌμ ν΄λ¦ν©λλ€.
- Google λ‘κ·ΈμΈ λ° λμ νλ©΄μ μ§νν©λλ€.
- μ±κ³΅μ μΌλ‘ μ°λλλ©΄ μ¬μ΄λλ°μ "β Google κ³μ μ΄ μ°λλμμ΅λλ€." λ©μμ§κ° νμλ©λλ€. μ΄μ Gmail λ° μΊλ¦°λ κ΄λ ¨ κΈ°λ₯μ μ¬μ©ν μ μμ΅λλ€.
-
κ΄μ¬ λΆμΌ μ€μ (μ ν):
- μ¬μ΄λλ°μ "κ΄μ¬ λΆμΌ μ€μ " μΉμ μμ κ΄μ¬μ¬λ₯Ό μ λ ₯νκ³ "κ΄μ¬ λΆμΌ μ μ₯" λ²νΌμ ν΄λ¦ν©λλ€.
- μ μ₯ μ μλμΌλ‘ ν΄λΉ κ΄μ¬μ¬μ λν λ³΄κ³ μ μμ±μ΄ μμλ©λλ€.
-
λλΉ λΉμμ λν:
- "π¦ λλΉ λΉμ" ν νλ¨μ μ λ ₯μ°½μ μ§λ¬Έμ΄λ μμ²μ μ λ ₯ν©λλ€.
- λλΉλ μ§λ¬Έμ λΆμνκ³ νμμ λ°λΌ μ°λλ λꡬ(λ μ¨, Gmail, μΊλ¦°λ, κ²μ)λ₯Ό μ¬μ©νμ¬ λ΅λ³μ μμ±ν©λλ€.
-
κ΄μ¬λΆμΌ λ³΄κ³ μ νμΈ:
- "π κ΄μ¬λΆμΌ λ³΄κ³ μ" νμΌλ‘ μ΄λν©λλ€.
- κ΄μ¬ λΆμΌκ° μ€μ λμ΄ μλ€λ©΄ μλμΌλ‘ μμ±λ μ΅μ μ 보 λΈλ¦¬νμ νμΈν μ μμ΅λλ€.
- νλ¨μ μ λ ₯μ°½μ ν΅ν΄ μ§μ μνλ ν€μλλ‘ μΉ κ²μμ μνν μλ μμ΅λλ€.
μ΄ "λλΉ λΉμ" μ ν리μΌμ΄μ μ LangGraphμ MCP(Model Context Protocol)λ₯Ό ν΅ν©νλ λ°©λ²μ 보μ¬μ£Όλ teddylee777/langgraph-mcp-agents νλ‘μ νΈλ₯Ό μ°Έκ³ νμμ΅λλ€.
μ£Όμ μ°Έκ³ λΌμ΄λΈλ¬λ¦¬λ λ€μκ³Ό κ°μ΅λλ€:
model-context-protocol: https://github.com/modelcontextprotocollangchain-mcp-adapters: https://github.com/langchain-ai/langchain-mcp-adapters
μ΄ νλ‘μ νΈλ MIT λΌμ΄μ μ€λ₯Ό λ°λ¦ λλ€. μμΈν λ΄μ©μ LICENSE νμΌμ μ°Έκ³ νμΈμ.
