TI

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.

Quick Install
npx -y @trycon/ticket-generator-mcp

Overview

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
git clone https://github.com/trycon/ticket-generator-mcp.git
cd ticket-generator-mcp

# install
npm install

# run
PORT=8080 TICKET_API_URL="https://api.ticket-generator.example" TICKET_API_KEY="sk_..." npm start

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:

docker build -t ticket-generator-mcp .
docker run -p 8080:8080 -e TICKET_API_URL="https://api.ticket-generator.example" -e TICKET_API_KEY="sk_..." ticket-generator-mcp

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.

EndpointMethodPurpose
/mcp/generatePOSTGenerate tickets (single, batch, or streaming)
/mcp/eventsGETList active events available to attach tickets to
/healthGETHealth check and readiness
/metricsGETOptional 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.

  1. single — Produce one ticket in a single response (synchronous).
  2. batch — Produce multiple tickets in one synchronous response (array).
  3. 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)

curl -X POST "http://localhost:8080/mcp/generate" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "single",
    "prompt": "Create a support ticket for a login failure for user [email protected]",
    "metadata": { "priority": "high", "source": "llm" }
  }'

Response (200 OK, JSON):

{
  "ticket": {
    "id": "TCK-1234",
    "summary": "Login failure for [email protected]",
    "description": "User unable to authenticate since 2026-04-09",
    "priority": "high",
    "event_id": "EVT-42"
  }
}

Batch generation (multiple tickets)

curl -X POST "http://localhost:8080/mcp/generate" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "batch",
    "prompt": "Generate tickets for these reports: [..list..]",
    "count": 5
  }'

Response:

{
  "tickets": [ { "id": "TCK-1", ... }, { "id": "TCK-2", ... }, ... ]
}

Streaming generation (incremental)

curl -N -X POST "http://localhost:8080/mcp/generate" \
  -H "Content-Type: application/json" \
  -d '{
    "mode": "stream",
    "prompt": "Create a ticket and stream progress",
    "metadata": {}
  }'

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

curl "http://localhost:8080/mcp/events"

Response:

{ "events": [ { "id": "EVT-42", "name": "Conference 2026", "active": true } ] }

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