@clawpilot-app/openclaw-media-bridge
v0.1.0
Published
ClawPilot media bridge plugin for OpenClaw
Maintainers
Readme
@clawpilot-app/openclaw-media-bridge
ClawPilot media bridge plugin for OpenClaw.
It lets an OpenClaw agent:
- upload a gateway-local image or file to ClawPilot R2-backed media storage
- get back a stable capability URL
- emit the exact attachment directive that ClawPilot App can render
- fetch a ClawPilot capability URL back to a local temp file when the agent needs bytes
The plugin is intentionally tool-first. It does not hijack Feishu, Discord, Telegram, or any other channel send path.
What This Plugin Registers
- Tool:
clawpilot_media_upload - Tool:
clawpilot_media_fetch - Gateway RPC:
clawpilot_media.status - Skill:
clawpilot-media-bridge
Install
Canonical npm install command:
openclaw plugins install @clawpilot-app/openclaw-media-bridgeLocal archive install is also supported:
openclaw plugins install ./openclaw-media-bridge.tgzAfter installation, restart the gateway.
Config
Add or update the plugin entry in ~/.openclaw/openclaw.json:
{
plugins: {
entries: {
"clawpilot-media-bridge": {
enabled: true,
config: {
serverBaseUrl: "https://api.clawpilot.me",
gatewayClientId: "YOUR_GATEWAY_CLIENT_ID",
mediaBridgeToken: "mbt_xxx",
uploadMaxBytes: 104857600,
downloadHostAllowlist: ["api.clawpilot.me"],
allowedMessageChannels: ["webchat"],
},
},
},
},
}Field notes:
serverBaseUrl: ClawPilot server origin or origin+base-path.gatewayClientId: the gateway client id bound in ClawPilot server.mediaBridgeToken: bearer token issued by ClawPilot server for this gateway.uploadMaxBytes: hard transport cap. Default104857600(100 MB).downloadHostAllowlist: hosts thatclawpilot_media_fetchmay download from.allowedMessageChannels: defaults to["webchat"]so the plugin stays scoped to ClawPilot App style sessions.allowedAgentIds: optional extra guard if you only want this plugin available to a dedicated app agent.
App Onboarding Flow
Recommended product flow:
- User installs the plugin with
openclaw plugins install @clawpilot-app/openclaw-media-bridge - User restarts the gateway
- ClawPilot App calls
clawpilot_media.status - If
hasMediaBridgeTokenis false, the app requests a token from ClawPilot server - The app writes
plugins.entries.clawpilot-media-bridge.config - User restarts the gateway again so the new config takes effect
Model-Facing Usage
This section is written so both humans and agents can understand the intended usage.
Sending a generated image or file back to the user
- Generate or locate a local file path on the gateway host.
- Call
clawpilot_media_upload. - Use the returned
assistantDirectiveverbatim in the final assistant message.
Do not hand-write capability URLs.
Do not hand-write CP_MEDIA_V1 payloads.
The plugin returns:
MEDIA:<url>for imagesCP_MEDIA_V1:<base64url-json>for generic files
Reading a file that came from ClawPilot App
If the user message already contains a ClawPilot capability URL or a CP_MEDIA_V1 block and the agent needs the local bytes, call clawpilot_media_fetch.
That tool downloads the file to a local temp path and returns:
localPathfileNamemimeTypesizeBytes
Tool Reference
clawpilot_media_upload
Purpose:
- Upload a gateway-local file to ClawPilot media storage.
- Return the exact directive line that ClawPilot App understands.
Input:
{
"path": "/tmp/report.pdf",
"kind": "auto",
"fileName": "report.pdf",
"mimeType": "application/pdf"
}Key output fields:
{
"ok": true,
"mediaId": "med_xxx",
"publicId": "mpub_xxx",
"kind": "file",
"capabilityUrl": "https://api.clawpilot.me/api/v1/openclaw/media/f/mpub_xxx?token=...",
"assistantDirective": "CP_MEDIA_V1:...",
"markdownLink": "[report.pdf](https://api.clawpilot.me/api/v1/openclaw/media/f/mpub_xxx?token=...)"
}clawpilot_media_fetch
Purpose:
- Download an allowed ClawPilot capability URL to a temp file on the gateway host.
Input:
{
"capabilityUrl": "https://api.clawpilot.me/api/v1/openclaw/media/f/mpub_xxx?token=...",
"expectedFileName": "report.pdf",
"expectedMimeType": "application/pdf"
}clawpilot_media.status
Purpose:
- Let ClawPilot App detect whether the plugin is installed, enabled, and configured.
Example success payload:
{
"ok": true,
"pluginId": "clawpilot-media-bridge",
"version": "0.1.0",
"enabled": true,
"configured": false,
"hasMediaBridgeToken": false,
"serverBaseUrl": "https://api.clawpilot.me",
"gatewayClientId": null,
"needsRestart": false
}Safety Boundaries
- This plugin does not register a global outbound hook.
- This plugin does not rewrite every
MEDIA:line in every channel. - Runtime checks still require a valid session context and allowed message channel.
- Default scope is
webchat, which is the OpenClaw path most aligned with ClawPilot App usage.
Recommended Agent Policy
For strongest isolation, enable these tools only for your ClawPilot App agent:
clawpilot_media_uploadclawpilot_media_fetch
Do not enable them globally for every channel-facing agent unless that is explicitly what you want.
