内容
align="center">
<h1 align="center">ASG 卡</h1>
<p align="center">
<strong>您的 AI 代理需要一张信用卡。ASG 卡为其提供了一张信用卡 - 程序化地,几秒钟内,支持 USDC 或 Stripe。</strong>
</p>
</p>
<p align="center">
<a href="https://www.npmjs.com/package/@asgcard/sdk"><img src="https://img.shields.io/npm/v/@asgcard/sdk?label=sdk&color=0969da" alt="SDK 版本"></a>
<a href="https://www.npmjs.com/package/@asgcard/cli"><img src="https://img.shields.io/npm/v/@asgcard/cli?label=cli&color=0969da" alt="CLI 版本"></a>
<a href="https://www.npmjs.com/package/@asgcard/mcp-server"><img src="https://img.shields.io/npm/v/@asgcard/mcp-server?label=mcp-server&color=0969da" alt="MCP 服务器版本"></a>
<br />
<a href="https://www.npmjs.com/package/@asgcard/sdk"><img src="https://img.shields.io/npm/dm/@asgcard/sdk?label=sdk%20downloads&color=green" alt="SDK 下载量"></a>
<a href="https://www.npmjs.com/package/@asgcard/cli"><img src="https://img.shields.io/npm/dm/@asgcard/cli?label=cli%20downloads&color=green" alt="CLI 下载量"></a>
<a href="https://www.npmjs.com/package/@asgcard/mcp-server"><img src="https://img.shields.io/npm/dm/@asgcard/mcp-server?label=mcp%20downloads&color=green" alt="MCP 下载量"></a>
<br />
<a href="https://github.com/ASGCompute/asgcard/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue" alt="许可证"></a>
<a href="https://asgcard.dev"><img src="https://img.shields.io/badge/website-asgcard.dev-blueviolet" alt="官网"></a>
<img src="https://komarev.com/ghpvc/?username=ASGCompute&label=repo%20views&color=blueviolet&style=flat" alt="访问量">
</p>
<p align="center">
🌐 <a href="README.md">English</a> | <a href="README.zh-CN.md">中文</a>
</p>
---
**ASG 卡** 是一个 **以代理为中心** 的虚拟信用卡平台。AI 代理可以程序化地创建和管理 Mastercard 虚拟信用卡,通过 **Stellar x402** (USDC) 或 **Stripe Machine Payments Protocol** (信用卡) 支付。
## 快速开始 — 第一张卡
```bash
# 一步到位(创建钱包,配置 MCP,安装技能)
npx @asgcard/cli onboard -y --client codex
# 使用 Stellar 上的 USDC 资助钱包(显示 onboard 地址)
# 然后:
npx @asgcard/cli card:create -a 10 -n "AI 代理" -e you@email.com
```
## SDK 使用
```typescript
import { ASGCardClient } from "@asgcard/sdk";
const client = new ASGCardClient({
privateKey: "S...", // Stellar 私钥
rpcUrl: "https://mainnet.sorobanrpc.com"
});
// 自动处理:402 → USDC 支付 → 创建信用卡
const card = await client.createCard({
amount: 10, // $10 信用卡额度
nameOnCard: "AI 代理",
email: "agent@example.com"
});
// card.detailsEnvelope = { cardNumber, cvv, expiryMonth, expiryYear }
```
### SDK 方法
| 方法 | 描述 |
|--------|-------------|
| `createCard({amount, nameOnCard, email, phone?})` | 使用 x402 支付创建虚拟信用卡 |
| `fundCard({amount, cardId})` | 为现有信用卡充值 |
| `listCards()` | 列出此钱包的所有信用卡 |
| `getTransactions(cardId, page?, limit?)` | 获取信用卡交易历史 |
| `getBalance(cardId)` | 获取实时信用卡余额 |
| `getPricing()` | 获取当前定价 |
| `health()` | API 健康检查 |
## MCP 服务器(AI 代理集成)
`@asgcard/mcp-server` 为 Codex、Claude Code 和 Cursor 提供了 **11 种工具**:
| 工具 | 描述 |
|------|-------------|
| `get_wallet_status` | **首先使用** - 钱包地址,USDC 余额,准备就绪 |
| `create_card` | 创建虚拟信用卡(x402 支付) |
| `fund_card` | 资助现有信用卡(x402 支付) |
| `list_cards` | 列出所有钱包信用卡 |
| `get_card` | 获取信用卡摘要 |
| `get_card_details` | 获取 PAN,CVV,过期时间 |
| `freeze_card` | 冻结信用卡 |
| `unfreeze_card` | 解冻信用卡 |
| `get_pricing` | 查看定价 |
| `get_transactions` | 信用卡交易历史(真实的 4payments 数据) |
| `get_balance` | 来自 4payments 的实时信用卡余额 |
### MCP 设置
```bash
npx @asgcard/cli install --client codex # 或 claude,cursor
```
## 架构
```mermaid
graph TB
subgraph 客户端
SDK["@asgcard/sdk<br>(npm, TypeScript)"]
CLI["@asgcard/cli<br>onboard + card ops"]
MCP["@asgcard/mcp-server<br>11 种工具"]
TG["Telegram Bot<br>@ASGCardbot"]
WEB["asgcard.dev"]
STRIPE_WEB["stripe
subgraph ASG 基础设施
API["ASG Card API<br>api.asgcard.dev"]
FAC["x402 促进者"]
DB["PostgreSQL"]
end
subgraph 支付轨道
STELLAR["Stellar 公网<br>USDC"]
STRIPE["Stripe<br>MPP"]
end
subgraph 外部
ISSUER["信用卡发行商<br>(MasterCard)"]
end
SDK -->|"x402 HTTP"| API
CLI -->|"x402 HTTP"| API
MCP -->|"x402 HTTP"| API
TG -->|"Webhook"| API
WEB -->|"定价"| API
STRIPE_WEB -->|"MPP"| API
API -->|"验证/结算"| FAC"| DB
API -->|"REST"| ISSUER
FAC -->|"Soroban RPC"| STELLAR
API -->|"支付意图"| STRIPE
SDK -->|"签名交易"| STELLAR
```
## 支付轨道
ASG 卡支持两种支付轨道。信用卡产品相同 - 只有支付方式不同。
### Stellar 版本(x402)
1. **代理请求信用卡** → API 返回 `402 Payment Required` 及 USDC 金额
2. **代理通过 SDK 签署 Stellar USDC 转账**
3. **x402 促进者验证并结算** 链上支付
4. **API 通过信用卡**
5. **信用卡详情立即返回** 在响应中
使用:SDK,CLI,MCP 服务器。无需人工干预。
### Stripe 版本(MPP)
1. **代理创建支付请求** → API 返回 `approval_required` + `approvalUrl`
2. **所有者在 `stripe.asgcard.dev/approve` 打开审批页面**
3. **所有者审查并批准** → Stripe Elements 表单,实时定价
4. **所有者通过 Stripe 支付** → 信用卡/Apple Pay/Google Pay
5. **信用卡创建** → 代理轮询直到 `completed`
使用:基于会话的身份验证(`X-STRIPE-SESSION`)。人工审批。
## 工作空间
| 目录 | 描述 |
|-----------|-------------|
| `/api` | ASG 卡 API(Express + x402 + Stripe MPP) |
| `/sdk` | `@asgcard/sdk` TypeScript 客户端 |
| `/cli` | `@asgcard/cli` CLI 及 onboarding |
| `/mcp-server` | `@asgcard/mcp-server` MCP 服务器(11 种工具) |
| `/web` | 营销网站(asgcard.dev) |
| `/web-stripe` | Stripe 版本网站(stripe.asgcard.dev) |
| `/docs` | 内部文档和 ADRs |
## API 端点
### 公共
| 路由 | 方法 | 描述 |
|-------|--------|-------------|
| `/health` | GET | 健康检查 |
| `/pricing` | GET | 定价信息 |
| `/cards/tiers` | GET | 定价信息 |
| `/supported` | GET | x402 功能 |
### Stellar x402(需要支付)
| 路由 | 方法 | 描述 |
|-------|--------|-------------|
| `/cards/create/tier/:amount` | POST | 创建虚拟信用卡 |
| `/cards/fund/tier/:amount` | POST | 为现有信用卡充值 |
### 钱包身份验证
| 路由 | 方法 | 描述 |
|-------|--------|-------------|
| `/cards/` | GET | 列出钱包的信用卡 |
| `/cards/:id` | GET | 信用卡详情 |
| `/cards/:id/details` | GET | 敏感数据(需要随机数) |
| `/cards/:id/transactions` | GET | 信用卡交易历史 |
| `/cards/:id/balance` | GET | 实时信用卡余额 |
| `/cards/:id/freeze` | POST | 冻结信用卡 |
| `/cards/:id/unfreeze` | POST | 解冻信用卡 |
### Stripe MPP(测试版)
| 路由 | 方法 | 描述 |
|-------|--------|-------------|
| `/stripe-beta/session` | POST | 创建托管会话 |
| `/stripe-beta/payment-requests` | POST | 创建支付请求 |
| `/stripe-beta/payment-requests/:id` | GET | 查询请求状态 |
| `/stripe-beta/approve/:id` | GET/POST | 审批页面数据 / 批准或拒绝 |
| `/stripe-beta/approve/:id/complete` | POST | 完成支付(MPP 凭证) |
| `/stripe-beta/cards` | GET | 列出会话的信用卡 |
| `/stripe-beta/cards/:id/details` | GET | 信用卡详情(需要随机数) |
## 定价
**简单,透明,无隐藏费用。**
- **$10** 信用卡创建(无需初始充值)
- **3.5%** 每次充值
就是这样。充值金额从 $5 到 $5,000。
> 创建信用卡,无需充值 → **$10**。创建充值 $100 的信用卡 → **$113.50**。稍后充值 $200 → **$207**。
> 在 Stellar 和 Stripe 轨道上均采用相同的定价。
## Telegram 机器人(@ASGCardbot)
将您的钱包链接到 Telegram 进行信用卡管理:
| 命令 | 描述 |
|---------|-------------|
| `/start` | 欢迎 / 链接账户 |
| `/mycards` | 列出您的信用卡 |
| `/faq` | 常见问题 |
| `/support` | 支持 |
## 安全
- 使用 **AES-256-GCM** 加密存储信用卡详情
- 基于代理随机数的防重放保护(每小时 5 次读取)
- 钱包签名身份验证(Stellar 版本)
- 基于会话的身份验证,带有测试版门控(Stripe 版本)
- 从日志中删除 Stripe 会话密钥
- Telegram webhook 秘密验证
- 操作端点受 API 密钥 + IP 白名单保护
## 贡献
我们欢迎贡献!请参阅 [CONTRIBUTING.md](CONTRIBUTING.md) 获取指南,并查看标记为 [`good first issue`](https://github.com/ASGCompute/asgcard/labels/good%20first%20issue) 的问题以开始。
该项目遵循我们的 [行为准则](CODE_OF_CONDUCT.md)。
## 许可证
MIT
---
<p align="center">
<a href="https://star-history.com/#ASGCompute/asgcard&Date">
<img src="https://api.star-history.com/svg?repos=ASGCompute/asgcard&type=Date" width="600" alt="Star 历史图表">
</a>
</
连接信息
猜你喜欢
暂无推荐服务器