GO

godstale/ollama-mcp-tutorials

Developer tools
11 stars 15 forks 품질 41 트렌드 18

LangChain과 LangGraph를 활용한 AI 에이전트 프로그래밍 가이드입니다. 기본적인 Ollama 챗봇부터 고급 MCP(Model Context Protocol) 기반 멀티 에이전트 시스템까지 단계별로 학습할 수 있습니다.

개요

LangChain과 LangGraph를 활용한 AI 에이전트 프로그래밍 가이드입니다. 기본적인 Ollama 챗봇부터 고급 MCP(Model Context Protocol) 기반 멀티 에이전트 시스템까지 단계별로 학습할 수 있습니다. - : LangChain 기본 개념과 Ollama 통합 - : 프롬프트 엔지니어링과 대화 히스토리 - : RAG(검색 증강 생성) 구현 - : LangSmith를 활용한 관찰 가능성과 추적 - : 도구 지원 에이전트 - : LangGraph를 활용한 멀티 에이전트 시스템 - : MCP 프로토콜 통합 - : 고급 MCP 활용 사례 - : 실제 애플리케이션 (회의록 자동 생성) - : Ollama 통합, 스트리밍, 출력 파싱 - : 프롬프트 템플릿과 대화 메모리 - : 벡터 스토어, 임베딩, RAG 패턴 - LangSmith 통합을 통한 추적 및 모니터링 - 데이터셋 관리와 평가 - 단일 및 다중 도구 에이전트 구현 - LangChain 에이전트의 ReAct 패턴 - 복잡한 상태 라우팅 로직 - 에이전트 조정을 위한 슈퍼바이저 패턴 - 그래프 시각화 기능 - mcp_config.json에서 적절한 MCP 서버 구성 필요 - 전체적으로 async/await 패턴 사용 - MCP 클라이언트 라이프사이클 신중한 처리 - : 날씨 도구가 포함된 기본 MCP 에이전트 - : 고급 MCP 통합 (Notion, 뉴스 수집) - LangGraph 워크플로를 사용한 회의록 자동 생성 시스템 - 구조화된 상태 관리를 갖춘 오디오 처리 파이프라인 - 모듈형 구성 요소: 전사기, 요약기, 파일 핸들러 - 음성-텍스트 변환에는 Faster Whisper, 요약에는 Ollama 사용

README

AI Agent Programming Guide: LangChain & LangGraph with MCP

한국어 | English

LangChain과 LangGraph를 활용한 AI 에이전트 프로그래밍 가이드입니다. 기본적인 Ollama 챗봇부터 고급 MCP(Model Context Protocol) 기반 멀티 에이전트 시스템까지 단계별로 학습할 수 있습니다.

📚 프로젝트 구성

학습 진도표

  • ch03: LangChain 기본 개념과 Ollama 통합
  • ch04: 프롬프트 엔지니어링과 대화 히스토리
  • ch05: RAG(검색 증강 생성) 구현
  • ch06: LangSmith를 활용한 관찰 가능성과 추적
  • ch07: 도구 지원 에이전트
  • ch08: LangGraph를 활용한 멀티 에이전트 시스템
  • ch09: MCP 프로토콜 통합
  • ch10: 고급 MCP 활용 사례
  • ch11: 실제 애플리케이션 (회의록 자동 생성)

🚀 시작하기

필수 사전 설치

  1. Python 3.10+ (일부 프로젝트는 3.12+ 요구)

  2. UV 패키지 매니저

    # macOS/Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  3. Ollama 설치 및 실행

    # Ollama 설치 (https://ollama.com/download)
    # 모델 다운로드
    ollama pull qwen2.5:7b
    ollama pull llama3:8b
    

프로젝트 실행 방법

각 챕터는 독립적인 Python 프로젝트입니다:

# 원하는 챕터/프로젝트 디렉토리로 이동
cd ch11  # 또는 ch09/01_mcp_agent 등

# 의존성 설치
uv sync

# 메인 스크립트 실행
uv run python main.py

# CLI 인자가 있는 프로젝트의 경우 (ch11)
uv run python main.py --audio-path path/to/audio.mp3 --save

📋 챕터별 상세 내용

ch03-ch05: 기초 개념

  • ch03: Ollama 통합, 스트리밍, 출력 파싱
  • ch04: 프롬프트 템플릿과 대화 메모리
  • ch05: 벡터 스토어, 임베딩, RAG 패턴

ch06: 관찰 가능성

  • LangSmith 통합을 통한 추적 및 모니터링
  • 데이터셋 관리와 평가

ch07: 도구 지원 에이전트

  • 단일 및 다중 도구 에이전트 구현
  • LangChain 에이전트의 ReAct 패턴

ch08: 멀티 에이전트 시스템

  • 복잡한 상태 라우팅 로직
  • 에이전트 조정을 위한 슈퍼바이저 패턴
  • 그래프 시각화 기능

ch09-ch10: MCP 통합

  • mcp_config.json에서 적절한 MCP 서버 구성 필요
  • 전체적으로 async/await 패턴 사용
  • MCP 클라이언트 라이프사이클 신중한 처리
  • ch09: 날씨 도구가 포함된 기본 MCP 에이전트
  • ch10: 고급 MCP 통합 (Notion, 뉴스 수집)

