diff --git a/sources/platform/integrations/ai/mcp.md b/sources/platform/integrations/ai/mcp.md index 3842045fc5..622ed2694a 100644 --- a/sources/platform/integrations/ai/mcp.md +++ b/sources/platform/integrations/ai/mcp.md @@ -326,47 +326,14 @@ For a detailed overview of client support for dynamic discovery, see the [MCP cl ::: -## Agentic payments with Skyfire +## Agentic payments -The Apify MCP server integrates with [Skyfire](https://www.skyfire.xyz/) to enable _agentic payments_. This allows AI agents to autonomously pay for Actor runs without requiring an Apify API token. Instead of authenticating with an Apify token, the agent uses Skyfire _PAY tokens_ to cover billing for each tool call. +Agentic payments allow AI agents to autonomously pay for Actor runs without requiring an Apify API token. The Apify MCP server supports two payment methods: -### Prerequisites +- [x402 protocol](/platform/integrations/x402) - Direct on-chain payments using USDC on the [Base](https://www.base.org/) blockchain via the open [x402](https://www.x402.org/) standard. +- [Skyfire](/platform/integrations/skyfire) - Managed payment tokens through the [Skyfire](https://www.skyfire.xyz/) payment platform. -- _Skyfire account_ - Sign up for a [Skyfire account](https://www.skyfire.xyz/) and fund your wallet. -- _MCP client with multi-server support_ - An MCP client that supports multiple servers, such as Claude Desktop or VS Code. - -### Setup - -Configure both the Skyfire MCP server and the Apify MCP server in your client. Enable payment mode by adding the `payment=skyfire` query parameter to the Apify server URL: - -```json -{ - "mcpServers": { - "skyfire": { - "url": "https://api.skyfire.xyz/mcp/sse", - "headers": { - "skyfire-api-key": "" - } - }, - "apify": { - "url": "https://mcp.apify.com?payment=skyfire" - } - } -} -``` - -Replace `` with your API key from your [Skyfire dashboard](https://www.skyfire.xyz/). - -### How it works - -When Skyfire payment mode is enabled, the agent handles the full payment flow autonomously: - -1. The agent discovers relevant Actors via `search-actors` or `fetch-actor-details` (these remain free). -1. Before executing an Actor, the agent creates a PAY token using the `create-pay-token` tool from the Skyfire MCP server (minimum $5.00 USD). -1. The agent passes the PAY token in the `skyfire-pay-id` input property when calling the Actor tool. -1. The Actor returns results as usual. Unused funds on the token remain available for future runs or return upon expiration. - -To learn more, see the [Skyfire integration documentation](/platform/integrations/skyfire) and the [Agentic Payments with Skyfire](https://blog.apify.com/agentic-payments-skyfire/) blog post. +For setup instructions and details, see the individual integration pages. ## Telemetry diff --git a/sources/platform/integrations/ai/skyfire.md b/sources/platform/integrations/ai/skyfire.md index e6674a73dd..9f909bca78 100644 --- a/sources/platform/integrations/ai/skyfire.md +++ b/sources/platform/integrations/ai/skyfire.md @@ -13,9 +13,9 @@ Agentic payments enable AI agents to autonomously run Apify Actors using third-p Apify supports agentic payments through _Skyfire_, a payment network specifically designed for AI agents. -:::warning Experimental feature +:::caution Experimental feature -Keep in mind that agentic payments are an experimental feature and may undergo significant changes considering the rapid evolution of payment protocols and AI technologies. +Agentic payments are an experimental feature and may change significantly as payment protocols and AI technologies evolve. ::: diff --git a/sources/platform/integrations/ai/x402.md b/sources/platform/integrations/ai/x402.md new file mode 100644 index 0000000000..30c3a9c1d0 --- /dev/null +++ b/sources/platform/integrations/ai/x402.md @@ -0,0 +1,74 @@ +--- +title: Agentic payments with x402 protocol +sidebar_label: x402 +description: Use the x402 protocol to enable AI agents to autonomously pay for Apify Actor runs using USDC on the Base blockchain. +sidebar_position: 19 +slug: /integrations/x402 +--- + +Agentic payments enable AI agents to autonomously run Apify Actors using third-party payment providers, without requiring traditional Apify user accounts. This allows agents to discover, execute, and pay for web scraping and automation tasks independently. + +Apify supports agentic payments through the [x402 protocol](https://www.x402.org/), an open standard for internet-native payments. + +:::caution Experimental feature + +Agentic payments are an experimental feature and may change significantly as payment protocols and AI technologies evolve. + +::: + +## What is x402 + +The [x402 protocol](https://www.x402.org/) is an open standard for internet-native payments. It enables direct on-chain payments using USDC on the [Base](https://www.base.org/) blockchain. + +The Apify MCP server implements an MCP extension of this protocol to support agentic payments. The client automatically detects payment requirements in the tool's metadata and signs a USDC payment on the Base blockchain (mainnet). This payment is included with the tool call - no human intervention needed. + +## Use x402 with Apify MCP server + +The [Apify MCP server](/platform/integrations/mcp) provides the simplest way for agents to access Apify's Actor library using x402 payments. + +### Prerequisites + +- _`mcpc` CLI_ - Install the [`mcpc` CLI](https://github.com/apify/mcp-cli) (`npm install -g @apify/mcpc`), the Universal MCP command-line client. +- _USDC on Base_ - A wallet funded with USDC on the [Base](https://www.base.org/) mainnet blockchain. + +### Setup + +Set up a local wallet and connect to the Apify MCP server with x402 payment support. + +1. Create or import a wallet: + + ```bash + # Create a new wallet (generates a random private key) + mcpc x402 init + + # Or import an existing wallet from a private key + mcpc x402 import + + # Verify your wallet address + mcpc x402 info + ``` + +1. Fund the wallet with USDC on Base mainnet. + +1. Connect to the Apify MCP server with x402 payment mode enabled. Add the `?payment=x402` query parameter to the server URL and pass the `--x402` flag to `mcpc`: + + ```bash + mcpc connect "mcp.apify.com?payment=x402" @apify --x402 + ``` + +1. Call tools as usual. Payments are handled automatically: + + ```bash + mcpc @apify tools-call call-actor actor:="apify/rag-web-browser" input:='{"query": "latest AI news"}' + ``` + +### How it works + +When x402 payment mode is enabled, the agent handles the full payment flow autonomously: + +1. The Apify MCP server advertises payment requirements in each paid tool's metadata. +1. When `mcpc` calls a paid tool, it automatically signs a USDC payment using your local wallet and includes it in the request. +1. The server verifies and settles the payment on-chain, then executes the tool and returns the result. +1. If a tool is called without a payment, the server responds that payment is required and `mcpc` signs and retries automatically. + +The Apify MCP server requires a minimum transaction of $1.00. The server tracks the payment as a balance. Subsequent tool calls draw from this balance without requiring a new on-chain transaction. When the balance runs out, `mcpc` automatically signs a new payment to top it up. After a period of inactivity, the server refunds any remaining unused balance to the client's wallet address on the Base blockchain.