Set up with a coding agent
Coding agents such as Claude Code and Cursor can reach Runledger through two MCP servers. The developer server is for setting up and debugging an integration, and agent-led setup is its main job: an agent in your repo configures the sandbox, checks it, and proposes the live changes for you to approve. It changes the sandbox directly and never changes live billing.
Before you start
- A coding agent that supports MCP over HTTP.
- A Runledger account, where you sign in when the agent first connects. Read Access, actors and audit if you plan to give the agent a restricted key.
The docs server comes with the docs site. Every page is also available as Markdown, and the site serves llms.txt and llms-full.txt.
Connect
On first use, the server asks you to sign in to Runledger in the browser and approve what the agent may do. Clients without browser sign-in can send a restricted or agent key (rl_rk_test_...) as a bearer token; a secret key is refused with 401. A key reaches only its own environment, so a sandbox key reads and writes the sandbox, and proposing a live change takes a second connection with a live agent key that holds config:propose. An Admin can create an agent key in the dashboard, and a Collaborator can create one for the sandbox with a preset of scopes and an expiry; the key is marked agent: true, and everything it changes is recorded as made by an agent. The server refuses live keys for writes.
What an agent does with it
The server’s instructions name these steps in order, so the agent doesn’t have to infer them:
- Read.
get_configshows what is configured, the clock presets and the keys the agent holds. - Ask you. The agent asks you to confirm the confirmation window, the reversal horizon and the dispute decision window. It isn’t meant to guess them.
- Validate.
validate_configreturns the changes a configuration would make and any warnings. The agent shows you each warning. - Apply.
apply_configwrites the sandbox, andconnect_payment_providerconnects a provider’s test mode. - Exercise.
preview_event,create_test_customer,set_test_limits,run_scenarioandadvance_test_clockrun the setup through its clocks, andget_usage_summaryshows what a customer’s meters would read. - Check.
check_integrationlists what a live integration is still missing. - Propose. For live,
propose_live_config, called through a connection with a live agent key, sends the change to you with a link to the diff.
The search_provider_catalog, get_cost_catalog and simulate_pricing tools, and the pricing block on preview_event, belong to pricing from cost. There the agent matches the models your code calls to the provider price catalog and drafts cost models and price rules. You supply any negotiated or self-hosted rates that aren’t in the catalog and confirm the markup, the floor and whether a guardrail may block, and live changes are proposals as above.
Tools
Each tool calls the public API, so anything an agent does here you can also do with the SDKs. Every tool declares input and output schemas, and is marked read-only or not so your agent can ask before it writes. That is twenty-two tools, including three for pricing from cost and two for usage windows and spend limits.
Scopes
An agent’s key or session carries scopes. A tool that needs a scope the agent lacks fails with insufficient_scope and says which scope it needed, so the agent can ask you to widen the grant. The tools above need:
Reversing a charge and deciding a dispute need charges:write and disputes:resolve. Those are never part of an agent preset and no tool here uses them. Removing a payment provider is DELETE /v1/payment_providers/{id} in the API, and there is no tool for it. Only an Admin can remove a live provider.
Safety
- The sandbox is where agents write. With the right scopes an agent applies configuration directly, and each write records the client’s name and the person it acts for.
- Live changes need a person.
propose_live_configreturns a proposal with a diff and areview_url. An Admin approves it in the dashboard, and the approver is recorded asapproved_byin the audit log. Proposals expire after 7 days. Reading live configuration is allowed with a read scope. - Secrets stay out of the chat. Agents never create or roll keys and never receive live provider credentials. Connecting a live provider, which isn’t open yet, will be a link a person opens and an Admin confirms in the dashboard, and a live webhook secret is shown only in the dashboard.
- Tool results can contain text your end customers wrote, such as dispute descriptions and evidence. Runledger sanitizes it, but your agent should still treat it as data, never as instructions.
- Every tool call is recorded in your request logs with the agent named, and every configuration change in the audit log.
No tool on this server writes live data except propose_live_config, and that only proposes. Tools that move money in live, such as approving a reversal, are not offered to agents. An agent key can still hold spend_limits:write or auto_top_up:write and call the API directly, within the limits described in Access, actors and audit. Allowances, pools and operator spend limits are configuration, so an agent sets them up the same way as plans: validate_config, apply_config in the sandbox, then propose_live_config. Exporting and importing a whole configuration is GET and PUT /v1/config in the API; there are no MCP tools for it.
Next steps
- Configuration describes the document an agent validates, applies and proposes.
- Access, actors and audit lists the scopes an agent key can hold.
- Going live uses
check_integrationto list what is missing.