ch11: 실제 애플리케이션

  • LangGraph 워크플로를 사용한 회의록 자동 생성 시스템
  • 구조화된 상태 관리를 갖춘 오디오 처리 파이프라인
  • 모듈형 구성 요소: 전사기, 요약기, 파일 핸들러
  • 음성-텍스트 변환에는 Faster Whisper, 요약에는 Ollama 사용

🛠️ 개발 도구 (사용 가능한 경우)

# 코드 포맷팅
uv run black .
uv run isort .

# 타입 검사
uv run mypy .

# 테스트
uv run pytest

📝 환경 설정 (선택사항)

일부 프로젝트에서 필요한 환경 변수:

# OpenAI API 키 (GPT 모델 사용 프로젝트)
export OPENAI_API_KEY="your-api-key"

# LangSmith API 키 (ch06 추적)
export LANGCHAIN_API_KEY="your-langsmith-key"

# Tavily API 키 (ch08 웹 검색 도구)
export TAVILY_API_KEY="your-tavily-key"

🎯 추천 학습 경로

  1. ch03부터 시작 - 기본 LangChain 개념
  2. ch04-ch05 진행 - 기초 패턴들
  3. ch06 활용 - 개발 초기에 관찰 가능성 이해
  4. ch07-ch08 탐색 - 에이전트 아키텍처
  5. ch09-ch10 진행 - 최신 MCP 통합
  6. ch11로 완료 - 실제 애플리케이션 구현

🔗 Colab 노트북 링크

각 챕터는 Google Colab에서 직접 실행할 수 있는 노트북도 제공합니다:

ch03

ch04

ch05

ch06

ch07

ch08

ch09

ch10

ch11

📄 라이선스

이 프로젝트는 교육 목적으로 제공되며, 각 챕터의 LICENSE 파일을 참고하세요.


English

AI Agent Programming Guide: LangChain & LangGraph with MCP

A comprehensive guide for AI agent programming using LangChain and LangGraph. Learn step-by-step from basic Ollama chatbots to advanced MCP (Model Context Protocol) based multi-agent systems.

📚 Project Structure

Learning Roadmap

  • ch03: Basic LangChain concepts with Ollama integration
  • ch04: Prompt engineering and chat history
  • ch05: RAG (Retrieval-Augmented Generation) implementation
  • ch06: Observability and tracing with LangSmith
  • ch07: Tool-enabled agents
  • ch08: Multi-agent systems with LangGraph
  • ch09: MCP protocol integration
  • ch10: Advanced MCP use cases
  • ch11: Real-world application (meeting transcription)

🚀 Getting Started

Prerequisites

  1. Python 3.10+ (some projects require 3.12+)

  2. UV Package Manager

    # macOS/Linux
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
    # Windows
    powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
    
  3. Ollama Installation & Setup

    # Install Ollama (https://ollama.com/download)
    # Download models
    ollama pull qwen2.5:7b
    ollama pull llama3:8b
    

Running Projects

Each chapter contains independent Python projects:

# Navigate to desired chapter/project directory
cd ch11  # or ch09/01_mcp_agent, etc.

# Install dependencies
uv sync

# Run main script
uv run python main.py

# For projects with CLI arguments (like ch11)
uv run python main.py --audio-path path/to/audio.mp3 --save

📋 Chapter Details

ch03-ch05: Foundation Concepts

  • ch03: Ollama integration, streaming, output parsing
  • ch04: Prompt templates and conversation memory
  • ch05: Vector stores, embeddings, RAG patterns

ch06: Observability

  • LangSmith integration for tracing and monitoring
  • Dataset management and evaluation

ch07: Tool-Enabled Agents

  • Single and multi-tool agent implementations
  • ReAct pattern with LangChain agents

ch08: Multi-Agent Systems

  • Complex state routing logic
  • Supervisor pattern for agent coordination
  • Graph visualization capabilities

ch09-ch10: MCP Integration

  • Proper MCP server configuration in mcp_config.json
  • Async/await patterns throughout
  • Careful MCP client lifecycle handling
  • ch09: Basic MCP agent with weather tools
  • ch10: Advanced MCP integrations (Notion, news aggregation)

ch11: Real-World Application

  • Meeting transcription system using LangGraph workflows
  • Audio processing pipeline with structured state management
  • Modular components: transcriber, summarizer, file handler
  • Uses Faster Whisper for speech-to-text and Ollama for summarization

🛠️ Development Tools (where available)

# Code formatting
uv run black .
uv run isort .

# Type checking
uv run mypy .

# Testing
uv run pytest

📝 Environment Setup (Optional)

Environment variables needed for some projects:

# OpenAI API Key (for projects using GPT models)
export OPENAI_API_KEY="your-api-key"

# LangSmith API Key (for ch06 tracing)
export LANGCHAIN_API_KEY="your-langsmith-key"

# Tavily API Key (for ch08 web search tools)
export TAVILY_API_KEY="your-tavily-key"
  1. Start with ch03 - Basic LangChain concepts
  2. Progress through ch04-ch05 - Foundation patterns
  3. Use ch06 - Understand observability early in development
  4. Explore ch07-ch08 - Agent architectures
  5. Advance to ch09-ch10 - Cutting-edge MCP integration
  6. Complete with ch11 - Real-world application implementation

Each chapter provides Google Colab notebooks for direct execution:

ch03

ch04

ch05

ch06

ch07

ch08

ch09

ch10

ch11

📄 License

This project is provided for educational purposes. Please refer to the LICENSE files in each chapter.

GitHub에서 전체 README 보기

설치

This server does not publish a one-line install command.

Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →