helpdesk
Enables a support team's AI assistant to search support tickets, reply to tickets, read full ticket threads as resources, and draft replies, with every operation scoped to the agent's team.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Build an MCP server in Node.js with NestJS
This is the finished application of the tutorial Build an MCP server in Node.js in the NestJS documentation. The tutorial builds it step by step and explains every decision; this repository is the result, ready to clone.
What it does
An MCP server for a helpdesk, built with @nestjs/mcp, that lets a support team's AI assistant work with tickets:
Two tools:
search-tickets(read-only) andreply-to-ticket, with Zod schemas written for the model and validation errors it can read.Each ticket as a resource,
tickets://{ticketId}, with its whole thread, and adraft-replyprompt that embeds the ticket.Streamable HTTP at
POST /mcp, as an OAuth 2.1 resource server: it accepts only JWT access tokens issued for it (issuer, audience,typ: at+jwt, signature checked against the provider's JWKS), and answers a request without one with a 401 that points at its protected resource metadata.Every query scoped to the team named in the token: an agent of one team never reads or changes another team's tickets, whatever the model asks for. Replying needs the
tickets:writescope.Requests from web pages on other sites, or with a
Hostit doesn't answer to, get 403.The same tools over stdio (
node dist/stdio.js), for an assistant that launches the server locally, with the team taken fromHELPDESK_TEAM.Tickets, replies and teams in PostgreSQL through Drizzle; every call reported to NestJS Observe once it has a key pair.
There is no identity provider here. scripts/dev-issuer.ts stands in for one on your machine: it holds a key pair, serves its public key as a JWKS, and signs access tokens for any agent, team and scopes you ask for. The tests use it too.
Warning: the development issuer gives a token to anyone who asks. It is for local use only: never deploy it. It refuses to start with
NODE_ENV=production, listens on the loopback interface only, and lives inscripts/, which the build doesn't compile. It is not an authorization server either: it has no sign-in page, so clients that sign users in through OAuth can't use it.
Related MCP server: Freshdesk MCP Server
Run it
You need Node.js 22.18 or later (the development issuer runs TypeScript directly), and Docker for PostgreSQL.
git clone https://github.com/nestjs/example-mcp-server.git
cd example-mcp-server
npm install
cp .env.example .env
docker compose up -d
npm run db:migrate
npm run build
npm run db:seed # two teams, four tickets; it empties the tables firstStart the development issuer in one terminal. It serves its keys at http://localhost:3001/jwks.json and tokens at POST http://localhost:3001/token:
npm run dev:issuerStart the server in another:
npm run startThe MCP endpoint is http://localhost:3000/mcp. Get a token for Ada, of the billing team, and search her team's tickets:
TOKEN=$(curl -s localhost:3001/token -d username=ada -d team=billing -d 'scope=tickets:read tickets:write' | jq -r .access_token)
curl localhost:3000/mcp -H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
-H "Authorization: Bearer $TOKEN" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"search-tickets","arguments":{"text":"refund"}}}'The tutorial's Try it section goes further with curl and the MCP Inspector: the 401 challenge, reading a ticket, replying, another team's agent, a read-only token. Connect an assistant shows how to add the server to Claude Code, Cursor, VS Code and other clients, over HTTP with the token as a header, or as a stdio command:
{
"mcpServers": {
"helpdesk": {
"command": "node",
"args": ["/path/to/example-mcp-server/dist/stdio.js"],
"env": { "HELPDESK_TEAM": "billing" }
}
}
}Use node with the built file's absolute path, not npm run, which prints its own lines to stdout, the protocol's channel. The rest of the configuration comes from the project's .env.
A real identity provider
In production, point the configuration at your identity provider instead of the development issuer (see Use a real identity provider):
MCP_RESOURCE: the server's publichttpsURL, such ashttps://helpdesk.example.com/mcp. Create an API in the provider whose identifier is this URL, with the scopestickets:readandtickets:write, and a claim for the team.OIDC_ISSUER: the exactissof the provider's access tokens.OIDC_JWKS_URL: thejwks_uriof its/.well-known/openid-configurationdocument.OIDC_AUDIENCE: the tokens'aud, only when the provider can't make itMCP_RESOURCE(Entra ID puts the API's client ID there).OIDC_TOKEN_TYPE: thetypheader of its access tokens,at+jwtby default; set it empty for a provider that sends none (Entra ID, Okta).OIDC_TEAM_CLAIM: the claim that names the agent's team,teamby default.MCP_ALLOWED_HOSTS: the hostnames clients reach the server by.
The tutorial has a table of the differences between Auth0, Microsoft Entra ID, Okta and WorkOS AuthKit. It summarizes each provider's documentation and wasn't run against them: decode one access token from your provider and compare it with the configuration before you deploy. With a real provider, most MCP clients sign the user in themselves, from the 401 and the metadata.
Operations
Operation | Section |
Tools | |
Resource template | |
| |
| |
|
Layout
Path | What it holds |
| the HTTP server on the Node adapter: JSON logs in production, security headers, shutdown hooks |
| the stdio server, from an application context, with every log line on stderr |
| NestJS Observe, config, database, and |
| the environment's schema, checked at startup |
| the Drizzle tables ( |
|
|
| the tools, resource template and prompt ( |
| the development issuer, for your machine and the tests only |
| e2e tests on PostgreSQL: in memory, over HTTP, and over stdio |
| migrations |
Tests
TEST_DATABASE_URL=postgres://postgres:helpdesk@localhost:5432/helpdesk_test npm run test:e2edocker compose creates the helpdesk_test database. The tests truncate its tables, so never point them at your development database. The script builds first, because the stdio tests launch dist/stdio.js, which reads the rest of its configuration from .env: copy .env.example to .env before running them. They serve the development issuer's keys on 127.0.0.1:3162 and the application on 127.0.0.1:3163.
Stack
NestJS 12 on the Node adapter, @nestjs/mcp on the MCP TypeScript SDK, Zod, @nestjs/config, JwtVerifier from @nestjs/authentication, Drizzle and PostgreSQL, NestJS Observe, and Vitest.
Production
Read the tutorial's production checklist first: https://docs.nestjs.com/tutorials/mcp-server#production-checklist. Never deploy the development issuer, or a token endpoint like it.
NestJS Observe is wired in src/app.module.ts and sends nothing until it has a key pair. npx @nestjs/observe link writes the key pair (OBSERVE_APP_KEY, OBSERVE_APP_SECRET) into .env; in production, set them in the platform's environment, since start:prod doesn't load .env. Observe then records each MCP call under its operation, such as tools/call search-tickets: https://docs.nestjs.com/observability/overview. For the stdio server, add the key pair to the client's env, since the SDK reads it before .env is loaded.
License
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Helpdesk tickets from your AI: find, reply, take, hold, complete — within your own role. OAuth.
Read tickets, contacts, companies, agents and groups; create, update and reply to tickets.
Work your Help tickets with your AI: read them, reply or leave notes, and set up forms and sites.
Read tickets, users, orgs, macros and satisfaction ratings; create, update and comment on tickets.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to search and retrieve support tickets, add notes, close tickets, and access SLA policies through MCP tools, resources, and prompts over Streamable HTTP.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to search and read tickets and their conversations, contacts, companies, agents, groups, knowledge base articles, SLA policies, business hours and canned responses, and, on explicit request, create and update records, reply to tickets, add notes, and perform confirmed deletes, merges or conversions. It is stateless and multi-tenant, taking per-request credentials via HTTP headers so every action is performed as the designated agent.Apache 2.0
- FlicenseNot gradedqualityAmaintenanceEnables users to retrieve and manage support tickets and comments, analyze tickets, draft responses, and access help center articles through a Model Context Protocol integration with OAuth-backed per-user permissions.-
- FlicenseNot gradedqualityAmaintenanceEnables AI assistants to retrieve and manage support tickets and comments, analyze tickets, draft responses, and search help center articles as a knowledge base. Each operator authorizes with their own login via OAuth, so their existing role, group restrictions, and comment authorship apply to every action.-