Ticket Generator MCP Server for Streamable HTTP
Generate tickets and fetch active events with an MCP server using Streamable HTTP—connect AI models to Ticket Generator APIs via three generation modes.
npx -y @trycon/ticket-generator-mcpOverview
The Ticket Generator MCP Server implements the Model Context Protocol (MCP) over Streamable HTTP to bridge AI models and Ticket Generator APIs. It provides a lightweight HTTP server that exposes MCP-compatible endpoints for generating tickets and retrieving active events. The server supports both synchronous and streaming interactions, letting models produce structured ticket output while receiving incremental updates.
This server is useful when you want to integrate an LLM or other model into a ticketing workflow without building a custom adapter. It standardizes three generation modes (single, batch, streaming) so models and downstream systems can use the same protocol to create tickets, query available events, and follow long-running generation processes in real time.
Features
- MCP v1-compatible over Streamable HTTP (chunked/Server-Sent semantics)
- Three generation modes: single-ticket, batch generation, and streaming generation
- Endpoints for: generate tickets, fetch active events, and health checks
- Environment-driven configuration and Docker support
- Example request/response shapes for easy integration with model clients
- Lightweight, framework-agnostic server suitable as an adapter between models and ticket APIs
Installation / Configuration
Prerequisites:
- Node.js 18+ (or equivalent runtime)
- Optional: Docker for containerized deployment
Install and run locally:
# clone
# install
# run
PORT=8080 TICKET_API_URL="https://api.ticket-generator.example" TICKET_API_KEY="sk_..."
Example .env (create a .env file or export env vars):
PORT=8080
TICKET_API_URL=https://api.ticket-generator.example
TICKET_API_KEY=sk_examplekey
LOG_LEVEL=info
Run with Docker:
# Dockerfile (example)
FROM node:18-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --production
COPY . .
CMD ["node", "server.js"]
Build & run:
Configuration options (env vars):
- PORT — HTTP port to listen on (default: 8080)
- TICKET_API_URL — Base URL for the upstream Ticket Generator API
- TICKET_API_KEY — API key for upstream authentication
- LOG_LEVEL — Logging verbosity (debug/info/warn/error)
Available Resources
The server exposes MCP-style endpoints that are intended to be used by model runtimes or MCP-capable clients.
| Endpoint | Method | Purpose |
|---|---|---|
| /mcp/generate | POST | Generate tickets (single, batch, or streaming) |
| /mcp/events | GET | List active events available to attach tickets to |
| /health | GET | Health check and readiness |
| /metrics | GET | Optional metrics endpoint (if enabled) |
Request/response formats use JSON with an MCP-compatible envelope. Streaming responses are delivered as chunked JSON objects (one per line) so MCP clients can consume partial output.
Generation Modes
The server supports three modes selected via the “mode” field in the request body.
- single — Produce one ticket in a single response (synchronous).
- batch — Produce multiple tickets in one synchronous response (array).
- stream — Produce tokens or partial ticket objects incrementally; the server sends newline-delimited JSON chunks (streaming).
Use Cases
Below are concrete examples showing how to use each mode.
Single-ticket generation (synchronous)
Response (200 OK, JSON):
Batch generation (multiple tickets)
Response:
Streaming generation (incremental)
Server will stream NDJSON chunks: {“event”:“partial”,“data”:{“text”:“Creating summary…”}} {“event”:“partial”,“data”:{“text”:“Fetching event suggestions…”}} {“event”:“done”,“data”:{“ticket”:{“id”:“TCK-999”,“summary”:“…”,“description”:“…”}}}
Fetching active events
Response:
Connecting an AI model
- Use the “/mcp/generate” endpoint as the model’s output sink.
- For streaming models, read chunked responses to retrieve partial tokens and final structured output.
- Use metadata to pass model context, user info, or routing hints to the Ticket Generator API.
Notes and Best Practices
- Expect streaming responses to be newline-delimited JSON; implement line-by-line parsing.
- Validate upstream API credentials and use TLS for production deployments.
- Use the “metadata” field to carry structured context (event IDs, user IDs) so generated tickets are actionable.
- Keep prompts and templates deterministic for reproducible ticket fields when integrating with automated workflows.
Repository and source code are