mustafamjumaah/prayer-times-mcp-server
If you are the rightful owner of prayer-times-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that provides Islamic prayer times using the AlAdhan API, designed for AI assistants and other MCP clients.
Prayer Times MCP Server
A Model Context Protocol (MCP) server that provides Islamic prayer times using the AlAdhan API. This server allows AI assistants and other MCP clients to access accurate prayer times for any location worldwide.
Features
- 🌍 Global Coverage: Get prayer times for any location worldwide
- 📅 Multiple Date Support: Get prayer times for specific dates or full monthly calendars
- 🕌 22 Calculation Methods: Support for different Islamic authorities and calculation methods
- ⏰ Next Prayer Detection: Find the next upcoming prayer time
- 🎯 Precise Tuning: Fine-tune prayer times with custom adjustments
- 📚 Rich Resources: Access documentation and method information
- 🤖 AI-Ready: Designed for integration with AI assistants and MCP clients
Installation
- Install the required dependencies:
pip install mcp aiohttp
- Clone or download the server files:
git clone <repository-url>
cd mcp-test
Usage
Running the Server
Start the MCP server:
python server.py
The server runs using the stdio transport and waits for MCP client connections.
Available Tools
1. get_prayer_times_by_address
Get prayer times for a specific address.
Parameters:
address(required): Full address (e.g., "Dubai, UAE", "London, UK")method(optional): Calculation method ID (1-22), default is 8 (Gulf Region)date(optional): Date in DD-MM-YYYY format, defaults to todaytune(optional): Comma-separated tuning values for each prayer time
Example:
{
"address": "Dubai, UAE",
"method": 8,
"date": "15-01-2024"
}
2. get_prayer_times_by_city
Get prayer times for a specific city and country.
Parameters:
city(required): City namecountry(required): Country namemethod(optional): Calculation method ID (1-22), default is 8date(optional): Date in DD-MM-YYYY format
Example:
{
"city": "London",
"country": "UK",
"method": 2
}
3. get_monthly_calendar
Get prayer times calendar for an entire month.
Parameters:
address(required): Full addressmonth(required): Month number (1-12)year(required): Year (e.g., 2024)method(optional): Calculation method ID (1-22), default is 8
Example:
{
"address": "Mecca, Saudi Arabia",
"month": 1,
"year": 2024,
"method": 4
}
4. get_next_prayer
Get the next upcoming prayer time.
Parameters:
address(required): Full addressmethod(optional): Calculation method ID (1-22), default is 8
Example:
{
"address": "New York, USA",
"method": 2
}
Available Resources
1. prayer://methods
List of all available prayer time calculation methods with descriptions.
2. prayer://current-times
Current prayer times for Dubai, UAE (default location).
3. prayer://documentation
Comprehensive documentation on how to use the prayer times API.
Available Prompts
1. daily_prayer_reminder
Generate a formatted daily prayer time reminder for a specific location.
Parameters:
location(required): City and country (e.g., "London, UK")method(optional): Calculation method ID (1-22)
Prayer Calculation Methods
The server supports 22 different calculation methods used by various Islamic authorities worldwide:
- Muslim World League
- Islamic Society of North America
- Egyptian General Authority of Survey
- Umm Al-Qura University, Makkah
- University of Islamic Sciences, Karachi
- Institute of Geophysics, University of Tehran
- Shia Ithna-Ashari, Leva Institute, Qum
- Gulf Region (Default)
- Kuwait
- Qatar
- Majlis Ugama Islam Singapura, Singapore
- Union Organization islamic de France
- Diyanet İşleri Başkanlığı, Turkey
- Spiritual Administration of Muslims of Russia
- Moonsighting Committee
- Dubai, UAE
- Jabatan Kemajuan Islam Malaysia (JAKIM)
- Tunisia
- Algeria
- Kementerian Agama Republik Indonesia
- Morocco
- Comunidate Islamica de Lisboa (Portugal)
Tuning Parameters
You can fine-tune prayer times by adding/subtracting minutes from each prayer time using the tune parameter:
Format: Imsak,Fajr,Sunrise,Dhuhr,Asr,Maghrib,Sunset,Isha,Midnight
Example: 0,0,0,0,0,0,0,0,0 (no adjustment)
API Integration
This server uses the AlAdhan API to fetch accurate prayer times. The API provides:
- Accurate prayer time calculations based on astronomical data
- Support for multiple calculation methods
- Global coverage with geocoding
- Hijri date information
- Sunrise, sunset, and other solar times
Error Handling
The server provides comprehensive error handling:
- Network errors: Handles API connection issues gracefully
- Invalid parameters: Validates input parameters and provides clear error messages
- API errors: Handles API response errors and provides meaningful feedback
- Resource not found: Clear error messages for unknown resources or tools
Testing
Run the test script to verify the server functionality:
python simple_test.py
Contributing
Feel free to contribute to this project by:
- Reporting bugs
- Suggesting new features
- Adding support for additional calculation methods
- Improving error handling
- Adding more comprehensive tests
License
This project is open source and available under the MIT License.
Acknowledgments
- AlAdhan API for providing the prayer times data
- Model Context Protocol for the MCP specification
- The Islamic community for prayer time calculation methods
Note: This server is designed for educational and practical use. For critical applications, please ensure you have appropriate error handling and fallback mechanisms in place.