How It Works
- Confirm configuration source:
STATESET_APP_CONFIG_JSON,APP_CONFIG_PATH, orconfig/app_config.json. - Start the server or verify an existing instance.
- Check health and API docs before invoking workflows.
- Use tenant-scoped REST, CLI, or MCP calls with tenant auth.
- For writes, use idempotency keys and explicit confirmation where the surface supports it.
- After syncs, inspect jobs, webhook events, audit logs, and reconciliation/commerce ops views.
Status Flows
- Server: configured -> starting -> healthy | degraded | failed
- Sync Job: queued -> running -> succeeded | retrying | failed | dead_lettered
- Webhook: received -> validated -> persisted -> processed | retrying | failed
- MCP Tool: discovered -> validated -> confirmed -> executed -> audited
Usage
- Local server:
cargo runorstateset-sync-server - Healthcheck:
stateset-sync-server --healthcheck - API docs:
GET /docs/orGET /api-docs/openapi.jsonon your server - REST base path:
/v1/tenants/{tenant_id}/... - MCP smoke test:
stateset-sync-server mcp-test --url <url> --tenant <tenant_id> --api-key <key> - MCP stdio:
stateset-sync-server mcp-stdio --tenant <tenant_id> - CLI:
stateset-sync --help
Permissions
- Read: health, docs, list/get orders, list jobs, inventory reads, plan tiers, MCP
tools/list, MCP resources. - Write: create/update orders, trigger syncs, replay webhooks, inventory reservations, custom MCP tools.
- Admin: platform diagnostics, tenant policy, audit logs, operator-safe dashboard routes.
Idempotency-Key header when available and should not be retried blindly after a timeout without checking job or idempotency state.
Examples
Output
Present Results to User
- Server URL, tenant ID, and config source used.
- Health/readiness result and any degraded dependency.
- Auth method used: tenant API key, JWT, CLI token, or admin key.
- For syncs: job ID, state, retry count, failures, and next inspection endpoint.
- For MCP: tool name, params, confirmation/dry-run status, and response
_meta. - Exact command or endpoint for the next step.
Troubleshooting
- Config missing: set
APP_CONFIG_PATHorSTATESET_APP_CONFIG_JSON. - Auth rejected: verify tenant ID,
x-stateset-api-key, JWT claims, or CLI token. - Metrics protected: set
STATESET_METRICS_AUTH_TOKENand passAuthorization: Bearer. - Sync stuck: inspect
/v1/tenants/{tenant_id}/jobs, DLQ, and webhook events. - Shopify inventory mismatch: verify the fulfillment integration’s
shopify_inventory_location_idand the Shopify locations it maps to. - MCP mismatch: run
mcp-test, then compare tool schemas fromtools/list.
Error Codes
tenant_not_found: Tenant ID is not configured.unauthorized: Missing or invalid tenant authentication.missing_integration: Tenant lacks the requested connector.rate_limit_exceeded: Retry after the providedRetry-Aftervalue.idempotency_conflict: Same key was reused with a different request fingerprint.
Further reading
- Sync Server MCP — the 186-tool registry and four transports
- Sync Server connectors
- Sync Server troubleshooting