Production-ready Muslim prayer reminder system on Cloudflare Workers with Streamable HTTP MCP and deterministic host middleware

Muslim Prayer Reminder System (Cloudflare Remote MCP + Hybrid Middleware)

npm versionSmitheryCursorCILicense: MITMCPCloudflare WorkersTypeScriptNode.js

Production-ready Muslim prayer reminder system running on Cloudflare Workers, exposing both a Streamable HTTP Model Context Protocol (MCP) server and an ultra-fast edge REST API with deterministic host middleware.

๐Ÿ•Œ Architecture Overview

  1. Remote Cloudflare MCP Worker (src/index.ts):

    • Uses modern Web Standard Streamable HTTP transport (@modelcontextprotocol/sdk).
    • Backed by Cloudflare KV for user preference storage and deduplication sentinels.
    • Calculates prayer times in-isolate via adhan (<1ms astronomical solar computation).
    • Layered location resolver (explicit coordinates -> user preference -> host headers -> request.cf geolocation -> Makkah fallback).
    • High-latitude polar day/night handling (fiqh-compliant 48ยฐ clamping).
  2. Deterministic Host Middleware (src/middleware/host-connector.ts):

    • Bridges the protocol limitation: generic MCP tools cannot intercept arbitrary model prompts or force response appending.
    • Runs alongside the LLM call (<5ms latency overhead), and deterministically appends \n\n๐Ÿ•Œ It is time for [Prayer] prayer. to the final answer whenever a prayer is due.
    • Fail-open: network timeouts or worker outages never disrupt the primary AI conversation.

๐Ÿ› ๏ธ MCP Tools

Tool Name Type Description
get_prayer_status Read-only Checks whether an obligatory prayer is currently due and returns reminder text, window bounds, and dedupe key.
get_today_prayer_times Read-only Returns today's full timetable (Fajr, Sunrise, Dhuhr, Asr, Maghrib, Isha) in UTC and formatted local time.
get_next_prayer Read-only Returns the immediate next prayer name, scheduled time, and remaining countdown in minutes.
configure_prayer_preferences State mutation Sets user calculation method, madhab, reminder mode, location mode (fixed vs auto), and language.
get_prayer_preferences Read-only Inspects active user calculation settings and preferences.

๐Ÿš€ Quick Start & Deployment

1. Run Automated Test Suite Locally

npm test

Executes 39 automated tests covering 10 benchmark cities, DST transitions, Hanafi/Shafi Asr differences, deduplication, JSON-RPC MCP conformance, and end-to-end middleware post-processing.

2. Deploy to Cloudflare Workers

# 1. Create Cloudflare KV namespace
npx wrangler kv:namespace create PRAYER_KV

# 2. Update wrangler.toml with the returned namespace ID
# 3. Deploy
npx wrangler deploy

๐Ÿ”Œ Connecting to AI Hosts

โšก 1-Click Client Installation Matrix

Client / Environment Support Mode 1-Click Deeplink / Quick Command
Cursor Remote HTTP Add to Cursor
Claude Desktop Remote HTTP Add URL https://muslim-prayer-mcp.najetareqz.workers.dev/mcp to config
VS Code Local / NPX npx -y muslim-prayer-mcp via .vscode/mcp.json
Windsurf / Devin Remote HTTP Add https://muslim-prayer-mcp.najetareqz.workers.dev/mcp to mcp_config.json
Gemini CLI Auto-indexed gemini-cli --mcp-server https://muslim-prayer-mcp.najetareqz.workers.dev/mcp
Autonomous Agents All Modes Direct agent setup: llms-install.md

Option 1: Local Stdio via NPX (Claude Desktop, Cursor, Windsurf, VS Code)

{
  "mcpServers": {
    "muslim-prayer": {
      "command": "npx",
      "args": ["-y", "muslim-prayer-mcp"]
    }
  }
}

Option 2: Remote Streamable HTTP (Cloudflare Workers)

{
  "mcpServers": {
    "muslim-prayer": {
      "url": "https://muslim-prayer-mcp.najetareqz.workers.dev/mcp"
    }
  }
}

Deterministic Host Middleware (Node.js / Express / Vercel AI SDK)

import { PrayerReminderMiddleware } from './src/middleware/host-connector.ts';

const prayerMiddleware = new PrayerReminderMiddleware({
  workerBaseUrl: 'https://muslim-prayer-mcp.najetareqz.workers.dev',
  userId: 'user_123',
});

// Wrap any LLM completion
const rawAnswer = await callYourLlm('What is the best database for this project?');
const { responseText, reminderAppended } = await prayerMiddleware.processResponse(rawAnswer, {
  'X-User-Coordinates': '24.71, 46.68',
  'X-User-Timezone': 'Asia/Riyadh',
});

console.log(responseText);
// If Maghrib is due:
// PostgreSQL is the recommended database...
//
// ๐Ÿ•Œ It is time for Maghrib prayer.

๐Ÿ”’ Privacy & Data Minimization

  • Coordinate Truncation: All incoming latitude/longitude values are rounded to 2 decimal places (~1.1km precision), preventing street-level tracking while preserving sub-minute solar calculation accuracy.
  • No Coordinate Leakage: MCP tool outputs return prayer names and reminders; raw coordinates are never passed into the LLM context.
  • In-Isolate Execution: Calculations run directly within the Cloudflare V8 isolate; no user coordinates are sent across WAN to third-party prayer APIs.

๐ŸŽจ Official Branding Assets

Official high-resolution branding assets with antialiased transparent corners:

๐Ÿ“œ Legal & Compliance

MCP Server ยท Populars

MCP Server ยท New

    esperanza-volkov

    confdiff

    Semantic, format-aware diff for config & structured-data files (JSON, YAML, TOML, INI, .env, .properties, CSV, XML). See what actually changed โ€” keys and values, not text noise.

    Community esperanza-volkov
    butterbase-ai

    @butterbase/mcp

    Open-source backend-as-a-service. Postgres, auth, storage, functions, AI gateway, MCP.

    Community butterbase-ai
    adamsiwiec1

    Host MCP SSE Server on Google Cloud Run

    Host an Model Context Protocol SSE deployment on Cloud Run, Authenticating with IAM.

    Community adamsiwiec1
    Mitek99

    DeepView MCP

    DeepView MCP is a Model Context Protocol server that enables IDEs like Cursor and Windsurf to analyze large codebases using Gemini 2.5 Pro's extensive context window.

    Community Mitek99
    prisma

    orm

    Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

    Community prisma