A Model Context Protocol (MCP) server that provides AI agents with access to the Ticket Generator APIs for managing tickets and events.
This MCP server acts as a bridge between AI agents and the Ticket Generator APIs, allowing AI assistants to:
- Get ticket data and information
- Generate ticket URLs for sharing
- Send tickets via email or other delivery methods
- Retrieve event details and information
- Node.js 18.0.0 or higher
- A Ticket Generator API key (obtain from https://apis.ticket-generator.com/client/api-docs/)
- (For local development) ngrok for exposing local server
-
Install dependencies:
npm install
-
Start the server (HTTP mode):
npm run dev:http
-
Expose locally with ngrok:
ngrok http 3000
-
Configure your MCP client with the ngrok URL and your API key:
{ "mcpServers": { "ticket-generator": { "url": "https://your-ngrok-url.ngrok-free.app/mcp", "headers": { "Authorization": "your_ticket_generator_api_key" } } } }
Important: The API key is passed securely via the Authorization header from your MCP client configuration. It is:
- Never stored in environment variables or
.envfiles - Session-specific - each client session has its own API key
- Transmitted securely over HTTPS (production) or ngrok tunnel (development)
This MCP server runs in HTTP transport mode for both development and production. The API key is securely passed from your MCP client configuration.
-
Start the MCP server in HTTP mode:
npm run dev:http
This will start the server on
http://localhost:3000 -
In a separate terminal, expose your local server using ngrok:
ngrok http 3000
-
Copy the ngrok forwarding URL (e.g.,
https://abc123.ngrok-free.app) -
Configure your MCP client (Claude Desktop, Cursor, etc.) with the ngrok URL and your API key:
{ "mcpServers": { "ticket-generator": { "url": "https://abc123.ngrok-free.app/mcp", "headers": { "Authorization": "your_ticket_generator_api_key" } } } }
For production deployment, follow these steps:
-
Deploy the server to your hosting platform (AWS, DigitalOcean, etc.)
-
Set the required environment variables:
export MCP_TRANSPORT=http export PORT=3000 export HOST=0.0.0.0
-
Optional environment variables for production:
CORS_ORIGINS— comma-separated allowed origins (e.g.,https://yourapp.com)RATE_WINDOW_MS— rate-limit window in ms (default: 60000)RATE_MAX— max requests per IP per window (default: 60)JSON_LIMIT— JSON body limit (default: 200kb)LOG_FORMAT— morgan log format (default: combined)
-
Start the server:
npm start
-
Configure your MCP client with your production URL:
{ "mcpServers": { "ticket-generator": { "url": "https://your-production-domain.com/mcp", "headers": { "Authorization": "your_ticket_generator_api_key" } } } }
GET /health— Health check endpointPOST /mcp— MCP initialization and tool call handlingGET /mcp— Server-to-client notifications via streamingDELETE /mcp— Session termination
The MCP server provides the following tools for AI agents:
Gets ticket data and information from the Ticket Generator API.
Parameters:
ticket_id(required): The unique ID of the ticket to retrieve data forevent_id(optional): The event ID associated with the ticketuser_id(optional): The user ID who owns the ticket
Generates a ticket URL for sharing or accessing the ticket.
Parameters:
ticket_id(required): The unique ID of the ticket to get URL forevent_id(optional): The event ID associated with the ticketuser_id(optional): The user ID who owns the ticketformat(optional): URL format preference (web, mobile, pdf) - default: web
Sends a ticket via email or other delivery method.
Parameters:
ticket_id(required): The unique ID of the ticket to sendrecipient_email(required): Email address to send the ticket torecipient_name(optional): Name of the recipientdelivery_method(optional): Delivery method (email, sms, whatsapp) - default: emailmessage(optional): Custom message to include with the ticket
Gets event details and information from the Ticket Generator API.
Parameters:
event_id(required): The unique ID of the event to get details forinclude_tickets(optional): Whether to include ticket information in the response - default: falseinclude_attendees(optional): Whether to include attendee information in the response - default: false
Add this server to your Claude Desktop configuration file (claude_desktop_config.json):
{
"mcpServers": {
"ticket-generator": {
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "your_ticket_generator_api_key"
}
}
}
}For local development with ngrok:
{
"mcpServers": {
"ticket-generator": {
"url": "https://abc123.ngrok-free.app/mcp",
"headers": {
"Authorization": "your_ticket_generator_api_key"
}
}
}
}Add the server to your Cursor MCP configuration:
{
"mcpServers": {
"ticket-generator": {
"url": "https://your-server-url.com/mcp",
"headers": {
"Authorization": "your_ticket_generator_api_key"
}
}
}
}Any MCP-compatible client can connect to this server using HTTP transport. Configure it with:
- URL: Your server endpoint (e.g.,
https://your-domain.com/mcp) - Authorization Header: Your Ticket Generator API key
This MCP server integrates with the following Ticket Generator API endpoints:
/ticket/data- Get ticket data and information/ticket/url- Generate ticket URLs for sharing/ticket/send- Send tickets via email or other delivery methods/event/details- Get event details and information
For detailed information about the Ticket Generator APIs, visit: https://apis.ticket-generator.com/client/api-docs/
The MCP server includes comprehensive error handling:
- Invalid API keys are caught and reported
- Network errors are handled gracefully
- Invalid parameters are validated and error messages are provided
- All errors are returned in a structured format for AI agents to understand
ticket-generator-mcp/
├── server.js # Main MCP server implementation
├── package.json # Node.js dependencies and scripts
├── ecosystem.config.cjs # PM2 configuration for production
├── deploy.sh # Deployment script
├── nginx.conf # Nginx reverse proxy configuration
├── Dockerfile # Docker container configuration
└── README.md # This file
To add new tools to the MCP server:
- Add the tool definition to the
getToolDefinitions()function - Add the corresponding case in the
handleToolCall()function - Implement the API call using the
makeTGRequesthelper function
-
Install dependencies:
npm install
-
Start the server in development mode:
npm run dev:http
-
In a separate terminal, start ngrok:
ngrok http 3000
-
Use the ngrok URL to configure your MCP client with your API key in the Authorization header
ISC
For issues related to:
- This MCP server: Create an issue in this repository
- Ticket Generator APIs: Contact Ticket Generator support
- MCP protocol: Refer to the MCP documentation