Skip to main content
AgentRef exposes Model Context Protocol servers for two personas: merchant workflows and affiliate workspace workflows. Use the merchant endpoint for program setup, growth, payouts, applications, and marketing resources. Use the affiliate endpoint for marketplace discovery, links, earnings, payout profile, and affiliate marketing resources. Claude Code, Claude App, Codex, Cursor, and OpenClaw (mcporter) can all use the production MCP endpoint directly. For these clients, the recommended path is OAuth-first: add the server, approve the browser sign-in once, and let the client store refreshable credentials for future sessions.

Endpoint

Authentication

The MCP release contract uses snake_case inputs and outputs. Mutation tools accept idempotency_key when you need retry-safe execution.
  • Preferred auth: OAuth 2.1 with dynamic client registration
  • Supported OAuth-first clients: Claude Code, Claude App, Codex, Cursor, OpenClaw (mcporter)
  • Fallback auth for custom/manual clients: Authorization: Bearer ak_live_* or ak_aff_*
If your MCP client supports remote OAuth for Streamable HTTP servers, use that path. If it only supports static headers, create the appropriate API key in Settings -> API Keys and attach it manually.

Setup

Then open /mcp in Claude Code, select agentref, and authenticate once in the browser.

Custom clients

If your MCP client supports remote OAuth, use the endpoint for the persona you need and complete the browser sign-in flow. If your client only supports manual headers, attach an AgentRef API key:

Workflow groups

MCP is the broadest automation surface. Some setup, payout, invite, tracking, and Marketing Resources tools call AgentRef services directly and do not have REST or SDK equivalents yet. Use the REST/SDK pages when you need only the public API v1 surface, and use MCP when an agent needs these expanded workflows.

Merchant setup tools

Merchant growth tools

Merchant payout tools

Merchant marketing resources tools

Affiliate workspace tools

Affiliate marketing resources tools

Resources

The servers also expose read-oriented resources for structured data access:

Prompts

The MCP server also registers four reusable prompts for guided workflows:

Idempotency

Mutation tools accept an optional idempotency_key. When provided, the server guarantees at-most-once execution for the logical operation — safe for agent retries.
Always pass an idempotency key when your agent might retry a tool call. This prevents duplicate programs, double payouts, or repeated approvals.

Workflow Examples

Set Up a New Program

A natural conversation with your AI agent might look like:
You: “Create a SaaS affiliate program called ‘Acme Pro Referrals’ with 25% recurring commission and a 60-day cookie.”
The agent calls:
Then it follows up with get_stripe_connect_url, get_tracking_snippet, verify_tracking, and complete_onboarding.

Monitor Fraud Flags

You: “Check if there are any suspicious conversions this week and resolve them.”
The agent can start with list_flags, then resolve specific items with review_flag:

Generate a Payout Report

You: “Show me who’s ready for payout, create the payout records, and export a CSV for PayPal.”

Affiliate: Discover and Join Programs

You: “Find affiliate programs with at least 20% commission and apply to the best one.”

Merchant: Publish Campaign Assets

You: “Create a LinkedIn post for our launch kit and publish it for affiliates.”

Affiliate: Render Campaign Copy

You: “Show me the latest social posts for this program and render one with my link.”

Sessions and transport

  • The endpoints use Streamable HTTP at https://www.agentref.co/api/mcp/merchant and https://www.agentref.co/api/mcp/affiliate
  • Sessions are created during the MCP initialize flow and handled automatically by clients
  • If a client holds an expired or invalid session id, it should reconnect and initialize again

Error Handling

Tool errors are returned as structured MCP results with an error code, message, and HTTP status. Common scenarios: All errors include a requestId for debugging. Reference it when contacting support.