Docs / MCP Support

MCP Support

Use Chargly through a lightweight MCP server to check balances, meter AI actions, and create credit top-ups from agent-native workflows.

Why use MCP with Chargly

Integrate with MCP-aware tools and runtimes. Expose billing as standard agent tools. Avoid rebuilding billing logic in each agent workflow.

MVP MCP tools

Initial tool surface

Chargly's first MCP release focuses on wallet lookups, event metering, and top-ups.

chargly.get_wallet

Fetch the current wallet balance for a customer.

Input

customerId · required

Output

customerId walletId balance unit
chargly.meter_event

Record a billable AI action and deduct credits.

Input

customerId event credits · required
metadata · optional

Output

success eventId deductedCredits remainingBalance
chargly.create_checkout

Create a Stripe checkout session for a credit top-up. Uses Stripe for payment processing.

Input

customerId creditPackId · required
successUrl cancelUrl · optional

Output

checkoutId checkoutUrl credits
chargly.list_credit_packs

Return available credit packs for purchase.

Input

None for MVP

Output

List of pack objects with id, name, credits, price
pack_500
500 credits · $10

Pricing Advisor tools

MCP can inspect and apply Pricing Advisor recommendations. See Pricing Advisor MCP for when and how agents use these tools. Agents can fetch pricing rules, list recommendations, explain why a change was suggested, and apply or reject it — all through tools.

chargly.get_pricing_ruleFetch a pricing rule by feature or ID.
chargly.list_pricing_recommendationsList recommendations for your project.
chargly.get_pricing_recommendationGet a single recommendation by ID.
chargly.explain_pricing_recommendationGet the reason and confidence for a recommendation.
chargly.apply_pricing_recommendationApply a recommendation (creates new immutable version).
chargly.reject_pricing_recommendationReject a recommendation (preserves audit history).

Example workflow

  1. 1Call chargly.get_wallet
  2. 2If balance is sufficient, call chargly.meter_event
  3. 3If balance is low, call chargly.list_credit_packs
  4. 4Call chargly.create_checkout

SDK vs MCP

Use the SDK for direct app integration. Use MCP for agent-native tool integrations. Both map to the same Chargly billing primitives.

MVP scope note

The initial MCP surface focuses only on wallet lookups, event metering, checkout creation, and credit pack listing. Admin or analytics tools are not included yet.

Implementation note

The MCP server maps to the same core Chargly billing primitives used by the SDK and API.

Next