Used for managing environment variables like API keys and server configurations
Used as the web framework for implementing the RESTful API structure of the MCP server
Supports integration with a Python FastAPI backend for extended functionality
Used for AI model integration to enable the financial analysis and portfolio management services provided by the MCP server
Provides local AI model support (specifically using Gemma 3:4B) for the financial advisory services
Designed to work with a React-based frontend for the financial analysis services
MCP Server Node.js
Bu proje, Model Context Protocol (MCP) kullanarak finansal analiz ve portföy yönetimi hizmetleri sunan Node.js tabanlı bir AI agent sistemidir. LangChain ve Ollama kullanarak yerel olarak çalışan yapay zeka modelleri ile kullanıcılara akıllı finansal danışmanlık hizmetleri sunar.
🚀 Özellikler
🤖 AI Agent Sistemi
- Master Agent: Gelen sorguları analiz ederek uygun uzman ajana yönlendirir
- Portfolio Analysis Agent: Yatırım portföylerini analiz eder ve strateji önerileri sunar
- Risk Analysis Agent: Portföy risk değerlendirmesi ve risk azaltma önerileri
- General Chatbot Agent: Genel finansal sorular ve sohbet
📊 Piyasa Verileri
- Finnhub API entegrasyonu ile gerçek zamanlı borsa verileri
- Hisse senedi fiyatları, değişim oranları ve piyasa analizi
- Portföy varlıklarının güncel piyasa değerlendirmesi
🔧 Teknik Özellikler
- Express.js web framework'ü
- LangChain ile AI model entegrasyonu
- Ollama ile yerel AI model desteği (Gemma 3:4B)
- RESTful API yapısı
- CORS desteği ile frontend entegrasyonu
📋 Gereksinimler
Sistem Gereksinimleri
- Node.js 18+
- npm veya yarn
- Ollama (yerel AI modeli için)
- Finnhub API Key (piyasa verileri için)
AI Model Kurulumu
🛠️ Kurulum
1. Proje Kurulumu
2. Ortam Değişkenleri
.env
dosyası oluşturun:
3. Finnhub API Key Alma
- Finnhub.io sitesine kayıt olun
- Ücretsiz API key alın
.env
dosyasına ekleyin
🚀 Çalıştırma
Master Agent Server
Server http://localhost:8001
adresinde çalışacak.
Portfolio Analysis Server (Alternatif)
📡 API Endpoints
Master Agent Endpoint
POST /master-agent
Gelen sorguları analiz ederek uygun ajana yönlendirir.
Request:
Response:
Portfolio Analysis Endpoint
POST /analyze-portfolio
Detaylı portföy analizi yapar.
Request:
Response:
🤖 Agent Tipleri ve Kullanım
1. Portfolio Analysis Agent
Tetikleyici kelimeler: portföy
, analiz
, yatırım
, strateji
Örnek sorgular:
- "Portföyümü analiz et"
- "Yatırım tavsiyesi ver"
- "Hangi hisse senetlerini almalıyım?"
2. Risk Analysis Agent
Tetikleyici kelimeler: risk
, volatilite
, beta
, var
Örnek sorgular:
- "Portföyümün riski nedir?"
- "Risk seviyemi değerlendir"
- "Volatilite analizi yap"
3. General Chatbot Agent
Diğer tüm sorgular
Örnek sorgular:
- "Merhaba"
- "Finansal piyasalar hakkında bilgi ver"
- "Borsada ne olup bitiyor?"
🏗️ Proje Yapısı
Dosya Açıklamaları
master-server.js
- Ana sunucu dosyası
- Gelen sorguları analiz eder ve uygun ajana yönlendirir
- LLM tabanlı akıllı routing sistemi
server.js
- Alternatif sunucu (portfolio odaklı)
- Adım adım portfolio analizi yapar
- Manuel orchestration işlevi görür
tools.js
- AI agent sınıflarını içerir
- LangChain Tool sınıfından türetilmiş uzman ajanlar
- Finnhub API entegrasyonu
🔧 Teknik Detaylar
Agent Routing Algoritması
Piyasa Verisi Entegrasyonu
LLM Prompt Engineering
🔗 Entegrasyonlar
Frontend Entegrasyonu
Bu Node.js server, React tabanlı frontend ile çalışacak şekilde tasarlanmıştır:
Python Backend Entegrasyonu
Python FastAPI backend ile birlikte çalışabilir:
- Python backend:
http://localhost:8000
- Node.js MCP Server:
http://localhost:8001
🧪 Test Etme
Manuel Test
Test Senaryoları
- Portfolio Analysis Test:
- Risk Analysis Test:
- General Chat Test:
🚨 Sorun Giderme
Ollama Bağlantı Sorunu
Finnhub API Hatası
- API key'in doğru olduğundan emin olun
- Günlük API limit kontrolü yapın
.env
dosyasının doğru yüklendiğini kontrol edin
Port Çakışması
📈 Performans ve Optimizasyon
Memory Usage
- Ollama modeli RAM'de tutulur (~4GB for Gemma 3:4B)
- Node.js heap boyutunu ayarlayın:
node --max-old-space-size=8192
API Rate Limits
- Finnhub: 60 calls/minute (free tier)
- Ollama: Local, sınırsız
Caching
Portfolio verileri ve piyasa verileri için basit caching implementasyonu:
🔮 Gelecek Geliştirmeler
Planlanan Özellikler
- Redis cache entegrasyonu
- WebSocket real-time updates
- Multiple LLM model desteği
- Advanced portfolio optimization
- Risk calculation algorithms
- Historical data analysis
- Custom alert system
Teknik İyileştirmeler
- TypeScript migration
- Unit test coverage
- API documentation (OpenAPI/Swagger)
- Docker containerization
- Load balancing support
- Logging framework (Winston)
- Health check endpoints
🤝 Katkıda Bulunma
- Fork edin
- Feature branch oluşturun (
git checkout -b feature/AmazingFeature
) - Commit yapın (
git commit -m 'Add some AmazingFeature'
) - Push edin (
git push origin feature/AmazingFeature
) - Pull Request açın
📄 Lisans
Bu proje ISC lisansı altında lisanslanmıştır.
🆘 Destek
Sorunlar için:
- GitHub Issues kullanın
- Dokümantasyonu kontrol edin
- Log dosyalarını inceleyin
Not: Bu proje eğitim ve demo amaçlıdır. Üretim ortamında kullanmadan önce security review yapın ve rate limiting ekleyin.
This server cannot be installed
A Node.js-based AI agent system using Model Context Protocol (MCP) that provides financial analysis and portfolio management services through LangChain and Ollama-powered local AI models.
Related MCP Servers
- AsecurityFlicenseAqualityA Model Context Protocol server that allows AI assistants to query and analyze financial data through Ledger CLI, enabling tasks like financial reporting, budget analysis, and accounting.Last updated -923Python
- -securityAlicense-qualityAn MCP server for tracking and managing cryptocurrency portfolio allocations, enabling AI agents to query and optimize portfolio strategies in real time.Last updated -7PythonMIT License
- -securityAlicense-qualityAn open-source implementation of the Model Context Protocol (MCP) that bridges AI agents with enterprise systems, enabling secure access to real-world data and capabilities.Last updated -1PythonApache 2.0
- -securityFlicense-qualityA Model Context Protocol server built with FastMCP that provides financial data tools for AI agents, enabling them to access and analyze stock market information from Yahoo Finance through natural language queries.Last updated -2Python