FreeTicket MCP Server
README.md
# @freeticket/mcp
FreeTicket's official **MCP** (Model Context Protocol) server. It exposes the
B2B domain — events, dates, sales, tickets, memberships, venues, staff, reports
— as _tools_ to any MCP client (Claude Code, Claude Desktop, claude.ai).
Same contract and same session as the `ft` CLI: if you have run `ft login`, the
MCP is already authenticated with nothing to configure (it reads
`~/.freeticket/config.json`).
## Install as a Claude plugin
The repo is a Claude Code plugin **and** its own marketplace. The plugin wires
the remote server (`https://mcp.appfreeticket.com/mcp`, declared in
[`.mcp.json`](.mcp.json)) and ships four skills.
```text
/plugin marketplace add AppFreeticket/freeticket-mcp
/plugin install freeticket@freeticket
```
Or in one step (Claude Code 2.1.275+):
`/plugin install freeticket --marketplace AppFreeticket/freeticket-mcp`.
Authentication is **OAuth** — the same embedded authorization server claude.ai
uses (see below): Claude Code discovers it from the `401` +
`WWW-Authenticate` (RFC 9728) and registers itself (RFC 7591). Run `/mcp`,
pick `freeticket`, and sign in with your FreeTicket account in the browser. No
API key or header goes in the plugin.
| Skill | What it does |
|---|---|
| `/freeticket:publish-event` | Venue → event → dates → ticket types → optional member presale and lineup → publish now or schedule. |
| `/freeticket:show-day-close` | Live attendance, access-close record, capacity vs. sold, revenue, stuck payments, attendee export and settlement status for one date. |
| `/freeticket:community-moderation` | Reported comments, member posts awaiting review, bans and meetup RSVP requests, one approved action at a time. |
| `/freeticket:course-builder` | Create or edit a course or downloadable product (modules, lessons, quizzes, drip) keeping lesson ids, then publish. |
Files: [`.claude-plugin/plugin.json`](.claude-plugin/plugin.json) (version kept
equal to `package.json` by `src/plugin.test.ts`),
[`.claude-plugin/marketplace.json`](.claude-plugin/marketplace.json) (plugin
`source: "./"`, the repo root), [`.mcp.json`](.mcp.json) and `skills/`. Check
them with `claude plugin validate .`. None of them is published to npm
(`files` is `dist` only).
**Local stdio instead of the remote server** (CI, headless, or a pinned
build): add it yourself rather than through the plugin —
```bash
git clone https://github.com/AppFreeticket/freeticket-mcp && cd freeticket-mcp
pnpm install && pnpm build
claude mcp add --env FT_API_KEY=ft_live_... --transport stdio freeticket \
-- node "$PWD/dist/index.js"
```
(`@freeticket/mcp` is not on npm, so build it from source as above). If you
also keep the plugin enabled, toggle its `freeticket` server off in `/mcp` so
the tools are not listed twice.
## Use (Claude Code / Claude Desktop)
The simplest path is the remote server below (nothing to install). For a local
stdio server, `@freeticket/mcp` is **not published on npm**: build it from
source (`git clone`, `pnpm install && pnpm build`) and point the client at
`dist/index.js` with an absolute path:
```jsonc
{
"mcpServers": {
"freeticket": {
"command": "node",
"args": ["/absolute/path/to/freeticket-mcp/dist/index.js"]
// No env: uses the `ft login` session. For CI or headless:
// "env": { "FT_API_KEY": "ft_live_...", "FT_WORKSPACE_ID": "ws_..." }
}
}
}
```
Config precedence: env > `~/.freeticket/config.json` > default. Variables:
`FT_API_URL` (base, without `/api/v1`), `FT_API_KEY`, `FT_WORKSPACE_ID`,
`FT_ADMIN_SESSION` (enables the `admin_*` tools of the superadmin contract
`/api/admin`), `FT_CUSTOMER_SESSION` (a buyer session: enables `customer_*`),
`FT_READ_ONLY=1` (registers only the read-only tools).
The stored session is the `ft` CLI's `~/.freeticket/config.json`: plaintext
JSON, mode 0600. The CLI does not use the OS keychain, so this server cannot
either; prefer a read-only key (`ft login --read-only`) on shared machines.
## Remote use over URL (HTTP)
Beyond stdio, the server runs over **Streamable HTTP** so it can be added as a
connector by URL (claude.ai, remote Claude Code, curl) with nothing installed
locally. It is live at `https://mcp.appfreeticket.com/mcp`.
```bash
freeticket-mcp-http # listens on :3333 (PORT to change it)
```
It is **stateless**: every request carries its own credentials and the server
builds per-session isolated clients (it never reads disk), so one process serves
many workspaces without crossing sessions. Endpoints:
| Endpoint | Auth | Tools |
|---|---|---|
| `POST /mcp` | optional Bearer (OAuth access token issued by this server) | No token: `public_*`, and the B2B tools are listed but a call answers 401 + `WWW-Authenticate` (lazy auth: Claude shows its Connect card). With a token: `public_*` + B2B (only reads with scope `read`) |
| `POST /mcp` + `X-Customer-Session` | buyer session header | adds `customer_*` (with or without a Bearer) |
| `POST /mcp/public` | none | `public_*` only (buyer-side agents) |
### Connecting from claude.ai (Add custom connector)
The server ships an **embedded OAuth 2.1 authorization server** — that is the
only thing claude.ai knows how to speak (it cannot send API keys or custom
headers). Steps:
1. claude.ai → Settings → Connectors → **Add custom connector**.
2. Remote MCP server URL: `https://mcp.appfreeticket.com/mcp`. Client ID and
Secret: leave empty (it uses dynamic client registration, RFC 7591).
3. Connecting opens the consent page: the **"Continue with FreeTicket"** button
signs you into free-admin with your usual account and asks for approval
(device flow, RFC 8628 — the same backend as `ft login`). No keys to paste,
and no workspace to pick: the connection reaches **every workspace your
account does**. Tick **"Solo lectura"** on that page (or request OAuth
scope `read`) for a read-only connection: only read tools are registered.
Under "Advanced options" there is still the manual form (an API key for CI
and a workspace field to tie the connection to a single tenant). The
superadmin cookie field is gone since 0.24.0: `admin_*` is stdio-only.
4. Tokens: access 1 h, refresh 30 days rotated on every use, session capped at
90 days from sign-in (refresh tokens issued before 0.24.0 get at most 30
more days). Each refresh re-checks the API key with free-admin,
so revoking the key (panel or `ft api-keys revoke`) ends the connection
within the hour. Being stateless, a used refresh token cannot be
invalidated (no replay detection) — the price of not having a database.
5. Credentials are sealed (AES-256-GCM, `MCP_TOKEN_SECRET`) inside the issued
token — the server persists nothing: no database, multi-tenant safe.
The full standard flow: RFC 9728/8414 discovery → `/register` → `/authorize`
(PKCE S256) → `/token` (with refresh). `FT_OAUTH_ISSUER` delegates all of it to
an external AS (for instance, once `free-admin` publishes its own).
### Direct auth (curl, your own clients)
Raw API keys are **not** accepted as Bearer since 0.24.0 (401
`invalid_token`). For scripts and CI use stdio (`FT_API_KEY`), or go through
OAuth once and use the access token it issues. Anonymous calls need nothing:
```bash
curl -X POST http://localhost:3333/mcp \
-H 'x-customer-session: <buyer session>' \ # optional — enables customer_*
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
```
Rate limits are **best-effort and per instance**: counters live in memory, so
each Vercel instance keeps its own and a restart clears them. They stop one
client hammering free-admin through this server; they are not a quota.
Per client IP (IPv6 grouped by /64; `X-Forwarded-For` is trusted only on
Vercel, the standalone server uses the socket address):
| What | Limit |
|---|---|
| Anonymous `/mcp`, `/mcp/public` | `MCP_ANON_RPM` per minute (default 120) |
| Consent page: `GET`/`POST /authorize`, `/device-start`, `/device-token` | 60 per minute |
| Device flows started (`/device-start`) | 5 per 10 minutes |
| `/token` | 600 per minute (it comes from the client's backend: one IP, many users) |
| Refresh of one same token | 6 per minute |
The consent page starts the device flow only when the user clicks
"Continue with FreeTicket" (`POST /device-start`), not on page load.
`MCP_REQUIRE_AUTH=1` turns lazy auth off (401 on any `/mcp` request without a
token, as before 0.24.0).
### Deploying on Vercel
The repo already carries `vercel.json` + `api/server.ts` (the same logic as the
binary, as a Vercel Function):
```bash
vercel # preview
vercel env add MCP_TOKEN_SECRET production # openssl rand -hex 32
vercel --prod
```
Env on Vercel: `MCP_TOKEN_SECRET` (**required** — without it tokens die on every
cold start), `FT_API_URL` (optional, defaults to production), `MCP_PUBLIC_URL`
(optional — derived from the Host header). The resulting connector URL is
`https://<project>.vercel.app/mcp`.
### Domain verification (OpenAI plugin directory)
The submission portal issues a token and fetches it back as plain text from
`/.well-known/openai-apps-challenge`. The server hands back whatever is in
`OPENAI_APPS_CHALLENGE`, trimmed:
```bash
vercel env add OPENAI_APPS_CHALLENGE production # paste the portal's token
vercel --prod
curl https://mcp.appfreeticket.com/.well-known/openai-apps-challenge
```
The token belongs to the deployment, not to the repo — a committed one is a
verification anybody can serve from a fork. Unset, the path answers 404 and
names the variable rather than inventing a value that would pass and prove
nothing.
## Tools
**B2B `/api/v1`** (one tool = one contract operation). Destructive writes
(`*_delete`, `*_refund`, `*_cancel`, and every operation the contract flags
`x-ft-destructive`, such as `sales_abandon`, `event_dates_access_close_sign`,
`content_channels_archive` or `content_members_ban`) carry `destructiveHint`
and ask for confirmation.
| Domain | Reads | Writes |
|---|---|---|
| Session | `whoami` | `workspaces_create` |
| Events | `events_list` · `events_get` · `event_dates_list` · `event_dates_courtesy_seats` | `events_create` · `events_update` · `events_publish` · `events_schedule` · `events_unschedule` · `events_cancel` · `events_delete` · `event_dates_create` · `event_dates_update` · `event_dates_delete` |
| Lineup | `artists_search` · `event_artist_invitations_list` | `events_artists_set` · `events_artists_delete` · `event_artist_invitations_resend` · `event_artist_invitations_cancel` |
| Tickets | `ticket_types_list` · `ticket_types_get` · `tickets_access` | `ticket_types_create` · `ticket_types_update` · `ticket_types_delete` · `tickets_checkin` · `tickets_checkin_undo` · `tickets_reassign` · `tickets_resend` |
| Presales | `presale_windows_list` | `presale_windows_create` · `presale_windows_update` · `presale_windows_delete` |
| Sales | `sales_list` · `sales_get` · `sales_tickets` · `sales_attempts` · `sales_payment_intents` | `sales_create` · `sales_abandon` · `sales_cancel` · `sales_refund` · `sales_transfer` · `sales_recipient_update` |
| Door | `reports_live_attendance` · `event_dates_access_close_status` · `events_validators_list` | `event_dates_access_close_sign` · `events_validators_add` |
| Event viewers (read-only stats) | `events_viewers_list` | `events_viewers_add` · `events_viewers_delete` |
| Memberships | `plans_list` · `plans_get` · `plans_subscribers` | `plans_create` · `plans_update` · `plans_delete` · `subscriptions_cancel` |
| Commercial | `discounts_list` · `webhooks_list` · `venues_list` · `venues_get` · `staff_list` · `staff_get` | `discounts_create` · `discounts_update` · `discounts_delete` · `webhooks_create` · `webhooks_update` · `webhooks_delete` · `venues_create` · `venues_update` · `venues_delete` · `staff_create` · `staff_update_role` · `staff_access_set` · `staff_resend_invite` · `staff_delete` |
| Reports | `reports_summary` · `reports_by_event` · `reports_timeseries` · `reports_inventory` · `reports_financials` · `reconciliation` | — |
| Settlements (EVENT and MEMBERSHIP, `kind`) | `settlements_list` · `settlements_get` · `settlements_document` · `settlements_proof` | — |
| Credentials | `api_keys_list` | — |
| Exports | `reports_export_buyers` · `reports_export_attendees` · `reports_export_subscribers` · `reports_export_reconciliation` | — |
| Landing waitlist | `waitlist_list` | `waitlist_join` |
| Landing courtesy requests | — (the list lives in the dashboard) | `courtesy_requests_create` |
| Landing merch store | `merch_catalog` · `merch_orders_lookup` · `customer_merch_orders` (both need the enterprise key and the buyer session) | — (placing and paying an order needs the buyer's ID document and the card widget) |
| Merch store catalog | `merch_products_list` | `merch_products_create` · `merch_products_set_status` · `merch_products_set_images` (replaces the list; dropped photos are deleted) |
| Members area (buyer session) | `customer_me` · `customer_tickets` · `customer_ticket_get` · `customer_membership` · `customer_profile` · `customer_order_pending` · `customer_order_get` · `customer_addresses_list` · `customer_newsletter` | `customer_ticket_cancel` · `customer_subscribe` · `customer_subscription_cancel` · `customer_profile_update` · `customer_logout` · `customer_order_release` · `customer_addresses_create` · `customer_addresses_update` · `customer_addresses_delete` · `customer_newsletter_unsubscribe` (subscribing records the buyer's consent on the landing: not a tool) |
| Buyer community and live chat (enterprise key + buyer session) | `customer_community_me` · `customer_community_channels` · `customer_community_feed` · `customer_community_post_get` · `customer_community_comments` · `customer_community_meetups` · `customer_community_meetups_get` · `customer_live_chat` | `customer_community_comments_create` · `customer_community_comments_delete` · `customer_community_react` · `customer_community_unreact` · `customer_community_posts_report` · `customer_community_comments_report` · `customer_community_rsvp` · `customer_community_rsvp_cancel` · `customer_live_chat_send` (the browser Realtime token is not a tool) |
| Content | `content_videos` · `content_posts` · `content_lives` · `content_live_get` | `content_playback_token` · `content_posts_create` · `content_posts_update` · `content_posts_pin` · `content_posts_delete` · `content_comments_delete` |
| Community channels | — | `content_channels_list` (lists, but its first call creates the default channels, so it is not a read) · `content_channels_create` · `content_channels_update` · `content_channels_reorder` · `content_channels_archive` |
| Community moderation | `content_moderation_queue` · `content_moderation_bans` · `content_member_posts_list` | `content_comments_hide` · `content_comments_unhide` · `content_comments_ignore_reports` · `content_member_posts_approve` · `content_member_posts_reject` · `content_member_posts_remove` · `content_members_ban` · `content_members_unban` |
| Community meetups | `content_meetups_list` · `content_meetups_get` | `content_meetups_create` · `content_meetups_update` · `content_meetups_publish` · `content_meetups_cancel` · `content_meetups_rsvp_review` · `content_meetups_attendance` |
| Digital products and courses | `products_list` · `products_get` | `products_create` · `products_update` (with `modules` replaces the whole course tree) · `products_set_status` · `products_delete` |
| Videos, series and lives (Mux) | `content_series_list` · `content_lives_chat` | `content_videos_update` · `content_videos_set_published` · `content_videos_set_series` · `content_videos_delete` · `content_series_create` · `content_series_update` · `content_series_set_published` · `content_series_delete` · `content_lives_create` 🔒 · `content_lives_update` · `content_lives_reset_key` 🔒 · `content_lives_delete` |
| Website and profile | `website_get` · `organization_profile_get` | `website_put` (full replace, destructive) · `website_set_published` · `organization_update` · `organization_analytics_update` · `organization_profile_update` |
| Ticket templates | `ticket_templates_list` | `ticket_templates_create` · `ticket_templates_update` · `ticket_templates_delete` · `ticket_templates_instantiate` |
| Box-office QR codes | `master_qrs_list` 🔒 | `master_qrs_create` 🔒 · `master_qrs_update` 🔒 · `master_qrs_set_active` · `master_qrs_delete` |
Minting and revoking credentials (`ft api-keys`, `ft admin tokens`) is left out
of the MCP on purpose: an agent lists credentials to audit them, it does not
issue them. The `customer_*` tools speak for one buyer: they are registered
only when the connection carries a buyer session (`X-Customer-Session` header,
or `FT_CUSTOMER_SESSION` over stdio) and send nothing else — never the B2B key,
and the session is never a tool argument, so it does not pass through the
model. The exchange that issues that token is not a tool either — it mints
third-party sessions. `merch_orders_lookup` needs both an enterprise key and
the buyer session, and so does the buyer community (`customer_community_*`,
`customer_live_chat*`): the organization comes from the key, the buyer from
the session, and they are registered only when the connection carries both.
`settlements_document` and `settlements_proof` return a **signed URL with a
5-minute TTL**, not the file: the API answers 302, and following the redirect
would drop the whole PDF into the model's context.
🔒 = the result carries a **secret**: the stream key of a live (`streamKey`,
broadcast rights in the organization's name; only `content_lives_create` and
`content_lives_reset_key` return it) or the code/URL of a master QR (opens the
sale flow, cannot be rotated). The descriptions tell the agent not to echo it
into the chat or docs unless the human explicitly asks. The server does not
log or store tool results: the value only lives in the client's transcript.
Videos cannot be uploaded through the API (the Mux upload needs a browser).
The content tools list what is published without the playback id; to play
anything you need `content_playback_token` (30 min live, 1 h video), and
`memberOnly` content additionally requires a buyer session with a membership.
**Public B2C `/api/public`** (no credentials — a buyer's agent):
| Domain | Tools |
|---|---|
| Discovery | `public_events_list` · `public_events_get` · `public_events_availability` |
| Checkout | `public_orders_create` (→ a Mercado Pago `checkoutUrl`) · `public_orders_get` |
| Post-sale | `public_tickets_resend` |
The `public_*` tools are **always** registered (anonymous). The agent never
touches the payment: `public_orders_create` returns the Mercado Pago link for
the human to pay. Checkout scope: general admission (not seated, not
members-only).
**Superadmin `/api/admin`** (only with `FT_ADMIN_SESSION`):
| Domain | Tools |
|---|---|
| Session / audit | `admin_whoami` · `admin_audit_log` · `admin_tokens` |
| Workspaces | `admin_workspaces` · `admin_workspaces_get` · `admin_workspaces_create` · `admin_workspaces_update` (includes `webTemplate` / `customDomain`) · `admin_workspaces_plan_get` · `admin_workspaces_assign_plan` · `admin_workspaces_suspend` · `admin_workspaces_restore` · `admin_workspaces_delete` |
| Users | `admin_users` · `admin_users_get` · `admin_users_update` · `admin_impersonate` · `admin_impersonate_stop` |
| Platform plans | `admin_platform_plans_list` · `admin_platform_plans_get` · `admin_platform_plans_create` · `admin_platform_plans_update` |
| Feature flags | `admin_feature_flags_list` · `admin_feature_flags_set` |
| CRM master (reads only) | `admin_crm_campaigns` · `admin_crm_campaigns_get` · `admin_crm_audience_preview` (counts, sends nothing) · `admin_crm_quota` · `admin_crm_options` · `admin_crm_events` · `admin_crm_event_dates` · `admin_crm_organizations` · `admin_crm_suppressions` (masked emails) |
| Settlements (reads only) | `admin_settlements_list` · `admin_settlements_get` |
Launching, advancing or stopping batches and cancelling CRM campaigns is not
exposed: those operations send real email and WhatsApp to buyers. The contract
marks them `x-ft-mcp: { expose: false }` and `src/coverage.test.ts` fails if a
tool calls them. Use the CLI (`ft admin crm`) or the panel. The same marker
keeps out adding or lifting CRM suppressions, the test send, the people search
(it returns full buyer emails) and every settlement write (create, files,
regenerate, send, mark paid, proofs, delete: organizers' money), which go
through `ft admin crm` / `ft admin settlements` or the panel.
## UI in the host (MCP Apps)
The server implements the **`io.modelcontextprotocol/ui`** extension
([MCP Apps](https://modelcontextprotocol.io/docs/extensions/apps), spec
`2026-01-26`), so lists and reports do not arrive as a wall of JSON: the host
draws them.
- Resource: `ui://freeticket/view.html`, mimeType `text/html;profile=mcp-app`.
- Tools with a view point at it through `_meta.ui.resourceUri`; only those carry
`structuredContent` (what the view reads). Every other tool returns the text
alone, so a host that feeds structuredContent to the model never gets the
payload twice.
## Output budget
Every result is **compact JSON** capped at `MAX_TEXT_CHARS` (25 000 chars,
`src/api.ts`). Over the cap the largest list is cut by whole items and a
`truncated: { shown, total, field, hint }` note says how to get the rest
(`limit` + `cursor` when the tool pages, filters when it does not); the result
is always valid JSON. `sales_list`, `sales_tickets`, `sales_attempts` and the
buyer/attendee exports return a trimmed row by default — `verbose: true` returns
it as the API sends it. Errors keep the API's `error.code` and add `status`,
`retryable`, `retryAfterSeconds` (429) and a `hint` with the next step.
- A single view picks the render from the shape of the payload: **array → table**
(currency formatting, status pills, horizontal scroll), **object → KPI tiles**.
- The HTML is self-contained: no external scripts, no fetch, no remote fonts. It
declares `csp: {}` — it asks for no network, so the host's deny-by-default
sandbox has nothing to block.
- **The brand is ours, the theme is the host's.** The view adopts the host's CSS
variables (`hostContext.styles.variables`) to blend into the chat, but only
those in the extension's contract (`--color-*`, `--font-*`): the FreeTicket
logo and brand accent are not overridable. On a theme change it sets
`data-theme` **and** `color-scheme`, otherwise `light-dark()` would follow the
OS and the view would render light inside a dark chat.
- It listens only to the frame that mounted it (`event.source`), reports its
height with `ui/notifications/size-changed`, formats currency in the host's
locale, and answers `ui/resource-teardown` so unmounting is clean.
- Hosts without the extension (or terminal clients) ignore `_meta` and see the
same text as always: nothing breaks.
**49 tools with a view** (v0.20.0) — every list and every report. Details
(`*_get`) and writes deliberately have none: a lone object or a `delete`
acknowledgement gains nothing from a table, and drawing one suggests there is
data where there is not. `src/ui.test.ts` mounts the real view in jsdom and
fails if a new list registers without `_meta.ui`, if the host manages to
override the branding, or if an API payload renders unescaped.
## Support and privacy
- Support: [soporte@freeticket.us](mailto:soporte@freeticket.us), or open an
issue at
[AppFreeticket/freeticket-mcp](https://github.com/AppFreeticket/freeticket-mcp/issues).
- Privacy policy:
[appfreeticket.com/legal/privacidad](https://appfreeticket.com/legal/privacidad).
The server is stateless: it keeps no log or store of tool results.
## Development
```bash
pnpm install
pnpm generate # regenerates src/client/, src/admin-client/ and src/public-client/ from the specs
pnpm dev # runs the server over stdio
pnpm typecheck && pnpm test
```
Contracts this build targets: B2B **1.45.0**, superadmin **1.8.0**, public
**0.10.1**. All three are served by `free-admin` and are the only source of
truth, on separate semver lineages. To propagate a backend change, use the
`contract-sync` agent from the
[ai-native](https://github.com/AppFreeticket/ai-native) umbrella — and check for
drift first: what free-admin serves today may already be ahead of the numbers
above.
MIT.
TDQS
A4/5.0
Scored across 6 tools
Disambiguation5/5
Each tool targets a distinct resource-action pair (events availability, events detail, events list, orders create, orders get, tickets resend) with no functional overlap.
Naming Consistency5/5
All tools follow a consistent 'public_{resource}_{action}' pattern using snake_case, making it predictable for an agent.
Tool Count5/5
With 6 tools, the server is well-scoped for B2C event browsing and order management, covering the essential workflows without bloat.
Completeness4/5
The set covers the main user journey (browse, check stock, create order, check status, resend ticket) but lacks a cancel order tool, which is a minor gap.
Maintenance
ActivityActive
ResponsivenessMostly unanswered