Developer GuideOperations

Running the MCP Server

Production VPS deployment runbook: building the server and static docs bundle, installing the isolated Nginx site with Certbot TLS, and operating taicket-mcp with single-service PM2 commands.

Single-service PM2 operational rule

NEVER run pm2 restart all or pm2 reload all

The Taicket VPS hosts ticketbot-core, ticketbot-dashboard, monopoly-server, tournament-platform, taicket-docs, and taicket-profile inside ecosystem.config.cjs. Always target taicket-mcp explicitly (--only taicket-mcp or pm2 restart taicket-mcp) so live Discord bot sessions and web apps are never interrupted.

The taicket-mcp block in ecosystem.config.cjs runs dist/index.js from ./mcp on port 4130 with instances: 1, autorestart: true, max_memory_restart: 1G, and dedicated log files at ./logs/mcp-out.log and ./logs/mcp-error.log.

Build and single-service PM2 runbook

  1. 1

    Build TypeScript server, tool manifest, and static docs bundle

    Run npm run build:all inside mcp/ to compile dist/, regenerate src/generated/tools-manifest.json, and export the Next.js docs bundle into mcp/dist/site/.

    Build server and docs bundlebash
    cd /path/to/taicket/mcp
    npm ci
    npm --prefix docs-site ci
    npm run build:all
  2. 2

    Start ONLY taicket-mcp on initial deployment

    From the repository root, launch only the taicket-mcp entry and save the PM2 process list.

    Initial single-service PM2 startbash
    cd /path/to/taicket
    pm2 start ecosystem.config.cjs --only taicket-mcp
    pm2 save
  3. 3

    Restart ONLY taicket-mcp and inspect logs

    Use targeted restart and log commands for all subsequent updates.

    Targeted restart and log tailbash
    pm2 restart taicket-mcp
    pm2 logs taicket-mcp --lines 50

Isolated Nginx site and Certbot TLS setup

Taicket MCP uses its own completely separate Nginx configuration at nginx/mcp.taicket.xyz.conf, installed to /etc/nginx/sites-available/mcp.taicket.xyz. Never modify existing site configs such as taicket.xyz or docs.taicket.xyz.

Install dedicated Nginx site and provision Let's Encrypt TLSbash
# 1. Ensure ACME webroot directory exists
sudo mkdir -p /var/www/certbot

# 2. Provision Let's Encrypt certificate for mcp.taicket.xyz
sudo certbot certonly --webroot -w /var/www/certbot -d mcp.taicket.xyz

# 3. Install isolated Nginx site configuration
sudo cp nginx/mcp.taicket.xyz.conf /etc/nginx/sites-available/mcp.taicket.xyz
sudo ln -sf /etc/nginx/sites-available/mcp.taicket.xyz /etc/nginx/sites-enabled/mcp.taicket.xyz

# 4. Validate configuration syntax and reload Nginx gracefully
sudo nginx -t
sudo systemctl reload nginx

External prerequisites before public go-live

Before running Certbot, create an A record for mcp.taicket.xyz in Cloudflare pointing to the VPS IPv4 address, and register https://mcp.taicket.xyz/oauth/discord/callback under OAuth2 -> Redirects in the Discord Developer Portal.

Post-deployment health and security checks

Verify live HTTPS endpoints and security headersbash
# Health endpoint
curl -i https://mcp.taicket.xyz/health

# OAuth 2.1 discovery documents
curl -s https://mcp.taicket.xyz/.well-known/oauth-protected-resource
curl -s https://mcp.taicket.xyz/.well-known/oauth-authorization-server

# Confirm unauthenticated /mcp returns 401 + WWW-Authenticate
curl -i -X POST https://mcp.taicket.xyz/mcp \
  -H "Content-Type: application/json" \
  -d '{}'

# Confirm X-Frame-Options: DENY & Cache-Control: no-store on /account
curl -sI https://mcp.taicket.xyz/account

Related documentation