Natal MCP Server
by Tristan-hsu
README.md
# Natal MCP Server
A Model Context Protocol (MCP) server that provides professional astrology chart generation and analysis capabilities using the [natal](https://github.com/hoishing/natal) library. This server enables AI assistants like Claude to create and analyze astrological charts with high precision and detail.
## โจ Features
- **๐ฏ Chart Generation**: Create natal charts, transit charts, synastry charts, and solar return charts
- **๐ Data Analysis**: Extract detailed astrological data including planet positions, houses, aspects, and statistics
- **๐ MCP Integration**: Seamlessly integrate with Claude Desktop and other MCP clients
- **๐ Multiple Formats**: Support for SVG chart generation and structured data output
- **โก Performance**: Built-in caching for improved performance
- **๐ก๏ธ Robust**: Comprehensive error handling and input validation
- **๐ฑ Cross-Platform**: Works on Windows, macOS, and Linux
## ๐ Installation
### Prerequisites
- Python 3.12 or higher
- uv (recommended) or pip
### Using uv (Recommended)
```bash
uv add natal-mcp
```
### Using pip
```bash
pip install natal-mcp
```
### Using npm (for Node.js projects)
```bash
npm install natal-mcp
```
## ๐โโ๏ธ Quick Start
### Running the Server
```bash
# Using uv (recommended)
uv run natal-mcp
# Using pip
natal-mcp
# Using npm
npx natal-mcp
# With custom options
natal-mcp --transport sse --port 8080 --log-level debug
```
### Claude Desktop Integration
Add the following to your Claude Desktop configuration file:
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
```json
{
"mcpServers": {
"natal": {
"command": "uv",
"args": ["run", "natal-mcp"]
}
}
}
```
Alternative configurations:
```json
{
"mcpServers": {
"natal": {
"command": "natal-mcp"
}
}
}
```
Or with npm:
```json
{
"mcpServers": {
"natal": {
"command": "npx",
"args": ["natal-mcp"]
}
}
}
```
## ๐ ๏ธ Available Tools
### Chart Generation Tools
#### `create_natal_chart`
Generate a natal (birth) chart from birth data.
**Parameters:**
- `name` (string): Full name of the person
- `utc_datetime` (string): Birth date and time in UTC (ISO format, e.g., '1990-01-15T10:30:00Z')
- `latitude` (float): Birth location latitude (-90 to 90)
- `longitude` (float): Birth location longitude (-180 to 180)
- `width` (int, optional): Chart width in pixels (default: 600)
- `theme` (string, optional): Chart theme - 'light', 'dark', or 'mono' (default: 'dark')
#### `create_transit_chart`
Generate a transit chart comparing natal positions with current planetary positions.
**Parameters:**
- `name` (string): Full name of the person
- `birth_utc_datetime` (string): Birth date and time in UTC
- `birth_latitude` (float): Birth location latitude
- `birth_longitude` (float): Birth location longitude
- `transit_utc_datetime` (string): Transit date and time in UTC
- `transit_latitude` (float, optional): Transit location latitude (defaults to birth location)
- `transit_longitude` (float, optional): Transit location longitude (defaults to birth location)
- `width` (int, optional): Chart width in pixels (default: 600)
- `theme` (string, optional): Chart theme (default: 'dark')
#### `create_synastry_chart`
Generate a synastry chart comparing two people's natal charts.
**Parameters:**
- `person1_name` (string): Full name of the first person
- `person1_utc_datetime` (string): First person's birth date and time in UTC
- `person1_latitude` (float): First person's birth location latitude
- `person1_longitude` (float): First person's birth location longitude
- `person2_name` (string): Full name of the second person
- `person2_utc_datetime` (string): Second person's birth date and time in UTC
- `person2_latitude` (float): Second person's birth location latitude
- `person2_longitude` (float): Second person's birth location longitude
- `width` (int, optional): Chart width in pixels (default: 600)
- `theme` (string, optional): Chart theme (default: 'dark')
#### `create_solar_return_chart`
Generate a solar return chart for a specific year.
**Parameters:**
- `name` (string): Full name of the person
- `birth_utc_datetime` (string): Birth date and time in UTC
- `birth_latitude` (float): Birth location latitude
- `birth_longitude` (float): Birth location longitude
- `return_year` (int): Year for the solar return (e.g., 2024)
- `return_latitude` (float, optional): Location latitude for solar return (defaults to birth location)
- `return_longitude` (float, optional): Location longitude for solar return (defaults to birth location)
- `width` (int, optional): Chart width in pixels (default: 600)
- `theme` (string, optional): Chart theme (default: 'dark')
### Data Analysis Tools
#### `get_chart_data`
Extract detailed astrological data from a natal chart.
**Parameters:**
- `name` (string): Full name of the person
- `utc_datetime` (string): Birth date and time in UTC
- `latitude` (float): Birth location latitude
- `longitude` (float): Birth location longitude
- `theme` (string, optional): Chart theme (default: 'dark')
**Returns:** Detailed chart data including planets, houses, aspects, and signs.
#### `get_chart_statistics`
Get statistical analysis of a natal chart.
**Parameters:**
- `name` (string): Full name of the person
- `utc_datetime` (string): Birth date and time in UTC
- `latitude` (float): Birth location latitude
- `longitude` (float): Birth location longitude
- `theme` (string, optional): Chart theme (default: 'dark')
**Returns:** Statistical distributions including elements, modalities, polarities, quadrants, and hemispheres.
#### `generate_chart_report`
Generate a comprehensive astrological chart report.
**Parameters:**
- `name` (string): Full name of the person
- `utc_datetime` (string): Birth date and time in UTC
- `latitude` (float): Birth location latitude
- `longitude` (float): Birth location longitude
- `format` (string, optional): Report format - 'markdown' or 'html' (default: 'markdown')
- `theme` (string, optional): Chart theme (default: 'dark')
**Returns:** Comprehensive chart analysis in the specified format.
## ๐ Example Usage
### Basic Natal Chart
```
Create a natal chart for John Doe born on January 15, 1990 at 10:30 AM UTC in New York City (latitude: 40.7128, longitude: -74.0060).
```
### Transit Analysis
```
Create a transit chart for the same person for today's date to see current planetary influences.
```
### Relationship Compatibility
```
Create a synastry chart comparing John Doe with Jane Smith (born March 22, 1992 at 2:15 PM UTC in Los Angeles, latitude: 34.0522, longitude: -118.2437) to analyze relationship compatibility.
```
### Annual Forecast
```
Generate a solar return chart for John Doe for the year 2024 to see the themes for his upcoming year.
```
## ๐ง Command Line Options
```bash
natal-mcp --help
```
**Available options:**
- `--transport`: Transport protocol ('stdio' or 'sse', default: 'stdio')
- `--port`: Port for SSE transport (default: 8000)
- `--host`: Host for SSE transport (default: 'localhost')
- `--log-level`: Logging level ('debug', 'info', 'warning', 'error', default: 'info')
- `--cache-size`: Maximum number of charts to cache (default: 100)
- `--version`: Show version information
## ๐งช Development
### Requirements
- Python 3.12+
- uv (recommended) or pip
- natal library
- MCP Python SDK
### Setup
```bash
git clone <repository-url>
cd natal-mcp
uv sync
```
### Running Tests
```bash
# Run all tests
uv run pytest
# Run with coverage
uv run pytest --cov=natal_mcp
# Run specific test file
uv run pytest tests/test_tools.py
# Run with verbose output
uv run pytest -v
```
### Code Quality
```bash
# Format code
uv run black src/ tests/
# Sort imports
uv run isort src/ tests/
# Type checking
uv run mypy src/
```
### Building
```bash
# Build package
uv build
# Install in development mode
uv pip install -e .
```
## ๐ Troubleshooting
### Common Issues
**1. Python Version Error**
```
Error: Python 3.12+ not found
```
Solution: Install Python 3.12 or higher and ensure it's in your PATH.
**2. Natal Library Import Error**
```
ImportError: No module named 'natal'
```
Solution: Ensure all dependencies are installed with `uv sync` or `pip install -r requirements.txt`.
**3. Claude Desktop Connection Issues**
- Verify the configuration file path is correct
- Check that the command path is accessible
- Restart Claude Desktop after configuration changes
- Check logs for error messages
**4. Chart Generation Errors**
- Verify date format is ISO 8601 (e.g., '1990-01-15T10:30:00Z')
- Check latitude/longitude ranges (-90 to 90, -180 to 180)
- Ensure timezone is UTC
### Debug Mode
Run with debug logging to see detailed information:
```bash
natal-mcp --log-level debug
```
## ๐ API Reference
For detailed API documentation, see the docstrings in the source code or generate documentation with:
```bash
uv run python -m pydoc natal_mcp
```
## ๐ค Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Add tests for new functionality
5. Ensure all tests pass (`uv run pytest`)
6. Format code (`uv run black src/ tests/`)
7. Commit your changes (`git commit -m 'Add amazing feature'`)
8. Push to the branch (`git push origin feature/amazing-feature`)
9. Open a Pull Request
### Development Guidelines
- Follow PEP 8 style guidelines
- Add type hints to all functions
- Write comprehensive tests
- Update documentation for new features
- Ensure backward compatibility
## ๐ License
MIT License - see [LICENSE](LICENSE) file for details.
## ๐ Acknowledgments
- [natal](https://github.com/hoishing/natal) - The excellent astrology library that powers this server
- [Model Context Protocol](https://modelcontextprotocol.io/) - The protocol that enables AI integration
- [FastMCP](https://github.com/modelcontextprotocol/python-sdk) - The Python SDK for MCP servers
## ๐ Support
- ๐ [Report Issues](https://github.com/natal-mcp/natal-mcp/issues)
- ๐ฌ [Discussions](https://github.com/natal-mcp/natal-mcp/discussions)
- ๐ง Email: contact@natal-mcp.com
---
Made with โค๏ธ for the astrology and AI communities.
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues