From d0bce738c97384d6e358cc62dd32e0987db89eea Mon Sep 17 00:00:00 2001 From: Parv Ahuja <17094219+parvahuja@users.noreply.github.com> Date: Mon, 6 Jul 2026 10:10:32 -0400 Subject: [PATCH 1/3] docs: add OpenClaw partner integration guide --- src/pages.gen.ts | 1 + src/pages/partner-integrations/openclaw.mdx | 100 ++++++++++++++++++++ vocs.config.ts | 4 + 3 files changed, 105 insertions(+) create mode 100644 src/pages/partner-integrations/openclaw.mdx diff --git a/src/pages.gen.ts b/src/pages.gen.ts index 0bc6c87d..08eaa170 100644 --- a/src/pages.gen.ts +++ b/src/pages.gen.ts @@ -45,6 +45,7 @@ type Page = | { path: '/overview'; render: 'static' } | { path: '/partner-integrations/cloudflare-agents'; render: 'static' } | { path: '/partner-integrations/mcp-sdk'; render: 'static' } + | { path: '/partner-integrations/openclaw'; render: 'static' } | { path: '/partner-integrations/vercel-ai-sdk'; render: 'static' } | { path: '/payment-methods/card/charge'; render: 'static' } | { path: '/payment-methods/card'; render: 'static' } diff --git a/src/pages/partner-integrations/openclaw.mdx b/src/pages/partner-integrations/openclaw.mdx new file mode 100644 index 00000000..8a88aa82 --- /dev/null +++ b/src/pages/partner-integrations/openclaw.mdx @@ -0,0 +1,100 @@ +--- +description: "Use MPP with OpenClaw." +--- + +# OpenClaw + +Use [`Mppx.create`](/sdk/typescript/client/Mppx.create) from an [OpenClaw plugin](https://docs.openclaw.ai/plugins/building-plugins) to make plugin-owned HTTP requests and MCP tool calls payment-aware. Free calls pass through untouched; when a paid tool or a 402-protected request returns an MPP Challenge, `mppx` creates a Credential, retries the call, and returns the result. + +```bash [terminal] +$ pnpm add mppx viem openclaw typebox @modelcontextprotocol/sdk +``` + +```ts [payments.ts] +import { Mppx, tempo } from 'mppx/client' +import { privateKeyToAccount } from 'viem/accounts' + +const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`) + +export const mppx = Mppx.create({ + methods: [tempo({ account })], +}) +``` + +## Pay for HTTP requests + +Register the plugin on startup, then use the payment-aware fetch for HTTP calls your plugin owns. + +```ts [index.ts] +import { definePluginEntry } from 'openclaw/plugin-sdk/plugin-entry' +import { Type } from 'typebox' +import { mppx } from './payments' + +export default definePluginEntry({ + id: 'mpp-payments', + name: 'MPP Payments', + description: 'Adds payment-aware OpenClaw tools.', + register(api) { + api.registerTool({ + name: 'paid_ping', + description: 'Call a paid MPP HTTP endpoint.', + parameters: Type.Object({}), + async execute() { + const response = await mppx.fetch('https://mpp.dev/api/ping/paid') + return { + content: [{ type: 'text', text: JSON.stringify(await response.json()) }], + } + }, + }) + }, +}) +``` + +## Pay for MCP tools + +For paid MCP tools, create the MCP client inside the plugin and pass the same payment-aware fetch to the Streamable HTTP transport. + +```ts [mcp.ts] +import { Client } from '@modelcontextprotocol/sdk/client/index.js' +import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js' +import { mppx } from './payments' + +const client = new Client({ + name: 'openclaw-mpp', + version: '1.0.0', +}) + +await client.connect( + new StreamableHTTPClientTransport(new URL(''), { + fetch: mppx.fetch, + }), +) + +const result = await client.callTool({ + name: 'premium_search', + arguments: { query: 'tempo' }, +}) + +console.log(result) +``` + +OpenClaw-managed MCP servers configured through `openclaw mcp` currently use OpenClaw's own guarded HTTP fetch. Until OpenClaw exposes a fetch override for that registry, use the plugin-owned MCP client pattern above for paid MCP tools. + +## Manage agent spend + +The examples above use a standard viem account. For long-running apps or agents, use scoped access keys when the runtime should pay in the background with spending limits, call scopes, recipient restrictions, and independent revocation. + +Create the access key first, then pass the Tempo account into the same setup. + +```ts [payments.ts] +export const mppx = Mppx.create({ + methods: [ + tempo({ + account: provider.getAccount(), + ...provider.getMppxParameters({ accessKey }), + }), + ], +}) +``` + +See [Managing agent spend](/guides/managing-agent-spend) for limits, scopes, recipients, and revocation. diff --git a/vocs.config.ts b/vocs.config.ts index 45542d1b..ad5888a3 100644 --- a/vocs.config.ts +++ b/vocs.config.ts @@ -299,6 +299,10 @@ export default defineConfig({ text: "Official MCP SDK", link: "/partner-integrations/mcp-sdk", }, + { + text: "OpenClaw", + link: "/partner-integrations/openclaw", + }, { text: "Vercel AI SDK", link: "/partner-integrations/vercel-ai-sdk", From 735b9d793543daf882909410dac28836d3cd77e7 Mon Sep 17 00:00:00 2001 From: Parv Ahuja <17094219+parvahuja@users.noreply.github.com> Date: Mon, 6 Jul 2026 12:22:39 -0400 Subject: [PATCH 2/3] docs: update OpenClaw partner integration --- src/pages/partner-integrations/openclaw.mdx | 98 +++++---------------- 1 file changed, 23 insertions(+), 75 deletions(-) diff --git a/src/pages/partner-integrations/openclaw.mdx b/src/pages/partner-integrations/openclaw.mdx index 8a88aa82..55d3a81e 100644 --- a/src/pages/partner-integrations/openclaw.mdx +++ b/src/pages/partner-integrations/openclaw.mdx @@ -4,97 +4,45 @@ description: "Use MPP with OpenClaw." # OpenClaw -Use [`Mppx.create`](/sdk/typescript/client/Mppx.create) from an [OpenClaw plugin](https://docs.openclaw.ai/plugins/building-plugins) to make plugin-owned HTTP requests and MCP tool calls payment-aware. Free calls pass through untouched; when a paid tool or a 402-protected request returns an MPP Challenge, `mppx` creates a Credential, retries the call, and returns the result. +Use the official MPP plugin to make OpenClaw HTTP requests payment-aware. Free calls pass through untouched; when a 402-protected request returns an MPP or [x402](/guides/use-mpp-with-x402) Challenge, `mppx` creates a Credential, retries the call, and returns the result. ```bash [terminal] -$ pnpm add mppx viem openclaw typebox @modelcontextprotocol/sdk +$ openclaw plugins install clawhub:@tempoxyz/openclaw-mpp +$ openclaw plugins enable mpp ``` -```ts [payments.ts] -import { Mppx, tempo } from 'mppx/client' -import { privateKeyToAccount } from 'viem/accounts' +## Set up payments -const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`) +Configure the payment account and the origins OpenClaw is allowed to pay. -export const mppx = Mppx.create({ - methods: [tempo({ account })], -}) -``` - -## Pay for HTTP requests - -Register the plugin on startup, then use the payment-aware fetch for HTTP calls your plugin owns. - -```ts [index.ts] -import { definePluginEntry } from 'openclaw/plugin-sdk/plugin-entry' -import { Type } from 'typebox' -import { mppx } from './payments' - -export default definePluginEntry({ - id: 'mpp-payments', - name: 'MPP Payments', - description: 'Adds payment-aware OpenClaw tools.', - register(api) { - api.registerTool({ - name: 'paid_ping', - description: 'Call a paid MPP HTTP endpoint.', - parameters: Type.Object({}), - async execute() { - const response = await mppx.fetch('https://mpp.dev/api/ping/paid') - return { - content: [{ type: 'text', text: JSON.stringify(await response.json()) }], - } +```json5 [openclaw.json] +{ + plugins: { + entries: { + mpp: { + enabled: true, + config: { + privateKey: "0x...", + allowedOrigins: ["https://mpp.dev"], + }, }, - }) + }, }, -}) +} ``` -## Pay for MCP tools - -For paid MCP tools, create the MCP client inside the plugin and pass the same payment-aware fetch to the Streamable HTTP transport. - -```ts [mcp.ts] -import { Client } from '@modelcontextprotocol/sdk/client/index.js' -import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js' -import { mppx } from './payments' - -const client = new Client({ - name: 'openclaw-mpp', - version: '1.0.0', -}) - -await client.connect( - new StreamableHTTPClientTransport(new URL(''), { - fetch: mppx.fetch, - }), -) +## Pay for HTTP requests -const result = await client.callTool({ - name: 'premium_search', - arguments: { query: 'tempo' }, -}) +Restart the gateway after changing plugin config. -console.log(result) +```bash [terminal] +$ openclaw gateway restart ``` -OpenClaw-managed MCP servers configured through `openclaw mcp` currently use OpenClaw's own guarded HTTP fetch. Until OpenClaw exposes a fetch override for that registry, use the plugin-owned MCP client pattern above for paid MCP tools. +After the plugin loads, OpenClaw code in the gateway process that uses `fetch` can call free and paid HTTP endpoints through the same path. The plugin also exposes an `mpp_fetch` tool for requests that should explicitly use the payment-aware fetch. ## Manage agent spend -The examples above use a standard viem account. For long-running apps or agents, use scoped access keys when the runtime should pay in the background with spending limits, call scopes, recipient restrictions, and independent revocation. - -Create the access key first, then pass the Tempo account into the same setup. - -```ts [payments.ts] -export const mppx = Mppx.create({ - methods: [ - tempo({ - account: provider.getAccount(), - ...provider.getMppxParameters({ accessKey }), - }), - ], -}) -``` +The example above uses a raw payment key. For long-running apps or agents, use scoped access keys when the runtime should pay in the background with spending limits, call scopes, recipient restrictions, and independent revocation. See [Managing agent spend](/guides/managing-agent-spend) for limits, scopes, recipients, and revocation. From c7d04f3c39d7782a1be8a1e99122e814ef671bcb Mon Sep 17 00:00:00 2001 From: Parv Ahuja <17094219+parvahuja@users.noreply.github.com> Date: Mon, 6 Jul 2026 12:47:50 -0400 Subject: [PATCH 3/3] docs: update OpenClaw plugin setup --- src/pages/partner-integrations/openclaw.mdx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/pages/partner-integrations/openclaw.mdx b/src/pages/partner-integrations/openclaw.mdx index 55d3a81e..075a3cf4 100644 --- a/src/pages/partner-integrations/openclaw.mdx +++ b/src/pages/partner-integrations/openclaw.mdx @@ -13,16 +13,20 @@ $ openclaw plugins enable mpp ## Set up payments -Configure the payment account and the origins OpenClaw is allowed to pay. +Set `TEMPO_PRIVATE_KEY` in the OpenClaw gateway environment, then restart the gateway. + +```bash [terminal] +$ TEMPO_PRIVATE_KEY=0x... openclaw gateway run +``` + +By default, the plugin can pay any origin. Add `allowedOrigins` when an OpenClaw runtime should only pay specific origins. ```json5 [openclaw.json] { plugins: { entries: { mpp: { - enabled: true, config: { - privateKey: "0x...", allowedOrigins: ["https://mpp.dev"], }, }, @@ -33,12 +37,6 @@ Configure the payment account and the origins OpenClaw is allowed to pay. ## Pay for HTTP requests -Restart the gateway after changing plugin config. - -```bash [terminal] -$ openclaw gateway restart -``` - After the plugin loads, OpenClaw code in the gateway process that uses `fetch` can call free and paid HTTP endpoints through the same path. The plugin also exposes an `mpp_fetch` tool for requests that should explicitly use the payment-aware fetch. ## Manage agent spend