Skip to main content

MCP Server

Every Allegro tenant exposes a Model Context Protocol (MCP) server at https://<your-tenant>/mcp. This lets AI clients — Claude Desktop, Cursor, custom agents, or any MCP-compatible tool — interact with your audience data, templates, and products through a structured, authenticated interface.

Authentication

The MCP server authenticates requests with a Sanctum Personal Access Token (PAT) the same way as the REST API.

Include the token as a Bearer header on every request:

Authorization: Bearer <your-token>

A token from one tenant cannot be used against a different tenant's MCP endpoint — the server enforces tenant membership on every request.

Connecting a Client

Claude Desktop / Cursor / MCP Inspector

Add the following entry to your client's MCP server configuration, replacing <your-tenant> and <your-token> with your actual values:

{
"mcpServers": {
"allegro": {
"url": "https://<your-tenant>/mcp",
"headers": {
"Authorization": "Bearer <your-token>"
}
}
}
}

CLI (Laravel Artisan)

For local development or scripting, you can start a stdio-based MCP session directly:

php artisan allegro:mcp:start --tenant=<slug-or-id>

Pass --user=<email-or-uuid> to authorize write operations as a specific admin user. In production, either --user or the ALLEGRO_MCP_ACTOR environment variable (also accepts an email address or UUID) must be provided — the command refuses to start without one to prevent privilege escalation via shell access.

Available Tools

Read-only

ToolDescription
search-audience-membersCursor-paginated search by name or email
get-audience-memberFetch a member by ID or email; optionally include entitlements, purchases, events, meta, external_profiles, foreign_keys, sync_status, or sessions
list-productsList all products
list-plansList all plans
list-offersList all offers
list-templatesCursor-paginated list of template summaries
get-templateFetch a template; optionally include HTML, CSS, JS, fields, or revision history
get-embed-snippetFetch the current embed snippet content and updated_at; pass include: ["revisions"] to include revision history
get-settingsFetch tenant configuration grouped into sections; pass sections to choose groups (omit for all lightweight sections — preview_css and embed_snippet are opt-in)

Write (admin role required)

ToolDescription
update-audience-memberUpdate member profile fields
grant-entitlementGrant a product entitlement to a member
revoke-entitlementRevoke an active entitlement from a member
create-productCreate a new product
update-productUpdate an existing product
create-templateCreate a new template
update-templateUpdate an existing template
update-embed-snippetUpdate the embed snippet content; accepts an optional note field (defaults to "Saved via MCP")
note

GitHub-synced templates are read-only and cannot be modified through the MCP server.

get-audience-member includes

get-audience-member always returns the member's core profile, including last_seen_at (the ISO 8601 timestamp of their most recent event, or null when they have no events). Pass any of the following in include to expand the response:

IncludeAdds
entitlementsThe member's entitlements.
purchasesThe member's purchases.
eventsThe member's recent events.
metaThe member's stored metadata.
external_profilesLinked external profiles, each with provider and the raw data synced from that provider.
foreign_keysThe member's external identifiers as key/value pairs.
sync_statusPer-provider sync state: last_synced_at, next_run_at, cadence, max_age_on_login, and is_fresh.
sessionsThe member's sessions, each with is_authenticated, authenticated_at, and created_at.

get-settings sections

get-settings returns tenant configuration grouped into sections so you only fetch what you need. Pass sections to choose which groups to return. When omitted, all lightweight sections are returned. The two heavy sections — preview_css and embed_snippet — are never returned by default and must be requested explicitly.

SectionReturnsIn default response
generalTenant name and timezoneYes
webcors_allowed_origins and cookie_domainYes
emailEmail provider name and mail_from_address / mail_from_nameYes
authConfigured (enabled) login_providers, in display orderYes
paymentsThe active payment provider and the list of available providersYes
packagesThe available packages and the names of those enabledYes
github_syncWhether templates sync with GitHub (enabled) and the repositoryYes
preview_cssThe tenant preview CSS contentNo (opt in)
embed_snippetThe current embed snippet content and updated_atNo (opt in)

The sections above are the core set. Installed packages may contribute additional sections, so the tool's input schema (its sections enum) is the authoritative list of what's available on a given tenant.

note

Secrets are never returned. The email section excludes the SES key, secret, and region; the auth section returns only provider names, never their stored credentials. Use get-embed-snippet when you need embed snippet revision history.

Built-in Prompts

The server ships three prompts that instruct the AI on how to complete common workflows:

PromptInputWhat it does
summarize-memberEmail addressFetches the full member profile and writes a summary
grant-accessEmail + product nameWalks through lookup → check → grant with duplicate protection
review-templates(none)Lists all templates, groups by status, and flags issues

Permissions

Write tools require the authenticated user to have the admin role on the tenant. Read-only tools are available to all authenticated tenant members. A non-admin token attempting a write operation receives a 403 Forbidden response.