Skip to content

Call third-party APIs from your Worker with typed bindings

capa turns an OpenAPI spec into a Cloudflare service binding. Call it from your Worker, or let your agent call it through one MCP server. Every call returns the response and an evidence record.

Call Stripe from any Worker
const { result, evidence } =
  await env.STRIPE.paymentIntents.create({
    amount: 2500,
    currency: "usd",
  });

console.log(result.id, evidence.act.status, evidence.verdict);
pi_... 200 pass
  1. 1

    The provider publishes a spec

    POST /v1/payment_intents
  2. 2

    capa generates a typed method

    paymentIntents.create(body)
  3. 3

    You deploy it to your account

    cf deploy
  4. 4

    Your Worker or your agent calls it

    env.STRIPE.paymentIntents.create(…)

When the provider changes the spec, a weekly job regenerates the binding and opens a pull request.

The evidence record says what capa sent, what came back, and which checks passed. Log it, show it, or ignore it.

{
operationId: "PostPaymentIntents",
act: {
request: { method: "POST", url: "https://api.stripe.com/v1/payment_intents" },
status: 200,
},
assert: [{ kind: "httpStatus", expected: "2xx", actual: 200, passed: true }],
verdict: "pass",
}

From your Worker

Bind the capability and call typed methods. The API key stays in the capability Worker.

src/index.ts
const { result, evidence } =
await env.STRIPE.paymentIntents.create({
amount: 2500,
currency: “usd”,
});
Tutorial

From your agent

Connect Claude or Cursor to capa-gateway. The agent writes code that runs in a sandbox with no network access. The sandbox calls the capability through the gateway, which adds your key from your vault.

MCP tool: execute
const me = await capa.github.user.list();
return me.result.login;
Use capa from an agent

Deploy a capability from the catalog, set its key, then bind it from your Worker.

Terminal window
cd capabilities/stripe
cf migrate && cf deploy
cf workers secrets update STRIPE_API_KEY --worker capa-stripe --type secret_text
cloudflare.config.ts
env: {
STRIPE: bindings.worker({ worker: "capa-stripe", exportName: "StripeCapability" }),
}

Using Wrangler? The tutorial shows both.

Capabilities
16
Operations
6,325
Namespaces
570
  • github

    Repos, issues, pull requests, Actions, releases, and org workflows.

    Operations
    1,230
    Auth
    Bearer
    Entrypoint
    GithubCapability
  • kubernetes

    Core Kubernetes resources and cluster APIs exposed through one generated binding.

    Operations
    1,190
    Auth
    Bearer
    Entrypoint
    KubernetesCapability
  • gitlab

    Projects, MRs, pipelines: across the entire GitLab API.

    Operations
    1,072
    Auth
    Private-Token
    Entrypoint
    GitlabCapability
  • jira

    Issues, boards, sprints: JSRPC over Jira Cloud REST v3.

    Operations
    602
    Auth
    Basic
    Entrypoint
    JiraCapability
  • stripe

    Charges, customers, and subscriptions without hand-writing a Stripe wrapper.

    Operations
    559
    Auth
    Bearer
    Entrypoint
    StripeCapability
  • box

    Files, folders, collaboration, and metadata from the Box Platform API.

    Operations
    295
    Auth
    Bearer
    Entrypoint
    BoxCapability
  • discord

    Applications, guilds, channels, messages, and webhooks from Discord HTTP API v10.

    Operations
    246
    Auth
    Bearer
    Entrypoint
    DiscordCapability
  • sentry

    Organizations, projects, issues, events, releases, and alerts from Sentry.

    Operations
    245
    Auth
    Bearer
    Entrypoint
    SentryCapability
  • twilio

    Accounts, phone numbers, calls, messages, recordings, and Twilio REST resources.

    Operations
    197
    Auth
    Basic
    Entrypoint
    TwilioCapability
  • slack

    Channels, chat, users, files, admin endpoints, and Slack Web API workflows.

    Operations
    174
    Auth
    Bearer
    Entrypoint
    SlackCapability
  • zoom

    Meetings, webinars, recordings, users, reports, and Zoom account operations.

    Operations
    155
    Auth
    Bearer
    Entrypoint
    ZoomCapability
  • twitch

    Twitch Helix channels, streams, clips, chat, moderation, and creator workflows.

    Operations
    149
    Auth
    Bearer
    Entrypoint
    TwitchCapability
  • blooio

    Send iMessage from anywhere: chats, messages, contacts, groups, FaceTime, and webhooks.

    Operations
    58
    Auth
    Bearer
    Entrypoint
    BlooioCapability
  • twilio-messaging

    Messaging Services, senders, compliance registrations, and delivery controls.

    Operations
    58
    Auth
    Basic
    Entrypoint
    TwilioMessagingCapability
  • twilio-verify

    Verification services, factors, templates, rate limits, and fraud-safe flows.

    Operations
    57
    Auth
    Basic
    Entrypoint
    TwilioVerifyCapability
  • htmlcsstoimage

    Render HTML/CSS or URLs to PNG, JPG, WebP, or PDF: images, templates, OG configs, and storage.

    Operations
    38
    Auth
    Basic
    Entrypoint
    HtmlcsstoimageCapability

To add an API, run the codegen against its spec. Keep the result in your account, or open a pull request to add it here.