Freedom Commerce Protocol
🕊️ Freedom Commerce Protocol
代理原生市场——AI 代理可以在此发现、协商并购买服务,无需编写任何 HTML 代码。
“如果代理要在 2030 年前协调 3-5 万亿美元的商业活动,它们需要一个为它们构建的市场,而不是为使用浏览器的普通人类构建的市场。”
Freedom Commerce 是一个用于代理商业 (agentic commerce) 的开放协议和参考实现——这是一个从底层开始为机器对机器 (M2M) 交易设计的市场 API。没有验证码 (CAPTCHA),没有 DOM 解析,没有脆弱的浏览器自动化。纯 JSON、MCP 工具定义和协议驱动的协商。
为什么存在这个项目
今天的网络是为人类构建的。AI 代理在浏览时面临以下问题:
❌ 验证码 阻止了自动化访问 ❌ 重 JavaScript 页面 导致 DOM 解析失败 ❌ 结构不一致 —— 每个网站都不同 ❌ 没有机器可读的定价 —— 代理无法比较报价 ❌ 没有协商协议 —— 要么接受,要么离开 ❌ 没有标准结账流程 —— 每个支付流程都是独特的
Freedom Commerce 颠覆了这一点:API 即店面。 代理调用 JSON 端点,获取 MCP 工具定义,协商价格并进行交易——一切都在毫秒内完成。
当前网络 → 人类浏览 HTML,填写表单,点击按钮
Freedom Commerce → 代理调用 POST /api/purchase,获取收据
工作原理
┌─────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ AI Agent │────▶│ Freedom Commerce │────▶│ Service │
│ (Claude, │ │ Protocol API │ │ Providers │
│ GPT, │◀────│ (localhost:4000) │◀────│ (APIProxy, │
│ Grok, │ │ │ │ DataForge...) │
│ etc.) │ └──────────────────┘ └─────────────────┘
│ │ │
│ Discovers │ │ MCP Tool Definitions
│ Negotiates │ │ Agent-to-Agent Negotiation
│ Purchases │ │ ACP-compatible Payments
└─────────────┘ └──────────────────────────────────代理流程
发现 —
GET /api/services?category=infrastructure&maxPrice=10检查 —
GET /api/services/{id}获取详细信息 + 提供商信息比较 —
GET /api/mcp/tools查看所有购买选项作为 MCP 工具定义协商 (可选) —
POST /api/negotiate提交您的报价购买 —
POST /api/purchase→ 获取已签名的收据
架构
freedom-commerce/
├── server.js # HTTP server — agent-first API
├── lib/
│ └── registry.js # Service registry, negotiation engine, MCP tool generator
├── protocols/ # (ready for ACP, UCP, A2A protocol adapters)
├── public/
│ └── index.html # Human dashboard (for monitoring only)
├── package.json
└── README.md核心概念
概念 | 描述 |
提供商 (Provider) | 服务卖家 (APIProxy, DataForge, LogTail 等) |
服务 (Service) | 带有价格、类别、条款的可购买产品 |
MCP 工具 | 代理可以调用的机器可读操作定义 |
协商 (Negotiation) | 代理与代理之间的价格讨论及还价 |
交易 (Transaction) | 带有加密收据的已完成购买 |
API 参考
所有端点均返回 application/json。代理通过 X-Agent-ID 标头标识自己。
发现
GET /api/services用于代理驱动过滤的查询参数:
参数 | 类型 | 示例 | 描述 |
| string |
| 按类别过滤 |
| number |
| 最高价格 |
| number |
| 最低提供商评分 |
| string |
| 名称 + 描述中的文本搜索 |
响应:
{
"query": { "category": "infrastructure", "maxPrice": 10 },
"count": 3,
"services": [
{
"name": "API Proxy — 10k requests",
"category": "infrastructure",
"price": 4.99,
"currency": "USD",
"description": "10,000 API proxy requests with global CDN caching",
"deliveryTime": "instant",
"terms": "Monthly subscription, cancel anytime",
"provider": { "name": "APIProxy", "rating": 4.8 }
}
]
}MCP 工具定义
GET /api/mcp/tools返回与 Model Context Protocol 兼容的工具定义。代理使用这些定义来了解有哪些购买操作可用。
{
"protocol": "MCP/1.0",
"tools": [
{
"name": "purchase_api_proxy_10k",
"description": "Purchase: API Proxy — 10k requests",
"inputSchema": {
"type": "object",
"properties": {
"quantity": { "type": "number" },
"maxPrice": { "type": "number" }
},
"required": ["quantity"]
},
"_acp": {
"price": 4.99,
"currency": "USD",
"paymentEndpoint": "/api/payments/svc_xxx"
}
}
]
}购买
POST /api/purchase
Content-Type: application/json
X-Agent-ID: my-agent
{
"serviceId": "svc_xxx",
"quantity": 2
}响应:
{
"transaction": {
"id": "txn_1747432892",
"status": "completed",
"price": 9.98,
"currency": "USD"
},
"receipt": "FCP-txn_1747432892"
}协商 (代理对代理)
POST /api/negotiate
Content-Type: application/json
X-Agent-ID: my-agent
{
"serviceId": "svc_xxx",
"offer": { "price": 3.99 }
}提供商还价:
POST /api/negotiate/{id}/counter
{ "price": 4.50 }代理接受:
POST /api/negotiate/{id}/accept市场统计
GET /api/stats{
"totalProviders": 5,
"totalServices": 8,
"totalTransactions": 42,
"totalRevenue": 249.50,
"activeNegotiations": 3
}快速入门
# Clone
git clone https://github.com/BARRYPMARSHALL/freedom-commerce.git
cd freedom-commerce
# Run (no dependencies needed — pure Node.js)
node server.js
# The marketplace starts with 8 demo services from 5 providers
# Agent API: http://localhost:4000/api/services
# Dashboard: http://localhost:4000/无需 npm install。 零外部依赖。纯 Node.js http 模块。
种子服务
服务器启动时预置了一个用于演示的市场:
服务 | 提供商 | 类别 | 价格 |
API Proxy — 10k req | APIProxy | infrastructure | $4.99 |
API Proxy — 100k req | APIProxy | infrastructure | $29.99 |
Synthetic Dataset — 1k rows | DataForge | data | $9.99 |
Synthetic Dataset — 10k rows | DataForge | data | $49.99 |
Log Ingestion — 1GB/mo | LogTail | infrastructure | $14.99 |
Email Sending — 1k emails | MailJet | communication | $2.99 |
Serverless Compute — 10hr | ComputeCells | compute | $5.99 |
GPU Compute — 1hr A100 | ComputeCells | compute | $2.49 |
协议兼容性
Freedom Commerce 旨在与新兴的代理商业协议桥接:
协议 | 状态 | 描述 |
MCP (Model Context Protocol) | ✅ 原生 | 为每项服务自动生成工具定义 |
ACP (Agentic Commerce Protocol) | 🔧 适配器就绪 | Stripe/OpenAI 支付标准 — 添加您的 Stripe 密钥 |
UCP (Universal Commerce Protocol) | 🔧 适配器就绪 | Shopify/Google 目录发现标准 |
A2A (Agent-to-Agent) | 🔧 未来 | Google 的代理互操作性协议 |
部署
本地 (ngrok)
# Start the server
node server.js &
# Expose via ngrok
ngrok http 4000生产环境 (Railway / Fly.io / Render)
服务器是无状态的,作为单个进程部署。无需构建步骤。
# Example: Deploy to Railway
railway login
railway init
railway up为您的平台分配的端口设置 PORT 环境变量。
差异之处
传统电子商务 | Freedom Commerce | |
客户 | 带浏览器的人类 | AI 代理 |
界面 | HTML + CSS + JS | JSON API + MCP 工具 |
发现 | SEO、广告、搜索 |
|
比较 | 手动切换标签页 |
|
定价 | 固定,人工协商 | 代理对代理协商协议 |
结账 | 表单 + 验证码 |
|
购买耗时 | 分钟 | < 100ms |
愿景
Freedom Commerce 是迈向代理原生经济的第一步,在该经济中:
代理自主管理订阅、重新订购供应品、比较并切换提供商
提供商在 API 质量上竞争,而不是在 SEO 或广告支出上竞争
人类设定预算和策略——代理执行
市场在毫秒内清算,而不是几天
协议 (MCP, ACP, UCP) 创建机器商业的通用层
3-5 万亿美元的预测不是关于人类购物更快——而是关于代理为我们购物。但代理无法在为人类眼球构建的网络上购物。它们需要 API、工具定义和协议。这就是本项目存在的意义。
许可证
MIT — 基于此构建。
由 Freedom 🕊️ 为 Barry Marshall 构建
💰 加密支付轨道
Freedom Commerce 基于加密原生支付构建——因为代理没有银行账户,它们有钱包。
支持的支付方式
方式 | 链 | 代币 | 手续费 | 结算时间 |
USDC 转账 | Base L2 | USDC | 0.5% 协议费 | ~12 秒 |
x402 微支付 | Base L2 | USDC | 0.5% 协议费 | ~$0.001 gas |
托管合约 | Base L2 | USDC | 0.5% 协议费 | 链上最终确认 |
原生 ETH | Ethereum | ETH | 0.5% | ~12 秒 |
原生 SOL | Solana | SOL | 0.5% | ~2 秒 |
为什么选择加密货币?
法币支付轨道 (Stripe, PayPal) 在代理商业中失败的原因:
问题 | 法币 | 加密货币 |
最低交易额 | 最低 $0.50 | 0.000001 美分 |
结算时间 | 2-3 个工作日 | ~12 秒 (Base L2) |
KYC 要求 | 必须是个人 | 仅需钱包 |
退款风险 | 180 天风险 | 最终结算 |
跨境费用 | 3%+ 货币费用 | 到处成本相同 |
代理自主权 | 不可能 (无人参与) | 完全可编程 |
加密 API 端点
POST /api/crypto/pay → Create USDC payment request
POST /api/crypto/verify → Verify on-chain payment
POST /api/crypto/escrow → Create escrow contract
POST /api/crypto/escrow/:id/deposit → Deposit into escrow
POST /api/crypto/escrow/:id/release → Release funds
POST /api/crypto/escrow/:id/refund → Refund (dispute)
POST /api/crypto/x402 → x402 micropayment request
GET /api/crypto/methods → Supported chains/tokens
GET /api/crypto/quote → Fee quote
GET /api/crypto/solidity → Escrow contract template
GET /api/crypto/stats → Payment statistics协议架构
┌──────────────┐ ┌──────────────────┐ ┌──────────────┐
│ AI Agent │────▶│ Freedom Commerce │────▶│ Provider │
│ (Wallet) │ │ (Marketplace) │ │ (Wallet) │
│ │ │ │ │ │
│ 1. Discover │ │ 3. Create │ │ 5. Deliver │
│ services │ │ escrow │ │ service │
│ 2. Negotiate│ │ 4. Both deposit │ │ 6. Confirm │
│ price │ │ USDC │ │ │
│ │ │ │ │ │
│ │ │ 7. Release │ │ │
│ │ │ funds │ │ │
│ │ │ 8. Protocol fee │ │ │
└──────────────┘ └──────────────────┘ └──────────────┘
│
┌────────┴────────┐
│ On-Chain │
│ (Base L2) │
│ USDC + Escrow │
└─────────────────┘加密货币快速入门
# 1. Discover a service
curl http://localhost:4000/api/services?category=infrastructure
# 2. Get a crypto quote
curl "http://localhost:4000/api/crypto/quote?amount=10"
# 3. Create an escrow (agent + provider deposit USDC)
curl -X POST http://localhost:4000/api/crypto/escrow \
-H "Content-Type: application/json" \
-d '{"agentWallet":"0xAgent...","providerWallet":"0xProvider...","amount":10}'
# 4. Agent deposits into escrow
curl -X POST http://localhost:4000/api/crypto/escrow/ESCROW_ID/deposit \
-d '{"wallet":"0xAgent...","party":"agent"}'
# 5. Provider deposits
curl -X POST http://localhost:4000/api/crypto/escrow/ESCROW_ID/deposit \
-d '{"wallet":"0xProvider...","party":"provider"}'
# 6. Release funds on delivery
curl -X POST http://localhost:4000/api/crypto/escrow/ESCROW_ID/release部署托管合约
完整的 Solidity 托管合约位于:
GET /api/crypto/solidity部署到 Base L2:
# Using Foundry
forge create FreedomEscrow \
--rpc-url https://base-rpc.publicnode.com \
--private-key $YOUR_KEY \
--constructor-args $AGENT_ADDR $PROVIDER_ADDR $FEE_COLLECTOR $USDC_BASE $AMOUNT $DEADLINE路线图
[x] Base L2 上的 USDC 支付
[x] x402 微支付协议
[x] 带有 Solidity 合约的链上托管
[x] 多链支持 (ETH, SOL, MATIC)
[ ] 将托管合约部署到 Base 主网
[ ] Coinbase 智能钱包集成
[ ] 跨链结算 (LayerZero/Wormhole)
🚀 部署
Railway (推荐)
# Install Railway CLI
npm install -g @railway/cli
# Deploy
railway login
cd freedom-commerce
railway init
railway upDocker
docker build -t freedom-commerce .
docker run -p 4000:4000 freedom-commerce手动
git clone https://github.com/BARRYPMARSHALL/freedom-commerce.git
cd freedom-commerce
node server.js环境变量
变量 | 默认值 | 描述 |
|
| HTTP 服务器端口 |
|
| 协议费接收地址 |
🤝 MCP 集成
Freedom Commerce 已在 Awesome MCP Servers 目录中注册 (PR #5570 待处理)。
Claude Desktop
添加到 claude_desktop_config.json:
{
"mcpServers": {
"freedom-commerce": {
"command": "node",
"args": ["/path/to/lib/mcp-server.js"]
}
}
}任何 MCP 客户端
该端点返回完整的 MCP 兼容工具定义:
GET /api/mcp/toolsThis server cannot be deployed
Related MCP Connectors
The independent agent-commerce protocol for AI-agent checkout on any online store.
Machine-service catalogue, payment hand-off and free market discovery for autonomous AI agents.
Marketplace and payment rail for AI agents: list, buy and settle with signed receipts.
Agent-to-agent marketplace for AI task discovery, matching, delivery, and trust.