Skip to main content
Glama

🛠️ CivicAgentKit — 东非公民 AI SDK

用于在东非构建公民 AI 工具的统一 Python 工具包。安装一次即可访问肯尼亚的议会记录、县级预算、NDMA 干旱数据、M-Pesa 支付,以及 MCP 和 A2A 协议集成。

PyPI License: CC BY-NC-ND 4.0 MCP A2A

安装

pip install civic-agent-kit

Related MCP server: mcp-colombia-secop

包含内容

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
)

快速示例

加载县级预算数据:

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']])

作为 A2A 代理提供肯尼亚公民数据:

from civic_agent_kit import KenyaA2AServer

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

作为 MCP 服务器提供服务:

from civic_agent_kit import KenyaMCPServer

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

用斯瓦希里语询问权利问题:

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..."

东非 AI 技术栈

                    ┌─────────────────────────────────────┐
                    │         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│       └─────────────┘
                                      └────────────┘

数据

所有数据均来自肯尼亚公民数据集 (CC BY-SA 4.0):

相关包

包

描述

PyPI

mpesa-mcp

M-Pesa + Africa's Talking MCP 服务器

PyPI

civic-agent-kit

本包

PyPI

完整作品集

13 个已部署的公民应用:gabrielmahia.github.io

知识产权与合作

© 2026 Gabriel Mahia · contact@aikungfu.dev 许可证:CC BY-NC-ND 4.0

Available Tools

6 tools
kenya_budget_summaryKenya County Budget SummaryA
Read-onlyIdempotent

Get county budget allocation, development vs recurrent split, and absorption rate. FY 2022/23 data from Kenya Controller of Budget. DEMO data — real data: opendata.go.ke and cob.go.ke.

Inputs: county (required), language. Returns: object

kenya_counties_listKenya Counties ListA
Read-onlyIdempotent

List all 47 Kenya counties. Returns names suitable for use with other tools.

Inputs: no named parameters. Returns: object

kenya_county_droughtKenya County Drought StatusA
Read-onlyIdempotent

Get current NDMA drought phase for any of Kenya's 47 counties. Phase 1=Minimal, 2=Stressed, 3=Crisis, 4=Emergency, 5=Famine. Data source: Kenya National Drought Management Authority (NDMA). DEMO data — for real-time data see ndma.go.ke.

Inputs: county (required), language. Returns: object

kenya_parliament_billsKenya Parliament BillsA
Read-onlyIdempotent

Query Kenya Parliament bills and their legislative status. Returns bills with title, status, type, date and summary. DEMO data — real data: parliament.go.ke.

Inputs: status, keyword. Returns: object

kenya_rights_queryKenya Constitutional Rights Q&AA
Read-onlyIdempotent

Query Kenya constitutional rights from Chapter 4 of the Constitution of Kenya 2010. Returns the specific constitutional article and its provisions. Works in English and Kiswahili.

Inputs: right (required), language. Returns: object

kenya_sacco_lookupKenya SACCO LookupA
Read-onlyIdempotent

Look up Kenya SACCOs from the SASRA registry. Returns name, type, membership, assets, county and focus sector. DEMO data — real registry: sasra.go.ke.

Inputs: name, county. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    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 recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      C
      quality
      B
      maintenance
      Provides access to Kenya 47-county local government data, including demographics, budgets, services, and contact information for all counties.
      6
      50 PyPI
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables access to UK government open data via the data.gov.uk CKAN API, allowing querying of datasets through natural language or direct MCP tools.
      71 npm
      MIT