IntroductionTechnical

Architecture overview

Technical architecture of the standalone Taicket MCP service: single-process Express and Streamable HTTP runtime, 11-database isolation topology, OAuth 2.1 security controls, and static documentation pipeline.

Single-process service topology

Taicket MCP runs as one standalone TypeScript service inside mcp/, managed by a single PM2 process (taicket-mcp) listening on 127.0.0.1:4130 behind an isolated Nginx virtual host at /etc/nginx/sites-available/mcp.taicket.xyz. It does not modify or share runtime state with the existing dashboard/, bot/, docs/, profile/, tournament/, activity/, or club/ services.

Route PrefixSubsystemResponsibilities
/mcpStreamable HTTP MCP TransportHandles POST, GET, and DELETE MCP protocol frames with per-request Bearer verification, scope enforcement, and rate limiting.
/.well-known/* & /oauth/*OAuth 2.1 Authorization ServerServes RFC 9728 / RFC 8414 metadata, DCR (/oauth/register), CIMD fetcher, Discord OAuth2 callback, consent UI, token issuance, revocation, and /oauth/approve-action.
/account & /account/*Connected Clients & Token PortalDiscord-authenticated web UI for reviewing OAuth grants, minting scoped PATs (tmcp_..., 7d/30d/90d mandatory expiry), revoking tokens, and viewing audit history.
/, /docs/*, /privacy, /terms, /supportStatic Next.js Docs BundleServes the pre-exported static documentation site from mcp/dist/site/ with auto-generated 31-tool schemas.
/healthHealth ProbeLightweight process and database readiness endpoint for local monitoring.

11-database MongoDB isolation layout

All MCP authentication state, encrypted Discord tokens, hashed MCP tokens, setup previews, and tamper-evident audit logs live in a dedicated physically isolated MongoDB database (MCP_MONGODB_URI / taicket_mcp). Configuration tools read and write directly across Taicket core and dedicated module clusters through lazy pooled Mongoose connections.

Database ClusterPurposeCollections / Modules
taicket_mcp (Isolated)MCP Auth, Governance & AuditMcpOAuthClient, McpOAuthTransaction (10m TTL), McpOAuthCode (60s TTL), McpOAuthGrant, McpAccessToken, McpRefreshToken, McpSetupPreview (15m TTL), McpAuditLog
Main Taicket DB (MONGODB_URI)Core Platform & Standard ModulesGuildConfig, PanelConfig, QuickResponse, AIPanelConfig, ServerInformation, AutomodGuildConfig, BotAiModeration, AiMemory, ChatBotConfig, ModerationConfig, AutoModConfig, AutoBanConfig, GuildVerification, JailConfig, InterviewConfig, ServerDashboardConfig, LevelingConfig, GreetingConfig, CustomCommand, ComponentBuilder, Utility, Music, ActivityReward, BumpReminder, GuildSubscription (read-only), BotBlacklist
9 Dedicated Module DBsIsolated High-Throughput Modulestaicket_antinuke, taicket_booster, taicket_economy, taicket_giveaways, taicket_jarvis, taicket_match_together, taicket_reaction_roles, taicket_reaction_trigger, taicket_starboard

Per-request zero-trust execution pipeline

Every invocation hitting POST /mcp passes through six mandatory verification stages before any tool handler executes:

  1. Token hashing & grant lookup:: requireMcpBearerAuth extracts the Bearer token (OAuth 2.1 access token or tmcp_... PAT), computes its SHA-256 digest, and verifies active status, expiry, resource match (https://mcp.taicket.xyz/mcp), and required scope.
  2. Server-derived caller identity:: ctx.userId is derived strictly from the verified database token record. Tools never accept a caller user ID parameter.
  3. Global blacklist & grant guild allowlist:: Checks BotBlacklist for both ctx.userId and target guildId, and enforces tokenRecord.allowedGuildIds when the user scoped the token to specific servers.
  4. Live Discord & DB RBAC parity:: Evaluates Real Admin (Owner / 0x8 / 0x20), Temp Admin, Anti-Nuke Owner/Trusted/EmergencyOperator, Interviewer, ServerDashboard, and ComponentBuilder access with field-level projection filtering.
  5. Cross-guild resource, role safety & tier validation:: Verifies every channel/category ID against live fetchGuildChannels(guildId), enforces isRoleSafeForDelegation across all role assignments, validates regex/media URLs (DNS-rebinding-pinned), and applies all 18 Free/Pro/Enterprise tier gates.
  6. Tamper-evident audit logging & error sanitization:: Appends a hash-chained HMAC-SHA256 entry to taicket_mcp.mcp_audit_logs and strips any internal details via sanitizeMcpError.

Automated schema-to-docs parity

All 31 MCP tools define their input schemas in Zod inside mcp/src/tools/registry.ts. During builds, mcp/scripts/generate-docs-manifest.ts emits mcp/docs-site/src/generated/tools-manifest.json, guaranteeing that every documented parameter, scope, annotation, and error code matches production code.

Sample MCP server initialization capabilities payloadjson
{
  "protocolVersion": "2025-03-26",
  "serverInfo": {
    "name": "taicket-mcp",
    "version": "1.0.0"
  },
  "capabilities": {
    "tools": {
      "listChanged": false
    },
    "resources": {
      "subscribe": false,
      "listChanged": false
    },
    "prompts": {
      "listChanged": false
    }
  }
}

Related documentation