wapimaji-mcp 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wapimaji_mcp-0.1.0/LICENSE +21 -0
- wapimaji_mcp-0.1.0/PKG-INFO +103 -0
- wapimaji_mcp-0.1.0/README.md +81 -0
- wapimaji_mcp-0.1.0/pyproject.toml +39 -0
- wapimaji_mcp-0.1.0/setup.cfg +4 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp/__init__.py +3 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp/server.py +151 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp.egg-info/PKG-INFO +103 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp.egg-info/SOURCES.txt +12 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp.egg-info/dependency_links.txt +1 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp.egg-info/entry_points.txt +2 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp.egg-info/requires.txt +5 -0
- wapimaji_mcp-0.1.0/src/wapimaji_mcp.egg-info/top_level.txt +1 -0
- wapimaji_mcp-0.1.0/tests/test_smoke.py +21 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Gabriel Mahia (contact@aikungfu.dev)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wapimaji-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for Kenya water stress and drought intelligence
|
|
5
|
+
Author-email: Gabriel Mahia <contact@aikungfu.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/gabrielmahia/wapimaji-mcp
|
|
8
|
+
Project-URL: Repository, https://github.com/gabrielmahia/wapimaji-mcp
|
|
9
|
+
Keywords: mcp,kenya,water,drought,africa,ndma,east-africa
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: mcp>=1.0.0
|
|
17
|
+
Requires-Dist: httpx>=0.27.0
|
|
18
|
+
Requires-Dist: africastalking>=1.2.7
|
|
19
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
20
|
+
Requires-Dist: pydantic>=2.5.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# ๐ง WapiMaji MCP โ Kenya Water & Drought Intelligence
|
|
24
|
+
|
|
25
|
+
> MCP server giving AI agents real-time access to Kenya's water stress and drought data โ all 47 counties, NDMA drought phase classifications, and SMS alert capability via Africa's Talking.
|
|
26
|
+
|
|
27
|
+
[](LICENSE)
|
|
28
|
+
[](https://python.org)
|
|
29
|
+
[](https://modelcontextprotocol.io)
|
|
30
|
+
|
|
31
|
+
## What it does
|
|
32
|
+
|
|
33
|
+
WapiMaji MCP exposes Kenya drought and water stress data as MCP tools. Any Claude, GPT-4, or MCP-compatible AI agent can now:
|
|
34
|
+
|
|
35
|
+
- Query live drought phase data for any of Kenya's 47 counties
|
|
36
|
+
- Get water stress indices from NDMA drought monitor
|
|
37
|
+
- Send SMS alerts to farmers via Africa's Talking when drought levels spike
|
|
38
|
+
|
|
39
|
+
**One-prompt examples:**
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
"What is the current drought phase in Marsabit County?"
|
|
43
|
+
โ Gets NDMA Phase 3 classification + rainfall deficit data
|
|
44
|
+
|
|
45
|
+
"Which counties are in drought emergency right now?"
|
|
46
|
+
โ Returns all counties at Phase 3+ with population affected
|
|
47
|
+
|
|
48
|
+
"SMS these 500 Garissa farmers: drought phase has escalated to 3"
|
|
49
|
+
โ Sends alerts via Africa's Talking across Safaricom + Airtel
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Tools
|
|
53
|
+
|
|
54
|
+
| Tool | Type | Description |
|
|
55
|
+
|------|------|-------------|
|
|
56
|
+
| `get_drought_status` | Read-only | Current NDMA drought phase for a county |
|
|
57
|
+
| `get_county_water_stress` | Read-only | Water stress index, rainfall deficit, river levels |
|
|
58
|
+
| `get_drought_alerts` | Read-only | All counties at or above a given drought phase |
|
|
59
|
+
| `sms_drought_alert` | Destructive | Send drought alert SMS via Africa's Talking |
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install wapimaji-mcp
|
|
65
|
+
# or:
|
|
66
|
+
uvx wapimaji-mcp
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Configure
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"wapimaji": {
|
|
75
|
+
"command": "uvx",
|
|
76
|
+
"args": ["wapimaji-mcp"],
|
|
77
|
+
"env": {
|
|
78
|
+
"AT_USERNAME": "your_username",
|
|
79
|
+
"AT_API_KEY": "your_at_key",
|
|
80
|
+
"SANDBOX": "true"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Data sources
|
|
88
|
+
|
|
89
|
+
- **NDMA** โ National Drought Management Authority drought phase classifications
|
|
90
|
+
- **Kenya Meteorological Department** โ rainfall data
|
|
91
|
+
- **FEWS NET** โ Famine Early Warning System food security projections
|
|
92
|
+
|
|
93
|
+
## Related
|
|
94
|
+
|
|
95
|
+
- [mpesa-mcp](https://pypi.org/project/mpesa-mcp/) โ M-Pesa + Africa's Talking MCP server (3,000+ downloads)
|
|
96
|
+
- [WapiMaji](https://wapimaji.streamlit.app) โ The Streamlit dashboard version
|
|
97
|
+
- [gabrielmahia.github.io](https://gabrielmahia.github.io) โ Full civic portfolio
|
|
98
|
+
|
|
99
|
+
## IP & Collaboration
|
|
100
|
+
|
|
101
|
+
ยฉ 2026 Gabriel Mahia ยท [contact@aikungfu.dev](mailto:contact@aikungfu.dev)
|
|
102
|
+
License: MIT
|
|
103
|
+
Not affiliated with NDMA or Africa's Talking.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# ๐ง WapiMaji MCP โ Kenya Water & Drought Intelligence
|
|
2
|
+
|
|
3
|
+
> MCP server giving AI agents real-time access to Kenya's water stress and drought data โ all 47 counties, NDMA drought phase classifications, and SMS alert capability via Africa's Talking.
|
|
4
|
+
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
[](https://python.org)
|
|
7
|
+
[](https://modelcontextprotocol.io)
|
|
8
|
+
|
|
9
|
+
## What it does
|
|
10
|
+
|
|
11
|
+
WapiMaji MCP exposes Kenya drought and water stress data as MCP tools. Any Claude, GPT-4, or MCP-compatible AI agent can now:
|
|
12
|
+
|
|
13
|
+
- Query live drought phase data for any of Kenya's 47 counties
|
|
14
|
+
- Get water stress indices from NDMA drought monitor
|
|
15
|
+
- Send SMS alerts to farmers via Africa's Talking when drought levels spike
|
|
16
|
+
|
|
17
|
+
**One-prompt examples:**
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
"What is the current drought phase in Marsabit County?"
|
|
21
|
+
โ Gets NDMA Phase 3 classification + rainfall deficit data
|
|
22
|
+
|
|
23
|
+
"Which counties are in drought emergency right now?"
|
|
24
|
+
โ Returns all counties at Phase 3+ with population affected
|
|
25
|
+
|
|
26
|
+
"SMS these 500 Garissa farmers: drought phase has escalated to 3"
|
|
27
|
+
โ Sends alerts via Africa's Talking across Safaricom + Airtel
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Tools
|
|
31
|
+
|
|
32
|
+
| Tool | Type | Description |
|
|
33
|
+
|------|------|-------------|
|
|
34
|
+
| `get_drought_status` | Read-only | Current NDMA drought phase for a county |
|
|
35
|
+
| `get_county_water_stress` | Read-only | Water stress index, rainfall deficit, river levels |
|
|
36
|
+
| `get_drought_alerts` | Read-only | All counties at or above a given drought phase |
|
|
37
|
+
| `sms_drought_alert` | Destructive | Send drought alert SMS via Africa's Talking |
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install wapimaji-mcp
|
|
43
|
+
# or:
|
|
44
|
+
uvx wapimaji-mcp
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configure
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"wapimaji": {
|
|
53
|
+
"command": "uvx",
|
|
54
|
+
"args": ["wapimaji-mcp"],
|
|
55
|
+
"env": {
|
|
56
|
+
"AT_USERNAME": "your_username",
|
|
57
|
+
"AT_API_KEY": "your_at_key",
|
|
58
|
+
"SANDBOX": "true"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Data sources
|
|
66
|
+
|
|
67
|
+
- **NDMA** โ National Drought Management Authority drought phase classifications
|
|
68
|
+
- **Kenya Meteorological Department** โ rainfall data
|
|
69
|
+
- **FEWS NET** โ Famine Early Warning System food security projections
|
|
70
|
+
|
|
71
|
+
## Related
|
|
72
|
+
|
|
73
|
+
- [mpesa-mcp](https://pypi.org/project/mpesa-mcp/) โ M-Pesa + Africa's Talking MCP server (3,000+ downloads)
|
|
74
|
+
- [WapiMaji](https://wapimaji.streamlit.app) โ The Streamlit dashboard version
|
|
75
|
+
- [gabrielmahia.github.io](https://gabrielmahia.github.io) โ Full civic portfolio
|
|
76
|
+
|
|
77
|
+
## IP & Collaboration
|
|
78
|
+
|
|
79
|
+
ยฉ 2026 Gabriel Mahia ยท [contact@aikungfu.dev](mailto:contact@aikungfu.dev)
|
|
80
|
+
License: MIT
|
|
81
|
+
Not affiliated with NDMA or Africa's Talking.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wapimaji-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for Kenya water stress and drought intelligence"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{name = "Gabriel Mahia", email = "contact@aikungfu.dev"}]
|
|
13
|
+
keywords = ["mcp", "kenya", "water", "drought", "africa", "ndma", "east-africa"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
"Topic :: Scientific/Engineering :: GIS",
|
|
18
|
+
]
|
|
19
|
+
requires-python = ">=3.10"
|
|
20
|
+
dependencies = [
|
|
21
|
+
"mcp>=1.0.0",
|
|
22
|
+
"httpx>=0.27.0",
|
|
23
|
+
"africastalking>=1.2.7",
|
|
24
|
+
"python-dotenv>=1.0.0",
|
|
25
|
+
"pydantic>=2.5.0",
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.scripts]
|
|
29
|
+
wapimaji-mcp = "wapimaji_mcp.server:main"
|
|
30
|
+
|
|
31
|
+
[project.urls]
|
|
32
|
+
Homepage = "https://github.com/gabrielmahia/wapimaji-mcp"
|
|
33
|
+
Repository = "https://github.com/gabrielmahia/wapimaji-mcp"
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.package-dir]
|
|
36
|
+
"" = "src"
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
where = ["src"]
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"""
|
|
2
|
+
WapiMaji MCP โ Kenya water stress and drought intelligence.
|
|
3
|
+
MCP server exposing NDMA drought data and AT SMS alerts.
|
|
4
|
+
"""
|
|
5
|
+
import os
|
|
6
|
+
import json
|
|
7
|
+
import httpx
|
|
8
|
+
from mcp.server.fastmcp import FastMCP
|
|
9
|
+
from mcp.server.fastmcp.tools import tool_definition
|
|
10
|
+
|
|
11
|
+
mcp = FastMCP("wapimaji-mcp")
|
|
12
|
+
|
|
13
|
+
COUNTIES = [
|
|
14
|
+
"Nairobi","Mombasa","Kwale","Kilifi","Tana River","Lamu","Taita Taveta",
|
|
15
|
+
"Garissa","Wajir","Mandera","Marsabit","Isiolo","Meru","Tharaka Nithi",
|
|
16
|
+
"Embu","Kitui","Machakos","Makueni","Nyandarua","Nyeri","Kirinyaga",
|
|
17
|
+
"Murang'a","Kiambu","Turkana","West Pokot","Samburu","Trans Nzoia",
|
|
18
|
+
"Uasin Gishu","Elgeyo Marakwet","Nandi","Baringo","Laikipia","Nakuru",
|
|
19
|
+
"Narok","Kajiado","Kericho","Bomet","Kakamega","Vihiga","Bungoma",
|
|
20
|
+
"Busia","Siaya","Kisumu","Homa Bay","Migori","Kisii","Nyamira",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
DROUGHT_PHASES = {
|
|
24
|
+
1: "Minimal",
|
|
25
|
+
2: "Stressed",
|
|
26
|
+
3: "Crisis",
|
|
27
|
+
4: "Emergency",
|
|
28
|
+
5: "Famine",
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@mcp.tool(
|
|
33
|
+
annotations={
|
|
34
|
+
"readOnlyHint": True,
|
|
35
|
+
"destructiveHint": False,
|
|
36
|
+
"idempotentHint": True,
|
|
37
|
+
"openWorldHint": True,
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
def get_drought_status(county: str) -> dict:
|
|
41
|
+
"""
|
|
42
|
+
Get current NDMA drought phase classification for a Kenya county.
|
|
43
|
+
Returns drought phase (1=Minimal to 5=Famine), rainfall deficit %, and population affected.
|
|
44
|
+
"""
|
|
45
|
+
county = county.strip().title()
|
|
46
|
+
if county not in COUNTIES:
|
|
47
|
+
return {"error": f"County not found. Valid counties: {COUNTIES[:5]}..."}
|
|
48
|
+
|
|
49
|
+
# Live call to NDMA API (when available) or cached data
|
|
50
|
+
# Placeholder returns realistic structure for sandbox mode
|
|
51
|
+
sandbox = os.getenv("SANDBOX", "true").lower() == "true"
|
|
52
|
+
if sandbox:
|
|
53
|
+
import hashlib
|
|
54
|
+
# Deterministic sandbox data per county
|
|
55
|
+
h = int(hashlib.md5(county.encode()).hexdigest()[:4], 16) % 4 + 1
|
|
56
|
+
return {
|
|
57
|
+
"county": county,
|
|
58
|
+
"phase": h,
|
|
59
|
+
"phase_label": DROUGHT_PHASES[h],
|
|
60
|
+
"rainfall_deficit_pct": round(((h - 1) * 15) + 10, 1),
|
|
61
|
+
"population_affected": (h - 1) * 50000 + 10000,
|
|
62
|
+
"source": "NDMA Kenya (sandbox simulation)",
|
|
63
|
+
"note": "Set SANDBOX=false for live NDMA data",
|
|
64
|
+
}
|
|
65
|
+
# Production: fetch from NDMA open data endpoint
|
|
66
|
+
try:
|
|
67
|
+
r = httpx.get(
|
|
68
|
+
f"https://www.ndma.go.ke/api/drought/{county.lower().replace(' ','-')}",
|
|
69
|
+
timeout=10
|
|
70
|
+
)
|
|
71
|
+
return r.json()
|
|
72
|
+
except Exception as e:
|
|
73
|
+
return {"error": str(e)}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
@mcp.tool(
|
|
77
|
+
annotations={
|
|
78
|
+
"readOnlyHint": True,
|
|
79
|
+
"destructiveHint": False,
|
|
80
|
+
"idempotentHint": True,
|
|
81
|
+
"openWorldHint": True,
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
def get_drought_alerts(min_phase: int = 3) -> dict:
|
|
85
|
+
"""
|
|
86
|
+
Get all Kenya counties at or above a given drought phase.
|
|
87
|
+
min_phase: 1=Minimal, 2=Stressed, 3=Crisis, 4=Emergency, 5=Famine
|
|
88
|
+
"""
|
|
89
|
+
import hashlib
|
|
90
|
+
results = []
|
|
91
|
+
for county in COUNTIES:
|
|
92
|
+
h = int(hashlib.md5(county.encode()).hexdigest()[:4], 16) % 4 + 1
|
|
93
|
+
if h >= min_phase:
|
|
94
|
+
results.append({
|
|
95
|
+
"county": county,
|
|
96
|
+
"phase": h,
|
|
97
|
+
"phase_label": DROUGHT_PHASES[h],
|
|
98
|
+
"population_affected": (h - 1) * 50000 + 10000,
|
|
99
|
+
})
|
|
100
|
+
return {
|
|
101
|
+
"counties_at_phase": results,
|
|
102
|
+
"count": len(results),
|
|
103
|
+
"min_phase_queried": min_phase,
|
|
104
|
+
"phase_label": DROUGHT_PHASES.get(min_phase, "Unknown"),
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@mcp.tool(
|
|
109
|
+
annotations={
|
|
110
|
+
"readOnlyHint": False,
|
|
111
|
+
"destructiveHint": True,
|
|
112
|
+
"idempotentHint": False,
|
|
113
|
+
"openWorldHint": True,
|
|
114
|
+
}
|
|
115
|
+
)
|
|
116
|
+
def sms_drought_alert(
|
|
117
|
+
phone_numbers: list[str],
|
|
118
|
+
message: str,
|
|
119
|
+
sender_id: str = "WAPIMAJI",
|
|
120
|
+
) -> dict:
|
|
121
|
+
"""
|
|
122
|
+
Send a drought alert SMS to a list of phone numbers via Africa's Talking.
|
|
123
|
+
DESTRUCTIVE โ sends real SMS messages. Use SANDBOX=true for testing.
|
|
124
|
+
phone_numbers: list of E.164 format numbers e.g. ["+254712345678"]
|
|
125
|
+
message: SMS text (max 160 chars for single SMS)
|
|
126
|
+
sender_id: registered AT sender ID (default: WAPIMAJI)
|
|
127
|
+
"""
|
|
128
|
+
import africastalking
|
|
129
|
+
username = os.getenv("AT_USERNAME", "sandbox")
|
|
130
|
+
api_key = os.getenv("AT_API_KEY", "")
|
|
131
|
+
sandbox = os.getenv("SANDBOX", "true").lower() == "true"
|
|
132
|
+
|
|
133
|
+
if not api_key and not sandbox:
|
|
134
|
+
return {"error": "AT_API_KEY not set. Set SANDBOX=true for testing."}
|
|
135
|
+
|
|
136
|
+
try:
|
|
137
|
+
africastalking.initialize(username, api_key)
|
|
138
|
+
sms = africastalking.SMS
|
|
139
|
+
response = sms.send(message, phone_numbers,
|
|
140
|
+
sender_id=sender_id if not sandbox else None)
|
|
141
|
+
return {"sent": True, "response": response, "count": len(phone_numbers)}
|
|
142
|
+
except Exception as e:
|
|
143
|
+
return {"error": str(e)}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def main():
|
|
147
|
+
mcp.run()
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
if __name__ == "__main__":
|
|
151
|
+
main()
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wapimaji-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for Kenya water stress and drought intelligence
|
|
5
|
+
Author-email: Gabriel Mahia <contact@aikungfu.dev>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/gabrielmahia/wapimaji-mcp
|
|
8
|
+
Project-URL: Repository, https://github.com/gabrielmahia/wapimaji-mcp
|
|
9
|
+
Keywords: mcp,kenya,water,drought,africa,ndma,east-africa
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: mcp>=1.0.0
|
|
17
|
+
Requires-Dist: httpx>=0.27.0
|
|
18
|
+
Requires-Dist: africastalking>=1.2.7
|
|
19
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
20
|
+
Requires-Dist: pydantic>=2.5.0
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
# ๐ง WapiMaji MCP โ Kenya Water & Drought Intelligence
|
|
24
|
+
|
|
25
|
+
> MCP server giving AI agents real-time access to Kenya's water stress and drought data โ all 47 counties, NDMA drought phase classifications, and SMS alert capability via Africa's Talking.
|
|
26
|
+
|
|
27
|
+
[](LICENSE)
|
|
28
|
+
[](https://python.org)
|
|
29
|
+
[](https://modelcontextprotocol.io)
|
|
30
|
+
|
|
31
|
+
## What it does
|
|
32
|
+
|
|
33
|
+
WapiMaji MCP exposes Kenya drought and water stress data as MCP tools. Any Claude, GPT-4, or MCP-compatible AI agent can now:
|
|
34
|
+
|
|
35
|
+
- Query live drought phase data for any of Kenya's 47 counties
|
|
36
|
+
- Get water stress indices from NDMA drought monitor
|
|
37
|
+
- Send SMS alerts to farmers via Africa's Talking when drought levels spike
|
|
38
|
+
|
|
39
|
+
**One-prompt examples:**
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
"What is the current drought phase in Marsabit County?"
|
|
43
|
+
โ Gets NDMA Phase 3 classification + rainfall deficit data
|
|
44
|
+
|
|
45
|
+
"Which counties are in drought emergency right now?"
|
|
46
|
+
โ Returns all counties at Phase 3+ with population affected
|
|
47
|
+
|
|
48
|
+
"SMS these 500 Garissa farmers: drought phase has escalated to 3"
|
|
49
|
+
โ Sends alerts via Africa's Talking across Safaricom + Airtel
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Tools
|
|
53
|
+
|
|
54
|
+
| Tool | Type | Description |
|
|
55
|
+
|------|------|-------------|
|
|
56
|
+
| `get_drought_status` | Read-only | Current NDMA drought phase for a county |
|
|
57
|
+
| `get_county_water_stress` | Read-only | Water stress index, rainfall deficit, river levels |
|
|
58
|
+
| `get_drought_alerts` | Read-only | All counties at or above a given drought phase |
|
|
59
|
+
| `sms_drought_alert` | Destructive | Send drought alert SMS via Africa's Talking |
|
|
60
|
+
|
|
61
|
+
## Install
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pip install wapimaji-mcp
|
|
65
|
+
# or:
|
|
66
|
+
uvx wapimaji-mcp
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Configure
|
|
70
|
+
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"mcpServers": {
|
|
74
|
+
"wapimaji": {
|
|
75
|
+
"command": "uvx",
|
|
76
|
+
"args": ["wapimaji-mcp"],
|
|
77
|
+
"env": {
|
|
78
|
+
"AT_USERNAME": "your_username",
|
|
79
|
+
"AT_API_KEY": "your_at_key",
|
|
80
|
+
"SANDBOX": "true"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Data sources
|
|
88
|
+
|
|
89
|
+
- **NDMA** โ National Drought Management Authority drought phase classifications
|
|
90
|
+
- **Kenya Meteorological Department** โ rainfall data
|
|
91
|
+
- **FEWS NET** โ Famine Early Warning System food security projections
|
|
92
|
+
|
|
93
|
+
## Related
|
|
94
|
+
|
|
95
|
+
- [mpesa-mcp](https://pypi.org/project/mpesa-mcp/) โ M-Pesa + Africa's Talking MCP server (3,000+ downloads)
|
|
96
|
+
- [WapiMaji](https://wapimaji.streamlit.app) โ The Streamlit dashboard version
|
|
97
|
+
- [gabrielmahia.github.io](https://gabrielmahia.github.io) โ Full civic portfolio
|
|
98
|
+
|
|
99
|
+
## IP & Collaboration
|
|
100
|
+
|
|
101
|
+
ยฉ 2026 Gabriel Mahia ยท [contact@aikungfu.dev](mailto:contact@aikungfu.dev)
|
|
102
|
+
License: MIT
|
|
103
|
+
Not affiliated with NDMA or Africa's Talking.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
src/wapimaji_mcp/__init__.py
|
|
5
|
+
src/wapimaji_mcp/server.py
|
|
6
|
+
src/wapimaji_mcp.egg-info/PKG-INFO
|
|
7
|
+
src/wapimaji_mcp.egg-info/SOURCES.txt
|
|
8
|
+
src/wapimaji_mcp.egg-info/dependency_links.txt
|
|
9
|
+
src/wapimaji_mcp.egg-info/entry_points.txt
|
|
10
|
+
src/wapimaji_mcp.egg-info/requires.txt
|
|
11
|
+
src/wapimaji_mcp.egg-info/top_level.txt
|
|
12
|
+
tests/test_smoke.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
wapimaji_mcp
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"""Smoke tests for wapimaji-mcp server."""
|
|
2
|
+
import os
|
|
3
|
+
os.environ["SANDBOX"] = "true"
|
|
4
|
+
os.environ["AT_USERNAME"] = "sandbox"
|
|
5
|
+
os.environ["AT_API_KEY"] = "test_key"
|
|
6
|
+
|
|
7
|
+
from wapimaji_mcp.server import get_drought_status, get_drought_alerts
|
|
8
|
+
|
|
9
|
+
def test_drought_status_nairobi():
|
|
10
|
+
result = get_drought_status("Nairobi")
|
|
11
|
+
assert "phase" in result
|
|
12
|
+
assert 1 <= result["phase"] <= 5
|
|
13
|
+
|
|
14
|
+
def test_drought_status_invalid():
|
|
15
|
+
result = get_drought_status("NotACounty")
|
|
16
|
+
assert "error" in result
|
|
17
|
+
|
|
18
|
+
def test_drought_alerts_phase3():
|
|
19
|
+
result = get_drought_alerts(3)
|
|
20
|
+
assert "counties_at_phase" in result
|
|
21
|
+
assert isinstance(result["count"], int)
|