Support Desk MCP Server
by Laxman-1998
README.md
# mcp-support-desk-server
An [MCP](https://modelcontextprotocol.io) server that lets an AI agent work a **synthetic** support desk (tickets, customers, refund requests), with the controls you would want before giving an agent access to a real business system:
- **Scoped permissions.** The operator grants scopes when the server starts. The default is read-only.
- **PII masking.** Customer emails are masked unless `customers:pii` is granted.
- **Draft-only and request-only writes.** The server can save a reply draft and file a refund request; it cannot send an email or pay out money. A human approves outside the server.
- **Refund cap and duplicate guard** enforced server-side, not left to the model.
- **Audit log** of every call, including denied and rejected ones, with the actor and arguments.
- **Untrusted-content signalling.** Ticket text is marked `body_is_untrusted_customer_text` in tool output and in tool descriptions. The data includes 8 deliberately hostile tickets (prompt injection, data exfiltration attempts) for red-team testing of agents.
All data is generated and fictional (`example.com` / `example.net` addresses). No real customer or employer data is involved.
Part of a set with [`safe-agent-runtime`](https://github.com/Laxman-1998/safe-agent-runtime) (an agent that uses this server) and [`llm-eval-observability`](https://github.com/Laxman-1998/llm-eval-observability).
## Quick start
```bash
pip install -e ".[dev]"
supportdesk seed --db desk.db # 60 customers, 408 tickets (400 normal + 8 hostile), seed=7
pytest -q # 11 tests, including a real stdio subprocess run
supportdesk serve --db desk.db # stdio, read-only grant
supportdesk serve --db desk.db --actor triage-bot \
--scopes tickets:read,customers:read,tickets:write,refunds:write
supportdesk audit --db desk.db --limit 20
```
Use it from an MCP host (for example Claude Desktop or Claude Code) by registering the command `supportdesk serve --db /path/desk.db --scopes ...` as a stdio server.
## Tools
| Tool | Scope | Effect |
|---|---|---|
| `search_tickets` | `tickets:read` | Word search on subject and body, filters, max 50 results |
| `get_ticket` | `tickets:read` | Ticket plus internal notes, body truncated to 2000 characters |
| `get_customer` | `customers:read` | Profile, email masked unless `customers:pii` |
| `add_internal_note` | `tickets:write` | Adds a note invisible to the customer |
| `draft_reply` | `tickets:write` | Saves a draft only; nothing is sent |
| `update_ticket_status` | `tickets:write` | open, pending, resolved or closed |
| `request_refund` | `refunds:write` | Creates a `pending_approval` request, capped (default 200), one pending per ticket |
Also exposed: the `supportdesk://schema` resource and a `triage_ticket` prompt that tells the model to treat ticket text as data and to flag injection attempts.
Read tools carry the MCP `readOnlyHint` annotation, and write tools do not, so hosts can show the right approval UI.
## What this does and does not protect against
The server enforces limits that do not depend on the model behaving well: scopes, caps, masking, draft-only writes, an audit trail, parameterised SQL and escaped `LIKE` wildcards. See [`docs/threat-model.md`](docs/threat-model.md) for the mapping to the OWASP Top 10 for LLM Applications.
It cannot stop a model from being *talked into* calling a permitted tool, for example adding a misleading note or filing a small refund request. That defence belongs to the agent runtime (approval gates, injection screening, budgets) and is the subject of `safe-agent-runtime`.
## Design decisions
- **Grant at launch, not per call.** MCP over stdio has no login step, so the operator who starts the process picks the scopes. For a remote deployment the same `Principal` would come from a verified token.
- **Requests, not actions, for money.** An agent that can file a request is useful; one that can pay is a liability.
- **Synthetic and seeded.** Same seed, same data, so evals are repeatable.
- **Tests go through the real MCP protocol** using the in-memory client, plus one test that launches the actual CLI over stdio.
## Limits
- SQLite and a single process; not built for concurrent production traffic.
- Search is substring matching, not full-text or semantic.
- Written against MCP Python SDK 2.x (`MCPServer`); version 1.x used a different class name.
MIT licensed.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues