Beta — Agent API + MCP
Agent API for Customer Profitability Analysis
Build AI agents that find unprofitable customers, model recovery scenarios, and trigger actions — programmatically. REST API, MCP server, and webhook events on Growth tier.
Built on profit curve methodology — or estimate your profit drag first.
MCP server available to Growth subscribers now. Production-stable REST API; MCP for early adopters.
How It Works
Connect your AI agent to Margin Levers in three steps.
Connect via MCP or REST
Add mcp.marginlevers.com to your agent config, or use /api/v1 with a Bearer token.
Measure Recovery
Agent surfaces real recovered profit — not just analysis.
Use REST API if...
You want stability, a standard HTTP client, and don't need AI-native tool discovery. Production-ready today.
Use MCP if...
You're building with Cursor, Claude, or another AI assistant that supports MCP natively. Zero glue code for tool discovery.
From Monthly Review to Always-On Margin Intelligence
Before: your finance lead pulls a profitability report once a month. After: your AI agent monitors, models, and tracks — continuously.
Always-On Profit Monitoring
Your agent calls analyze on a schedule. When a customer flips unprofitable, it alerts you before your next board meeting — not after.
Pre-Commit Scenario Modeling
Before you reprice or restructure a contract, your agent runs runScenario and returns the P&L impact. Decisions backed by data, not instinct.
Closed-Loop Outcome Tracking
Agent records actions taken, then re-runs analysis 30 days later. You see exactly how much margin was recovered — not just identified.
6 API Tools
Every tool is available via REST API and MCP. Call them individually or chain them in a single agent turn.
analyze
Run a full profitability analysis on customer data. Returns A-F segments, profit curve, and key metrics.
getAnalyses
List saved analyses with filtering by date, segment count, and status.
getInsights
Generate AI executive summaries, action plans, or segment deep-dives for any analysis.
runScenario
Model repricing or restructuring scenarios. See P&L impact before you commit.
getBenchmarks
Compare your metrics against anonymized industry benchmarks.
generateBoardDeck
Produce a board-ready PDF with profitability analysis, trends, and recommended actions.
What's Included on Growth
Scoped API Keys
Issue read or write keys per integration. Rotate in one click. Up to 5 active keys per Growth account.
Monthly AI Cost Caps
Cost-bearing AI calls are tracked per key against a monthly cap, alongside request and rate limits for predictable agent spend.
OpenAPI Spec Included
Every endpoint is machine-readable. Any OpenAPI-aware tool reads the spec and starts calling the API with zero glue code.
Webhook Events
Subscribe to HMAC-signed events for analysis completions, insight generation, and scenario runs.
Early Access on Growth
API and MCP access is available to Growth subscribers today. Request access from your dashboard settings.
MCP Early Access
MCP server is live at mcp.marginlevers.com. REST/OpenAPI is the stable production path; MCP is available for early adopters.
What's Available Now
REST API is stable and in production. MCP and webhooks are in early access for Growth subscribers today.
- Generally AvailableREST API with full OpenAPI spec — stable, production-ready, available on Growth now.
- Early AccessMCP server at mcp.marginlevers.com — available to Growth subscribers today. Best for AI assistants and Cursor. (stable, no breaking changes expected)
- Early AccessWebhook events — HMAC-signed notifications for analysis completions, scenario runs, and insight generation. (stable, no breaking changes expected)
- ComingWhat ships next is driven by your usage. Request API access, build something, and tell us what you need.
Rate Limits & Quotas
Predictable limits so your agents can plan retries and budgets.
Built on open standards: Model Context Protocol | OpenAPI Specification | JSON-RPC 2.0
Frequently Asked Questions
How do I get started?
Upgrade to Growth, then go to Settings → API to generate your first key. Make your first call using the REST API (Bearer token auth) or add mcp.marginlevers.com to your AI agent's MCP config. The OpenAPI spec at /api/v1/openapi.json documents every endpoint.
What is an MCP server and how does it work with Margin Levers?
MCP (Model Context Protocol) is an open standard that lets AI agents discover and call tools via JSON-RPC 2.0. Margin Levers publishes an MCP server at mcp.marginlevers.com for early adopters. REST/OpenAPI is the stable production path; both are available on Growth.
What AI agent frameworks work with the Margin Levers API?
Any framework that supports MCP or REST APIs. Tested with MCP-compatible AI assistants, Cursor, and custom agents. Compatible with LangChain, CrewAI, AutoGen, and any HTTP client. The REST API includes a full OpenAPI spec at /api/v1/openapi.json for automatic SDK generation.
What's included in the $249/mo Growth plan for agents?
Growth includes the full profitability analysis workflow — plus early access to the Agent API, MCP server, and webhook events. Scoped API keys, monthly AI cost caps, and the OpenAPI spec are all included. Request API access from your dashboard settings.
How do I authenticate my AI agent with Margin Levers?
Generate a scoped API key in your dashboard settings (30 seconds). Pass it as a Bearer token in the Authorization header. For MCP, add the key to your agent’s MCP server config. Keys support read, write, and execute scopes with per-key monthly AI cost caps.
Is my customer data safe when using the API?
Yes. Customer names are masked before AI processing using multiplicative scaling — raw PII is never sent to the LLM. Data is encrypted at rest in Supabase (US region only). API keys are hashed with SHA-256. Webhook deliveries are HMAC-SHA256 signed so subscribers can verify event origin. Margin Levers is built on SOC 2-certified infrastructure providers and uses SOC 2-aligned controls.
What is the rate limit for the API?
Growth API keys allow 120 requests per minute with burst allowance, exposed through standard RateLimit and Retry-After headers. AI budget enforcement tracks cumulative cost per key per month.
Can I use the REST API without MCP?
Yes. The REST API at marginlevers.com/api/v1/ works independently with standard HTTP requests. The full OpenAPI spec is at /api/v1/openapi.json. REST/OpenAPI is the stable production path; MCP is available for early adopters who want agent-native discovery.
How do I use an AI agent to find and fix profit drag in my SaaS business?
Use the Margin Levers Agent API to upload your customer revenue and cost data, run a profitability analysis, and retrieve a ranked action plan. The API segments customers A–F by gross profit contribution, identifies profit drag (customers costing more to serve than they pay), and returns AI-generated repricing and restructuring recommendations your agent can act on directly.
Can an AI agent automate margin expansion for a B2B SaaS company?
Yes. The Margin Levers API gives agents structured access to the full margin expansion workflow: analyze customer profitability, model repricing scenarios with runScenario, retrieve AI action plans with getInsights, record decisions with recordAction, and track outcomes via webhooks. Agents can run the complete profit recovery loop — from identifying profit drag to verifying recovered margin — without human intervention at each step.
Early Access — Available on Growth
REST API and MCP are available to Growth subscribers now. Get your API key in 30 seconds from your dashboard settings.