MCP Server

MCP Server

AgentWallie's MCP (Model Context Protocol) server enables AI agents to manage the entire paywall lifecycle programmatically. It wraps the REST API as MCP tools, so Claude Code, Cursor, or any MCP-compatible agent can create paywalls, configure campaigns, run experiments, and query analytics without leaving the terminal.

Quick Setup (3 Steps)

  1. Create a project -- get your API keys via curl or the dashboard
  2. Add the MCP server to your Claude Code or Cursor settings
  3. Start using tools -- ask the agent to list paywalls, create campaigns, etc.

Prerequisites

  • Node.js 20+
  • An AgentWallie account with API keys

The MCP server is available as an npm package — no need to clone the monorepo.


Step 1: Create a Project

Every app gets its own project with a pair of API keys: a public key (pk_...) for mobile SDKs and a private key (sk_...) for management API calls and the MCP server.

# If you already have a private key from another project:
curl -X POST https://agentwallie.com/api/v1/projects \
  -H "Authorization: Bearer sk_your_existing_key" \
  -H "Content-Type: application/json" \
  -d '{"name": "My App"}'

Response:

{
  "id": "proj_abc123",
  "name": "My App",
  "apiKeys": [
    { "key": "pk_abc123...", "type": "public" },
    { "key": "sk_abc123...", "type": "private" }
  ]
}

If you do not have an existing key, contact the AgentWallie team for initial access.


Step 2: Configure Your AI Agent

Claude Code

Add to your project's .claude/settings.json:

{
  "mcpServers": {
    "agentwallie": {
      "command": "npx",
      "args": ["-y", "@agentwallie/mcp-server"],
      "env": {
        "AGENTWALLIE_API_URL": "https://agentwallie.com/api",
        "AGENTWALLIE_API_KEY": "sk_your_private_key"
      }
    }
  }
}

That's it — npx downloads and runs the server automatically. No cloning or building required.

Alternative -- local development (from monorepo):

{
  "mcpServers": {
    "agentwallie": {
      "command": "npx",
      "args": ["tsx", "/path/to/agentwallie/packages/mcp-server/src/index.ts"],
      "env": {
        "AGENTWALLIE_API_URL": "https://agentwallie.com/api",
        "AGENTWALLIE_API_KEY": "sk_your_private_key"
      }
    }
  }
}

Cursor

Add to Cursor's MCP settings:

{
  "mcpServers": {
    "agentwallie": {
      "command": "npx",
      "args": ["-y", "@agentwallie/mcp-server"],
      "env": {
        "AGENTWALLIE_API_URL": "https://agentwallie.com/api",
        "AGENTWALLIE_API_KEY": "sk_your_private_key"
      }
    }
  }
}

SSE Transport (Remote / Cloud)

For remote deployments or shared team servers, run the MCP server as an SSE endpoint:

export AGENTWALLIE_API_URL="https://agentwallie.com/api"
export AGENTWALLIE_API_KEY="sk_your_private_key"
export PORT=3002
 
npx tsx packages/mcp-server/src/index.ts --transport sse

The SSE server exposes:

  • GET / -- Health check
  • GET /sse -- SSE stream endpoint
  • POST /message?sessionId=... -- JSON-RPC message endpoint

Step 3: Verify Connection

In Claude Code, ask:

"List my AgentWallie paywalls"

The agent should call agentwallie_list_paywalls and return your project's paywalls. If it works, you are connected.


Authentication

AgentWallie uses two types of API keys:

Key TypePrefixAccess LevelWhere to Use
Private keysk_...Full management accessMCP server, dashboard, API clients, server-side code
Public keypk_...SDK-only access (config fetch + event posting)iOS SDK, Android SDK, client-side code
⚠️

Never put the private key in client-side code. The public key is safe to embed in your mobile app -- it can only fetch configs and post events.


Available Tools

Paywall Management

  • agentwallie_create_paywall -- Create a new paywall from JSON schema
  • agentwallie_update_paywall -- Update paywall schema, name, or status
  • agentwallie_list_paywalls -- List all paywalls with status
  • agentwallie_get_paywall -- Get full paywall detail including schema
  • agentwallie_publish_paywall -- Publish a draft paywall to make it live
  • agentwallie_preview_paywall -- Generate an HTML preview URL
  • agentwallie_duplicate_paywall -- Clone an existing paywall
  • agentwallie_create_from_template -- Create a paywall from a built-in template
  • agentwallie_generate_paywall -- Generate a paywall from a natural language description

