MCP Stock Details Server

MCP Stock Details Server

A Model Context Protocol server providing comprehensive Korean stock market analysis, including financial data, valuation metrics, ESG information, and investment insights.

Category
访问服务器

README

MCP Stock Details Server

Python 3.8+ License: MIT Tests

A comprehensive Model Context Protocol (MCP) server for Korean stock market analysis, providing detailed financial data, analysis tools, and investment insights.

🚀 Features

Phase 1 ✅ - Core Infrastructure

  • MCP Server Framework: Model Context Protocol compliant server
  • Data Collection: DART (Data Analysis, Retrieval and Transfer System) integration
  • Caching System: Redis-based caching with memory fallback
  • Error Handling: Comprehensive exception handling and logging

Phase 2 ✅ - Analysis Tools (Weeks 1-5)

Week 1: Company & Financial Analysis

  • get_company_overview: Comprehensive company information
  • get_financial_statements: Income statement, balance sheet, cash flow analysis

Week 2: Financial Ratios & Valuation

  • get_financial_ratios: 50+ financial ratios with industry benchmarks
  • get_valuation_metrics: Multiple valuation approaches (DCF, multiples, etc.)

Week 3: ESG & Technical Analysis

  • get_esg_info: Environmental, Social, Governance analysis
  • get_technical_indicators: Technical analysis indicators (RSI, MACD, etc.)

Week 4: Shareholder & Business Analysis

  • get_shareholder_info: Shareholder structure, governance metrics
  • get_business_segments: Business segment performance analysis

Week 5: Market Analysis

  • get_peer_comparison: Industry peer comparison and benchmarking
  • get_analyst_consensus: Analyst consensus, target prices, investment opinions

Upcoming Features (Phase 3-5)

  • Advanced valuation models (DCF, Monte Carlo simulation)
  • Risk analysis engine (VaR, stress testing)
  • Real-time data pipeline
  • Performance optimization
  • Production deployment

🛠️ Installation

Prerequisites

  • Python 3.8 or higher
  • Redis (optional, for enhanced caching)

Setup

# Clone the repository
git clone https://github.com/yourusername/mcp-stock-details.git
cd mcp-stock-details

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Set up environment variables
cp .env.example .env
# Edit .env with your DART API key and other settings

Environment Variables

# Required
DART_API_KEY=your_dart_api_key_here

# Optional
REDIS_URL=redis://localhost:6379/0
LOG_LEVEL=INFO
CACHE_TTL=3600

🚀 Quick Start

Running the Server

# Start the MCP server
python -m src.server

# Or run with specific configuration
python -m src.server --config config/development.json

Using with Claude Desktop

Add to your Claude Desktop MCP configuration:

{
  "mcpServers": {
    "stock-details": {
      "command": "python",
      "args": ["-m", "src.server"],
      "cwd": "/path/to/mcp-stock-details",
      "env": {
        "DART_API_KEY": "your_api_key"
      }
    }
  }
}

Example Usage

# Get company overview
result = await server.call_tool("get_company_overview", {
    "company_code": "005930",  # Samsung Electronics
    "include_financial_summary": True
})

# Analyze financial ratios
result = await server.call_tool("get_financial_ratios", {
    "company_code": "005930",
    "include_industry_comparison": True,
    "analysis_period": "3Y"
})

# Compare with peers
result = await server.call_tool("get_peer_comparison", {
    "company_code": "005930",
    "include_valuation_comparison": True,
    "max_peers": 5
})

📊 Supported Analysis

Financial Analysis

  • Profitability Ratios: ROE, ROA, Operating Margin, Net Margin
  • Liquidity Ratios: Current Ratio, Quick Ratio, Cash Ratio
  • Leverage Ratios: Debt-to-Equity, Interest Coverage, EBITDA Coverage
  • Efficiency Ratios: Asset Turnover, Inventory Turnover, Receivables Turnover
  • Valuation Ratios: P/E, P/B, EV/EBITDA, PEG Ratio

Advanced Analysis

  • DCF Valuation: Multi-stage dividend discount model
  • Peer Comparison: Industry benchmarking and relative valuation
  • ESG Scoring: Environmental, Social, Governance metrics
  • Technical Indicators: RSI, MACD, Bollinger Bands, Moving Averages
  • Risk Analysis: Beta, VaR, Sharpe Ratio, Maximum Drawdown

Market Intelligence

  • Analyst Consensus: Target prices, investment ratings, earnings estimates
  • Shareholder Analysis: Ownership structure, governance metrics
  • Business Segments: Revenue breakdown, segment performance analysis

🧪 Testing

# Run all tests
python -m pytest

# Run with coverage
python -m pytest --cov=src --cov-report=html

# Run specific test categories
python -m pytest tests/unit/
python -m pytest tests/integration/

📁 Project Structure

mcp-stock-details/
├── src/
│   ├── server.py                 # Main MCP server
│   ├── config.py                 # Configuration management
│   ├── exceptions.py             # Custom exceptions
│   ├── models/                   # Data models
│   ├── tools/                    # Analysis tools
│   │   ├── company_tools.py
│   │   ├── financial_tools.py
│   │   ├── valuation_tools.py
│   │   ├── esg_tools.py
│   │   ├── technical_tools.py
│   │   ├── risk_tools.py
│   │   ├── shareholder_tools.py
│   │   ├── business_segment_tools.py
│   │   ├── peer_comparison_tools.py
│   │   └── analyst_consensus_tools.py
│   ├── collectors/               # Data collectors
│   ├── utils/                    # Utility functions
│   └── cache/                    # Caching system
├── tests/
│   ├── unit/                     # Unit tests
│   ├── integration/              # Integration tests
│   └── fixtures/                 # Test data
├── config/                       # Configuration files
├── docs/                         # Documentation
├── requirements.txt
├── development-plan.md
└── README.md

📈 Development Status

  • [x] Phase 1: Core Infrastructure (Completed)
  • [x] Phase 2: Analysis Tools - Weeks 1-5 (Completed)
  • [ ] Phase 3: Advanced Analysis Engine - Weeks 6-8
  • [ ] Phase 4: Performance & Quality - Weeks 9-10
  • [ ] Phase 5: Deployment & Operations - Weeks 11-12

See Development Plan for detailed roadmap.

🤝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

# Install development dependencies
pip install -r requirements-dev.txt

# Install pre-commit hooks
pre-commit install

# Run tests before committing
python -m pytest

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Related Resources

📞 Support

🙏 Acknowledgments

  • DART (금융감독원) for providing comprehensive financial data
  • Model Context Protocol team for the excellent framework
  • Korean financial data providers and community

Note: This project is for educational and research purposes. Please ensure compliance with data usage terms and local regulations when using financial data.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选