MistralAI Agents API와 MCP를 활용한 금융 분석가
MistralAI Agents API와 MCP를 활용한 금융 분석가 (Financial Analyst with MistralAI Agents API and MCP)
MistralAI agents API에 MCP 서버를 결합해서 주식 분석과 리포트 생성을 수행하는 금융 분석 애플리케이션 쿡북이에요.
출처: 문서
본문
사용 사례 (Use Case)
- 실시간 주가, 과거 데이터, 애널리스트 추천 얻기
- 종합적인 금융 리포트 생성하기
- 리포트를 파일로 저장하기
아키텍처 (Architecture)
├── mcp_servers/
│ ├── stdio_yfinance_server.py
│ ├── stdio_report_gen_server.py
│ └── stdio_save_report_server.py
├── async_run_report_gen_mcp.py
메인 애플리케이션 (Main Application)
- app.py: MistralAI 에이전트를 통합한 Chainlit 인터페이스
MCP 서버 (MCP Servers)
- stdio_yfinance_server.py: Yahoo Finance 데이터 조회 (가격, 재무 정보)
- stdio_report_gen_server.py: MistralAI를 사용한 LLM 기반 리포트 생성
- stdio_save_report_server.py: 리포트를 파일로 영속화
설치 (Installation)
pip install chainlit yfinance mcp mistralai loguru griffe
환경 설정 (Environment Setup)
MistralAI API 키를 설정하세요:
export MISTRAL_API_KEY="your_api_key_here"
서버들(mcp_servers/stdio_report_gen_server.py)에도 Mistral API 키를 설정하세요.
사용법 (Usage)
애플리케이션 실행:
chainlit run app.py
브라우저를 열고 다음과 같은 질문을 해 보세요:
- "What's the current stock price of AAPL?"
- "Get me a report on the historical stock prices of microsoft and save it to msft_historical.md"
- "Show me Microsoft's analyst recommendations"
앱이 자동으로 적절한 MCP 서버를 사용해서 데이터를 가져오고 리포트를 생성해요.