Africa's Talking Airtime MCP
非洲的谈话广播时间 MCP
该项目实现了一个模型上下文协议 (MCP) 服务器,用于使用Africa's Talking API管理通话时间交易。它提供了一套工具,用于查询账户余额、发送通话时间、查看近期充值交易、汇总近期充值金额以及统计特定电话号码的充值次数。该应用程序使用 SQLite 存储交易数据,并支持使用 Africa's Talking 通话时间服务的非洲国家/地区,并提供正确的电话号码格式。
描述
Africa's Talking Airtime MCP 服务器与 Africa's Talking Airtime API 集成,以方便通话时间转移。主要功能包括:
向指定电话号码发送通话时间。
将交易详细信息存储在 SQLite 数据库中。
检索和汇总交易历史。
检查 Africa's Talking 上的账户余额。
该应用程序支持非洲Talking Airtime服务支持的国家。
Related MCP server: mpesa-mcp
安装
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装非洲的 Talking Airtime 服务器:
npx -y @smithery/cli install @nasoma/africastalking-airtime-mcp --client claude先决条件
Python 3.10 或更高版本
curl -LsSf https://astral.sh/uv/install.sh | sh按照以下步骤在本地设置并运行项目:
克隆存储库:
git clone https://github.com/nasoma/africastalking-airtime-mcp.git
cd africastalking-airtime-mcp通过运行以下命令设置虚拟环境并安装依赖项:
uv sync 一切顺利!
与AI工具一起使用
使用 Claude Desktop
将其添加到您的claude_desktop_config.json中:
{
"mcpServers": {
"Airtime Server": {
"command": "{{PATH_TO_UV}}", // Run `which uv` and place the output here
"args": [
"--directory",
"{{PATH_TO_PROJECT}}", // cd into the repo, run `pwd` and enter the output here
"run",
"main.py"
],
"env": {
"username": "your_africastalking_username",
"api_key": "your_africastalking_api_key",
"country":"your_country", # e.g kenya, uganda, dr congo, rwanda, south africa
"currency_code":"currency-code" # e.g. KES, UGX, NGN
}
}
}
}配鹅
如果您想使用您喜欢的 LLM 并提供 API 密钥, Goose是一个不错的选择。
安装 Goose。
打开设置面板并添加自定义扩展(MCP 服务器)。
为您的扩展命名。类型为 STDIO。
添加命令。保存更改。

添加您的环境变量:
username、api_key、currency_code和country。保存更改。

