MCP Market Statistics Server
Provides comprehensive statistics and advanced analysis tools for the Korean stock market, offering real-time index data, sector analysis, investor trend tracking, and AI-based market pattern recognition.
README
π MCP Market Statistics Server
νκ΅ μ£Όμμμ₯μ μ’ ν©μ μΈ ν΅κ³ λ°μ΄ν°μ μμ₯ λΆμ μ 보λ₯Ό μ 곡νλ MCP(Model Context Protocol) μλ²μ λλ€.
β¨ μ£Όμ κΈ°λ₯
π’ μμ₯ λ°μ΄ν°
- μ€μκ° μ§μ νν©: KOSPI, KOSDAQ, KOSPI200 λ±
- μμ₯ μ 체 ν΅κ³: μκ°μ΄μ‘, κ±°λλκΈ, μμΉ/νλ½ μ’ λͺ© μ
- 52μ£Ό μ κ³ κ°/μ μ κ° ν΅κ³ λ° λΆμ
π μΉν°λ³ λΆμ
- μ μ’ λ‘ν μ΄μ λΆμ λ° μΆμ
- μΉν°λ³ λ°Έλ₯μμ΄μ λΉκ΅
- 리λ/λκ±°λ μ’ λͺ© μλ³
π° ν¬μμ λν₯
- κ°μΈ/κΈ°κ΄/μΈκ΅μΈ λ§€λ§€ λν₯
- νλ‘κ·Έλ¨ λ§€λ§€ νν© λΆμ
- μ€λ§νΈλ¨Έλ μΆμ’ μ§ν
π μμ₯ μ¬λ¦¬ μ§ν
- Fear & Greed Index (νκ΅ν)
- Put/Call Ratio λΆμ
- λ³λμ± μ§μ (VKOSPI)
- λ΄μ€ κ°μ± λΆμ
π κ³ κΈ λΆμ
- μμ₯ μ΄μ μ§ν νμ§ - AI κΈ°λ° μ΄μ ν¨ν΄ κ°μ§
- μμ₯ κ΅λ©΄ νλ¨ - λΆμ₯/κ³°μ₯/ν‘보μ₯ ꡬλΆ
- μ λμ± λΆμ - μμ₯ κΉμ΄ λ° μ λμ± μΈ‘μ
- μκ΄κ΄κ³ λ§€νΈλ¦μ€ - μμ° κ° μκ΄κ΄κ³ λΆμ
- ν¨ν΄ μΈμ - μ°¨νΈ ν¨ν΄ λ° κΈ°μ μ μ§ν λΆμ
- λ€μ€ μκ°λ λΆμ - μ¬λ¬ νμνλ μ ν΅ν© λΆμ
- κ°μ λΆμ - λ΄μ€ λ° μμ λ―Έλμ΄ κ°μ λΆμ
- κ°κ²© μμΈ‘ - λ¨Έμ λ¬λ κΈ°λ° κ°κ²© μμΈ‘
- 리μ€ν¬ νκ° - ν¬νΈν΄λ¦¬μ€ 리μ€ν¬ λΆμ
π λΉ λ₯Έ μμ
μ¬μ μꡬμ¬ν
- Python 3.11 μ΄μ
- TimescaleDB
- Redis
- Docker (μ νμ¬ν)
μ€μΉ
-
μ μ₯μ ν΄λ‘
git clone https://github.com/your-org/mcp-market-statistics.git cd mcp-market-statistics -
κ°μνκ²½ μμ± λ° νμ±ν
python -m venv venv source venv/bin/activate # Linux/Mac # λλ venv\Scripts\activate # Windows -
μμ‘΄μ± μ€μΉ
make install # λλ pip install -r requirements.txt -
νκ²½ λ³μ μ€μ
cp .env.example .env # .env νμΌμ νΈμ§νμ¬ λ°μ΄ν°λ² μ΄μ€ λ° API μ€μ
Dockerλ₯Ό μ΄μ©ν μ€ν
# μ΄λ―Έμ§ λΉλ λ° μ€ν
make docker-run
# λλ μ§μ μ€ν
docker-compose up -d
κ°λ° λͺ¨λ μ€ν
# κ°λ° μλ² μμ
make dev-server
# ν
μ€νΈ μ€ν
make test
# μ½λ ν¬λ§·ν
make format
# 보μ κ²μ¬
make security
π οΈ κ°λ° κ°μ΄λ
νλ‘μ νΈ κ΅¬μ‘°
mcp-market-statistics/
βββ src/ # μμ€ μ½λ
β βββ server.py # MCP μλ² λ©μΈ
β βββ tools/ # MCP λꡬ μ μ
β βββ collectors/ # λ°μ΄ν° μμ§
β βββ analytics/ # κ³ κΈ λΆμ μμ§
β β βββ advanced_pattern_recognition.py
β β βββ multi_timeframe_analyzer.py
β β βββ correlation_engine.py
β β βββ price_predictor.py
β β βββ sentiment_analyzer.py
β β βββ market_anomaly_detector.py
β β βββ risk_assessment_engine.py
β βββ analyzers/ # μμ₯ λΆμκΈ°
β βββ calculators/ # κ³μ° λͺ¨λ
β βββ models/ # λ°μ΄ν° λͺ¨λΈ
β βββ utils/ # μ νΈλ¦¬ν°
β βββ exceptions.py # 컀μ€ν
μμΈ
β βββ config.py # μ€μ κ΄λ¦¬
βββ tests/ # ν
μ€νΈ μ½λ
βββ .github/workflows/ # CI/CD νμ΄νλΌμΈ
βββ requirements.txt # Python μμ‘΄μ±
βββ Dockerfile # Docker μ΄λ―Έμ§ λΉλ
βββ docker-compose.yml # μλΉμ€ μ€μΌμ€νΈλ μ΄μ
βββ Makefile # κ°λ° λͺ
λ Ήμ΄
ν μ€νΈ μμ±
μ΄ νλ‘μ νΈλ TDD(Test-Driven Development) λ°©λ²λ‘ μ λ°λ¦ λλ€.
# λͺ¨λ ν
μ€νΈ μ€ν
make test
# 컀λ²λ¦¬μ§μ ν¨κ» ν
μ€νΈ
make test-cov
# ν΅ν© ν
μ€νΈ μ€ν
make test-integration
μ½λ νμ§
# λ¦°ν
μ€ν
make lint
# μ½λ ν¬λ§·ν
make format
# 보μ κ²μ¬
make security
# λͺ¨λ μ²΄ν¬ μ€ν
make ci-test
π§ μ€μ
νκ²½ λ³μ
| λ³μλͺ | μ€λͺ | κΈ°λ³Έκ° |
|---|---|---|
TIMESCALE_DB_HOST |
TimescaleDB νΈμ€νΈ | localhost |
TIMESCALE_DB_PORT |
TimescaleDB ν¬νΈ | 5432 |
TIMESCALE_DB_NAME |
λ°μ΄ν°λ² μ΄μ€ μ΄λ¦ | market_stats |
REDIS_HOST |
Redis νΈμ€νΈ | localhost |
REDIS_PORT |
Redis ν¬νΈ | 6379 |
LOG_LEVEL |
λ‘κ·Έ λ 벨 | INFO |
KRX_API_KEY |
KRX API ν€ | - |
λ°μ΄ν°λ² μ΄μ€ μ€ν€λ§
λ°μ΄ν°λ² μ΄μ€ μ€ν€λ§λ₯Ό μ΄κΈ°ννλ €λ©΄:
make db-setup
π‘ API μ¬μ©λ²
MCP λꡬ λͺ©λ‘
κΈ°λ³Έ μμ₯ λ°μ΄ν°
get_market_overview- μμ₯ μ 체 νν©get_sector_statistics- μΉν°λ³ ν΅κ³get_investor_flows- ν¬μμλ³ λ§€λ§€ λν₯get_market_breadth- μμ₯ ν μ§ν
κ³ κΈ λΆμ λꡬ
analyze_advanced_patterns- κ³ κΈ ν¨ν΄ μΈμ λ° λΆμanalyze_multi_timeframe- λ€μ€ μκ°λ λΆμanalyze_correlations- μκ΄κ΄κ³ μμ§predict_prices- AI κΈ°λ° κ°κ²© μμΈ‘analyze_sentiment- κ°μ λΆμdetect_anomalies- μμ₯ μ΄μ μ§ν νμ§assess_risks- 리μ€ν¬ νκ°get_market_sentiment- μμ₯ μ¬λ¦¬ μ§νget_market_regime- μμ₯ κ΅λ©΄ νλ¨
μ¬μ© μμ
# MCP ν΄λΌμ΄μΈνΈλ₯Ό ν΅ν μ¬μ©
import mcp
client = mcp.Client("market-stats-server")
# μμ₯ κ°μ μ‘°ν
overview = await client.call_tool("get_market_overview", {
"market": "KOSPI",
"include_details": True
})
# μΉν° ν΅κ³ μ‘°ν
sectors = await client.call_tool("get_sector_statistics", {
"sector": "IT",
"period": "1d"
})
π λͺ¨λν°λ§
ν¬μ€μ²΄ν¬
curl http://localhost:8000/health
λ©νΈλ¦
μλ²λ Prometheus λ©νΈλ¦μ /metrics μλν¬μΈνΈμμ μ 곡ν©λλ€.
λ‘κ·Έ
ꡬ쑰νλ JSON λ‘κ·Έλ₯Ό μ¬μ©νμ¬ ELK μ€νκ³Ό νΈνλ©λλ€.
π€ κΈ°μ¬νκΈ°
- μ΄μλ₯Ό μμ±νμ¬ κΈ°λ₯ μμ²μ΄λ λ²κ·Έλ₯Ό 리ν¬νΈν΄μ£ΌμΈμ
- ν¬ν¬νμ¬ μλ‘μ΄ λΈλμΉλ₯Ό μμ±ν΄μ£ΌμΈμ
- λ³κ²½μ¬νμ 컀λ°ν΄μ£ΌμΈμ
- ν μ€νΈλ₯Ό μ€ννκ³ ν΅κ³Όνλμ§ νμΈν΄μ£ΌμΈμ
- ν 리νμ€νΈλ₯Ό μμ±ν΄μ£ΌμΈμ
κ°λ° μν¬νλ‘μ°
# μμ‘΄μ± μ€μΉ λ° pre-commit μ€μ
make install-dev
# μλ‘μ΄ κΈ°λ₯ λΈλμΉ μμ±
git checkout -b feature/new-feature
# κ°λ° λ° ν
μ€νΈ
make test
# μ»€λ° μ 체ν¬
make pre-commit
# μ»€λ° λ° νΈμ
git commit -m "feat: add new feature"
git push origin feature/new-feature
π λΌμ΄μ μ€
μ΄ νλ‘μ νΈλ MIT λΌμ΄μ μ€ νμ λ°°ν¬λ©λλ€. μμΈν λ΄μ©μ LICENSE νμΌμ μ°Έμ‘°νμΈμ.
πββοΈ μ§μ
- λ¬Έμ: νλ‘μ νΈ μν€
- μ΄μ: GitHub Issues
- ν λ‘ : GitHub Discussions
ποΈ κ°λ° νν©
Phase 1-4: κΈ°λ³Έ μΈνλΌ λ° λ°μ΄ν° μμ§ (μλ£ β )
- MCP μλ² μν€ν μ²
- λ°μ΄ν° μμ§ νμ΄νλΌμΈ
- κΈ°λ³Έ λΆμ λꡬ
- λ°μ΄ν°λ² μ΄μ€ λ° μΊμ±
Phase 5: κ³ κΈ λΆμ μμ€ν (μλ£ β )
- AdvancedPatternRecognition: μ°¨νΈ ν¨ν΄, μΊλ€μ€ν±, νλͺ¨λ ν¨ν΄ μΈμ
- MultiTimeframeAnalyzer: λ€μ€ μκ°λ ν΅ν© λΆμ
- CorrelationEngine: κ³ κΈ μκ΄κ΄κ³ λΆμ (18κ° λΆμ λ°©λ²)
- PricePredictor: λ¨Έμ λ¬λ κΈ°λ° κ°κ²© μμΈ‘
- SentimentAnalyzer: λ΄μ€ λ° μμ λ―Έλμ΄ κ°μ λΆμ
- MarketAnomalyDetector: AI κΈ°λ° μ΄μ ν¨ν΄ νμ§
- RiskAssessmentEngine: ν¬νΈν΄λ¦¬μ€ 리μ€ν¬ λΆμ
Phase 6-10: κ³μ° λͺ¨λ λ° μ΅μ ν (μ§ν μμ )
- Calculator λͺ¨λ ꡬν
- Analyzer λͺ¨λ ꡬν
- Model λͺ¨λ ꡬν
- μ±λ₯ μ΅μ ν
- λ°°ν¬ λ° μ΄μ
π νλ‘μ νΈ ν΅κ³
- μ΄ μ½λ λΌμΈ: 15,000+ λΌμΈ
- ν μ€νΈ 컀λ²λ¦¬μ§: 95%+
- ꡬνλ λΆμ λ°©λ²: 100+ κ°
- μ§μ ν¨ν΄: 50+ μ’ λ₯
- TDD λ°©λ²λ‘ μ μ©μΌλ‘ λμ μ½λ νμ§ λ³΄μ₯
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.