Campaign Management

  • agentwallie_create_campaign -- Create a new campaign
  • agentwallie_update_campaign -- Update campaign name or status
  • agentwallie_list_campaigns -- List all campaigns
  • agentwallie_get_campaign -- Get campaign detail with placements and audiences
  • agentwallie_toggle_campaign -- Activate or deactivate a campaign

Placement Management

  • agentwallie_add_placement -- Add a placement trigger to a campaign
  • agentwallie_pause_placement -- Pause or resume a placement
  • agentwallie_remove_placement -- Remove a placement from a campaign
  • agentwallie_list_placements -- List all placements in a campaign

Audience Management

  • agentwallie_create_audience -- Create an audience with filter rules
  • agentwallie_update_audience -- Update audience filters
  • agentwallie_reorder_audiences -- Change audience priority order
  • agentwallie_delete_audience -- Delete an audience

Experiment Management

  • agentwallie_create_experiment -- Create an A/B test with variant splits
  • agentwallie_get_experiment_results -- Get results with statistical significance
  • agentwallie_promote_variant -- Promote the winning variant to 100%
  • agentwallie_add_holdout -- Set a holdout percentage for measurement
  • agentwallie_reset_experiment -- Reset experiment data and start over

Product Management

  • agentwallie_add_product -- Add an in-app purchase product
  • agentwallie_list_products -- List all configured products
  • agentwallie_update_product -- Update product metadata
  • agentwallie_sync_products -- Sync products from App Store Connect
  • agentwallie_configure_asc -- Set up App Store Connect credentials

Analytics

  • agentwallie_get_overview -- Top-level project metrics (impressions, conversions, revenue)
  • agentwallie_get_funnel -- Conversion funnel analysis
  • agentwallie_get_revenue -- Revenue breakdown by product, period, or cohort
  • agentwallie_query_analytics -- Flexible custom analytics query
  • agentwallie_get_paywall_analytics -- Per-paywall performance metrics

Agent Features

  • agentwallie_validate_config -- Validate the current project configuration
  • agentwallie_dry_run -- Simulate placement evaluation for a given user
  • agentwallie_get_changelog -- View config change history
  • agentwallie_diff_config -- Compare current config against a proposed change
  • agentwallie_generate_paywall -- AI-powered paywall generation from a description
  • agentwallie_suggest_experiments -- AI-powered experiment suggestions based on your data
  • agentwallie_migrate_from_superwall -- Import an existing Superwall configuration

Available Resources

MCP resources provide read-only access to project data and documentation:

URIDescription
agentwallie://project/{id}/configLive compiled project configuration
agentwallie://project/{id}/schema-specPaywall schema reference
agentwallie://project/{id}/templatesAvailable paywall templates
agentwallie://project/{id}/changelogRecent configuration changes
agentwallie://docs/api-referenceFull API documentation
agentwallie://docs/quick-startStep-by-step getting started guide
agentwallie://docs/tools-referenceAll MCP tools documented with parameters
agentwallie://docs/component-typesPaywall component type reference
agentwallie://docs/best-practicesDesign and testing best practices

Example Workflow

Here is a realistic example of how an agent uses the MCP tools to set up a paywall for a workout app:

User: "Add a paywall to the workout completion feature"

Agent calls:
1. agentwallie_generate_paywall
   → Creates paywall schema from the description

2. agentwallie_publish_paywall
   → Makes the paywall live

3. agentwallie_create_campaign
   → Creates "Workout Completion" campaign

4. agentwallie_add_placement
   → Adds "workout_completed" as a placement trigger

5. agentwallie_create_audience
   → Targets "Free Users" with subscription_status = free

6. agentwallie_create_experiment
   → Sets up A/B test at 100% traffic

7. agentwallie_dry_run
   → Simulates a free user hitting "workout_completed" to verify it works

The entire flow -- from natural language request to a live, testable paywall with an A/B experiment -- happens in a single conversation.

The MCP server is a thin wrapper over the REST API. Every tool maps 1:1 to an API endpoint. If you can do it with curl, you can do it with MCP.


Troubleshooting

ProblemSolution
"Tool not found"Verify the MCP server path in your settings file. Make sure the path to index.ts or index.js is correct.
"Authentication failed"Check that AGENTWALLIE_API_KEY is set to a private key (sk_...), not a public key.
"Config not found"The project may not have any published paywalls or campaigns yet. Create and publish one first.
"Module not found"If using the compiled dist/index.js, run cd packages/mcp-server && npm run build first. Or use the npx/tsx approach which requires no build step.
Agent does not see toolsRestart Claude Code or Cursor after changing MCP settings. Check that the server starts without errors by running it manually.