# mcp-ticket-demo [Health: Active]

**Category:** 🎧 Support & Service Management  
**Repository:** https://github.com/markusvankempen/mcp-ticket-demo  
**GitHub Stars:** 1  
**npm Downloads (last month):** 1217  
**Views:** 2  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-ticket-demo

## Description
MCP server demo — tickets, schema discovery, auth, and PII gating. stdio + HTTP.

## Tools
Capabilities this server exposes over MCP:

- **create_ticket** — Open a support ticket on behalf of a customer. ALWAYS pass requester_email as the real customer email. If you omit it the call still succeeds (201) but the service account owns the ticket and every reply is mailed to the bot, not the customer — that is the attribution scar. A tool is not done when the API call succeeds; it is done when the next thing that happens is right. This is a write tool and may require a credential.
- **add_comment** — Add a comment to an existing ticket. You need a real ticket_id from run_query schema=tickets — do not invent TCK- ids. Pass author as the human speaking; omitting it attributes the comment to the service account. This is a write tool and may require a credential. To resolve the ticket after commenting, call close_ticket.
- **close_ticket** — Resolve and close a support ticket (destructive, idempotent). Sets status to solved and records resolved_at. Optionally appends resolution as the final comment. If the ticket is already solved this is a no-op and returns alreadyClosed=true — do not retry. Use a real ticket_id from run_query schema=tickets. Use add_comment first if you want a longer explanation before closing. This is a write tool and may require a credential.
- **get_schema** — Discover names and shapes. With no name: lists every name with its kind (data = object shape: ticket, customer, server; query = tickets, customers, assets, timers, system, settings, events, users, api_keys, trace, errors or counters, the only names run_query accepts; tool = that tool's arguments). With a name from that list: the shape of that one. This does not perform the task. kind=query: the filterable keys are for run_query. kind=tool: these are the arguments, call that tool next and do not pass the tool name to run_query. kind=data: an object shape, call the tool named in next. An unknown name is an error. There is no list_schemas tool and no query_tickets tool.
- **run_query** — Exact-match rows for schema tickets, customers, assets, timers, system, settings, events, users, api_keys, trace, errors or counters only. Timers are read here (there is no get_timer): state, elapsed_ms and remaining_ms are worked out when you query. system is one row about this machine: memory, CPU, disk and whether it is in a container (inside Docker those are the container limits); there is no system_info tool. settings is one row: the saved settings, with no API keys or passwords (there is no get_settings tool); change them with update_settings (MQTT: set_mqtt). events are the events already announced, newest first; filter type takes a name or a group such as ticket.*. users and api_keys need an admin credential and never contain a password or a key secret; there is no list_users or list_api_keys tool. trace (the call trace, only while audit is on), errors (failed calls) and counters (success, error and denied per tool) also need an admin credential; there is no export_log tool. tickets: this is how tickets are found and read (there is no search_tickets or get_ticket tool). filter status (open, pending, solved), requester_email, attribution, query (a keyword in subject or body), or id for one ticket with its body and comments. A list returns the short fields; pass fields to choose others. customers: filter email for one customer (there is no lookup_customer tool). phone is the text REDACTED unless you present a credential with the pii scope. Do not pass a tool name or a singular data name. Do not invent query_tickets or query_with_filter. Empty rows mean no match; loosen the filter, do not retry the same query.
- **describe_server** — Call this first, and again after any denial or empty tool list: server identity, auth mode, who the server thinks you are, the scopes you hold, your rate-limit budget, and every tool with the scope it needs and whether it is currently available. The tools list is the set of actions — call a tool to do the work, do not get_schema it first. Discovery stays open in every auth mode. When a call was denied, this tells you which credential is missing — do not guess.
- **update_settings** — Change settings in one call. The argument has the shape of the settings row that run_query schema=settings returns, and every field is optional: authMode (off, write or all); rateLimit {enabled, limit, windowSeconds}; audit (record the call trace); uiAuth (hide the desk pages until sign-in); protocols {stdio, streamableHttp, sse} (at least one stays on); events {enabled, types, autoTimer, autoSystem} (which events the server announces; types are names, groups such as ticket.* or *); toolGates {tool: true|false} (false disables a tool, not describe_server); toolAuthOverrides {tool: true|false} (true requires a credential for that tool even while auth is off); toolScopeOverrides {tool: read|write|pii|admin|default} (default restores the tool's own scope; admin tools, describe_server and generate_traffic cannot change). Only the fields you send change. Everything is checked first, and if any part is refused nothing is changed. MQTT has its own tool, set_mqtt. Requires admin even when auth mode is off, because it can change auth mode, the rate limit, the call trace, the page lock and who may call what. Then call run_query with schema=settings, or describe_server for the scopes and gates in force.
- **set_mqtt** — Publish the events to an MQTT broker. Publish only: the server does not subscribe. Send url (mqtt://host:1883 or mqtts://host:8883), enabled, topic_prefix, username, password, qos 0 or 1, retain. Anything left out stays. Events must be on (update_settings with events.enabled=true) and only the kinds meant for everyday listeners are published, never settings, users or keys. The password is kept in memory and never shown again. test=true publishes one message to <prefix>/test. Requires admin. Then call run_query with schema=settings and read mqtt.status.
- **create_user** — Create a user. The password is stored as a hash and is never listed. The built-in admin cannot be replaced. Requires admin.
- **delete_user** — Delete a user by username. The built-in admin cannot be removed. Requires admin.
- **issue_api_key** — Issue an API key. The secret is returned once in key and is not stored. Requires admin. Then call run_query with schema=api_keys and confirm the secret is absent.
- **revoke_api_key** — Revoke an API key by id from run_query schema=api_keys or issue_api_key. Requires admin.
- **import_settings** — Restore a whole settings document: the row from run_query schema=settings (with or without kind), or one you saved earlier. Unlike update_settings it also restores MQTT, and it replaces the tool scope overrides. Does not restore API keys or passwords. Requires admin. Then call run_query with schema=settings.
- **generate_traffic** — Record one or more probe rounds in the log. Any credential works, even when auth mode is off. Does not create tickets or change settings. Then call run_query with schema=counters (or trace, when the call trace is on).
- **start_timer** — Start a timer. Pass seconds for a countdown (1 to 3600), or leave seconds out for a stopwatch that counts up until stop_timer. Returns the timer id (TMR-1). There is no get_timer: read state, elapsed_ms and remaining_ms with run_query schema=timers and filter {"id":"TMR-1"}. Do not poll in a loop; query again after the countdown ends.
- **stop_timer** — Stop a timer by its id (TMR-1). The timer keeps its elapsed time and its state becomes stopped. If the timer already stopped or its countdown already ended, nothing changes and alreadyOver is true; do not retry. Use an id from start_timer or from run_query schema=timers.
- **push_timer** — Make a running timer announce its time every every_seconds (1 to 60, default 5) as a timer.tick event tagged with topic. Listeners connect to GET /sse or to GET /mcp on an initialized session, and may filter with ?events=timer.tick&topic=demo. The first tick is sent at once. The pushing ends when the timer is stopped or its countdown ends; every_seconds 0 stops it early and leaves the timer running. Pass for_seconds to end it after that long: on a stopwatch (a clock heartbeat) the timer is stopped then, so start_timer without seconds plus push_timer with for_seconds=120 sends the time every few seconds for two minutes. If events are off, push_timer switches on the timer events itself (timer.started, timer.tick, timer.finished, timer.stopped) so a timer demo needs no admin credential; an administrator can turn that off with update_settings with events.autoTimer=false. Other events (log lines, tickets, settings) still need update_settings (events). This is not how you read a timer; read it with run_query schema=timers.
- **push_log** — Send one line to every client that is listening for log.line, optionally tagged with topic. Use it to test that a subscription works. The line is delivered at once. delivered is false when the server is not announcing log.line (events are off, or log.line is not selected), and next says how to turn it on. Nothing is stored except the recent-events buffer.
- **watch_system** — Announce a system.info event every every_seconds (1 to 60, default 5), the first at once. for_seconds (1 to 3600) stops the watch after that long. every_seconds 0 stops it and leaves nothing running. Only one watch runs at a time; calling this again replaces it. If system events are off, watch_system switches on system.info itself, so a dashboard needs no admin credential; an administrator can turn that off with update_settings with events.autoSystem=false. The numbers are the container's cgroup limit when the process is inside Docker. The watch does not keep the process alive.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "mcp-ticket-demo": {
    "command": "npx",
    "args": ["-y","mcp-ticket-demo"]
  }
}
```

## Documentation

## What mcp-ticket-demo does

The mcp-ticket-demo MCP server models a ticket desk while demonstrating production-oriented MCP patterns. It exposes 19 tools, three resources, and five prompts. Ticket data, schemas, and server operations are available through MCP rather than through a single generic request endpoint.

The ticket portion includes schema discovery through `get_schema` and querying through `run_query`. Creating a ticket can require a requester email; without one, the server records attribution indicating that the bot owns the ticket. Query results for the customer schema can redact the `phone` field when the caller lacks the `pii` scope.

The same server also exposes operational functions for settings, users, API keys, settings import, and sample traffic. Most administrative operations require the `admin` scope, including when authentication is otherwise disabled.

## How it works

The mcp-ticket-demo MCP server supports stdio for locally spawned clients, plus SSE and Streamable HTTP for networked use. All three transports expose the same tool set. The HTTP mode also provides browser-accessible endpoints for health checks, read-only smoke tests, administration, logs, and tool inventory.

Authentication can be configured as `off`, `write`, or `all`. Operators can combine the selected mode with per-tool gates, authentication locks, scopes, and rate limits. Rate-limit failures include a retry interval so clients can avoid retrying continuously. When an administrator changes a gate, connected SSE and Streamable HTTP sessions receive a `tools/list_changed` notification; one-shot curl requests do not maintain a session.

Tools use MCP error signaling with `isError: true` on failures. Tool annotations describe read-only, destructive, idempotent, and open-world behavior, helping clients decide when to confirm or retry an action. Resources include ticket-oriented URIs, open-ticket access, and schema access, with reads subject to the same gate as the corresponding tool.

## Setup and configuration

Use Node.js 18 or later. The quickest local commands are:

```bash
npx mcp-ticket-demo
MCP_MODE=http npx mcp-ticket-demo
```

The default HTTP address is `http://127.0.0.1:8787`. Its `/health` endpoint reports process liveness, while `/test` runs a read-only smoke test. `/admin`, `/log`, and `/tools` provide administration, observability, and tool inventory views. For a public bind or deployment, set `ADMIN_PASSWORD`; the default administrative password is disabled in that situation.

The command-line interface can inspect a running instance with `status`, invoke a tool with `call`, and apply or verify the demonstration configuration with `demo apply` and `demo check`. Use `--json` for script-friendly output. Commands that delete or reconfigure ask for confirmation.

## Tools and capabilities

The mcp-ticket-demo MCP server includes:

- Ticket operations, schema discovery, and filtered queries.
- Three MCP resources and five user-facing prompts.
- API key and user administration.
- Settings updates, imports, gates, locks, scopes, and rate-limit controls.
- PII redaction based on the caller's scope.
- Health, smoke-test, logging, counters, and call-trace views.
- stdio, SSE, and Streamable HTTP access.

VS Code, Cursor, and Windsurf can launch it with `npx mcp-ticket-demo` and `MCP_MODE=stdio`. The repository also documents a VS Code extension that can register the server with supported IDE configurations.

## Limitations and notes

The sample data and ticket desk are intended for learning, demonstrations, integration testing, and reference implementation work. A server started in stdio mode is local to the client process, while HTTP deployment requires operators to consider authentication, password configuration, network binding, and administrative scopes.

The public `/test` endpoint is read-only. Write smoke tests require administrative sign-in. The `/health` endpoint avoids exposing the working directory except on localhost. The `demo apply` command changes real server settings, so it should only be used against a server you control.

_Full upstream README: https://allmcps.com/mcp/mcp-ticket-demo/readme_

