Skip to main content

Platform services

These are infrastructure integrations, not sales channels.

SystemRoleFailure observed
S3-compatible storageRequired at boot. Presigned upload and download. Label artifactsMissing settings fail boot. Public URL fallback 404s on R2 if AWS_S3_PUBLIC_URL is unset
SMTP (nodemailer)Welcome, password reset, tenant invite, ticket notification on email_queueIf SMTP_HOST is set, port and from-address are mandatory. 3 attempts. Forgot-password still returns success to the client
Sentry5xx, terminal Bull failures, TrackedCron, outbox consumers, reportErrorInitialized from src/instrument.ts. DSN required in production
Prometheus/metricsBypasses JWT
AI gatewayAI_BASE_URL, AI_API_KEY, AI_MODEL, AI_EMBEDDING_MODEL. Compose points at BifrostEmbedding service catches failures so the API still boots
Cloudflare TurnstileLogin and signupBlank keys disable CAPTCHA
TwilioVoice agentToken stored encrypted on VoiceAgentConfig
Faster-Whisper / KokoroVOICE_STT_URL, VOICE_TTS_URLLocal defaults. Not shown as Compose services in the portion that was read
Bharat AddressAddress validation sidecarBHARATADDRESS_SIDECAR_URL

Files​

POST /v1/files/uploads/:purpose uploads through the API. POST /v1/file/get-presign returns a pre-signed URL so bytes can go to object storage. A separate operations file controller also exists.

MCP​

Tenants connect ChatGPT, Claude, Claude Code and other MCP clients to their workspace. The code is in src/modules/automation/mcp, on the official @modelcontextprotocol/sdk.

RouteWhat it is
POST /mcpMCP endpoint. Streamable HTTP, stateless, JSON responses. GET/DELETE answer 405.
/.well-known/oauth-protected-resource[/mcp]Protected resource metadata (RFC 9728).
/.well-known/oauth-authorization-serverAuthorization server metadata (RFC 8414).
/oauth/authorize, /oauth/token, /oauth/register, /oauth/revokeOAuth 2.1 with PKCE S256. Clients are identified by metadata document (CIMD) or dynamic registration.
/v1/mcp/authorization-requests/*Backs the admin consent page at /oauth/consent.
/v1/mcp/settings, /v1/mcp/grants, /v1/mcp/activitySettings → AI Assistants.
  • Two switches, both off by default: MCP_ENABLED=true for the deployment (otherwise every route above is 404) and TenantSetting.mcpEnabled per tenant.
  • A grant (McpGrant) binds one user, membership, tenant and client. Every request re-checks it within a 30-second cache. It checks the membership is active, the tenant is active and MCP-enabled, the user holds AI:USE, and the user is not warehouse-confined.
  • Calls run as platformRole: NONE in the grant's tenant. A platform-admin context would bypass the tenancy extension.
  • The code lives at src/modules/automation/mcp, next to the voice and WhatsApp agents. Like them, it is a channel onto the AI tools. Its tables are reached through McpRepository.
  • Tools are the READ tools from AiToolRegistryService, filtered by RBAC, plus search and fetch for ChatGPT. Write tools are not exposed. Results go through the AI prompt-injection sanitiser.
  • A tool's surfaces decides where it is offered: the in-app workspace, MCP, or both (the default). The read-only insight tools in finance, procurement, inventory-health, sales-insight and operations-insight are ['mcp']. Every report that aggregates over a period uses reportRange: 30 days by default, refused beyond 90. The workspace sends every tool to its smaller model on every turn, so add 'workspace' only after testing it there. execute() refuses a tool named from a surface it is not offered on.
  • Insight tool permissions follow the HTTP endpoints for the same data:
    • finance (payouts, receivables and aging, disputes, fee audits, COD, invoices, wallet, freight overcharges): SETTLEMENT:READ;
    • procurement and inventory health (purchase orders, goods receipts, vendors, stock counts, expiring lots, reorder suggestions, valuation): STOCK:READ;
    • REPORT:READ: top products, sales breakdown, coupons, channels;
    • CUSTOMER:READ: customer detail, top customers;
    • RETURN:READ: return analytics;
    • ORDER:READ: SLA breaches, order timeline, exceptions;
    • SHIPMENT:READ: NDR queue, RTO, claims, couriers;
    • FULFILLMENT:READ: manifests;
    • PRODUCT:READ: listing issues.
  • The reorder, valuation and top-product tools use raw SQL, which bypasses the tenancy extension. Each statement filters tenantId itself.
  • Analytics queries: those tools run through AnalyticsDatabaseService (src/common/database). It uses the primary database. Every statement runs under a 15-second timeout scoped to its transaction.
  • Not built yet: open-ended analytics (a governed metric catalogue with query_metrics) and an all-history slow-moving-stock report. Both wait for pre-computed daily rollups, so they don't scan live tables on the primary.
  • Freshness: every MCP tool result carries _meta keys com.pointnxt/asOf, timezone, currency, piiMode and staleChannels. An active channel counts as stale when its order sync is more than 2 hours old. Results other than search and fetch also get a one-line "Data as of …" note.
  • PII: MCP_PII_MODE is full, masked (the default) or none, set per deployment. It is applied to every tool result in McpToolService.execute by utils/pii.util.ts. Fields are matched by name. Free-text fields are also scanned for emails and phone numbers. Other strings are left untouched, so AWBs and order numbers survive.
  • Resources: pointnxt://workspace/context.
  • Output schemas: declared for search and fetch.
  • Access tokens are JWTs with audience $MCP_PUBLIC_URL/mcp, signed with MCP_TOKEN_SECRET. Refresh tokens are opaque, hashed and rotated. Reusing a refresh token revokes the grant.
  • Rate limits are per grant and per tenant (MCP_RATE_LIMIT_*). The global per-IP throttle is skipped because AI clients share egress IPs.
  • Each tool call is logged to McpToolCallLog without arguments or results.