For agents
Every API operation is also an MCP tool. An agent such as Claude Code can use these tools to find the rule that changed a span, write and edit rules, and prepare a commit for you to review.
Connect over MCP
Section titled “Connect over MCP”The server is at https://api.spanslice.com/mcp. It speaks streamable HTTP and takes the same bearer
access token as the API. It’s stateless. Each request stands alone, and there’s no
server-sent event stream.
Claude Code
Section titled “Claude Code”claude mcp add --transport http spanslice https://api.spanslice.com/mcp \ --header "Authorization: Bearer ss_pat_…"claude mcp add stores the token in your Claude Code settings, not in the repository.
Other clients
Section titled “Other clients”Any client that supports streamable HTTP with a custom header can connect with the same URL and header. Most take a config like this:
{ "mcpServers": { "spanslice": { "type": "http", "url": "https://api.spanslice.com/mcp", "headers": { "Authorization": "Bearer ${SPANSLICE_TOKEN}" } } }}If you commit a file like this (such as Claude Code’s .mcp.json), read the token from an environment variable, as
above, rather than writing it in. The server accepts bearer tokens only, not OAuth. A client that adds remote servers only
through OAuth can’t connect directly.
There’s one tool per operation, named by its operationId: getMe, listRules, createRule, and so on. Each tool’s
description is the operation’s description from the reference, plus the role it needs. Its arguments
combine the operation’s path and query parameters with its body fields. Headers become snake_case arguments, so
If-Match is if_match.
Rule conditions and actions make up most of the API’s schema. To keep the tool list short, the rule tools don’t spell
them out. They point the agent to getRuleLanguage instead. That tool returns every condition subject with its operators
and value shapes, every action with its fields, example rules, and the exact JSON Schemas.
Tools carry hints that clients use to decide what to confirm. Every read (get…, list…) is read-only and idempotent.
The table shows the rest:
| Tool | Read-only | Destructive | Idempotent |
|---|---|---|---|
createRule |
no | no | no |
updateRule |
no | no | no |
deleteRule |
no | yes | yes |
setRuleEnabled |
no | no | yes |
reorderRules |
no | no | yes |
commitEnvironment |
no | yes | no |
revertChange |
no | yes | no |
A failed call returns a tool result marked as an error. Its text is the same problem that the API would
send, so the agent can read detail and fix its request.
A workflow that works
Section titled “A workflow that works”The server’s instructions give agents this outline:
getMe, for the token’s organization and role.listProjects, thenlistEnvironments(note which ones haverequires_commit) andlistServices.getRuleLanguage, before writing any rule.listRulesto see what runs. To explain a span, take the keys in itsspanslice.rulesattribute and callgetRulewith each.createRuleorupdateRule, sending theversionit read asif_match.getPendingChangesfor each environment that requires commit. Show the changes to a person.commitEnvironmentwith theworking_versionit reviewed, only once a person has approved it.
Here’s an example prompt:
Health checks from the api service are flooding production. Write a rule that drops them, show me the pending changes for production, and wait for my go-ahead before you commit.
Keep it safe
Section titled “Keep it safe”- Use the lowest role that works. A viewer token can answer questions about rules but change nothing. Writing rules and committing need member. Nothing needs more.
- Pick the right kind of token. Use a personal token for an agent you run yourself. It acts as you, its commits show your name, and it stops working if you leave. Use an organization token for shared automation that shouldn’t depend on one person.
- Set an expiry, and revoke tokens you no longer use under Settings › Access tokens.
- Require commit in production. Then an agent’s edits wait as pending changes, and production keeps running its last
commit. A member token can still commit, though. Either have your client ask before it runs
commitEnvironment(the tool is marked destructive), or review and commit in the app yourself. - Keep tokens out of prompts and repositories. Pass them through your client’s settings or an environment variable.
Without MCP
Section titled “Without MCP”An agent that can make HTTP requests can use the API from the spec alone. The spec is at
https://api.spanslice.com/v1/openapi.json and needs no token. Its descriptions and examples are written to be enough on
their own. Give the agent the token in an environment variable, such as SPANSLICE_TOKEN, and have it send
Authorization: Bearer $SPANSLICE_TOKEN.
For the rest of these docs, llms.txt lists every page, and llms-full.txt has their full
text.