快速开始
5 分钟内让您的 AI 智能体开始付款。
安装 MCP 服务器
通过 npm 全局安装 BananaCrystal MCP 服务器。
npm install -g @bananacrystal/mcp-server配置 Claude Desktop
将 BananaCrystal 添加到您的 Claude Desktop 配置文件中。
{
"mcpServers": {
"bananacrystal": {
"command": "bananacrystal-mcp",
"env": {
"BANANACRYSTAL_API_KEY": "bc_test_your_sandbox_key_here"
}
}
}
}向您的智能体提问
您的智能体现在拥有 40 个支付工具。试试这些提示词:
MCP 工具
6 个类别共 40 个可用于生产环境的支付工具。只读操作始终免费。
pingget_server_infoechoget_my_profileget_balancesget_exchange_ratelist_supported_currencieslist_available_tokensget_transaction_historyget_my_limitsestimate_swap_feesget_agent_configcheck_approval_statusget_kyc_statusget_deposit_statusget_withdrawal_statusget_escrow_balancesget_escrow_historylist_offersget_offerget_my_offerslist_tradesget_tradeget_my_tradesrequest_transfer_otptransfer_tokensswap_currencyinitiate_kycinitiate_depositrequest_withdrawalcreate_offerupdate_offerdelist_offerdelete_offerengage_offercancel_traderequest_agent_transactionexecute_approved_transactionupdate_my_agent_settingsreset_sandbox_balance汇率 API
通过 REST 进行高级汇率操作。需要具有汇率权限范围的 API 密钥。
MCP 工具与汇率 API:有什么区别?
MCP 服务器已将 get_exchange_rate 作为 read_only 工具提供:您的智能体可以直接调用它,获取单一货币兑 USD 的买入/卖出汇率。这已能满足大多数智能体的使用场景。
汇率 API 功能更进一步:交叉货币对换算、批量操作、历史时间序列数据和统计摘要。这些功能以 HTTP 端点形式直接提供,使用具有 rate 权限范围的 API 密钥进行身份验证。请在账户控制台中创建汇率密钥。
身份验证
所有汇率 API 端点都需要在 x-api-key 请求头中传入具有 rate 权限范围的 API 密钥。对应的沙盒端点位于 /mcp/sandbox/rate/*,使用您的沙盒密钥(bc_test_...),并返回固定的模拟汇率,便于可重复测试。
/mcp/rate/currencies列出所有支持的货币
请求示例
curl "https://agentic.bananacrystal.com/mcp/rate/currencies" \
-H "x-api-key: bc_live_your_rate_key_here"响应示例
{
"count": 11,
"currencies": ["EGP", "EUR", "GBP", "GHS", "KES", "NGN", "TZS", "UGX", "USD", "XOF", "ZAR"]
}/mcp/rate/current获取两种货币之间的当前汇率
参数
| 名称 | 必填 | 描述 |
|---|---|---|
from | 必填 | 源货币代码(例如 USD) |
to | 必填 | 目标货币代码(例如 NGN) |
请求示例
curl "https://agentic.bananacrystal.com/mcp/rate/current?from=USD&to=NGN" \
-H "x-api-key: bc_live_your_rate_key_here"响应示例
{
"from": "USD",
"to": "NGN",
"rate": 1584.75,
"buyRate": 1590.0,
"sellRate": 1579.5,
"timestamp": "2026-04-30T10:22:00.000Z"
}/mcp/rate/convert将金额从一种货币换算为另一种货币
参数
| 名称 | 必填 | 描述 |
|---|---|---|
from | 必填 | 源货币代码 |
to | 必填 | 目标货币代码 |
amount | 必填 | 要换算的金额(数字) |
请求示例
curl "https://agentic.bananacrystal.com/mcp/rate/convert?from=USD&to=NGN&amount=100" \
-H "x-api-key: bc_live_your_rate_key_here"响应示例
{
"from": "USD",
"to": "NGN",
"amount": 100,
"converted": 158475.0,
"rate": 1584.75,
"timestamp": "2026-04-30T10:22:00.000Z"
}/mcp/rate/batch-convert在一次请求中换算多笔货币金额(最多 100 笔)
请求示例
curl -X POST "https://agentic.bananacrystal.com/mcp/rate/batch-convert" \
-H "x-api-key: bc_live_your_rate_key_here" \
-H "Content-Type: application/json" \
-d '{
"conversions": [
{ "from": "USD", "to": "NGN", "amount": 100 },
{ "from": "USD", "to": "GHS", "amount": 50 },
{ "from": "EUR", "to": "GBP", "amount": 200 }
]
}'响应示例
[
{ "from": "USD", "to": "NGN", "amount": 100, "converted": 158475.0, "rate": 1584.75, "timestamp": "..." },
{ "from": "USD", "to": "GHS", "amount": 50, "converted": 800.0, "rate": 16.0, "timestamp": "..." },
{ "from": "EUR", "to": "GBP", "amount": 200, "converted": 172.0, "rate": 0.86, "timestamp": "..." }
]/mcp/rate/history获取某个货币对的历史汇率
参数
| 名称 | 必填 | 描述 |
|---|---|---|
from | 必填 | 源货币代码 |
to | 必填 | 目标货币代码 |
startDate | 必填 | 开始日期(ISO 8601,例如 2026-04-01) |
endDate | 必填 | 结束日期(ISO 8601,例如 2026-04-30) |
请求示例
curl "https://agentic.bananacrystal.com/mcp/rate/history?from=USD&to=NGN&startDate=2026-04-01&endDate=2026-04-30" \
-H "x-api-key: bc_live_your_rate_key_here"响应示例
[
{ "date": "2026-04-01T00:00:00.000Z", "from": "USD", "to": "NGN", "buyRate": 1580.0, "sellRate": 1575.0, "midRate": 1577.5 },
{ "date": "2026-04-02T00:00:00.000Z", "from": "USD", "to": "NGN", "buyRate": 1582.0, "sellRate": 1577.0, "midRate": 1579.5 }
]/mcp/rate/stats获取某一时段内的汇率统计(最高、最低、平均、最新)
参数
| 名称 | 必填 | 描述 |
|---|---|---|
from | 必填 | 源货币代码 |
to | 必填 | 目标货币代码 |
days | 选填 | 时段天数,1 到 365(默认:30) |
请求示例
curl "https://agentic.bananacrystal.com/mcp/rate/stats?from=USD&to=NGN&days=30" \
-H "x-api-key: bc_live_your_rate_key_here"响应示例
{
"from": "USD",
"to": "NGN",
"period": "30d",
"high": 1598.0,
"low": 1560.0,
"avg": 1581.4,
"latest": 1584.75,
"count": 30
}沙盒汇率 API
将 /mcp/rate/ 替换为 /mcp/sandbox/rate/,并使用您的沙盒密钥获取固定的模拟汇率。历史数据以 ±2% 的波动生成,便于进行贴近真实的测试。不使用真实的汇率数据。
沙盒环境
使用预置余额安全测试您的集成,不涉及真实资金。
什么是沙盒?
沙盒是一个完全隔离的测试环境,与生产环境完全一致,包括相同的工具、相同的 API 和相同的响应格式。不会转移真实资金。沙盒 API 密钥以 bc_test_ 开头,并连接到 Hedera 测试网。
预置余额
每个沙盒账户初始都有以下余额。您可以随时使用 reset_sandbox_balance 恢复。
| 代币 | 金额 | 货币 |
|---|---|---|
USDb | 10,000 | USD |
NGNb | 5,000,000 | NGN |
GHSb | 50,000 | GHS |
KESb | 1,000,000 | KES |
ZARb | 150,000 | ZAR |
沙盒与正式环境对比
| 功能 | 沙盒 | 正式环境 |
|---|---|---|
| 真实资金流转 | 否:仅模拟 | 是 |
| OTP 验证 | 在 API 响应中返回 | 发送至您的邮箱 |
| 法币需要 KYC | 否 | 是 |
| 强制执行支出限额 | 是(可配置) | 是 |
| API 密钥前缀 | bc_test_... | bc_live_... |
| Hedera 结算 | 测试网 | 主网 |
| 预置余额 | 是(可随时重置) | 否 |
| 速率限制 | 宽松 | 按套餐 |
沙盒中的 OTP
在沙盒模式下,OTP 验证码会直接在 request_transfer_otp 的 API 响应中返回,而不是通过邮件发送。这让自动化测试更加简单,无需访问邮箱。
沙盒配置
{
"mcpServers": {
"bananacrystal": {
"command": "bananacrystal-mcp",
"env": {
"BANANACRYSTAL_API_KEY": "bc_test_your_sandbox_key_here",
"BANANACRYSTAL_API_URL": "https://agentic.bananacrystal.com/mcp/sandbox"
}
}
}
}配置
将 BananaCrystal 连接到您偏好的 AI 工具或框架。
{
"mcpServers": {
"bananacrystal": {
"command": "bananacrystal-mcp",
"env": {
"BANANACRYSTAL_API_KEY": "your_api_key_here"
}
}
}
}环境变量
BANANACRYSTAL_API_KEY必填您的 MCP API 密钥。沙盒密钥以 bc_test_ 开头,正式密钥以 bc_live_ 开头。
默认值: N/A
BANANACRYSTAL_API_URL选填覆盖 MCP 端点 URL。测试时请使用沙盒 URL。
默认值: https://agentic.bananacrystal.com/mcp
DEBUG选填设置为 true 以启用详细的请求/响应日志。
默认值: false
| 变量 | 必填 | 默认值 | 描述 |
|---|---|---|---|
BANANACRYSTAL_API_KEY | 必填 | N/A | 您的 MCP API 密钥。沙盒密钥以 bc_test_ 开头,正式密钥以 bc_live_ 开头。 |
BANANACRYSTAL_API_URL | 选填 | https://agentic.bananacrystal.com/mcp | 覆盖 MCP 端点 URL。测试时请使用沙盒 URL。 |
DEBUG | 选填 | false | 设置为 true 以启用详细的请求/响应日志。 |
框架集成
适用于最流行 AI 智能体框架的即用示例。
import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_tool_calling_agent, AgentExecutor
from langchain_anthropic import ChatAnthropic
from langchain_core.prompts import ChatPromptTemplate
async def main():
# Connect to BananaCrystal MCP server
client = MultiServerMCPClient({
"bananacrystal": {
"url": "https://agentic.bananacrystal.com/mcp",
"transport": "streamable_http",
"headers": {
"Authorization": "Bearer your_api_key_here"
}
}
})
# Get all 40 payment tools
tools = await client.get_tools()
# Create an agent with payment capabilities
llm = ChatAnthropic(model="claude-3-5-sonnet-20241022")
prompt = ChatPromptTemplate.from_messages([
("system", "You are a payment agent. Use the BananaCrystal tools to help users manage their finances."),
("human", "{input}"),
("placeholder", "{agent_scratchpad}"),
])
agent = create_tool_calling_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
# Run the agent
result = await executor.ainvoke({
"input": "What is my current USDb balance?"
})
print(result["output"])
asyncio.run(main())任何兼容 MCP 的框架都可以使用。如果您的框架支持基于 HTTP 的 MCP 服务器,请将其指向 https://agentic.bananacrystal.com/mcp,并将您的 API 密钥作为 Bearer 令牌。
安全架构
多层防护,确保您的智能体只能执行您明确授权的操作。
API 密钥权限范围
每个 API 密钥都有明确的权限范围。智能体只能在您授予的权限范围内执行操作。
支出限额
为每个 API 密钥设置硬性单笔交易上限和 24 小时滚动每日上限。这些限额在基础设施层面强制执行。
OTP 验证
每笔代币转账都需要发送到您注册邮箱的 6 位 OTP。没有您提供的验证码,智能体无法完成转账。
速率限制
按密钥、按分钟设置的速率上限可防止失控的智能体疯狂调用 API。限额随您的套餐等级调整。
不可篡改的审计记录
每次工具调用都会写入 Hedera 共识层,带有时间戳、防篡改,并可在链上公开验证。可通过 get_transaction_history 获取完整审计记录。
智能体审批流程
智能体间交易可以设置为在执行前需要人工邮件审批。使用 update_my_agent_settings 配置 require_human_approval。
API 密钥权限范围
查询余额、汇率、记录和限额,不转移任何资金
向其他账户发送代币(需要 OTP)
在货币稳定币之间兑换
法币充值和提现(需要 KYC)
创建和管理预测市场报价及交易
访问货币汇率、历史数据、换算和汇率统计
| 权限范围 | 允许的操作 |
|---|---|
| read_only | 查询余额、汇率、记录和限额,不转移任何资金 |
| transfer | 向其他账户发送代币(需要 OTP) |
| swap | 在货币稳定币之间兑换 |
| fiat | 法币充值和提现(需要 KYC) |
| offers | 创建和管理预测市场报价及交易 |
| rate | 访问货币汇率、历史数据、换算和汇率统计 |
价格
只读操作始终免费。只为转移价值的交易付费。
操作手续费
只读操作
get_balances, get_exchange_rate, list_trades, …
代币转账
transfer_tokens
货币兑换
swap_currency
法币充值
initiate_deposit
法币提现
request_withdrawal
预测市场
create_offer, engage_offer
| 操作 | 工具 | 手续费 |
|---|---|---|
| 只读操作 | get_balances, get_exchange_rate, list_trades, … | 免费 |
| 代币转账 | transfer_tokens | 0.3% |
| 货币兑换 | swap_currency | 0.5% |
| 法币充值 | initiate_deposit | 因通道而异 |
| 法币提现 | request_withdrawal | 因通道而异 |
| 预测市场 | create_offer, engage_offer | 结算时收取平台手续费 |
常见问题
关于 BananaCrystal 和 MCP 服务器的常见问题。