Skip to main content
Glama
README.md
# πŸ› οΈ CivicAgentKit β€” East African Civic AI SDK

[![civic-agent-kit Glama score](https://glama.ai/mcp/servers/gabrielmahia/civic-agent-kit/badges/score.svg)](https://glama.ai/mcp/servers/gabrielmahia/civic-agent-kit)
[![smithery badge](https://smithery.ai/badge/@gabrielmahia/civic-agent-kit)](https://smithery.ai/server/@gabrielmahia/civic-agent-kit)


---
**Compatible with `claude-sonnet-5`** (released 2026-06-30) β€” Anthropic's most agentic
Sonnet yet. Runs multi-step tool chains end-to-end without stopping short.
Install: `pip install civic-agent-kit` Β· Use with any MCP client.

---


> The unified Python toolkit for building civic AI tools in East Africa. One install gives you access to Kenya's parliament records, county budgets, NDMA drought data, M-Pesa payments, and both MCP and A2A protocol integrations.

[![PyPI](https://img.shields.io/pypi/v/civic-agent-kit)](https://pypi.org/project/civic-agent-kit/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
[![MCP](https://img.shields.io/badge/MCP-Compatible-green)](https://modelcontextprotocol.io)
[![A2A](https://img.shields.io/badge/A2A-Protocol%200.3-blue)](https://github.com/a2aproject/A2A)

## Install

```bash
pip install civic-agent-kit
```

## What's included

```python
from civic_agent_kit import (
    # Data loaders β€” Kenya's public civic datasets
    KenyaBudgetData,       # Controller of Budget β€” 47 counties
    KenyaParliamentData,   # MPs, bills, CDF β€” 13th Parliament
    KenyaSACCOData,        # SASRA SACCO registry
    KenyaDroughtData,      # NDMA drought phases

    # Agents
    BudgetAgent,           # County budget analysis (CrewAI)
    RightsAgent,           # Constitutional rights Q&A (EN/SW)
    DroughtAgent,          # Drought + SMS alert agent

    # Protocols
    KenyaMCPServer,        # MCP server β€” wraps all Kenya data as MCP tools
    KenyaA2AServer,        # A2A server β€” Kenya civic skills for agent-to-agent

    # Utils
    KenyaCounties,         # All 47 county codes + names
    KiswahiliTranslator,   # Simple civic term translations EN↔SW
)
```

## Quick examples

**Load county budget data:**
```python
from civic_agent_kit import KenyaBudgetData

budgets = KenyaBudgetData.load()
low_absorption = budgets[budgets['absorption_rate'] < 0.5]
print(low_absorption[['county', 'allocation_kes_m', 'absorption_rate']])
```

**Serve Kenya civic data as an A2A agent:**
```python
from civic_agent_kit import KenyaA2AServer

server = KenyaA2AServer(host="http://localhost:8000")
server.run()  # exposes /.well-known/agent.json + JSON-RPC endpoint
```

**Serve as an MCP server:**
```python
from civic_agent_kit import KenyaMCPServer

# Run alongside mpesa-mcp for full East African AI stack
server = KenyaMCPServer()
server.run()
```

**Ask a rights question in Kiswahili:**
```python
from civic_agent_kit import RightsAgent

agent = RightsAgent(language="sw")
answer = agent.ask("Haki yangu ya ardhi ni nini?")
print(answer)
# β†’ "Kifungu 40: Kila mtu ana haki ya kupata na kumiliki mali..."
```

## The East African AI Stack

```
                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚         Your AI Agent                β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
               β”‚                                          β”‚
        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”                          β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
        β”‚   MCP Layer  β”‚                          β”‚  A2A Layer   β”‚
        β”‚  (tools)     β”‚                          β”‚  (agents)    β”‚
        β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜                          β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜
               β”‚                                          β”‚
     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
     β”‚                    β”‚                   β”‚                     β”‚
β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”        β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”       β”Œβ”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”
β”‚mpesa-mcpβ”‚        β”‚KenyaMCP    β”‚     β”‚kenya-a2a   β”‚       β”‚CivicAgent   β”‚
β”‚payments β”‚        β”‚civic data  β”‚     β”‚parliament  β”‚       β”‚Kit agents   β”‚
β”‚SMS      β”‚        β”‚budgets     β”‚     β”‚budgets     β”‚       β”‚budget/rightsβ”‚
β”‚airtime  β”‚        β”‚parliament  β”‚     β”‚drought     β”‚       β”‚drought      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚rights EN/SWβ”‚       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

## Data

All data from the Kenya Civic Datasets (CC BY-SA 4.0):
- **Kaggle**: [gmahia/kenya-civic-data](https://kaggle.com/datasets/gmahia/kenya-civic-data-parliament-budget-saccos) β€” DOI: `10.34740/kaggle/dsv/15473045`
- **HuggingFace**: [gmahia/kenya-civic-data](https://huggingface.co/datasets/gmahia/kenya-civic-data) β€” DOI: `10.57967/hf/8223`

## Related packages

| Package | Description | PyPI |
|---------|-------------|------|
| `mpesa-mcp` | M-Pesa + Africa's Talking MCP server | [![PyPI](https://img.shields.io/pypi/v/mpesa-mcp)](https://pypi.org/project/mpesa-mcp/) |
| `civic-agent-kit` | This package | [![PyPI](https://img.shields.io/pypi/v/civic-agent-kit)](https://pypi.org/project/civic-agent-kit/) |

## Full portfolio

13 deployed civic apps: [gabrielmahia.github.io](https://gabrielmahia.github.io)

## IP & Collaboration

Β© 2026 Gabriel Mahia Β· [contact@aikungfu.dev](mailto:contact@aikungfu.dev)
License: MIT


## Protocol Coverage β€” Complete Stack

`civic-agent-kit` now supports all four major AI agent protocols for East Africa:

| Protocol | What it does | Implementation |
|----------|-------------|----------------|
| **MCP** | Agent β†’ Tool | [mpesa-mcp](https://github.com/gabrielmahia/mpesa-mcp), [wapimaji-mcp](https://github.com/gabrielmahia/wapimaji-mcp) |
| **A2A** | Agent β†’ Agent | [kenya-a2a](https://github.com/gabrielmahia/kenya-a2a) |
| **Google ADK** | Agent orchestration | [kenya-adk](https://github.com/gabrielmahia/kenya-adk) |
| **AG-UI** | Agent β†’ Frontend | [kenya-agui](https://github.com/gabrielmahia/kenya-agui) |

Each protocol layer above was implemented within weeks of its global release β€” because the coordination gaps these tools address don't wait for tooling maturity.

```python
from civic_agent_kit import CivicAgentKit

# Full protocol stack
kit = CivicAgentKit(
    mcp_servers=["mpesa-mcp", "wapimaji-mcp"],  # MCP
    a2a_registry="kenya-a2a",                    # A2A
    agui_server="kenya-agui",                    # AG-UI
    adk_config="kenya-adk",                      # Google ADK
)
```

<!-- interconnect:v1 -->
## Part of the East Africa coordination stack

- **Install & run:** `pip install reli-cli && reli list` β€” 33 MCP servers on the [official MCP Registry](https://registry.modelcontextprotocol.io) under `io.github.gabrielmahia`
- **Evaluate any model on Swahili agent tasks:** [kipimo](https://github.com/gabrielmahia/kipimo) Β· [dataset](https://huggingface.co/datasets/gmahia/kipimo) Β· [leaderboard](https://huggingface.co/spaces/gmahia/kipimo-leaderboard)
- **Coordinate across servers:** [africa-coord-bus](https://pypi.org/project/africa-coord-bus/) β€” offline-first event bus with a built-in Kenya routing table
- **Datasets:** [huggingface.co/gmahia](https://huggingface.co/gmahia) Β· **Docs hub:** [nairobi-stack](https://github.com/gabrielmahia/nairobi-stack)

Model-agnostic by design: closed APIs, open-weight models, and small distilled models are all first-class citizens.
<!-- /interconnect:v1 -->

TDQS

A4.3/5.0

Scored across 6 tools

Disambiguation5/5

Each tool addresses a distinct domain (budget, counties, drought, parliamentary bills, constitutional rights, SACCOs). There is no overlap in purpose, and agents can easily distinguish between them.

Naming Consistency5/5

All tools follow a consistent 'kenya_<domain>_<operation>' pattern, using snake_case. The naming is predictable and easy to understand.

Tool Count5/5

With 6 tools, the server is well-scoped for its purpose of providing Kenya-specific data. Each tool offers meaningful functionality without unnecessary bloat.

Completeness4/5

The tool set covers multiple important Kenya-related domains, but there are minor gaps such as missing education, health, or demographic data. However, the current selection is sufficient for many use cases.

Maintenance

ActivityMaintained
ResponsivenessNo issues