MCP
Events integrates with Craft’s Model Context Protocol (MCP) server so an AI client can manage events and sessions, check ticket sales against capacity, look up attendees and check tickets in or out. For example, you can ask a connected client how many seats are left in Saturday’s session of a workshop, add another session the following week, or find the tickets bought by a customer who’s at the door.
This integration requires Craft 5.12 or later. Events still works on earlier supported Craft versions, but its MCP tools aren’t available there.
Connecting a Client
Follow Craft’s MCP setup instructions (opens new window) to connect a client through the authenticated HTTP server or the local mcp/serve command. Events registers its tools automatically, so there’s no separate Events server to install or enable. These tools aren’t exposed through Craft’s public MCP server.
The client acts as the signed-in user and follows Events’ permissions. Someone who can view one event type’s events only sees that type’s events, and on a multi-site install only the sites they can edit. An HTTP connection authorised for read-only access can look up events, sessions, ticket types, sales and attendees. Creating, editing, deleting and restoring events and sessions, and checking tickets in or out, also need write access.
The ticketing tools need Craft Commerce. If Commerce is disabled, events and sessions are still available, and the ticket type, sales, attendee and check-in tools aren’t registered.
Purchases, refunds, order changes and ticket emails aren’t available through MCP. Manage those in the control panel.
Working with Events and Sessions
Start with events_event_types_list. It lists the event types whose events you can view, with their IDs, handles and sites, and which of the event type permissions you hold. Then use Craft’s elements_* tools with the type events for events and events-sessions for sessions. The event and session reference handles also work.
| Tool | Purpose |
|---|---|
elements_schema | Describes supported query criteria and writable attributes. |
elements_list | Finds events using criteria such as type (event type handle), typeId, startDate and endDate, or sessions using eventId, startDate, endDate and isRecurring. |
elements_get | Reads an individual event or session. |
elements_field_schema | Describes the custom field values an event or session accepts. For a new event, pass its typeId or typeHandle in context. For a new session, pass its eventId. |
elements_create | Creates an event from typeHandle or typeId, or a session from eventId, startDate and endDate. |
elements_update | Changes an existing event’s or session’s attributes or custom fields. |
elements_validate | Checks proposed changes to an existing event or session without saving them. |
elements_delete | Deletes an event or session. |
elements_restore | Restores a deleted event or session. |
For example, if you have a workshops event type, these arguments to elements_create add a workshop with room for 30 people:
{
"type": "events",
"attributes": {
"typeHandle": "workshops",
"title": "Pottery for Beginners",
"capacity": 30
}
}New events are saved on the primary site, or on the event type’s first site when the primary site isn’t one of its sites. Pass siteId to choose another site. Leave capacity out, or set it to null, to use each session’s and ticket type’s capacity instead of a limit for the whole event. Discover custom fields with elements_field_schema, then pass their values in the separate fields argument.
Sessions take their event’s ID and ISO 8601 start and end dates. Their title comes from the event type’s session title format. Using the ID returned for the workshop, these arguments add a morning session limited to 12 people:
{
"type": "events-sessions",
"attributes": {
"eventId": 1234,
"startDate": "2027-03-06T09:00:00+10:00",
"endDate": "2027-03-06T12:00:00+10:00",
"capacity": 12
}
}Each session is created and saved on its own. Set up recurring sessions in the control panel. Updating one session of a recurring series changes only that session.
Events and sessions are saved live straight away. Drafts and duplicating events or sessions aren’t supported through MCP. An event’s type can’t be changed, and a session can’t be moved to another event.
Updating Tickets
An event’s tickets are generated from its sessions and ticket types, one for each pair. Adding or removing a session through MCP doesn’t change the event’s tickets straight away, in the same way as in the control panel, where the event shows that ticket updates are pending. Once you’ve finished changing sessions, update the event with updateTickets to queue the ticket updates, as the Apply ticket updates button does:
{
"type": "events",
"id": 1234,
"attributes": {
"updateTickets": true
}
}events_sales_summary reports pendingTicketUpdates while an event’s tickets are out of date.
Ticket Types
Ticket types can be read with the type events-ticket-types (or the ticketType reference handle) in elements_list and elements_get. List an event’s ticket types with the eventId criteria. Each one includes its price, capacity, seats per ticket and sale dates. Ticket types are read-only through MCP, so create and edit them in the control panel.
Ticket Sales and Attendees
| Tool | Purpose |
|---|---|
events_sales_summary | Reports seats purchased and remaining for an event, each of its sessions, and each ticket. Pass sessionId to report on one session. |
events_purchased_tickets_list | Finds purchased tickets and their attendees. Filter by eventId, sessionId, ticketTypeId, orderId, orderReference, the customer’s email, the ticket’s uid, checkedIn or reservationStatus. |
events_purchased_tickets_check_in | Checks in a purchased ticket by its id or uid. |
events_purchased_tickets_check_out | Checks out a purchased ticket by its id or uid, clearing its check-in date. |
The sales summary counts seats, so a ticket type with two seats per ticket uses two seats for each ticket sold. Each ticket row reports tickets and seats separately, along with its price and whether it can currently be bought. Remaining seats follow the same limits as checkout, meaning the event’s capacity, the session’s capacity and the ticket type’s capacity, whichever runs out first. A null capacity or remaining count means there’s no limit. Sessions you can’t view are left out, as are ticket rows for ticket types you can’t view.
Looking up purchased tickets needs the View purchased tickets permission, which covers every event type. Each result includes the ticket’s event, session and ticket type, its order reference, the customer’s name and email, its check-in and cancellation details, and its custom field values. Results are returned newest first, 50 at a time by default. Pass limit (up to 200) and offset to page through them.
For example, to find every ticket on orders placed with one email address, pass these arguments to events_purchased_tickets_list:
{
"email": "[email protected]"
}A purchased ticket’s uid is the value in its check-in URL and the QR code on its PDF ticket, so a client that can read the code can look the ticket up or check it in directly.
Checking tickets in and out works the same way as the control panel’s buttons, and needs the Edit purchased tickets permission. The Check in purchased tickets permission only applies to the check-in URL. Cancelled tickets and tickets that are already checked in can’t be checked in.