工具说明
MCP 提供以下工具来管理通话时间交易:
检查余额:
描述:检索您的 Africa's Talking 帐户的当前通话时间余额。
用法:
check_balance()输出:返回帐户余额(例如,“帐户余额:KES 1234.00”),如果无法获取余额,则返回错误消息。
加载播放时间:
描述:向指定的电话号码发送通话时间并将交易保存在数据库中。
参数:
phone_number:收件人的电话号码(例如“0712345678”或“+254712345678”)。amount:要发送的空中时间量(例如 100)。currency_code:货币代码(例如“KES”)。
用法:
load_airtime("0712345678", 100.00, "KES")输出:确认成功(例如,“已成功向 +254712345678 发送 KES 100.00 通话时间”)或报告错误。
获取上次充值次数:
描述:从数据库中检索最近的
N通话时间充值交易。参数:
limit:要检索的交易数量(默认值:3)。
用法:
get_last_topups(3)输出:列出最近的交易(例如,“最近 3 笔充值交易:...”)或表示未找到交易。
最后 n 次充值总数:
描述:计算最近
N成功充值的总金额,确保它们使用相同的货币。参数:
n:要汇总的交易数量(默认值:3)。
用法:
sum_last_n_topups(3)输出:返回总数(例如,“最近 3 次成功充值的总和:KES 300.00”)或错误(如果货币不同)。
count_topups_by_number :
描述:计算特定电话号码成功充值的次数。
参数:
phone_number:要查询的电话号码(例如“0712345678”)。
用法:
count_topups_by_number("0712345678")输出:返回计数(例如,“成功充值至 +254712345678 的次数:5”)或错误。
示例提示
以下是用户可以根据可用工具向 AI 提出的示例问题或命令,以便与非洲的 Talking Airtime MCP 进行交互:
查看账户余额
我的 Africa's Talking 账户余额是多少?
你能告诉我当前余额吗?
检查我的通话时间余额。
发送通话时间
向 0712345678 发送 100 KES 通话时间。
给我的 0712345678 充值 60。
充值 50 奈拉至 +2348012345678。
您能向 0755123456 充值 200 UGX 吗?
查看最近的充值
显示最近 3 次通话时间交易。
我最近充值了哪些金额?
列出最近 5 次通话时间充值。
近期充值总额
我最近 3 次充值的总金额是多少?
将我最近 4 次通话时间交易的金额加起来。
我最近 5 次充值一共汇了多少钱?
按电话号码计算充值次数
我给0712345678充值过几次?
计算 +254712345678 的充值金额。
请告诉我有多少次成功充值到 0755123456。
笔记
确保您的 Africa's Talking 帐户有足够的资金来发送通话时间。
电话号码根据客户端或
claude_desktop_config.json中设置的country变量自动格式化。初始化时,在项目目录中创建 SQLite 数据库(
airtime_transactions.db)。最适合支持工具调用的模型,例如
Claude 3.7 Sonnet。如果您注重价格,GPT-4.1 Nano与 Goose 等客户端一起使用时是一个不错的、更便宜的选择。
🙏 致谢
非洲的谈话 API非洲的谈话文档。
Available Tools
5 toolscheck_balanceA
Checks the airtime balance of the Africa's Talking account.
This tool connects to the Africa's Talking API to fetch the user's
current application data, which includes the account balance.
Returns:
str: A message displaying the account balance or an error if the
balance cannot be retrieved.
Inputs: no named parameters.
count_topups_by_numberA
Counts the number of top-ups for a specific phone number.
Args:
phone_number (str): The phone number to count transactions for.
Returns:
str: The total count of top-ups for the given number or an error message.
Inputs: phone_number (required).
get_last_topupsA
Retrieves the last N top-up transactions from the database.
Args:
limit (int, optional): The number of recent transactions to fetch.
Defaults to 3.
Returns:
str: A formatted string listing the last N transactions or a message
if no transactions are found.
Inputs: limit.
load_airtimeA
Sends airtime to a specified phone number and logs the transaction.
This tool formats the phone number, sends the airtime using the
Africa's Talking API, and saves a record of the transaction in the
database.
Args:
phone_number (str): The recipient's phone number.
amount (float): The amount of airtime to send.
currency_code (str): The currency for the transaction (e.g., "KES").
Returns:
str: A message indicating the status of the airtime transaction.
Inputs: phone_number (required), amount (required), currency_code (required).
sum_last_n_topupsA
Calculates the sum of the last 'n' successful top-ups.
This tool retrieves the last 'n' transactions from the database and
calculates their total sum. It ensures that all transactions are in the
same currency before summing.
Args:
n (int, optional): The number of recent top-ups to sum. Defaults to 3.
Returns:
str: The total sum of the last 'n' top-ups or an error message if
the currencies are mixed or no transactions are found.
Inputs: n.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool has a clearly distinct purpose with no overlap: check_balance for account status, load_airtime for sending airtime, and three tools (count_topups_by_number, get_last_topups, sum_last_n_topups) for analyzing transaction history from different angles. The descriptions reinforce these distinct roles, making misselection unlikely.
The naming follows a consistent snake_case pattern with clear verb_noun structures (e.g., check_balance, load_airtime). However, there is a minor deviation: 'count_topups_by_number' uses a prepositional phrase instead of a simple noun, slightly breaking the pattern compared to tools like 'get_last_topups' or 'sum_last_n_topups'.
With 5 tools, the count is well-scoped for an airtime management server. It covers core operations (checking balance, sending airtime) and transaction analysis without being overwhelming, ensuring each tool earns its place in the workflow.
The toolset provides good coverage for airtime operations: checking balance, sending airtime, and analyzing transaction history. A minor gap exists in not having tools for managing transaction errors or refunds, but agents can likely work around this with the existing tools for core workflows.
Related MCP Connectors
Read Africa's Talking balance, incoming SMS, transactions; send SMS, airtime, data and voice calls.
Prepaid SMS OTP and transactional SMS API. Eight priced markets: NG, GH, KE, ZA, GB, BJ, CI, US.
Send SMS, track delivery, check prices and balance, validate numbers and manage Sender IDs.
Send messages and automate conversations over SMS, MMS, WhatsApp, Viber, IVR, and USSD in 150+ countries. Manage contacts, campaigns, and automated services, analyze message history, and look up channel options and pricing. Organizations can require human approval before sending messages.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA unified interface for major African payment providers including M-Pesa, Paystack, and MTN MoMo. It enables users to process payments, request funds, and manage transactions across the continent using natural language commands.17 npmMIT
- AlicenseAqualityBmaintenanceMCP server for East African fintech APIs — trigger M-Pesa STK Push payments, check transaction status, send SMS to 20+ African networks, and top up airtime via Africa's Talking.5209 PyPI7MIT
- FlicenseBqualityCmaintenanceEnables AI agents to interact with the BulkClix platform for SMS, OTP, airtime, mobile money, bank transfers, data bundles, KYC, contacts, and account management via natural language.25-
- AlicenseAqualityDmaintenanceEnables AI assistants to buy airtime and data, check wallet balance, list data plans, and view transactions for Nigerian mobile networks via an Azabill account.620 npmMIT