prayer-times-mcp-server

mustafamjumaah/prayer-times-mcp-server

3.1

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.

Tools
4
Resources
0
Prompts
0

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

  1. Install the required dependencies:
pip install mcp aiohttp
  1. 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 today
  • tune (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 name
  • country (required): Country name
  • method (optional): Calculation method ID (1-22), default is 8
  • date (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 address
  • month (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 address
  • method (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:

  1. Muslim World League
  2. Islamic Society of North America
  3. Egyptian General Authority of Survey
  4. Umm Al-Qura University, Makkah
  5. University of Islamic Sciences, Karachi
  6. Institute of Geophysics, University of Tehran
  7. Shia Ithna-Ashari, Leva Institute, Qum
  8. Gulf Region (Default)
  9. Kuwait
  10. Qatar
  11. Majlis Ugama Islam Singapura, Singapore
  12. Union Organization islamic de France
  13. Diyanet İşleri Başkanlığı, Turkey
  14. Spiritual Administration of Muslims of Russia
  15. Moonsighting Committee
  16. Dubai, UAE
  17. Jabatan Kemajuan Islam Malaysia (JAKIM)
  18. Tunisia
  19. Algeria
  20. Kementerian Agama Republik Indonesia
  21. Morocco
  22. 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:

  1. Reporting bugs
  2. Suggesting new features
  3. Adding support for additional calculation methods
  4. Improving error handling
  5. Adding more comprehensive tests

License

This project is open source and available under the MIT License.

Acknowledgments


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.