Metadata-Version: 2.4
Name: trading-economics-calendar-mcp
Version: 0.1.0
Summary: MCP server for fetching trading economics calendar events
Author-email: Gavin Huang <gavin@example.com>
Project-URL: Homepage, https://github.com/gavinHuang/trading_economics_calendar_mcp
Project-URL: Repository, https://github.com/gavinHuang/trading_economics_calendar_mcp
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fastmcp>=0.1.0
Requires-Dist: requests>=2.25.0
Requires-Dist: beautifulsoup4>=4.9.0
Requires-Dist: lxml>=4.6.0
Requires-Dist: python-dateutil>=2.8.0
Provides-Extra: dev
Requires-Dist: pytest>=6.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
Requires-Dist: black>=21.0.0; extra == "dev"
Requires-Dist: flake8>=3.8.0; extra == "dev"
Requires-Dist: mypy>=0.800; extra == "dev"
Dynamic: license-file

# Trading Economics Calendar MCP Server

A Model Context Protocol (MCP) server that provides access to economic calendar events from Trading Economics. This server allows you to fetch economic events with various filters including countries, importance levels, and date ranges.

## Features

- 📅 Fetch economic calendar events
- 🌍 Filter by major countries
- 📊 Filter by importance level (low, medium, high)
- 📆 Date range filtering
- 🔍 High-impact events filtering
- 🏛️ Country-specific event queries

## Installation

### From PyPI (when published)
```bash
pip install trading-economics-calendar-mcp
```

### From Source
```bash
git clone <repository-url>
cd trading-economics-calendar-mcp
pip install -e .
```

## Usage

### As MCP Server

Start the server:
```bash
trading-economics-mcp
```

### Available Tools

#### 1. Get Economic Events
```python
get_economic_events(
    countries=["United States", "Germany"],
    importance="high",
    start_date="2024-01-01",
    end_date="2024-01-31"
)
```

#### 2. Get Today's Events
```python
get_today_economic_events(
    countries=["United States"],
    importance="medium"
)
```

#### 3. Get This Week's Events
```python
get_week_economic_events(
    countries=["Japan", "United Kingdom"],
    importance="high"
)
```

#### 4. Get Major Countries
```python
get_major_countries()
# Returns: {"united_states": "United States", "germany": "Germany", ...}
```

#### 5. Get Importance Levels
```python
get_importance_levels()
# Returns: {"low": 1, "medium": 2, "high": 3}
```

#### 6. Get High-Impact Events
```python
get_high_impact_events(
    countries=["United States", "China"],
    start_date="2024-01-01",
    end_date="2024-01-31"
)
```

#### 7. Get Events by Country
```python
get_events_by_country(
    country="United States",
    start_date="2024-01-01",
    end_date="2024-01-07",
    importance="high"
)
```

## Supported Countries

The server supports filtering by major economies:
- United States
- China
- Japan
- Germany
- United Kingdom
- France
- Italy
- Canada
- Australia
- Brazil
- India
- Russia
- South Korea
- Spain
- Mexico
- Netherlands
- Switzerland
- Belgium
- Sweden
- Austria

## Response Format

Each economic event returns the following structure:
```json
{
    "date": "2024-01-15",
    "time": "08:30",
    "country": "United States",
    "event": "Retail Sales",
    "importance": 3,
    "actual": "0.6%",
    "forecast": "0.4%",
    "previous": "0.3%"
}
```

## Configuration

The server uses the following default settings:
- Base URL: `https://tradingeconomics.com`
- Request timeout: 30 seconds
- User agent: Modern browser string

## Error Handling

The server includes comprehensive error handling:
- Network timeouts
- Invalid response parsing
- Missing data fields
- Rate limiting (when applicable)

## Development

### Setup Development Environment
```bash
git clone <repository-url>
cd trading-economics-calendar-mcp
pip install -e ".[dev]"
```

### Run Tests
```bash
pytest
```

### Code Formatting
```bash
black trading_economics_calendar/
flake8 trading_economics_calendar/
mypy trading_economics_calendar/
```

## Contributing

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Run the test suite
6. Submit a pull request

## License

MIT License - see LICENSE file for details.

## Disclaimer

This tool fetches publicly available data from Trading Economics. Please respect their terms of service and rate limits. This tool is for educational and research purposes.
