Skip to main content
Glama

agenticpay

CI CodeQL gitleaks License: MIT GitHub stars npm: @agenticpay/sdk npm downloads

获取 AI 代理的付费。 为 MCP 生态系统提供的开源支付基础设施 —— 为任何工具声明价格,代理通过 x402 以 USDC 支付,并在 Solana 上约 1.5 秒内完成结算。

无需 Stripe。无需账户。无需 API 密钥。

全栈内容都在这里 —— SDK、CLI、支付墙中间件、自托管 x402 协调器 (facilitator) 以及一个实时 LLM 代理演示。全部采用 TypeScript,MIT 许可。

只想测试一下? 将你的 mcp-server 指向我们托管的 devnet 协调器:FACILITATOR_URL=https://agentpay-facilitator-e9b20a5fee6a.herokuapp.com —— 无需任何设置。

实时演示

一个真实的 Claude Opus 代理接收任务,决定使用哪些付费工具,通过 Solana 上的 x402 微支付自主完成支付,并回答用户问题。

$ pnpm --filter @agenticpay/two-agent-demo agent

Agent wallet: 3rHoEumCpH8EGrr6Lq2vBKeyec6h3yPRGj2nGG2FzEfX
Server:       http://localhost:4021
Facilitator:  http://localhost:4022   ← our own
Model:        claude-opus-4-7
Task:         Reverse the string 'agentpay rocks' and tell me how many words
              are in 'The quick brown fox jumps over the lazy dog'.

[turn 1] tool_use: reverse_string({"text":"agenticpay rocks"})  →  paying $0.001 USDC ...
  ✓ paid + got result in 1596ms: {"result":"skcor yaptnega"}
[turn 1] tool_use: word_count({"text":"The quick..."})  →  paying $0.0005 USDC ...
  ✓ paid + got result in 1286ms: {"count":9}

Agent final answer:
  1. Reversed string: skcor yaptnega
  2. Word count: 9 words

=== payments summary ===
  reverse_string   $0.0010 USDC   1596ms
  word_count       $0.0005 USDC   1286ms
  TOTAL            $0.0015 USDC   2 calls

链上证明 (Solana devnet):

Related MCP server: x402 Payment Gateway MCP Server

为什么

当前的 AI 代理栈假设人类持有信用卡。一旦代理开始自主行动——调用 API、雇佣子代理、支付计算费用——这种模式就会失效。你无法通过 OAuth 解决这个问题。

基于 HTTP 的稳定币微支付解决了这个问题。agenticpay 专门为 MCP 生态系统封装了缺失的工程体验:任何工具都可以声明价格,任何代理都可以支付,整个流程——包括实际提交链上结算的协调器——都是开源且可自托管的。

架构

┌──────────────┐     1) HTTP request                    ┌─────────────┐
│   Claude /   │ ────────────────────────────────────▶ │  mcp-server │
│   GPT agent  │     2) HTTP 402 + payment requirements │  (yours)    │
│              │ ◀──────────────────────────────────── │             │
│              │     3) signed USDC payload             │             │
│              │ ────────────────────────────────────▶ │             │
└──────────────┘                                        └─────┬───────┘
                                                              │ verify+settle
                                                              ▼
                                                   ┌──────────────────────┐
                                                   │ agenticpay facilitator │
                                                   │   (also yours, this  │
                                                   │    repo, port 4022)  │
                                                   └──────────┬───────────┘
                                                              │ submit
                                                              ▼
                                                          Solana
                                                       (USDC SPL,
                                                       sub-cent fees)

你也可以将 mcp-server 指向公共的 x402.org/facilitator 进行测试网/开发网测试,或者指向 Coinbase CDP 进行主网测试。我们只是让自托管路径变得简单。

软件包

软件包

功能

packages/sdk

TypeScript 原语:USDC 转账、钱包管理、网络配置

packages/cli

agenticpay 命令 —— 钱包、余额、发送

packages/mcp-server

带有 x402 支付墙中间件的 HTTP 服务器。每个工具都有价格。

packages/facilitator

自托管 x402 协调器 —— 在 Solana 上验证并结算 USDC 支付。代表代理支付 SOL 手续费。

packages/eliza-plugin

Eliza 插件 —— 将付费 HTTP 端点封装为原生的 Eliza Actions。Solana 原生 AI 代理按工具调用付费。

packages/ai-sdk

Vercel AI SDK 助手 —— 将付费工具直接放入 generateText / streamText 中。

packages/mcp-bridge

真正的 MCP 服务器 (stdio + @modelcontextprotocol/sdk),封装 x402 付费工具。放入 Claude Desktop / Cursor 中使用。

examples/two-agent-demo

真实的 Claude Opus 代理为工具调用付费

安装

npm install @agenticpay/sdk           # Solana + USDC primitives
npm install -g @agenticpay/cli        # `agenticpay` command
npm install @agenticpay/mcp-server    # paywalled HTTP server
npm install @agenticpay/facilitator   # self-hosted x402 facilitator
npm install @agenticpay/eliza-plugin  # Eliza plugin (Solana-native agents)
npm install @agenticpay/ai-sdk        # Vercel AI SDK paid tools
npm install -g @agenticpay/mcp-bridge # MCP server for Claude Desktop / Cursor

或者克隆 monorepo 以获取实时双代理演示和易于编辑的模板(建议首次运行时使用 —— 请参阅下方的快速入门)。

与 Claude Code 一起使用

本仓库提供了一个 Anthropic Skill,位于 .claude/skills/agenticpay/SKILL.md。将其复制到你的 ~/.claude/skills/ 中,为 Claude Code 提供关于 agenticpay 的一流上下文 —— 它将引导你完成 MCP 服务器变现、生成工具路由以及验证链上结算,而无需每次都重新阅读 README。

