Pikud Haoref Real-Time Alert System
About
Provides real-time access to Israeli emergency alerts from the official Pikud Haoref API.
Details
- Author
- leonmelamud
- Categories
- Communication, Productivity
Jump to
Api Key Authentication Required For All Endpoints
Important:API key authentication isrequired for both SSE endpointsfor security.
- Both SSE endpointsrequire API key authentication viaX-API-Keyheader
- MCP serverconnects with authentication to the internal webhook endpoint
- Same API keyused for both client and internal service authentication
ConfigureGEOIP_DB_PATHto restrict access to Israeli IP addresses only:
- Sign up atMaxMind
- DownloadGeoLite2-Country.mmdb
- SetGEOIP_DB_PATHin your.envfile
poha-real-time-alert-system/ ├── src/ # Main source code │ ├── core/ # Core MCP functionality │ │ ├── mcp_server.py # MCP server implementation │ │ ├── state.py # Application state management │ │ └── alert_queue.py # Alert queue management │ ├── api/ # FastAPI services │ │ ├── main.py # FastAPI application entry point │ │ └── sse_gateway.py # SSE gateway for VSCode extension │ ├── services/ # Business logic │ │ ├── polling.py # Core API polling logic │ │ └── sse.py # Server-Sent Events implementation │ └── utils/ # Utilities │ ├── security.py # Authentication and geo-restriction │ └── geolocation.py # Geo-IP functionality ├── docker/ # Docker configuration │ ├── Dockerfile # Main FastAPI container │ ├── mcp.Dockerfile # MCP server container │ └── docker-compose.yml # Multi-service setup ├── scripts/ # Utility scripts │ ├── start_mcp.sh # MCP server startup script │ └── diagram.py # Architecture diagram generator ├── tests/ # Comprehensive test suite ├── vscode-extension/ # VSCode extension for alerts ├── conftest.py # Test configuration ├── pytest.ini # Test settings ├── Makefile # Docker management commands ├── requirements.txt # Python dependencies ├── README.md # This file └── .gitignore # Git ignore rules
# Run tests in Docker make test # Or run tests locally pytest -v
- Core:fastapi,uvicorn,httpx,python-dotenv
- Security:geoip2,slowapi
- MCP:fastmcp,fuzzywuzzy,python-Levenshtein
- Testing:pytest,pytest-asyncio,respx
make deploy # One-command deploy (build + start + health-check) make up # Start all 3 services make down # Stop all services make restart # Rebuild and restart make logs # View all logs make status # Show container status make clean # Remove containers and volumes
The oref.org.il APIgeo-blocks non-Israeli IPs. For production, deploy on aGCP e2-micro VM inme-west1(Tel Aviv)— free-tier eligible with an Israeli IP.
# 1. Create free VM in Tel Aviv gcloud compute instances create pikud-haoref \ --zone=me-west1-a \ --machine-type=e2-micro \ --image-family=debian-12 \ --image-project=debian-cloud \ --tags=http-server # 2. Allow ports 8000-8002 gcloud compute firewall-rules create allow-pikud-haoref \ --allow=tcp:8000-8002 --target-tags=http-server # 3. SSH and install Docker gcloud compute ssh pikud-haoref --zone=me-west1-a sudo apt update && sudo apt install -y docker.io docker-compose sudo usermod -aG docker $USER && newgrp docker # 4. Clone, configure, and deploy git clone <repo-url> && cd pikud-a-oref-mcp cp .env.example .env # Edit API_KEY for production! make deploy
Replace<GCP_VM_IP>with your VM's external IP:
- Free forever(e2-micro is always-free tier)
- Israeli IPfrom Tel Aviv data center — oref.org.il won't block it
- Low latencyto oref.org.il (same country)
- Docker works out of the boxon Debian
- API:https://www.oref.org.il/WarningMessages/alert/alerts.json
- Provider:Israeli Government (Pikud Haoref - Home Front Command)
- Coverage:All emergency alerts in Israel
- Update Frequency:Every 2 seconds
- Data Types:Rocket alerts, aerial intrusions, earthquakes, emergency announcements
- Emergency Response Teams- Real-time alert monitoring
- News Organizations- Breaking news automation
- Israeli Residents- Personal safety notifications
- Researchers- Emergency pattern analysis
- AI Assistants- Contextual emergency information
- Mobile Apps- Push notification services
- Smart Home Systems- Automated responses to alerts
Alerts are persisted to a local SQLite database (viaaiosqlite) for historical queries. The database is created automatically on startup.
- Default path:data/alerts.db(configurable viaDATABASE_PATHenv var)
- Tables:alerts(full alert data) +city_alerts(denormalized for fast city lookup)
- Indexedon city name and timestamp for fast queries
In addition to the SSE streaming endpoints, the following REST endpoints are available:
curl http://localhost:8000/health curl "http://localhost:8000/api/alerts/history?city=תל אביב&limit=10" curl http://localhost:8000/api/alerts/city/חיפה curl http://localhost:8000/api/alerts/stats
To use the Pikud HaOref MCP server withOpenClaw, add to youropenclaw.json:
{ "mcpServers": { "pikud-haoref": { "url": "http://127.0.0.1:8001/mcp" } } }
Seeopenclaw-config-example.jsonandskills/pikud-haoref/SKILL.mdfor full details.
# Required for FastAPI SSE endpoints API_KEY=poha-test-key-2024-secure # Optional - Enable geo-restriction GEOIP_DB_PATH=/path/to/GeoLite2-Country.mmdb
- "API key is missing"- EnsureX-API-Keyheader is set for both client and webhook endpoints
- MCP connection fails- Check:
- Python path in MCP config (use full venv path if needed:/path/to/venv/bin/python)
- API_KEY environment variable is set correctly
- FastAPI service is running on localhost:8000
- Restart your MCP client (Cursor, Claude Desktop, etc.)
- Alternative: Use the providedstart_mcp.shscript as the command
- Use Hebrew city names (e.g., "תל אביב" not "Tel Aviv")
- Check exact city names in alert history first:cities=["all"]
- Try broader names for fuzzy matching: "תל אביב" instead of "תל אביב - מרכז העיר"
- Rebuild Docker containers:docker-compose build --no-cache
- Install dependencies:pip install fuzzywuzzy python-Levenshtein
Both services provide detailed logging. Check logs for:
- API polling status
- SSE client connections and authentication
- MCP server webhook connection status
- Error messages
- Security events
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project accesses public emergency alert data from the Israeli government. The service is designed for legitimate emergency preparedness and news reporting purposes.
This service provides access to official Israeli emergency alert data but is not affiliated with or endorsed by the Israeli government or Pikud Haoref. Always follow official emergency procedures and consult official sources for critical safety information.
Manage your WhatsApp, SMS and Phone Calls using a single MCP connector
Connect to any function, any language, across network boundaries using AgentRPC.
Access your meeting transcripts, summaries, and action items from any AI assistant.
Connect Claude, ChatGPT, and other AI tools to your Granola meeting notes via MCP. Query your notes, search transcripts, and get meeting insights in your favorite AI assistants.
Build with the Kudosity API to send SMS and MMS. Access developer docs, API references and live testing tools to send messages, manage contact lists, configure webhooks and more.
Send SMS, WhatsApp, and RCS messages programmatically with DLT compliance. Manage contacts, schedule campaigns, and track delivery reports.
Interact with Twilio APIs to send messages, manage phone numbers, configure your account, and more.
The VoIPstudio MCP server gives compatible AI assistants secure access to authorised VoIPstudio account data, including recordings, call detail records, live calls and voicemails in order to query call activity, analyse patterns, identify agent performance issues and generate QA or operations reports in plain English.
A bridge server connecting Agent Communication Protocol (ACP) agents with Model Context Protocol (MCP) clients.
Provides real-time access to Israeli emergency alerts from the official Pikud Haoref API.
A comprehensive middleware service and MCP server for accessing Israeli emergency alerts from the official Pikud Haoref (Israeli Home Front Command) API.
- Single-source pollingof emergency alerts (eliminates duplicate API calls)
- Real-time SSE streamingvia public webhook endpoint
- API key authenticationfor client endpoints andgeo-restrictionto Israel
- Docker supportfor easy deployment
- Comprehensive testingsuite
- poha://alerts/recent- JSON data of recent alerts
- poha://alerts/current-status- System status information
- Exact substring matching- Find alerts by city name (e.g., "תל אביב" matches all Tel Aviv areas)
- Fuzzy matching- Intelligent matching with threshold 60 for partial/similar names
- Multi-city support- Search multiple cities simultaneously
- Hebrew city names- Optimized for Hebrew location names from the API
Important: The Pikud HaOref API (oref.org.il)geo-blocks non-Israeli IPs. You must run the services on a machine with an Israeli IP — either locally in Israel or on a GCPme-west1(Tel Aviv) VM.
# Clone and deploy (one command) git clone <repo-url> && cd pikud-a-oref-mcp make deploy # Creates .env, builds 3 containers, starts, health-checks # Manage services make logs # View logs from all services make status # Show container status make down # Stop all services make restart # Rebuild and restart
After startup, services are available at:
- FastAPI + Swagger UI:http://localhost:8000/docs
- MCP Server:http://localhost:8001/mcp
- SSE Gateway:http://localhost:8002/api/alerts-stream
Add to VS Codemcp.json, Claude Desktop config, or Cursor config:
{ "servers": { "pikud-haoref": { "type": "http", "url": "http://localhost:8001/mcp" } } }
make test-alert # Hebrew missile alert (תל אביב, רמת גן) make test-alert-en # English earthquake alert (Jerusalem, Haifa) make test-alert-drill # Drill alert (כל הארץ)
curl -N -H "X-API-Key: dev-secret-key" http://localhost:8000/api/alerts-stream
pip install -r requirements.txt # Start services individually (3 separate terminals) uvicorn src.api.main:app --host 0.0.0.0 --port 8000 --reload # Terminal 1 python -m src.core.mcp_server # Terminal 2 uvicorn src.api.sse_gateway:app --host 0.0.0.0 --port 8002 # Terminal 3
Server-Sent Events stream for real-time alerts (authenticated endpoint). Returns:
- event: new_alert- When a new alert is detected
- : keep-alive- Periodic keep-alive messages
Internal SSE webhook endpoint for services like the MCP server. Streams the same alert data as the client endpoint and requires the same API key authentication for security. Designed for server-to-server communication.
event: new_alert data: {"id": "12345", "data": ["Tel Aviv", "Ramat Gan"], "cat": "1", "title": "Rocket Alert", "desc": "Immediate shelter required"} : keep-alive
Use get_alert_history with limit=5 to get the 5 most recent alerts from the API. Use get_alert_history with region="Tel Aviv" to get alerts for a specific region. Use get_alert_history with cities=["תל אביב"] to get alerts for Tel Aviv (all areas). Use get_alert_history with cities=["תל אביב", "חיפה"] to get alerts for multiple cities. Use get_alert_history with cities=["תל אביב מרכז"] for specific areas with fuzzy matching.
- cities=["תל אביב"]- Finds all Tel Aviv areas (דרום העיר ויפו, מזרח, מרכז העיר, עבר הירקון)
- cities=["חיפה"]- Finds all Haifa-related alerts
- cities=["תל אביב", "חיפה", "ירושלים"]- Multiple cities simultaneously
- cities=["תל אביב מרכז"]- Fuzzy matches to "תל אביב - מרכז העיר"
- cities=["all"]- No city filtering (shows all alerts)
Use get_connection_status to verify the SSE subscription connection and see system health.
Pikud Haoref API ←→ [Single Poller] ←→ FastAPI Middleware ←→ [SSE Stream] ←→ MCP Server → AI Assistants ↓ [SSE Stream] ←→ Web Clients
- ✅50% reductionin API calls (single polling source)
- ✅Real-time propagationof alerts via SSE
- ✅Event-driven architecturefor better scalability
- ✅Automatic reconnectionfor robust SSE connections
Visual Diagram:Runpython diagram.pyto generatepoha_sse_architecture.pngshowing the complete system architecture.
API Key Authentication (Required for All Endpoints)
Important:API key authentication isrequired for both SSE endpointsfor security.
- Both SSE endpointsrequire API key authentication viaX-API-Keyheader
- MCP serverconnects with authentication to the internal webhook endpoint
- Same API keyused for both client and internal service authentication
ConfigureGEOIP_DB_PATHto restrict access to Israeli IP addresses only:
- Sign up atMaxMind
- DownloadGeoLite2-Country.mmdb
- SetGEOIP_DB_PATHin your.envfile
poha-real-time-alert-system/ ├── src/ # Main source code │ ├── core/ # Core MCP functionality │ │ ├── mcp_server.py # MCP server implementation │ │ ├── state.py # Application state management │ │ └── alert_queue.py # Alert queue management │ ├── api/ # FastAPI services │ │ ├── main.py # FastAPI application entry point │ │ └── sse_gateway.py # SSE gateway for VSCode extension │ ├── services/ # Business logic │ │ ├── polling.py # Core API polling logic │ │ └── sse.py # Server-Sent Events implementation │ └── utils/ # Utilities │ ├── security.py # Authentication and geo-restriction │ └── geolocation.py # Geo-IP functionality ├── docker/ # Docker configuration │ ├── Dockerfile # Main FastAPI container │ ├── mcp.Dockerfile # MCP server container │ └── docker-compose.yml # Multi-service setup ├── scripts/ # Utility scripts │ ├── start_mcp.sh # MCP server startup script │ └── diagram.py # Architecture diagram generator ├── tests/ # Comprehensive test suite ├── vscode-extension/ # VSCode extension for alerts ├── conftest.py # Test configuration ├── pytest.ini # Test settings ├── Makefile # Docker management commands ├── requirements.txt # Python dependencies ├── README.md # This file └── .gitignore # Git ignore rules
# Run tests in Docker make test # Or run tests locally pytest -v
- Core:fastapi,uvicorn,httpx,python-dotenv
- Security:geoip2,slowapi
- MCP:fastmcp,fuzzywuzzy,python-Levenshtein
- Testing:pytest,pytest-asyncio,respx
make deploy # One-command deploy (build + start + health-check) make up # Start all 3 services make down # Stop all services make restart # Rebuild and restart make logs # View all logs make status # Show container status make clean # Remove containers and volumes
The oref.org.il APIgeo-blocks non-Israeli IPs. For production, deploy on aGCP e2-micro VM inme-west1(Tel Aviv)— free-tier eligible with an Israeli IP.
# 1. Create free VM in Tel Aviv gcloud compute instances create pikud-haoref \ --zone=me-west1-a \ --machine-type=e2-micro \ --image-family=debian-12 \ --image-project=debian-cloud \ --tags=http-server # 2. Allow ports 8000-8002 gcloud compute firewall-rules create allow-pikud-haoref \ --allow=tcp:8000-8002 --target-tags=http-server # 3. SSH and install Docker gcloud compute ssh pikud-haoref --zone=me-west1-a sudo apt update && sudo apt install -y docker.io docker-compose sudo usermod -aG docker $USER && newgrp docker # 4. Clone, configure, and deploy git clone <repo-url> && cd pikud-a-oref-mcp cp .env.example .env # Edit API_KEY for production! make deploy
Replace<GCP_VM_IP>with your VM's external IP:
- Free forever(e2-micro is always-free tier)
- Israeli IPfrom Tel Aviv data center — oref.org.il won't block it
- Low latencyto oref.org.il (same country)
- Docker works out of the boxon Debian
- API:https://www.oref.org.il/WarningMessages/alert/alerts.json
- Provider:Israeli Government (Pikud Haoref - Home Front Command)
- Coverage:All emergency alerts in Israel
- Update Frequency:Every 2 seconds
- Data Types:Rocket alerts, aerial intrusions, earthquakes, emergency announcements
- Emergency Response Teams- Real-time alert monitoring
- News Organizations- Breaking news automation
- Israeli Residents- Personal safety notifications
- Researchers- Emergency pattern analysis
- AI Assistants- Contextual emergency information
- Mobile Apps- Push notification services
- Smart Home Systems- Automated responses to alerts
Alerts are persisted to a local SQLite database (viaaiosqlite) for historical queries. The database is created automatically on startup.
- Default path:data/alerts.db(configurable viaDATABASE_PATHenv var)
- Tables:alerts(full alert data) +city_alerts(denormalized for fast city lookup)
- Indexedon city name and timestamp for fast queries
In addition to the SSE streaming endpoints, the following REST endpoints are available:
curl http://localhost:8000/health curl "http://localhost:8000/api/alerts/history?city=תל אביב&limit=10" curl http://localhost:8000/api/alerts/city/חיפה curl http://localhost:8000/api/alerts/stats
To use the Pikud HaOref MCP server withOpenClaw, add to youropenclaw.json:
{ "mcpServers": { "pikud-haoref": { "url": "http://127.0.0.1:8001/mcp" } } }
Seeopenclaw-config-example.jsonandskills/pikud-haoref/SKILL.mdfor full details.
# Required for FastAPI SSE endpoints API_KEY=poha-test-key-2024-secure # Optional - Enable geo-restriction GEOIP_DB_PATH=/path/to/GeoLite2-Country.mmdb
- "API key is missing"- EnsureX-API-Keyheader is set for both client and webhook endpoints
- MCP connection fails- Check:
- Python path in MCP config (use full venv path if needed:/path/to/venv/bin/python)
- API_KEY environment variable is set correctly
- FastAPI service is running on localhost:8000
- Restart your MCP client (Cursor, Claude Desktop, etc.)
- Alternative: Use the providedstart_mcp.shscript as the command
- Use Hebrew city names (e.g., "תל אביב" not "Tel Aviv")
- Check exact city names in alert history first:cities=["all"]
- Try broader names for fuzzy matching: "תל אביב" instead of "תל אביב - מרכז העיר"
- Rebuild Docker containers:docker-compose build --no-cache
- Install dependencies:pip install fuzzywuzzy python-Levenshtein
Both services provide detailed logging. Check logs for:
- API polling status
- SSE client connections and authentication
- MCP server webhook connection status
- Error messages
- Security events
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project accesses public emergency alert data from the Israeli government. The service is designed for legitimate emergency preparedness and news reporting purposes.
This service provides access to official Israeli emergency alert data but is not affiliated with or endorsed by the Israeli government or Pikud Haoref. Always follow official emergency procedures and consult official sources for critical safety information.
Manage your WhatsApp, SMS and Phone Calls using a single MCP connector
Connect to any function, any language, across network boundaries using AgentRPC.
Access your meeting transcripts, summaries, and action items from any AI assistant.
Connect Claude, ChatGPT, and other AI tools to your Granola meeting notes via MCP. Query your notes, search transcripts, and get meeting insights in your favorite AI assistants.
Build with the Kudosity API to send SMS and MMS. Access developer docs, API references and live testing tools to send messages, manage contact lists, configure webhooks and more.
Send SMS, WhatsApp, and RCS messages programmatically with DLT compliance. Manage contacts, schedule campaigns, and track delivery reports.
Interact with Twilio APIs to send messages, manage phone numbers, configure your account, and more.
The VoIPstudio MCP server gives compatible AI assistants secure access to authorised VoIPstudio account data, including recordings, call detail records, live calls and voicemails in order to query call activity, analyse patterns, identify agent performance issues and generate QA or operations reports in plain English.
A bridge server connecting Agent Communication Protocol (ACP) agents with Model Context Protocol (MCP) clients.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.



