MCP Server
Connect AI agents to the Sawvant cutting optimization engine via the Model Context Protocol.
Overview
Sawvant exposes a hosted MCP server at mcp.sawvant.com that lets AI agents submit cutting optimization jobs, check status, and retrieve results. Works with Claude, Cursor, Windsurf, and any MCP-compatible client.
Tools
The MCP server exposes four tools.
authenticate
Authenticate via a two-phase device authorization flow (RFC 8628). No API key needed upfront.
Phase 1 — call with no arguments. Returns a URL, a user code (formatted XXXX-XXXX), and a device_code. Open the URL in your browser, sign in to your Sawvant account, and approve access.
Phase 2 — call again with the device_code from Phase 1. Polls until the user approves, then returns an oat_ access token valid for 24 hours. Use this token as the api_key parameter on subsequent tool calls.
| Parameter | Type | Required | Description |
|---|---|---|---|
device_code | string | no | Device code from a previous call. Omit to start a new flow. |
optimize_cutting
Submit a cutting optimization job. Accepts parts, sheets, machine constraints, and optional cost tariffs. Polls internally until the result is ready (typically under 2 seconds for fast strategy).
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Your Sawvant API key (sk_...) or access token (oat_...) from the device flow. |
strategy | string | no | "fast" (default, ~100ms) or "thorough" (~1-5s, requires Pro+). |
parts | array | yes | Parts to cut. Each: {"id": "P1", "length": 800, "width": 400, "quantity": 5, "grain": "none"}. All five fields required. Dimensions in mm. Max 5,000 parts. |
sheets | array | yes | Stock sheets. Each: {"id": "S1", "length": 2800, "width": 2070, "quantity": 0, "grain": "none"}. All five fields required. quantity=0 means unlimited. Max 100 types. |
machine | object | yes | {"blade_thickness": 4.0, "max_levels": 3, "cut_direction": "default"}. Kerf in mm, levels 1-3, direction one of default, rip, cross. |
cost_tariffs | object | no | {"setup_cost": 10, "cost_per_meter": 0.5}. Adds cost breakdown to result. Requires Pro+. |
Returns the full optimization result: sheet layouts with coordinates, yield percentage, and cost breakdown.
check_job
Check the status of a running job.
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Your Sawvant API key (sk_...) or access token (oat_...) from the device flow. |
job_id | string | yes | Job ID (UUID) from optimize_cutting. |
Returns status, progress percentage, current best yield, and processing phase.
get_result
Retrieve the full result of a completed job.
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | string | yes | Your Sawvant API key (sk_...) or access token (oat_...) from the device flow. |
job_id | string | yes | Job ID (UUID). |
Returns the complete optimization result with sheet layouts and metrics.
Authentication
Two methods are supported. Both sk_ (API keys) and oat_ (device flow tokens) are accepted wherever authentication is required.
Option A: Device flow (recommended for Claude Code)
No config needed beyond the server URL. The agent handles authentication interactively on the first tool call.
{
"mcpServers": {
"sawvant": {
"type": "http",
"url": "https://mcp.sawvant.com/mcp"
}
}
}On first use, the agent calls authenticate, prompts you to open a URL, and retrieves a token after you approve in your browser. The token is valid for 24 hours.
Option B: Static API key
If you already have an API key from the Sawvant dashboard, pass it as a Bearer header:
{
"mcpServers": {
"sawvant": {
"type": "http",
"url": "https://mcp.sawvant.com/mcp",
"headers": {
"Authorization": "Bearer sk_your_api_key"
}
}
}
}Rate limits and tier restrictions apply the same as the REST API.
Setup
Claude Code / Claude Desktop
Add to your MCP config (.claude/mcp.json or Claude Desktop settings).
Device flow (no credentials in config):
{
"mcpServers": {
"sawvant": {
"type": "http",
"url": "https://mcp.sawvant.com/mcp"
}
}
}Static API key:
{
"mcpServers": {
"sawvant": {
"type": "http",
"url": "https://mcp.sawvant.com/mcp",
"headers": {
"Authorization": "Bearer sk_your_api_key"
}
}
}
}Cursor / Windsurf
Use the HTTP endpoint https://mcp.sawvant.com/mcp. For static key auth, pass your API key as a Bearer token in the Authorization header. For device flow, omit the header and authenticate on first use. Refer to your client's MCP configuration docs for the exact format.
Example
Using Claude Code with the MCP server configured:
Optimize cutting for 20 shelves (600x400mm) and 8 brackets (300x200mm) on 2440x1220mm sheets.
If using device flow, the agent calls authenticate first and prompts you to approve access in your browser. After that, the token is cached for subsequent calls.
The agent then calls optimize_cutting with the parts and sheets, waits for the result, and returns the optimized layout with yield percentage and sheet count.