mkdir -p ~/.claude/skills
cp -r .claude/skills/agenticpay ~/.claude/skills/

快速入门 (devnet, ~5 分钟, 免费)

# 1. Install
pnpm install
pnpm -r build

# 2. Generate a payer wallet, fund it on devnet
node packages/cli/dist/index.js wallet new
node packages/cli/dist/index.js wallet show
# → fund SOL at https://faucet.solana.com  (paste pubkey)
# → fund USDC at https://faucet.circle.com (Solana Devnet, same pubkey)

# 3. (option A — fastest) Use our hosted devnet facilitator. Skip step 4.
export FACILITATOR_URL=https://agentpay-facilitator-e9b20a5fee6a.herokuapp.com

# 3. (option B — fully self-hosted) Start your own facilitator (terminal 1)
pnpm --filter @agenticpay/facilitator dev
# Note the printed feePayer address. It needs ~0.05 SOL devnet to cover fees.
# Either airdrop or use the helper:
pnpm --filter @agenticpay/facilitator fund
export FACILITATOR_URL=http://localhost:4022

# 4. Start the paywalled mcp-server (terminal 2)
PAY_TO=<recipient pubkey> pnpm --filter @agenticpay/mcp-server dev

# 5. Run the live LLM agent demo (terminal 3, needs ANTHROPIC_API_KEY in .env)
pnpm --filter @agenticpay/two-agent-demo agent

框架集成

最常见 AI 代理栈的即插即用模板位于 examples/ 下:

框架

文件

Anthropic SDK (规范)

examples/two-agent-demo/src/agent-llm.ts

真实付费服务器模板 (Claude 支持的工具)

examples/research-server/

LangChain.js

examples/langchain-js/agent-with-paid-tools.ts

LangChain Python

examples/langchain-python/agent_with_paid_tools.py

Eliza (Solana 原生)

examples/eliza/plugin-agenticpay.ts

Mastra

examples/mastra/paid-tool.ts

Vercel AI SDK

examples/vercel-ai-sdk/paid-tool.ts

OpenAI Custom GPT

examples/openai-gpt/action-schema.json

请参阅 examples/README.md 获取集成矩阵。

状态

预 alpha 版本。Devnet 已完成端到端验证。支持主网配置,但需要为协调器充值真实的 SOL,并指向支持主网的 RPC(Helius、QuickNode 等)。

路线图

  • [x] Devnet 端到端演示 (冒烟测试 + LLM 代理)

  • [x] 自托管 x402 协调器 (验证 + 结算,fee_payer 抽象)

  • [ ] 真实世界的 MCP 服务器模板 (搜索、获取、总结、提取 —— 而不是玩具般的 reverse_string)

  • [ ] 用于长期运行任务的链上托管 (Anchor 程序)

  • [ ] 链上代理声誉注册表

  • [ ] 托管协调器服务 (agenticpay.com)

什么是协调器?

如果你以前从未见过 x402:协调器是受信任的中间人,它 (1) 验证代理已签名的支付载荷,(2) 在链上提交 USDC 转账,以及 (3) 支付 SOL Gas 费用,这样代理就不需要任何 SOL —— 只需要 USDC。大多数 MCP 开发者不想运行自己的协调器;他们会指向一个托管的协调器。

本仓库提供了一个完整的协调器实现。你可以自托管、分叉、审计它,或者将其作为服务部署给你的用户。

许可

MIT

Available Tools

1 tool
agenticpay_infoB

Placeholder tool for Glama introspection handshake.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It describes itself as a 'placeholder,' implying no significant side effects, but fails to explicitly state whether it is read-only, what it returns, or any other behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that is both concise and front-loaded. Every word serves a purpose, and there is no unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (no parameters, no output schema), the description is adequately complete for its placeholder role. It explains the tool's purpose without missing essential details for a minimal introspection handshake.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, so the baseline score is 4 per the rubric. The description adds no parameter information, but none is needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool is a placeholder for 'Glama introspection handshake,' which is a specific purpose. The verb 'handshake' is implied, and the resource 'introspection' is named, distinguishing it from typical functional tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. As a placeholder, it likely serves a specific introspective role, but the description does not explain its usage context or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

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

  1. 1 tool updatev0.1.0
    • First observedagenticpay_info

TDQS

B3.2/5.0

Scored across 1 tool

Disambiguation5/5

Only one tool exists, so there is no ambiguity between tools.

Naming Consistency5/5

With a single tool, naming is trivially consistent; the name uses a clear verb_noun pattern.

Tool Count1/5

One placeholder tool is far too few for a server named 'agenticpay', which implies a payment domain requiring multiple operations.

Completeness1/5

The server lacks any functional tools; a payment server should have tools for transactions, balances, etc., but there is only a placeholder.

Maintenance

ActivityActive
ResponsivenessWithin a week

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Drop-in x402 payment middleware for MCP servers. Charge AI agents per tool call using USDC on Base chain — Python and JavaScript SDKs, no payment processor, no KYC.
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Agentic payments on Solana: an agent can pay x402 / HTTP 402 paywalls in USDC, hold a pre-paid balance or a subscription, and buy datasets or settle store checkouts. All 15 tools run behind fail-closed spending caps ($1 per payment, $10 per day by default), and settlement is non-custodial through a program-owned escrow that releases 99% to the creator.
    18
    79 npm
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    An MCP server providing 22 pay-per-call utility tools for AI agents (scrape, validate, embed, store, moderate, notify, convert, prevent loops) without accounts or API keys, using USDC payments via the x402 protocol.
    17
    77 npm
    1
    MIT