New to Crevio’s agentic model? Start with the AI & Agents overview to see how MCP, Tasks, and Events fit together. This page is the MCP surface in depth.
What is MCP?
Model Context Protocol (MCP) is an open standard that gives AI assistants a way to connect to external tools and data sources. Instead of manually writing API calls, an AI agent discovers and invokes your Crevio API through MCP — using natural language.How it works
Traditional MCP servers expose one tool per API endpoint. This works for small APIs, but quickly becomes impractical — each tool definition consumes tokens in the AI model’s context window. At 155 operations across 102 API paths and ~427 tokens per tool, that’s over 66,000 tokens burned before the agent does anything useful. Crevio uses Code Mode — inspired by Cloudflare’s approach — with just two tools:code_search— The agent writes Ruby code to filter and explore the API catalogcode_execute— The agent writes Ruby code to call endpoints, chain requests, and transform results
Connect
The server is available athttps://mcp.crevio.co/mcp over Streamable HTTP transport, authenticated with a Bearer token — the same API token you’d use for REST. Any MCP-compatible client connects: Claude Desktop, Cursor and other AI IDEs, or your own agent built on an MCP SDK. Once connected, the client lists two tools (code_search, code_execute) and the agent uses them to discover and call your API in code.
Connecting
Set up Claude Desktop, Cursor, or any MCP-compatible client.
The two tools
code_search — Discover API endpoints
A read-only, idempotent tool for exploring the Crevio API. Write Ruby code to filter and search the API catalog. A tools method is available that returns all 155 operations (across 102 API paths) as an array of hashes.
Each entry has keys: :method, :path, :summary, :description, :tags, :parameters, and :request_body.
code_execute — Run API operations
Executes Ruby code against the live Crevio API in a sandboxed environment. Available methods:
get(path, **params)— GET requestpost(path, **params)— POST requestpatch(path, **params)— PATCH requestdelete(path, **params)— DELETE request
/v1. Parameters are sent as query params for GET/DELETE and as a JSON body for POST/PATCH.
code_execute tool dispatches requests through the same API controllers as api.crevio.co — all authorization, validation, and rate limiting apply. Responses match the REST API format exactly.
Same API, same conventions
Because MCP runs through the same controllers as REST, the agent must follow the same conventions and gotchas — there are no MCP-specific shortcuts:- Params are unwrapped. Fields go at the top level. A
{ product: { ... } }wrapper is silently dropped — passpost("/products", name: "...", status: "draft"). - Associations are bare names + prefix-id strings. Use
product: "prod_abc123", notproduct_id. (A few schema fields keep an_idsuffix, e.g.site_id,tag_ids— match the field name exactly.) - Creation order matters. A product needs at least one price variant before it can go
active; creating itactivein one call fails with422. Create draft → add price variant(s) →patchstatus toactive. - List vs single. List endpoints return
{ "object": "list", "data": [...], "has_more": ... }; single resources return the object directly. - Money is in cents,
currencyis lowercase ISO ("usd"), and?expand=inlines related resources.
404 resource_missing on a POST/PATCH, it’s almost always a bad or nil association id — not a routing problem.
Example: How an agent handles a request
When you ask “Create a buy-one-get-one discount for my course”, here’s what happens under the hood:Discover relevant endpoints
The agent calls
code_search with Ruby code to find discount and product endpoints:Find the product and create the discount
The agent calls
code_execute to chain everything together in one shot:What’s available
Everything accessible through the REST API is available via MCP:| Category | Operations |
|---|---|
| Account | Retrieve, update |
| Profile | Retrieve your user profile |
| Products | Create, update, delete, list, retrieve |
| Price variants | Create, update, delete, list, retrieve |
| Experiences | List, retrieve (courses, downloads, links) |
| Reviews | Create, update, delete, list, retrieve |
| Blog posts | List, retrieve |
| Blog categories | List, retrieve |
| Legal pages | List, retrieve, update |
| Checkouts | Create, retrieve, update |
| Checkout links | Create, update, delete, list, retrieve |
| Orders | List, retrieve |
| Order items | List, retrieve |
| Refunds | Create, list, retrieve |
| Invoices | Create, list, retrieve, void |
| Subscriptions | List, retrieve, cancel, pause, resume |
| Customers | Create, update, delete, list, retrieve, tag |
| Tags | Create, update, delete, list, retrieve |
| Discounts | Create, update, delete, list, retrieve |
| Socials | Manage connected accounts, posts, comments, and analytics |
| Forms | Create, update, delete, list, retrieve, archive, restore |
| Form submissions | List, create, retrieve |
| Tasks | Create, update, delete, list, retrieve |
| Task runs | List, retrieve, update |
| Event sources | List, create, delete, retrieve, discover available |
| Events | List subscribable events |
| Formations | Create, list, retrieve, submit, retry payment |
| Formation documents | List, retrieve |
| AI sites | Create, update, delete, list, retrieve |
| Files | Create, list, retrieve, delete, confirm upload |
| Emails | Send |
| Webhook endpoints | Create, update, delete, list, retrieve, test |
| Webhook events | List, retrieve |
Security
The code execution environment runs in a sandboxed BasicObject clean room — the agent cannot access the filesystem, network, environment variables, or Ruby’s standard library. Only safe operations (arrays, hashes, strings, iteration) and the API dispatch methods are available. A 5-second timeout prevents runaway executions. All operations run within your account’s tenant boundary — the same multi-tenant isolation as the REST API. The MCP server dispatches requests through the same API controllers asapi.crevio.co. No special code paths — the agent gets the same behavior, validation, and error messages as direct API calls.
Next steps
Connecting
Set up Claude Desktop, Cursor, or any MCP-compatible client.
AI & Agents overview
How MCP, Tasks, and Events form Crevio’s agentic model.
Tasks (your AI workforce)
Turn the agent into a scheduled, autonomous workforce.
API conventions
The shapes, prefixes, and gotchas every call shares.

