mcp_chat

blueworm-lee/mcp_chat

3.1

If you are the rightful owner of mcp_chat and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

FastAPI MCP Chat is a Model Context Protocol-based chat service designed for efficient communication.

FastAPI MCP Chat

  • FastAPI 기반의 MCP(Model Context Protocol) μ±„νŒ… μ„œλΉ„μŠ€μž…λ‹ˆλ‹€.
  • Host(UI), MCP Client, MCP Serverλ₯Ό μ™„μ „νžˆ λΆ„λ¦¬μ‹œν‚¨ 데λͺ¨μž…λ‹ˆλ‹€.
  • λ³Έ 데λͺ¨μ—μ„œ Host 뢀뢄을 λΉΌκ±°λ‚˜ 별도 API μ—”λ“œν¬μΈνŠΈλ‘œ μ—°κ²°ν•˜λ©΄ λ©λ‹ˆλ‹€. (POST /chat/stream)
  • .env 파일 생성이 ν•„μš”ν•©λ‹ˆλ‹€.
    • GPT ν‚€λŠ” λ°˜λ“œμ‹œ ν•„μš”ν•©λ‹ˆλ‹€ (ANTHROPIC μ‚¬μš©ν•˜λ”λΌλ„ λΉ„μš©μ ˆκ°μ„ μœ„ν•΄ λ©”μ‹œμ§€ summary λΆ€λΆ„μ—μ„œ gpt-miniλ₯Ό μ‚¬μš©ν•¨)
    • ANTHROPIC ν‚€λŠ” μ˜΅μ…˜μž…λ‹ˆλ‹€

μš”κ΅¬μ‚¬ν•­

  • Python 3.8+
  • uv - Python νŒ¨ν‚€μ§€ κ΄€λ¦¬μž
  • Linux/macOS (systemd 지원)

μ„€μΉ˜ 방법

1. uv μ„€μΉ˜ (ν•„μš”ν•œ 경우)

# Linux/macOS
curl -LsSf https://astral.sh/uv/install.sh | sh

2. ν”„λ‘œμ νŠΈ 클둠

git clone https://github.com/blueworm-lee/mcp-chat.git
cd mcp-chat

3. μžλ™ μ„€μΉ˜

chmod +x install/install.sh
./install/install.sh

μ„€μΉ˜ μŠ€ν¬λ¦½νŠΈλŠ” λ‹€μŒ μž‘μ—…μ„ μˆ˜ν–‰ν•©λ‹ˆλ‹€:

  • Python μ˜μ‘΄μ„± μ„€μΉ˜ (uv sync)
  • 둜그 디렉토리 생성 (/var/log/mcp_chat)
  • systemd μ„œλΉ„μŠ€ 등둝

4. ν™˜κ²½ μ„€μ •

.env νŒŒμΌμ„ μƒμ„±ν•˜μ„Έμš”:

OPENAI_API_KEY="sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
ANTHROPIC_API_KEY="sk-ant-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
TAVILY_API_KEY="tvly-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

μ°Έκ³ :

  • OPENAI_API_KEY: ν•„μˆ˜ - λ©”μ‹œμ§€ μš”μ•½μ— μ‚¬μš©
  • ANTHROPIC_API_KEY: 선택 - Claude λͺ¨λΈ μ‚¬μš© μ‹œ ν•„μš”
  • TAVILY_API_KEY: ν•„μˆ˜ - μ›Ή 검색 κΈ°λŠ₯ μ‚¬μš© μ‹œ ν•„μš” (검색 κΈ°λŠ₯은 κΈ°λ³Έ tool둜 λ„£μŒ)

데λͺ¬ ꡬ동

μ„œλΉ„μŠ€ 관리

# μ„œλΉ„μŠ€ μ‹œμž‘
sudo systemctl start mcp_client

# μ„œλΉ„μŠ€ 쀑지
sudo systemctl stop mcp_client

# μ„œλΉ„μŠ€ μž¬μ‹œμž‘
sudo systemctl restart mcp_client

# μ„œλΉ„μŠ€ μƒνƒœ 확인
sudo systemctl status mcp_client

λΆ€νŒ… μ‹œ μžλ™ μ‹œμž‘

# μžλ™ μ‹œμž‘ ν™œμ„±ν™”
sudo systemctl enable mcp_client

# μžλ™ μ‹œμž‘ λΉ„ν™œμ„±ν™”
sudo systemctl disable mcp_client

둜그 확인

# μ‹€μ‹œκ°„ 둜그 보기
sudo journalctl -u mcp_client -f

# 졜근 둜그 확인
sudo journalctl -u mcp_client --since "1 hour ago"

API μ—”λ“œν¬μΈνŠΈ

  • POST /chat/stream - 슀트리밍 μ±„νŒ… API

개발 λͺ¨λ“œ

개발 μ€‘μ—λŠ” μ„œλΉ„μŠ€ λŒ€μ‹  직접 μ‹€ν–‰ν•  수 μžˆμŠ΅λ‹ˆλ‹€:

# 개발 μ„œλ²„ μ‹€ν–‰
uv run uvicorn main:app --host 0.0.0.0 --port 8000 --reload

νŠΈλŸ¬λΈ”μŠˆνŒ…

μ„œλΉ„μŠ€κ°€ μ‹œμž‘λ˜μ§€ μ•ŠλŠ” 경우

# μ„œλΉ„μŠ€ μƒνƒœ 확인
sudo systemctl status mcp_client

# 상세 둜그 확인
sudo journalctl -u mcp_client -n 50

ν™˜κ²½ λ³€μˆ˜ 문제

.env 파일이 ν”„λ‘œμ νŠΈ λ£¨νŠΈμ— μžˆλŠ”μ§€ ν™•μΈν•˜κ³ , API ν‚€κ°€ μ˜¬λ°”λ₯Έμ§€ ν™•μΈν•˜μ„Έμš”.

λΌμ΄μ„ μŠ€

MIT License