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 67 operations across 44 API paths and ~427 tokens per tool, that’s over 28,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
Base URL
POST endpoint that accepts JSON-RPC requests and returns JSON-RPC responses.
Authentication
All MCP requests require a Bearer token in theAuthorization header. Use the same API tokens from your Developer settings.
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 67 operations (across 44 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.
Connecting to Claude Desktop
Add this to your Claude Desktop configuration file (claude_desktop_config.json):
“List all my products and their prices” “Create a 20% discount code called SUMMER20 that expires next month” “Who are my top 5 customers by order count?”
Connecting to Cursor
In Cursor, go to Settings > MCP Servers and add a new server:- Name: Crevio
- Type: Streamable HTTP
- URL:
https://mcp.crevio.co/mcp - Headers:
Authorization: Bearer YOUR_API_TOKEN
Other MCP clients
Any MCP-compatible client that supports Streamable HTTP transport can connect. The server implements the standard MCP specification with JSON-RPC over HTTP.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 account details |
| Products | Create, update, delete, list, retrieve |
| Price variants | Create, update, list, retrieve |
| Orders | List, retrieve |
| Order items | Retrieve |
| Refunds | Create, list, retrieve |
| Customers | List, create, update, retrieve |
| Subscriptions | List, retrieve, cancel, pause, resume |
| Checkouts | Create, retrieve, update |
| Carts | Create, retrieve, update, delete |
| Discounts | Create, update, delete, list, retrieve |
| Checkout links | Create, update, delete, list, retrieve |
| Experiences | List, retrieve |
| Blog posts | List, retrieve |
| Invoices | Create, list, retrieve, void, pay |
| Reviews | List, retrieve |
| Files | Create, list, retrieve, delete, confirm upload |
| Emails | Send |
| Webhook endpoints | Create, update, delete, list, retrieve, test |
| Webhook events | List, retrieve |
| x402 | Get and update configuration |
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.
