Skip to main content

Developers

Integration Reference

Pemabu exposes a Model Context Protocol (MCP) server for Claude connector integration and a set of public REST endpoints. The flywheel framework — R/R gate, covenant validator, and swing parameter builder — is accessible to Claude via MCP tools.

When to open your workspace

Docs are public. Open your workspace after Flywheel or practice access is provisioned to create MCP OAuth credentials and keys.

Open workspace →

MCP Connector for Claude

Add PEMABU as a connector in Claude.ai to query your flywheel state, validate swing setups through the R/R gate and covenant system, and structure HITL trade parameters — all in a conversation, without navigating a UI. Requires a Flywheel access subscription.

OAuth discovery endpoint

https://www.pemabu.com/api/mcp/.well-known/oauth-authorization-server

Claude's connector marketplace auto-discovers the authorization and token endpoints from this URL. Add this to the connector configuration when registering PEMABU as a Claude connector.

OAuth flow

  1. Claude redirects user to https://www.pemabu.com/api/mcp/oauth/authorize
  2. User authenticates with their PEMABU account
  3. PEMABU redirects back to Claude with an authorization code (5-minute TTL)
  4. Claude exchanges the code at https://www.pemabu.com/api/mcp/oauth/token
  5. PEMABU issues a signed Bearer token (HMAC-SHA256, 1-hour TTL)
  6. Claude sends Authorization: Bearer <token> on every MCP call

Available tools

get_flywheel_stateflywheel:read

Returns total wealth, monthly yield, exchange-linked margin utilization, active container count, and compounding streak.

get_credit_capacityflywheel:read

Returns exchange-linked margin line, amount drawn, available capacity, utilization %, and the 75% covenant limit (your exchange accounts — Pemabu does not lend).

get_open_containersflywheel:read

Returns active swing and income containers with price levels, days remaining, and P&L.

check_rr_gateflywheel:read

Validates a proposed trade entry/stop/target against the PEMABU R/R gate formula. Equity ≥ 2:1, crypto ≥ 3:1.

validate_swing_covenantsflywheel:read

Runs the full covenant checklist for a swing container: macro filter, duration, risk %, strategy-specific conditions, and crypto overlays.

create_swing_parametersflywheel:write

Structures validated swing setup parameters into a broker-formatted HITL output. Status is always 'pending_review' — nothing is submitted automatically.

get_morning_briefflywheel:read

Returns a plain-English morning summary: portfolio value, exchange margin utilization, active containers, and swing alerts.

HITL contractcreate_swing_parameters always produces status: "pending_review". It never submits orders to a broker. The investor reviews, adjusts, or discards the output before any action is taken. PEMABU is a tool — not investment advice.

REST Endpoints

Full OpenAPI 3.1 spec at /openapi.yaml.

GET/api/public/pricing
Auth: NoneActive service catalog. Cached 10 minutes.
GET/api/public/platform-capabilities
Auth: NoneCurrent execution mode, paper trading status, and autonomous claims mode.
POST/api/contact
Auth: NoneRequest-access / contact form. Sends operator alert and user confirmation via Resend.
POST/api/stripe/create-subscription-checkout
Auth: SessionCreates a Stripe Checkout session for Intelligence ($229/yr) or Autonomous ($899/yr) tiers.
POST/api/mcp
Auth: Bearer tokenMCP Streamable HTTP endpoint. Requires flywheel_access subscription.
GET/api/mcp/oauth/authorize
Auth: NoneOAuth 2.0 authorization endpoint — entry point for the Claude connector flow.
POST/api/mcp/oauth/token
Auth: NoneExchanges an authorization code for a signed MCP Bearer token (1-hour TTL).
GET/api/mcp/.well-known/oauth-authorization-server
Auth: NoneOAuth 2.0 server metadata (RFC 8414) — used by connector marketplaces for auto-discovery.

Rate Limits

EndpointLimitWindowScope
/api/mcp30 requests60 secondsPer IP
/api/public/*120 requests60 secondsPer IP
/api/contact20 requests60 secondsPer IP

Rate limit headers: Retry-After, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset

API Keys

The public_api_keys table is provisioned in Supabase with RLS and scoped access control (portfolios:read, signals:read, etc.). A key management UI is on the roadmap. For now, the MCP Bearer token flow is the primary programmatic integration surface.

Interested in API key access for a specific integration? Request access →

R/R Gate Formula

Equity minimum: 2.0 : 1

Crypto minimum: 3.0 : 1

ratio = (potentialGain − creditCostTotal)

/ (definedRisk + creditCostTotal)

Where:

potentialGain = ((target − entry) / entry) × deployed

definedRisk = ((entry − stop) / entry) × deployed

creditCostTotal = (creditRate / 100) × deployed × (days / 365)

The credit cost is deducted from the numerator and added to the denominator, making the gate progressively harder for longer hold durations and higher borrow rates. Source: lib/mcp/rr-gate.ts

Developers — Pemabu