feat(enterprise): add Privacy Policy, Data Retention schedule, Sliding-Window Rate Limiting, Optional Auth Layer, Speeding A brand icon, and GitHub footer link

This commit is contained in:
root
2026-10-22 01:21:50 +00:00
parent 55795a3e02
commit be213678f4
16 changed files with 904 additions and 25 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 436 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

+45 -8
View File
@@ -5,6 +5,8 @@ import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
import { CourierRegistry } from "./registry.js"; import { CourierRegistry } from "./registry.js";
import { loadConfig } from "./config.js"; import { loadConfig } from "./config.js";
import { buildMcpServer, TOOLS } from "./server.js"; import { buildMcpServer, TOOLS } from "./server.js";
import { createRateLimiter } from "./middleware/rate_limit.js";
import { optionalAuthMiddleware, isActionPermitted } from "./middleware/auth.js";
import path from "node:path"; import path from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import pg from "pg"; import pg from "pg";
@@ -14,9 +16,27 @@ try {
dbPool = new pg.Pool({ connectionString: dbUrl, max: 4, idleTimeoutMillis: 30000 }); dbPool = new pg.Pool({ connectionString: dbUrl, max: 4, idleTimeoutMillis: 30000 });
} }
catch (_) { } catch (_) { }
// Automated Data Retention Engine (Daily Midnight Sweep)
// Anonymizes customer PII older than 90 days in accordance with data retention policy
setInterval(async () => {
if (dbPool) {
try {
const pruneRes = await dbPool.query(`UPDATE courier_parcels
SET recipient_name = 'ANONYMIZED', recipient_phone = 'ANONYMIZED', recipient_address = 'ANONYMIZED'
WHERE created_at < NOW() - INTERVAL '90 days' AND recipient_name != 'ANONYMIZED'`);
if (pruneRes.rowCount && pruneRes.rowCount > 0) {
console.log(`[Data Retention Engine] Anonymized ${pruneRes.rowCount} legacy order records older than 90 days.`);
}
}
catch (err) {
// Table may not exist in standalone mode; continue safely
}
}
}, 24 * 60 * 60 * 1000).unref();
const PORT = Number(process.env.PORT || 8080); const PORT = Number(process.env.PORT || 8080);
const APP_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); const APP_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const LANDING = path.join(APP_DIR, "index.html"); const LANDING = path.join(APP_DIR, "index.html");
const PRIVACY_HTML = path.join(APP_DIR, "privacy.html");
const HEALTH_HTML = path.join(APP_DIR, "health.html"); const HEALTH_HTML = path.join(APP_DIR, "health.html");
const MCP_EXPLORER_HTML = path.join(APP_DIR, "mcp_explorer.html"); const MCP_EXPLORER_HTML = path.join(APP_DIR, "mcp_explorer.html");
// Pull this client's courier keys from request headers or query params, with fallback to environment // Pull this client's courier keys from request headers or query params, with fallback to environment
@@ -73,6 +93,16 @@ app.use((req, res, next) => {
} }
next(); next();
}); });
// Enterprise Sliding-Window Rate Limiters
const generalLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 120, name: "General Gateway" });
const mcpLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 60, name: "MCP Protocol Gateway" });
const trackingLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 30, name: "Live Tracking Hub" });
const webhookLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 120, name: "Courier Webhook Gateway" });
// Apply global rate limiting and optional auth context evaluation
app.use(generalLimiter);
app.use(optionalAuthMiddleware);
// Static brand assets (app icons, favicons, logos)
app.use("/assets", express.static(path.join(APP_DIR, "assets")));
const sessions = new Map(); const sessions = new Map();
const SESSION_TTL_MS = 60 * 60 * 1000; // 1-hour idle expiration const SESSION_TTL_MS = 60 * 60 * 1000; // 1-hour idle expiration
// Sweep abandoned sessions every 15 minutes to prevent heap bloat // Sweep abandoned sessions every 15 minutes to prevent heap bloat
@@ -89,7 +119,7 @@ setInterval(() => {
} }
} }
}, 15 * 60 * 1000).unref(); }, 15 * 60 * 1000).unref();
app.post("/mcp", async (req, res) => { app.post("/mcp", mcpLimiter, async (req, res) => {
const sessionId = req.headers["mcp-session-id"]; const sessionId = req.headers["mcp-session-id"];
let transport; let transport;
if (sessionId && sessions.has(sessionId)) { if (sessionId && sessions.has(sessionId)) {
@@ -99,7 +129,7 @@ app.post("/mcp", async (req, res) => {
} }
else if (!sessionId && isInitializeRequest(req.body)) { else if (!sessionId && isInitializeRequest(req.body)) {
const registry = new CourierRegistry(loadConfig(keysFromRequest(req))); const registry = new CourierRegistry(loadConfig(keysFromRequest(req)));
const server = buildMcpServer(registry); const server = buildMcpServer(registry, (toolName) => isActionPermitted(req, toolName));
transport = new StreamableHTTPServerTransport({ transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => randomUUID(), sessionIdGenerator: () => randomUUID(),
// Return application/json for POST responses instead of SSE — far more compatible with // Return application/json for POST responses instead of SSE — far more compatible with
@@ -137,7 +167,7 @@ app.post("/mcp", async (req, res) => {
} }
}); });
// GET (server->client SSE stream or Browser Explorer) // GET (server->client SSE stream or Browser Explorer)
app.get("/mcp", async (req, res) => { app.get("/mcp", mcpLimiter, async (req, res) => {
const sessionId = req.headers["mcp-session-id"]; const sessionId = req.headers["mcp-session-id"];
if (!sessionId || !sessions.has(sessionId)) { if (!sessionId || !sessions.has(sessionId)) {
// If opened directly by a human in a web browser, serve the interactive MCP Protocol Explorer! // If opened directly by a human in a web browser, serve the interactive MCP Protocol Explorer!
@@ -170,7 +200,7 @@ app.delete("/mcp", async (req, res) => {
* Official Steadfast Webhook Integration Endpoint * Official Steadfast Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/steadfast * Callback URL: https://courier.auraajenticai.cloud/webhooks/steadfast
*/ */
app.post("/webhooks/steadfast", (req, res) => { app.post("/webhooks/steadfast", webhookLimiter, (req, res) => {
const payload = req.body; const payload = req.body;
console.log("[Steadfast Webhook Received]:", JSON.stringify(payload)); console.log("[Steadfast Webhook Received]:", JSON.stringify(payload));
if (!payload || !payload.consignment_id) { if (!payload || !payload.consignment_id) {
@@ -196,7 +226,7 @@ app.post("/webhooks/steadfast", (req, res) => {
* Official Pathao Webhook Integration Endpoint * Official Pathao Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/pathao * Callback URL: https://courier.auraajenticai.cloud/webhooks/pathao
*/ */
app.post("/webhooks/pathao", (req, res) => { app.post("/webhooks/pathao", webhookLimiter, (req, res) => {
const payload = req.body; const payload = req.body;
console.log("[Pathao Webhook Received]:", JSON.stringify(payload)); console.log("[Pathao Webhook Received]:", JSON.stringify(payload));
return res.status(200).json({ return res.status(200).json({
@@ -208,7 +238,7 @@ app.post("/webhooks/pathao", (req, res) => {
* Official RedX Webhook Integration Endpoint * Official RedX Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/redx * Callback URL: https://courier.auraajenticai.cloud/webhooks/redx
*/ */
app.post("/webhooks/redx", (req, res) => { app.post("/webhooks/redx", webhookLimiter, (req, res) => {
const payload = req.body; const payload = req.body;
console.log("[RedX Webhook Received]:", JSON.stringify(payload)); console.log("[RedX Webhook Received]:", JSON.stringify(payload));
return res.status(200).json({ return res.status(200).json({
@@ -220,7 +250,7 @@ app.post("/webhooks/redx", (req, res) => {
* Official Paperfly Webhook Integration Endpoint * Official Paperfly Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/paperfly * Callback URL: https://courier.auraajenticai.cloud/webhooks/paperfly
*/ */
app.post("/webhooks/paperfly", (req, res) => { app.post("/webhooks/paperfly", webhookLimiter, (req, res) => {
const payload = req.body; const payload = req.body;
console.log("[Paperfly Webhook Received]:", JSON.stringify(payload)); console.log("[Paperfly Webhook Received]:", JSON.stringify(payload));
return res.status(200).json({ return res.status(200).json({
@@ -232,7 +262,7 @@ app.post("/webhooks/paperfly", (req, res) => {
* Live Consumer & Merchant Cyber-Dark Tracking Hub * Live Consumer & Merchant Cyber-Dark Tracking Hub
* GET /track/:code * GET /track/:code
*/ */
app.get("/track/:code", async (req, res) => { app.get("/track/:code", trackingLimiter, async (req, res) => {
const code = req.params.code; const code = req.params.code;
const format = req.query.format; const format = req.query.format;
let courier = (req.query.courier || "").toLowerCase(); let courier = (req.query.courier || "").toLowerCase();
@@ -481,6 +511,13 @@ app.get("/health", (req, res) => {
// Otherwise return JSON for curl, metrics monitors, and Docker health checks // Otherwise return JSON for curl, metrics monitors, and Docker health checks
res.json(data); res.json(data);
}); });
app.get("/privacy", (_req, res) => {
res.sendFile(PRIVACY_HTML, (err) => {
if (err && !res.headersSent) {
res.redirect("/");
}
});
});
app.get("/", (_req, res) => { app.get("/", (_req, res) => {
res.sendFile(LANDING, (err) => { res.sendFile(LANDING, (err) => {
if (err && !res.headersSent) { if (err && !res.headersSent) {
+34
View File
@@ -0,0 +1,34 @@
import { Request, Response, NextFunction } from "express";
export interface AuraAuthContext {
isByok: boolean;
isMasterAuthorized: boolean;
callerToken?: string;
}
declare global {
namespace Express {
interface Request {
auraAuth?: AuraAuthContext;
}
}
}
/**
* Check if the inbound request has merchant custom carrier credentials (BYOK - Bring Your Own Keys)
*/
export declare function hasByokCredentials(req: Request): boolean;
/**
* Extract bearer token or API key from request
*/
export declare function extractAuthToken(req: Request): string | undefined;
/**
* Optional Auth Evaluator:
* Public endpoints, discovery, and BYOK requests are permitted.
* If server has AURA_API_KEY set, master-account mutating actions require authentication.
*/
export declare function optionalAuthMiddleware(req: Request, res: Response, next: NextFunction): void;
/**
* Helper to verify whether an action requires master auth and whether it is granted
*/
export declare function isActionPermitted(req: Request, toolName: string): {
permitted: boolean;
reason?: string;
};
+72
View File
@@ -0,0 +1,72 @@
/**
* Check if the inbound request has merchant custom carrier credentials (BYOK - Bring Your Own Keys)
*/
export function hasByokCredentials(req) {
const h = req.headers;
const q = req.query;
const hasKey = (header, query) => Boolean(h[header] || q[query]);
return Boolean(hasKey("x-steadfast-api-key", "steadfast_key") ||
hasKey("x-pathao-client-id", "pathao_client_id") ||
hasKey("x-redx-api-token", "redx_token") ||
hasKey("x-paperfly-api-key", "paperfly_key"));
}
/**
* Extract bearer token or API key from request
*/
export function extractAuthToken(req) {
const authHeader = req.headers["authorization"] || req.headers["Authorization"];
if (typeof authHeader === "string") {
if (authHeader.startsWith("Bearer ") || authHeader.startsWith("bearer ")) {
return authHeader.slice(7).trim();
}
return authHeader.trim();
}
const customKey = req.headers["x-aura-key"] || req.headers["x-api-key"];
if (typeof customKey === "string") {
return customKey.trim();
}
const qKey = req.query["aura_key"] || req.query["api_key"];
if (typeof qKey === "string") {
return qKey.trim();
}
return undefined;
}
/**
* Optional Auth Evaluator:
* Public endpoints, discovery, and BYOK requests are permitted.
* If server has AURA_API_KEY set, master-account mutating actions require authentication.
*/
export function optionalAuthMiddleware(req, res, next) {
const serverApiKey = process.env.AURA_API_KEY || process.env.COURIER_AUTH_TOKEN;
const isByok = hasByokCredentials(req);
const callerToken = extractAuthToken(req);
const isMasterAuthorized = Boolean(!serverApiKey || (callerToken && callerToken === serverApiKey));
req.auraAuth = {
isByok,
isMasterAuthorized,
callerToken,
};
next();
}
/**
* Helper to verify whether an action requires master auth and whether it is granted
*/
export function isActionPermitted(req, toolName) {
const isMutatingAction = ["create_parcel", "get_balance", "resolve_ndr_issue"].includes(toolName);
// Read-only tools (list_couriers, calculate_delivery_zone_and_fee, compare_courier_rates, etc.) are always permitted
if (!isMutatingAction) {
return { permitted: true };
}
// If caller brought their own courier credentials, they are modifying their own account — permitted!
if (req.auraAuth?.isByok) {
return { permitted: true };
}
// If using server default merchant credentials, verify master authorization
if (req.auraAuth?.isMasterAuthorized) {
return { permitted: true };
}
return {
permitted: false,
reason: `Unauthorized: Dispatching parcels or checking wallet balance using the master merchant account requires a valid Aura API key (pass 'Authorization: Bearer <token>' or 'x-aura-key') or Bring-Your-Own-Keys (BYOK) courier headers.`,
};
}
+9
View File
@@ -0,0 +1,9 @@
import { Request, Response, NextFunction } from "express";
interface RateLimiterOptions {
windowMs: number;
max: number;
message?: string;
name?: string;
}
export declare function createRateLimiter(options: RateLimiterOptions): (req: Request, res: Response, next: NextFunction) => void;
export {};
+71
View File
@@ -0,0 +1,71 @@
export function createRateLimiter(options) {
const { windowMs, max, message = "Too Many Requests. Rate limit exceeded, please retry later.", name = "Default" } = options;
const store = new Map();
// Prune expired rate limit entries every 5 minutes to avoid memory bloat
setInterval(() => {
const now = Date.now();
for (const [key, record] of store.entries()) {
if (now > record.resetAt) {
store.delete(key);
}
}
}, 5 * 60 * 1000).unref();
return (req, res, next) => {
// Extract Client IP (supporting Cloudflare cf-connecting-ip and reverse proxies like Traefik / Nginx)
const cfIp = req.headers["cf-connecting-ip"];
const xForwardedFor = req.headers["x-forwarded-for"];
let clientIp = "";
if (typeof cfIp === "string") {
clientIp = cfIp.trim();
}
else if (typeof xForwardedFor === "string") {
clientIp = xForwardedFor.split(",")[0].trim();
}
else if (Array.isArray(xForwardedFor) && xForwardedFor.length > 0) {
clientIp = xForwardedFor[0].trim();
}
else {
clientIp = req.socket?.remoteAddress || "unknown";
}
// Bypass loopback and internal orchestration networks
if (clientIp === "127.0.0.1" ||
clientIp === "::1" ||
clientIp === "::ffff:127.0.0.1" ||
clientIp.startsWith("10.") ||
clientIp.startsWith("172.16.") ||
clientIp.startsWith("172.17.") ||
clientIp.startsWith("172.18.")) {
return next();
}
const now = Date.now();
let record = store.get(clientIp);
if (!record || now > record.resetAt) {
record = {
count: 1,
resetAt: now + windowMs,
};
store.set(clientIp, record);
}
else {
record.count++;
}
const remaining = Math.max(0, max - record.count);
const resetTimeSec = Math.ceil(record.resetAt / 1000);
const retryAfterSec = Math.ceil((record.resetAt - now) / 1000);
res.setHeader("X-RateLimit-Limit", max);
res.setHeader("X-RateLimit-Remaining", remaining);
res.setHeader("X-RateLimit-Reset", resetTimeSec);
if (record.count > max) {
res.setHeader("Retry-After", retryAfterSec);
res.status(429).json({
error: "Too Many Requests",
limiter: name,
message,
retryAfterSeconds: retryAfterSec,
timestamp: new Date().toISOString(),
});
return;
}
next();
};
}
+4 -1
View File
@@ -7,4 +7,7 @@ export declare const TOOLS: Tool[];
* The registry carries the credentials — for STDIO it comes from env, * The registry carries the credentials — for STDIO it comes from env,
* for HTTP it is built per-request from that client's keys. * for HTTP it is built per-request from that client's keys.
*/ */
export declare function buildMcpServer(registry: CourierRegistry): Server; export declare function buildMcpServer(registry: CourierRegistry, authChecker?: (toolName: string) => {
permitted: boolean;
reason?: string;
}): Server;
+10 -1
View File
@@ -130,11 +130,20 @@ export const TOOLS = [
* The registry carries the credentials — for STDIO it comes from env, * The registry carries the credentials — for STDIO it comes from env,
* for HTTP it is built per-request from that client's keys. * for HTTP it is built per-request from that client's keys.
*/ */
export function buildMcpServer(registry) { export function buildMcpServer(registry, authChecker) {
const server = new Server({ name: "aura-courier-mcp", version: "2.4.0" }, { capabilities: { tools: {} } }); const server = new Server({ name: "aura-courier-mcp", version: "2.4.0" }, { capabilities: { tools: {} } });
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS })); server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
server.setRequestHandler(CallToolRequestSchema, async (request) => { server.setRequestHandler(CallToolRequestSchema, async (request) => {
const { name, arguments: args } = request.params; const { name, arguments: args } = request.params;
if (authChecker) {
const auth = authChecker(name);
if (!auth.permitted) {
return {
isError: true,
content: [{ type: "text", text: JSON.stringify({ error: "Unauthorized", message: auth.reason }, null, 2) }],
};
}
}
try { try {
switch (name) { switch (name) {
case "list_couriers": case "list_couriers":
+10 -6
View File
@@ -5,7 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Aura Courier MCP v2.4 — Universal Bangladesh Logistics & Spatial Engine for AI Agents."> <meta name="description" content="Aura Courier MCP v2.4 — Universal Bangladesh Logistics & Spatial Engine for AI Agents.">
<title>Aura Courier MCP</title> <title>Aura Courier MCP</title>
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='32' y2='32'%3E%3Cstop stop-color='%234d7cff'/%3E%3Cstop offset='.5' stop-color='%238b5cf6'/%3E%3Cstop offset='1' stop-color='%2338bdf8'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M16 3c.8 6.5 4.5 10.2 11 11-6.5 .8-10.2 4.5-11 11-.8-6.5-4.5-10.2-11-11C11.5 13.2 15.2 9.5 16 3z' fill='url(%23g)'/%3E%3C/svg%3E"> <link rel="icon" type="image/png" sizes="32x32" href="/assets/courier-favicon-32.png">
<link rel="icon" type="image/png" sizes="64x64" href="/assets/courier-favicon.png">
<link rel="apple-touch-icon" href="/assets/courier-app-icon.png">
<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
@@ -219,8 +221,8 @@
<!-- ===== HEADER ===== --> <!-- ===== HEADER ===== -->
<header> <header>
<div class="hbar"> <div class="hbar">
<a href="/" class="logo" aria-label="Aura Agentic AI"> <a href="/" class="logo" aria-label="Aura Courier MCP">
<img class="logo-img" src="https://auraajenticai.cloud/logo.png" alt="Aura Agentic AI logo" width="38" height="38" /> <b>Aura Agentic AI</b> <img class="logo-img" src="/assets/courier-app-icon.png" alt="Aura Courier MCP logo" width="38" height="38" style="border-radius:9px; box-shadow:0 0 12px rgba(56,189,248,.35);" /> <b>Aura Courier MCP</b>
<span class="logo-badge mono" data-i18n="header_badge">এমসিপি বাংলাদেশ v2.4</span> <span class="logo-badge mono" data-i18n="header_badge">এমসিপি বাংলাদেশ v2.4</span>
</a> </a>
<div class="header-right"> <div class="header-right">
@@ -486,9 +488,11 @@
<footer role="contentinfo"> <footer role="contentinfo">
<p data-i18n="footer_license">Aura Courier MCP v2.4 · Developed by <b>Aura Agentic AI</b> · Released under <b>Apache License 2.0</b></p> <p data-i18n="footer_license">Aura Courier MCP v2.4 · Developed by <b>Aura Agentic AI</b> · Released under <b>Apache License 2.0</b></p>
<p> <p>
<a href="https://auraajenticai.cloud">auraajenticai.cloud</a> · <a href="https://auraajenticai.cloud" target="_blank" rel="noopener">auraajenticai.cloud</a> ·
<a href="https://git.auraajenticai.cloud">git.auraajenticai.cloud</a> · <a href="https://github.com/auraajenticai/aura-courier-mcp" target="_blank" rel="noopener" style="color:var(--cyan); font-weight:600;"><svg class="ic" width="13" height="13" viewBox="0 0 24 24" fill="currentColor" style="vertical-align:-1px; margin-right:3px;"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0 0 24 12c0-6.63-5.37-12-12-12z"/></svg>github.com/auraajenticai</a> ·
<a href="https://glama.ai/mcp/servers/auraajenticai/aura-courier-mcp">Glama Verified</a> · <a href="https://git.auraajenticai.cloud/khondokar/aura-courier-mcp" target="_blank" rel="noopener">git.auraajenticai.cloud</a> ·
<a href="/privacy" style="color:var(--text); font-weight:500;">Privacy &amp; Data Retention</a> ·
<a href="https://glama.ai/mcp/servers/auraajenticai/aura-courier-mcp" target="_blank" rel="noopener">Glama Verified</a> ·
<a href="/health" data-i18n="footer_telemetry">Live Telemetry</a> <a href="/health" data-i18n="footer_telemetry">Live Telemetry</a>
</p> </p>
</footer> </footer>
+386
View File
@@ -0,0 +1,386 @@
<!doctype html>
<html lang="bn">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Aura Courier MCP — Privacy Policy & Data Retention Policy. Enterprise privacy, transparency, and data lifecycle management for Bangladesh courier logistics.">
<title>Privacy Policy & Data Retention — Aura Courier MCP</title>
<link rel="icon" type="image/png" sizes="32x32" href="/assets/courier-favicon-32.png">
<link rel="icon" type="image/png" sizes="64x64" href="/assets/courier-favicon.png">
<link rel="apple-touch-icon" href="/assets/courier-app-icon.png">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #09090f;
--bg2: #11121d;
--card: rgba(17, 18, 29, 0.72);
--line: rgba(255, 255, 255, 0.08);
--text: #e2e8f0;
--muted: #94a3b8;
--blue: #4d7cff;
--cyan: #38bdf8;
--green: #34d399;
--grad: linear-gradient(135deg, #4d7cff 0%, #8b5cf6 50%, #38bdf8 100%);
--font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
--font-mono: 'JetBrains Mono', monospace;
--maxw: 960px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: var(--bg);
color: var(--text);
font-family: var(--font-sans);
font-size: 15.5px;
line-height: 1.7;
-webkit-font-smoothing: antialiased;
overflow-x: hidden;
}
a { color: var(--cyan); text-decoration: none; transition: color 0.18s; }
a:hover { color: #fff; text-decoration: underline; }
.mono { font-family: var(--font-mono); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
/* Header */
header {
position: sticky; top: 0; z-index: 30; backdrop-filter: blur(14px);
background: rgba(9, 9, 15, 0.82); border-bottom: 1px solid var(--line);
}
.hbar {
display: flex; align-items: center; justify-content: space-between; gap: 14px;
max-width: var(--maxw); margin: 0 auto; padding: 14px 20px;
}
.logo {
display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: #fff;
}
.logo img {
width: 36px; height: 36px; border-radius: 9px; box-shadow: 0 0 12px rgba(56, 189, 248, 0.35); flex: none;
}
.header-actions { display: flex; align-items: center; gap: 14px; }
.btn-back {
display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600;
padding: 7px 14px; border-radius: 999px; background: rgba(77, 124, 255, 0.12);
border: 1px solid rgba(77, 124, 255, 0.3); color: #fff;
}
.btn-back:hover { background: rgba(77, 124, 255, 0.24); text-decoration: none; }
.lang-switch {
display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2);
}
.lang-btn {
font-family: var(--font-sans); font-size: 11.5px; font-weight: 600; color: var(--muted);
background: transparent; border: none; padding: 4px 10px; border-radius: 999px; cursor: pointer; transition: 0.18s;
}
.lang-btn.active { color: #fff; background: var(--grad); }
/* Main Container */
.container { max-width: var(--maxw); margin: 0 auto; padding: 40px 20px 80px; }
.hero-policy { margin-bottom: 36px; text-align: center; }
.badge-policy {
display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
color: var(--cyan); padding: 5px 12px; border-radius: 999px; background: rgba(56, 189, 248, 0.08);
border: 1px solid rgba(56, 189, 248, 0.28); margin-bottom: 14px;
}
h1 { font-size: 32px; font-weight: 900; letter-spacing: -0.02em; margin-bottom: 12px; }
.subtitle { color: var(--muted); font-size: 15px; max-width: 680px; margin: 0 auto; }
/* Policy Sections */
.policy-card {
background: var(--card); border: 1px solid var(--line); border-radius: 16px;
padding: 28px 30px; margin-bottom: 24px; backdrop-filter: blur(8px);
}
.policy-card h2 {
font-size: 19px; font-weight: 700; color: #fff; margin-bottom: 12px;
display: flex; align-items: center; gap: 10px;
}
.policy-card h2 .sec-num {
font-size: 13px; font-family: var(--font-mono); color: var(--cyan);
background: rgba(56, 189, 248, 0.1); padding: 2px 8px; border-radius: 6px;
}
.policy-card p { margin-bottom: 14px; color: #cbd5e1; }
.policy-card p:last-child { margin-bottom: 0; }
.policy-card ul { margin-left: 20px; margin-bottom: 14px; color: #cbd5e1; }
.policy-card li { margin-bottom: 8px; }
.policy-card b { color: #fff; }
/* Table */
.retention-table {
width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px;
}
.retention-table th, .retention-table td {
border: 1px solid var(--line); padding: 12px 14px; text-align: left;
}
.retention-table th {
background: rgba(255, 255, 255, 0.04); color: #fff; font-weight: 600;
}
.retention-table tr:hover { background: rgba(255, 255, 255, 0.02); }
.tag {
display: inline-block; padding: 2px 7px; border-radius: 4px; font-size: 11.5px; font-family: var(--font-mono);
}
.tag-green { background: rgba(52, 211, 153, 0.12); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.28); }
.tag-blue { background: rgba(77, 124, 255, 0.12); color: var(--blue); border: 1px solid rgba(77, 124, 255, 0.28); }
.tag-cyan { background: rgba(56, 189, 248, 0.12); color: var(--cyan); border: 1px solid rgba(56, 189, 248, 0.28); }
/* Footer */
footer {
text-align: center; padding: 36px 16px; border-top: 1px solid var(--line);
font-size: 13px; color: var(--muted);
}
footer p { margin-bottom: 8px; }
</style>
</head>
<body>
<header>
<div class="hbar">
<a href="/" class="logo" aria-label="Aura Courier MCP">
<img src="/assets/courier-app-icon.png" alt="Aura Courier MCP" />
<span>Aura Courier MCP</span>
</a>
<div class="header-actions">
<a href="/" class="btn-back">← <span data-i18n="nav_back">মেইন হাব (Main Hub)</span></a>
<div class="lang-switch" role="group" aria-label="Language Selector">
<button id="lang-bn" class="lang-btn active" onclick="setLang('bn')">🇧🇩 বাংলা</button>
<button id="lang-en" class="lang-btn" onclick="setLang('en')">🇬🇧 English</button>
</div>
</div>
</div>
</header>
<main class="container">
<div class="hero-policy">
<div class="badge-policy mono">
<span data-i18n="badge_text">ISO & Cyber Security Aligned · Universal Logistics Layer</span>
</div>
<h1 data-i18n="title">প্রাইভেসি পলিসি ও ডেটা রিটেনশন গাইডলাইন</h1>
<p class="subtitle" data-i18n="subtitle">Aura Courier MCP এন্টারপ্রাইজ গ্রেড লজিস্টিকস প্ল্যাটফর্মে কাস্টমার ও মার্চেন্ট ডেটা নিরাপত্তা, ক্যারিয়ার ট্রানজিট এবং স্বয়ংক্রিয় রিটেনশন মেকানিজম সংক্রান্ত স্বচ্ছ নীতিমালা।</p>
</div>
<!-- Section 1 -->
<article class="policy-card">
<h2><span class="sec-num">01</span> <span data-i18n="sec1_title">প্ল্যাটফর্ম পরিচিতি ও ডেটা কন্ট্রোলার (Data Controller)</span></h2>
<p data-i18n="sec1_p1"><b>Aura Courier MCP</b> (হোস্টেড ডোমেইন: <code>courier.auraajenticai.cloud</code>) হলো <b>Aura Agentic AI</b> দ্বারা পরিচালিত বাংলাদেশের প্রথম ইউনিফাইড AI লজিস্টিকস ইঞ্জিন। এই প্ল্যাটফর্মটি স্বয়ংক্রিয় এআই এজেন্ট (যেমন Claude, Cursor, Antigravity, n8n) এবং ই-কমার্স মার্চেন্টদের পক্ষ থেকে বাংলাদেশের ৪টি প্রধান কুরিয়ার (Steadfast, Pathao, RedX, Paperfly) এবং Google Maps স্পেশিয়াল রাউটিং পরিচালনা করে।</p>
<p data-i18n="sec1_p2">ডেটা সুরক্ষার ক্ষেত্রে Aura Agentic AI ডেটা প্রসেসর ও ডেটা ট্রানজিট কন্ট্রোলার হিসেবে কাজ করে। আমরা মার্চেন্টদের অনুমোদিত API ক্রেডেনশিয়াল ব্যবহার করে সরাসরি কুরিয়ার ক্যারিয়ারে নিরাপদ এন্ড-টু-এন্ড এনক্রিপ্টেড রিকোয়েস্ট প্রেরণ করি।</p>
</article>
<!-- Section 2 -->
<article class="policy-card">
<h2><span class="sec-num">02</span> <span data-i18n="sec2_title">যেসব ডেটা প্রসেস ও ট্রানজিট করা হয় (Data Processed)</span></h2>
<p data-i18n="sec2_p1">পার্সেল বুকিং, লাইভ ট্র্যাকিং এবং ডেলিভারি জোন নির্ধারণের জন্য প্ল্যাটফর্মটিতে শুধুমাত্র প্রয়োজনীয় তথ্য প্রসেস করা হয়:</p>
<ul>
<li><b data-i18n="sec2_item1_title">গ্রাহকের ডেলিভারি পরিচিতি:</b> <span data-i18n="sec2_item1_desc">প্রাপকের নাম, মোবাইল ফোন নম্বর এবং পূর্ণাঙ্গ ডেলিভারি ঠিকানা (জেলা, থানা ও সাব-লোকালিটি সহ)।</span></li>
<li><b data-i18n="sec2_item2_title">পার্সেল ও আর্থিক স্পেসিফিকেশন:</b> <span data-i18n="sec2_item2_desc">ক্যাশ-অন-ডেলিভারি (COD) অ্যামাউন্ট, ইনভয়েস নম্বর, পার্সেল ওজন (কেজি) এবং প্রডাক্ট ডেসক্রিপশন।</span></li>
<li><b data-i18n="sec2_item3_title">ট্র্যাকিং ও টেলিমেট্রি:</b> <span data-i18n="sec2_item3_desc">ক্যারিয়ার কনসাইনমেন্ট আইডি, ডেলিভারি ট্র্যাকিং কোড, ডেলিভারি স্ট্যাটাস (যেমন: ইন-ট্রানজিট, ডেলিভার্ড, আরটিও)।</span></li>
<li><b data-i18n="sec2_item4_title">প্রযুক্তিগত লগ:</b> <span data-i18n="sec2_item4_desc">রিকোয়েস্টের সোর্স আইপি (রেট লিমিটিংয়ের জন্য), ইউজার এজেন্ট এবং টাইমস্ট্যাম্প।</span></li>
</ul>
</article>
<!-- Section 3 -->
<article class="policy-card">
<h2><span class="sec-num">03</span> <span data-i18n="sec3_title">থার্ড-পার্টি কুরিয়ার ক্যারিয়ার ইন্টিগ্রেশন (Third-Party Processors)</span></h2>
<p data-i18n="sec3_p1">পার্সেল ডেলিভারি কার্যকর করতে গ্রাহকের শিপিং তথ্য শুধুমাত্র মার্চেন্টের নির্বাচিত ও অথরাইজড কুরিয়ার সার্ভিস প্রোভাইডারের অফিসিয়াল এন্ডপয়েন্টে পাঠানো হয়:</p>
<ul>
<li><b>Steadfast Courier Ltd.</b> (API: <code>portal.packzy.com/api/v1</code>)</li>
<li><b>Pathao Express</b> (API: <code>api-hermes.pathao.com</code>)</li>
<li><b>RedX Logistics</b> (API: <code>openapi.redx.com.bd</code>)</li>
<li><b>Paperfly Go</b> (API: <code>api.paperfly.com.bd</code>)</li>
<li><b>Google Maps Platform</b> (API: <code>routes.googleapis.com</code> ও Geocoding API)</li>
</ul>
<p data-i18n="sec3_p2"><b>জিরো ডেটা রিসেল গ্যারান্টি:</b> আমরা কোনো অবস্থাতেই কোনো কাস্টমার বা মার্চেন্টের ডেটা বিক্রি করি না, কোনো বিজ্ঞাপনদাতা নেটওয়ার্কের সাথে শেয়ার করি না এবং পাবলিক AI মডেল ট্রেনিংয়ে ব্যবহার করি না।</p>
</article>
<!-- Section 4 -->
<article class="policy-card" id="retention">
<h2><span class="sec-num">04</span> <span data-i18n="sec4_title">স্বচ্ছ ডেটা রিটেনশন পলিসি ও লাইফসাইকেল (Data Retention Schedule)</span></h2>
<p data-i18n="sec4_p1">ডেটা মিনিমাইজেশন নীতির আলোকে আমরা প্রতিটি ধরণের ডেটার জন্য সুনির্দিষ্ট ও কঠোর রিটেনশন টাইমলাইন অনুসরণ করি:</p>
<table class="retention-table">
<thead>
<tr>
<th data-i18n="th_type">ডেটার ধরণ (Data Scope)</th>
<th data-i18n="th_window">সংরক্ষণ মেয়াদ (Retention Window)</th>
<th data-i18n="th_action">মেয়াদোত্তীর্ণ অ্যাকশন (Lifecycle Action)</th>
</tr>
</thead>
<tbody>
<tr>
<td><b data-i18n="row1_type">Active MCP Sessions</b></td>
<td><span class="tag tag-cyan">৬০ মিনিট (Idle Expiration)</span></td>
<td data-i18n="row1_desc">ইন-মেমরি সেশন ক্লোজ এবং মেমোরি গারবেজ কালেকশন (Zero disk storage)।</td>
</tr>
<tr>
<td><b data-i18n="row2_type">Live Tracking Cache</b></td>
<td><span class="tag tag-blue">২ মিনিট</span></td>
<td data-i18n="row2_desc">ক্যারিয়ার কোটা বাঁচানোর জন্য সাময়িক ক্যাশ, এরপর স্বয়ংক্রিয়ভাবে মুছে ফেলা হয়।</td>
</tr>
<tr>
<td><b data-i18n="row3_type">Carrier Webhooks</b></td>
<td><span class="tag tag-cyan">৩০ দিন</span></td>
<td data-i18n="row3_desc">ডেলিভারি রিকনসিলিয়েশন ও ডিসপিউট মিটমাটের পর স্বয়ংক্রিয়ভাবে ডিলিট হয়।</td>
</tr>
<tr>
<td><b data-i18n="row4_type">Durable Courier Parcels</b></td>
<td><span class="tag tag-green">৯০ দিন (RTO Window)</span></td>
<td data-i18n="row4_desc">৯০ দিন পর কাস্টমারের নাম, ফোন ও ঠিকানা স্বয়ংক্রিয় প্রুনার দ্বারা অ্যানোনিমাইজ করা হয়।</td>
</tr>
</tbody>
</table>
<p data-i18n="sec4_p2">সার্ভারের ব্যাকগ্রাউন্ডে দৈনিক স্বয়ংক্রিয় প্রুনার রুটিন চলে যা ৯০ দিনের পুরনো ট্র্যাকিং পার্সেল থেকে কাস্টমার নাম, ফোন ও ঠিকানা মুছে ফেলে শুধু ফাইন্যান্সিয়াল রিপোর্ট অক্ষত রাখে।</p>
</article>
<!-- Section 5 -->
<article class="policy-card">
<h2><span class="sec-num">05</span> <span data-i18n="sec5_title">সিকিউরিটি ও এনক্রিপশন প্রটোকল (Security Safeguards)</span></h2>
<ul>
<li><b data-i18n="sec5_item1_title">ইন-ট্রানজিট এনক্রিপশন:</b> <span data-i18n="sec5_item1_desc">সমস্ত রিকোয়েস্ট TLS 1.3 ও আধুনিক সাইফার স্যুট দ্বারা সম্পূর্ণ সুরক্ষিত।</span></li>
<li><b data-i18n="sec5_item2_title">ক্রেডেনশিয়াল সিকিউরিটি:</b> <span data-i18n="sec5_item2_desc">মার্চেন্টদের কুরিয়ার পাসওয়ার্ড ও এপিআই কি মেমরিতে বা AES-256 এনক্রিপ্টেড ভল্টে সংরক্ষিত থাকে; কোনো প্লেন-টেক্সট ফাইলে সংরক্ষণ করা হয় না।</span></li>
<li><b data-i18n="sec5_item3_title">ইন-মেমরি স্লাইডিং-উইন্ডো রেট লিমিটিং:</b> <span data-i18n="sec5_item3_desc">DDoS ও স্ক্র্যাপিং রোধে প্রতিটি এন্ডপয়েন্ট রেট লিমিটেড (প্রতি মিনিটে সর্বোচ্চ ১২০ রিকোয়েস্ট)।</span></li>
<li><b data-i18n="sec5_item4_title">ঐচ্ছিক অথেন্টিকেশন গার্ড:</b> <span data-i18n="sec5_item4_desc">মাস্টার মার্চেন্ট একাউন্ট দিয়ে পার্সেল বুকিং সম্পূর্ণ সুরক্ষিত, শুধুমাত্র অনুমোদিত বিয়ারার টোকেন বা ক্লায়েন্টের নিজস্ব ক্রেডেনশিয়াল দিয়েই বুকিং সম্ভব।</span></li>
</ul>
</article>
<!-- Section 6 -->
<article class="policy-card">
<h2><span class="sec-num">06</span> <span data-i18n="sec6_title">আপনার অধিকার ও যোগাযোগ (Merchant Rights & Contact)</span></h2>
<p data-i18n="sec6_p1">যেকোনো মার্চেন্ট বা কাস্টমার তার সংরক্ষিত তথ্যের বিবরণ জানতে বা তাৎক্ষণিক মুছে ফেলার (Right to be Forgotten) অনুরোধ করতে পারেন। এ সংক্রান্ত যেকোনো প্রশ্ন বা ডেটা রিমুভাল রিকোয়েস্টের জন্য আমাদের সাথে সরাসরি যোগাযোগ করুন:</p>
<p>
<b>Data Protection Officer (DPO):</b> Redwan Khondokar<br>
<b>Official Email:</b> <a href="mailto:ceo@auraajenticai.cloud">ceo@auraajenticai.cloud</a> / <a href="mailto:hello@auraajenticai.cloud">hello@auraajenticai.cloud</a><br>
<b>Company:</b> Aura Agentic AI — Enterprise AI & Logistics Automation
</p>
</article>
</main>
<footer>
<p>Aura Courier MCP v2.4 · Developed by <b>Aura Agentic AI</b> · Released under <b>Apache License 2.0</b></p>
<p>
<a href="https://auraajenticai.cloud" target="_blank" rel="noopener">auraajenticai.cloud</a> ·
<a href="https://github.com/auraajenticai/aura-courier-mcp" target="_blank" rel="noopener">github.com/auraajenticai</a> ·
<a href="https://git.auraajenticai.cloud/khondokar/aura-courier-mcp" target="_blank" rel="noopener">git.auraajenticai.cloud</a> ·
<a href="/privacy">Privacy & Data Retention</a> ·
<a href="https://glama.ai/mcp/servers/auraajenticai/aura-courier-mcp" target="_blank" rel="noopener">Glama Verified</a> ·
<a href="/health">Live Telemetry</a>
</p>
</footer>
<script>
const i18n = {
bn: {
nav_back: "মেইন হাব (Main Hub)",
badge_text: "ISO & Cyber Security Aligned · Universal Logistics Layer",
title: "প্রাইভেসি পলিসি ও ডেটা রিটেনশন গাইডলাইন",
subtitle: "Aura Courier MCP এন্টারপ্রাইজ গ্রেড লজিস্টিকস প্ল্যাটফর্মে কাস্টমার ও মার্চেন্ট ডেটা নিরাপত্তা, ক্যারিয়ার ট্রানজিট এবং স্বয়ংক্রিয় রিটেনশন মেকানিজম সংক্রান্ত স্বচ্ছ নীতিমালা।",
sec1_title: "প্ল্যাটফর্ম পরিচিতি ও ডেটা কন্ট্রোলার (Data Controller)",
sec1_p1: "Aura Courier MCP (হোস্টেড ডোমেইন: courier.auraajenticai.cloud) হলো Aura Agentic AI দ্বারা পরিচালিত বাংলাদেশের প্রথম ইউনিফাইড AI লজিস্টিকস ইঞ্জিন। এই প্ল্যাটফর্মটি স্বয়ংক্রিয় এআই এজেন্ট (যেমন Claude, Cursor, Antigravity, n8n) এবং ই-কমার্স মার্চেন্টদের পক্ষ থেকে বাংলাদেশের ৪টি প্রধান কুরিয়ার (Steadfast, Pathao, RedX, Paperfly) এবং Google Maps স্পেশিয়াল রাউটিং পরিচালনা করে।",
sec1_p2: "ডেটা সুরক্ষার ক্ষেত্রে Aura Agentic AI ডেটা প্রসেসর ও ডেটা ট্রানজিট কন্ট্রোলার হিসেবে কাজ করে। আমরা মার্চেন্টদের অনুমোদিত API ক্রেডেনশিয়াল ব্যবহার করে সরাসরি কুরিয়ার ক্যারিয়ারে নিরাপদ এন্ড-টু-এন্ড এনক্রিপ্টেড রিকোয়েস্ট প্রেরণ করি।",
sec2_title: "যেসব ডেটা প্রসেস ও ট্রানজিট করা হয় (Data Processed)",
sec2_p1: "পার্সেল বুকিং, লাইভ ট্র্যাকিং এবং ডেলিভারি জোন নির্ধারণের জন্য প্ল্যাটফর্মটিতে শুধুমাত্র প্রয়োজনীয় তথ্য প্রসেস করা হয়:",
sec2_item1_title: "গ্রাহকের ডেলিভারি পরিচিতি:",
sec2_item1_desc: "প্রাপকের নাম, মোবাইল ফোন নম্বর এবং পূর্ণাঙ্গ ডেলিভারি ঠিকানা (জেলা, থানা ও সাব-লোকালিটি সহ)।",
sec2_item2_title: "পার্সেল ও আর্থিক স্পেসিফিকেশন:",
sec2_item2_desc: "ক্যাশ-অন-ডেলিভারি (COD) অ্যামাউন্ট, ইনভয়েস নম্বর, পার্সেল ওজন (কেজি) এবং প্রডাক্ট ডেসক্রিপশন।",
sec2_item3_title: "ট্র্যাকিং ও টেলিমেট্রি:",
sec2_item3_desc: "ক্যারিয়ার কনসাইনমেন্ট আইডি, ডেলিভারি ট্র্যাকিং কোড, ডেলিভারি স্ট্যাটাস (যেমন: ইন-ট্রানজিট, ডেলিভার্ড, আরটিও)।",
sec2_item4_title: "প্রযুক্তিগত লগ:",
sec2_item4_desc: "রিকোয়েস্টের সোর্স আইপি (রেট লিমিটিংয়ের জন্য), ইউজার এজেন্ট এবং টাইমস্ট্যাম্প।",
sec3_title: "থার্ড-পার্টি কুরিয়ার ক্যারিয়ার ইন্টিগ্রেশন (Third-Party Processors)",
sec3_p1: "পার্সেল ডেলিভারি কার্যকর করতে গ্রাহকের শিপিং তথ্য শুধুমাত্র মার্চেন্টের নির্বাচিত ও অথরাইজড কুরিয়ার সার্ভিস প্রোভাইডারের অফিসিয়াল এন্ডপয়েন্টে পাঠানো হয়:",
sec3_p2: "জিরো ডেটা রিসেল গ্যারান্টি: আমরা কোনো অবস্থাতেই কোনো কাস্টমার বা মার্চেন্টের ডেটা বিক্রি করি না, কোনো বিজ্ঞাপনদাতা নেটওয়ার্কের সাথে শেয়ার করি না এবং পাবলিক AI মডেল ট্রেনিংয়ে ব্যবহার করি না।",
sec4_title: "স্বচ্ছ ডেটা রিটেনশন পলিসি ও লাইফসাইকেল (Data Retention Schedule)",
sec4_p1: "ডেটা মিনিমাইজেশন নীতির আলোকে আমরা প্রতিটি ধরণের ডেটার জন্য সুনির্দিষ্ট ও কঠোর রিটেনশন টাইমলাইন অনুসরণ করি:",
th_type: "ডেটার ধরণ (Data Scope)",
th_window: "সংরক্ষণ মেয়াদ (Retention Window)",
th_action: "মেয়াদোত্তীর্ণ অ্যাকশন (Lifecycle Action)",
row1_type: "Active MCP Sessions",
row1_desc: "ইন-মেমরি সেশন ক্লোজ এবং মেমোরি গারবেজ কালেকশন (Zero disk storage)।",
row2_type: "Live Tracking Cache",
row2_desc: "ক্যারিয়ার কোটা বাঁচানোর জন্য সাময়িক ক্যাশ, এরপর স্বয়ংক্রিয়ভাবে মুছে ফেলা হয়।",
row3_type: "Carrier Webhooks",
row3_desc: "ডেলিভারি রিকনসিলিয়েশন ও ডিসপিউট মিটমাটের পর স্বয়ংক্রিয়ভাবে ডিলিট হয়।",
row4_type: "Durable Courier Parcels",
row4_desc: "৯০ দিন পর কাস্টমারের নাম, ফোন ও ঠিকানা স্বয়ংক্রিয় প্রুনার দ্বারা অ্যানোনিমাইজ করা হয়।",
sec4_p2: "সার্ভারের ব্যাকগ্রাউন্ডে দৈনিক স্বয়ংক্রিয় প্রুনার রুটিন চলে যা ৯০ দিনের পুরনো ট্র্যাকিং পার্সেল থেকে কাস্টমার নাম, ফোন ও ঠিকানা মুছে ফেলে শুধু ফাইন্যান্সিয়াল রিপোর্ট অক্ষত রাখে।",
sec5_title: "সিকিউরিটি ও এনক্রিপশন প্রটোকল (Security Safeguards)",
sec5_item1_title: "ইন-ট্রানজিট এনক্রিপশন:",
sec5_item1_desc: "সমস্ত রিকোয়েস্ট TLS 1.3 ও আধুনিক সাইফার স্যুট দ্বারা সম্পূর্ণ সুরক্ষিত।",
sec5_item2_title: "ক্রেডেনশিয়াল সিকিউরিটি:",
sec5_item2_desc: "মার্চেন্টদের কুরিয়ার পাসওয়ার্ড ও এপিআই কি মেমরিতে বা AES-256 এনক্রিপ্টেড ভল্টে সংরক্ষিত থাকে; কোনো প্লেন-টেক্সট ফাইলে সংরক্ষণ করা হয় না।",
sec5_item3_title: "ইন-মেমরি স্লাইডিং-উইন্ডো রেট লিমিটিং:",
sec5_item3_desc: "DDoS ও স্ক্র্যাপিং রোধে প্রতিটি এন্ডপয়েন্ট রেট লিমিটেড (প্রতি মিনিটে সর্বোচ্চ ১২০ রিকোয়েস্ট)।",
sec5_item4_title: "ঐচ্ছিক অথেন্টিকেশন গার্ড:",
sec5_item4_desc: "মাস্টার মার্চেন্ট একাউন্ট দিয়ে পার্সেল বুকিং সম্পূর্ণ সুরক্ষিত, শুধুমাত্র অনুমোদিত বিয়ারার টোকেন বা ক্লায়েন্টের নিজস্ব ক্রেডেনশিয়াল দিয়েই বুকিং সম্ভব।",
sec6_title: "আপনার অধিকার ও যোগাযোগ (Merchant Rights & Contact)",
sec6_p1: "যেকোনো মার্চেন্ট বা কাস্টমার তার সংরক্ষিত তথ্যের বিবরণ জানতে বা তাৎক্ষণিক মুছে ফেলার (Right to be Forgotten) অনুরোধ করতে পারেন। এ সংক্রান্ত যেকোনো প্রশ্ন বা ডেটা রিমুভাল রিকোয়েস্টের জন্য আমাদের সাথে সরাসরি যোগাযোগ করুন:"
},
en: {
nav_back: "Main Hub",
badge_text: "ISO & Cyber Security Aligned · Universal Logistics Layer",
title: "Privacy Policy & Data Retention Guidelines",
subtitle: "Enterprise-grade privacy governance, carrier data transit transparency, and automated lifecycle retention mechanisms for Aura Courier MCP.",
sec1_title: "Platform Overview & Data Controller",
sec1_p1: "Aura Courier MCP (hosted at courier.auraajenticai.cloud) is Bangladesh's foundational agentic logistics layer operated by Aura Agentic AI. It connects autonomous AI agents (Claude, Cursor, Antigravity, n8n) and e-commerce merchants to Bangladesh's top 4 couriers (Steadfast, Pathao, RedX, Paperfly) and Google Maps spatial routing.",
sec1_p2: "Under data privacy frameworks, Aura Agentic AI acts as a secure Data Processor and Transit Gateway. Using authorized merchant API credentials, orders and telemetry are securely transmitted directly to carrier endpoints via encrypted pipelines.",
sec2_title: "Categories of Personal Data Processed",
sec2_p1: "To process parcel bookings, live tracking queries, and delivery zone classification, only necessary operational data is handled:",
sec2_item1_title: "Recipient Delivery Identity:",
sec2_item1_desc: "Recipient Full Name, Mobile Phone Number, and Full Delivery Address (including District, Thana, and Sub-locality).",
sec2_item2_title: "Parcel & Financial Specifications:",
sec2_item2_desc: "Cash on Delivery (COD) Amount, Merchant Invoice Number, Parcel Weight (kg), and Item Description.",
sec2_item3_title: "Tracking & Telemetry:",
sec2_item3_desc: "Carrier Consignment ID, Tracking Number, Status Timeline (In-Transit, Delivered, Cancelled, RTO).",
sec2_item4_title: "Technical Logs:",
sec2_item4_desc: "Client Source IP (strictly for sliding-window rate limiting), User-Agent header, and request timestamps.",
sec3_title: "Authorized Third-Party Carrier Processors",
sec3_p1: "To fulfill delivery, customer shipping details are transmitted exclusively to merchant-authorized logistics providers:",
sec3_p2: "Strict Zero-Resale Guarantee: We never sell, lease, monetize, share customer data with third-party advertising networks, or use merchant data to train public LLM models.",
sec4_title: "Transparent Data Retention Schedule",
sec4_p1: "Adhering to strict data minimization principles, we enforce the following retention lifecycle:",
th_type: "Data Scope",
th_window: "Retention Window",
th_action: "Lifecycle Action",
row1_type: "Active MCP Sessions",
row1_desc: "In-memory session cleanup and garbage collection after 60 min idle (zero persistent disk write).",
row2_type: "Live Tracking Cache",
row2_desc: "2-minute in-memory cache to prevent carrier API rate exhaustion, then discarded.",
row3_type: "Carrier Webhooks",
row3_desc: "Retained for 30 days for financial reconciliation, then permanently purged.",
row4_type: "Durable Courier Parcels",
row4_desc: "Customer Name, Phone, and Address are permanently anonymized after 90 days (RTO window closed).",
sec4_p2: "An automated background retention pruner runs daily at midnight to scrub customer PII from parcel records older than 90 days while preserving non-identifiable financial aggregates.",
sec5_title: "Security & Encryption Safeguards",
sec5_item1_title: "In-Transit Encryption:",
sec5_item1_desc: "All HTTP and MCP communications are enforced over TLS 1.3 with modern AEAD cipher suites.",
sec5_item2_title: "Credential Isolation:",
sec5_item2_desc: "Merchant courier secrets are stored strictly in memory or PostgreSQL AES-256 encrypted vaults; never logged in plain text.",
sec5_item3_title: "Sliding-Window Rate Limiting:",
sec5_item3_desc: "Active in-memory throttling prevents scraping, DDoS, and carrier quota exhaustion (max 120 req/min).",
sec5_item4_title: "Optional Auth Layer:",
sec5_item4_desc: "Dispatching parcels on the default merchant account is secured behind Bearer token authentication or Bring-Your-Own-Keys (BYOK).",
sec6_title: "Merchant Rights & Contact",
sec6_p1: "Merchants and individuals retain full rights to query, export, or request immediate erasure (Right to be Forgotten) of any stored delivery record. Contact our Data Protection Officer at:"
}
};
let currentLang = localStorage.getItem('aura_lang') || 'bn';
function setLang(lang) {
currentLang = lang;
localStorage.setItem('aura_lang', lang);
document.documentElement.lang = lang;
document.getElementById('lang-bn').classList.toggle('active', lang === 'bn');
document.getElementById('lang-en').classList.toggle('active', lang === 'en');
const dict = i18n[lang];
document.querySelectorAll('[data-i18n]').forEach(el => {
const key = el.getAttribute('data-i18n');
if (dict[key]) {
el.innerHTML = dict[key];
}
});
}
document.addEventListener('DOMContentLoaded', () => setLang(currentLang));
</script>
</body>
</html>
+51 -8
View File
@@ -5,6 +5,8 @@ import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
import { CourierRegistry } from "./registry.js"; import { CourierRegistry } from "./registry.js";
import { loadConfig, EnvSource } from "./config.js"; import { loadConfig, EnvSource } from "./config.js";
import { buildMcpServer, TOOLS } from "./server.js"; import { buildMcpServer, TOOLS } from "./server.js";
import { createRateLimiter } from "./middleware/rate_limit.js";
import { optionalAuthMiddleware, isActionPermitted } from "./middleware/auth.js";
import path from "node:path"; import path from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import pg from "pg"; import pg from "pg";
@@ -15,9 +17,29 @@ try {
dbPool = new pg.Pool({ connectionString: dbUrl, max: 4, idleTimeoutMillis: 30000 }); dbPool = new pg.Pool({ connectionString: dbUrl, max: 4, idleTimeoutMillis: 30000 });
} catch (_) {} } catch (_) {}
// Automated Data Retention Engine (Daily Midnight Sweep)
// Anonymizes customer PII older than 90 days in accordance with data retention policy
setInterval(async () => {
if (dbPool) {
try {
const pruneRes = await dbPool.query(
`UPDATE courier_parcels
SET recipient_name = 'ANONYMIZED', recipient_phone = 'ANONYMIZED', recipient_address = 'ANONYMIZED'
WHERE created_at < NOW() - INTERVAL '90 days' AND recipient_name != 'ANONYMIZED'`
);
if (pruneRes.rowCount && pruneRes.rowCount > 0) {
console.log(`[Data Retention Engine] Anonymized ${pruneRes.rowCount} legacy order records older than 90 days.`);
}
} catch (err: any) {
// Table may not exist in standalone mode; continue safely
}
}
}, 24 * 60 * 60 * 1000).unref();
const PORT = Number(process.env.PORT || 8080); const PORT = Number(process.env.PORT || 8080);
const APP_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); const APP_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const LANDING = path.join(APP_DIR, "index.html"); const LANDING = path.join(APP_DIR, "index.html");
const PRIVACY_HTML = path.join(APP_DIR, "privacy.html");
const HEALTH_HTML = path.join(APP_DIR, "health.html"); const HEALTH_HTML = path.join(APP_DIR, "health.html");
const MCP_EXPLORER_HTML = path.join(APP_DIR, "mcp_explorer.html"); const MCP_EXPLORER_HTML = path.join(APP_DIR, "mcp_explorer.html");
@@ -83,6 +105,19 @@ app.use((req, res, next) => {
next(); next();
}); });
// Enterprise Sliding-Window Rate Limiters
const generalLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 120, name: "General Gateway" });
const mcpLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 60, name: "MCP Protocol Gateway" });
const trackingLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 30, name: "Live Tracking Hub" });
const webhookLimiter = createRateLimiter({ windowMs: 60 * 1000, max: 120, name: "Courier Webhook Gateway" });
// Apply global rate limiting and optional auth context evaluation
app.use(generalLimiter);
app.use(optionalAuthMiddleware);
// Static brand assets (app icons, favicons, logos)
app.use("/assets", express.static(path.join(APP_DIR, "assets")));
// Memory Leak Prevention: Managed Session with Automatic Idle Eviction & Garbage Collection // Memory Leak Prevention: Managed Session with Automatic Idle Eviction & Garbage Collection
interface ManagedSession { interface ManagedSession {
transport: StreamableHTTPServerTransport; transport: StreamableHTTPServerTransport;
@@ -106,7 +141,7 @@ setInterval(() => {
} }
}, 15 * 60 * 1000).unref(); }, 15 * 60 * 1000).unref();
app.post("/mcp", async (req: Request, res: Response) => { app.post("/mcp", mcpLimiter, async (req: Request, res: Response) => {
const sessionId = req.headers["mcp-session-id"] as string | undefined; const sessionId = req.headers["mcp-session-id"] as string | undefined;
let transport: StreamableHTTPServerTransport; let transport: StreamableHTTPServerTransport;
@@ -116,7 +151,7 @@ app.post("/mcp", async (req: Request, res: Response) => {
transport = entry.transport; transport = entry.transport;
} else if (!sessionId && isInitializeRequest(req.body)) { } else if (!sessionId && isInitializeRequest(req.body)) {
const registry = new CourierRegistry(loadConfig(keysFromRequest(req))); const registry = new CourierRegistry(loadConfig(keysFromRequest(req)));
const server = buildMcpServer(registry); const server = buildMcpServer(registry, (toolName) => isActionPermitted(req, toolName));
transport = new StreamableHTTPServerTransport({ transport = new StreamableHTTPServerTransport({
sessionIdGenerator: () => randomUUID(), sessionIdGenerator: () => randomUUID(),
// Return application/json for POST responses instead of SSE — far more compatible with // Return application/json for POST responses instead of SSE — far more compatible with
@@ -153,7 +188,7 @@ app.post("/mcp", async (req: Request, res: Response) => {
}); });
// GET (server->client SSE stream or Browser Explorer) // GET (server->client SSE stream or Browser Explorer)
app.get("/mcp", async (req: Request, res: Response) => { app.get("/mcp", mcpLimiter, async (req: Request, res: Response) => {
const sessionId = req.headers["mcp-session-id"] as string | undefined; const sessionId = req.headers["mcp-session-id"] as string | undefined;
if (!sessionId || !sessions.has(sessionId)) { if (!sessionId || !sessions.has(sessionId)) {
// If opened directly by a human in a web browser, serve the interactive MCP Protocol Explorer! // If opened directly by a human in a web browser, serve the interactive MCP Protocol Explorer!
@@ -188,7 +223,7 @@ app.delete("/mcp", async (req: Request, res: Response) => {
* Official Steadfast Webhook Integration Endpoint * Official Steadfast Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/steadfast * Callback URL: https://courier.auraajenticai.cloud/webhooks/steadfast
*/ */
app.post("/webhooks/steadfast", (req: Request, res: Response) => { app.post("/webhooks/steadfast", webhookLimiter, (req: Request, res: Response) => {
const payload = req.body; const payload = req.body;
console.log("[Steadfast Webhook Received]:", JSON.stringify(payload)); console.log("[Steadfast Webhook Received]:", JSON.stringify(payload));
@@ -220,7 +255,7 @@ app.post("/webhooks/steadfast", (req: Request, res: Response) => {
* Official Pathao Webhook Integration Endpoint * Official Pathao Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/pathao * Callback URL: https://courier.auraajenticai.cloud/webhooks/pathao
*/ */
app.post("/webhooks/pathao", (req: Request, res: Response) => { app.post("/webhooks/pathao", webhookLimiter, (req: Request, res: Response) => {
const payload = req.body; const payload = req.body;
console.log("[Pathao Webhook Received]:", JSON.stringify(payload)); console.log("[Pathao Webhook Received]:", JSON.stringify(payload));
return res.status(200).json({ return res.status(200).json({
@@ -233,7 +268,7 @@ app.post("/webhooks/pathao", (req: Request, res: Response) => {
* Official RedX Webhook Integration Endpoint * Official RedX Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/redx * Callback URL: https://courier.auraajenticai.cloud/webhooks/redx
*/ */
app.post("/webhooks/redx", (req: Request, res: Response) => { app.post("/webhooks/redx", webhookLimiter, (req: Request, res: Response) => {
const payload = req.body; const payload = req.body;
console.log("[RedX Webhook Received]:", JSON.stringify(payload)); console.log("[RedX Webhook Received]:", JSON.stringify(payload));
return res.status(200).json({ return res.status(200).json({
@@ -246,7 +281,7 @@ app.post("/webhooks/redx", (req: Request, res: Response) => {
* Official Paperfly Webhook Integration Endpoint * Official Paperfly Webhook Integration Endpoint
* Callback URL: https://courier.auraajenticai.cloud/webhooks/paperfly * Callback URL: https://courier.auraajenticai.cloud/webhooks/paperfly
*/ */
app.post("/webhooks/paperfly", (req: Request, res: Response) => { app.post("/webhooks/paperfly", webhookLimiter, (req: Request, res: Response) => {
const payload = req.body; const payload = req.body;
console.log("[Paperfly Webhook Received]:", JSON.stringify(payload)); console.log("[Paperfly Webhook Received]:", JSON.stringify(payload));
return res.status(200).json({ return res.status(200).json({
@@ -259,7 +294,7 @@ app.post("/webhooks/paperfly", (req: Request, res: Response) => {
* Live Consumer & Merchant Cyber-Dark Tracking Hub * Live Consumer & Merchant Cyber-Dark Tracking Hub
* GET /track/:code * GET /track/:code
*/ */
app.get("/track/:code", async (req: Request, res: Response) => { app.get("/track/:code", trackingLimiter, async (req: Request, res: Response) => {
const code = req.params.code; const code = req.params.code;
const format = req.query.format as string | undefined; const format = req.query.format as string | undefined;
@@ -512,6 +547,14 @@ app.get("/health", (req, res) => {
res.json(data); res.json(data);
}); });
app.get("/privacy", (_req, res) => {
res.sendFile(PRIVACY_HTML, (err) => {
if (err && !res.headersSent) {
res.redirect("/");
}
});
});
app.get("/", (_req, res) => { app.get("/", (_req, res) => {
res.sendFile(LANDING, (err) => { res.sendFile(LANDING, (err) => {
if (err && !res.headersSent) { if (err && !res.headersSent) {
+107
View File
@@ -0,0 +1,107 @@
import { Request, Response, NextFunction } from "express";
export interface AuraAuthContext {
isByok: boolean;
isMasterAuthorized: boolean;
callerToken?: string;
}
declare global {
namespace Express {
interface Request {
auraAuth?: AuraAuthContext;
}
}
}
/**
* Check if the inbound request has merchant custom carrier credentials (BYOK - Bring Your Own Keys)
*/
export function hasByokCredentials(req: Request): boolean {
const h = req.headers;
const q = req.query as Record<string, string | undefined>;
const hasKey = (header: string, query: string) => Boolean(h[header] || q[query]);
return Boolean(
hasKey("x-steadfast-api-key", "steadfast_key") ||
hasKey("x-pathao-client-id", "pathao_client_id") ||
hasKey("x-redx-api-token", "redx_token") ||
hasKey("x-paperfly-api-key", "paperfly_key")
);
}
/**
* Extract bearer token or API key from request
*/
export function extractAuthToken(req: Request): string | undefined {
const authHeader = req.headers["authorization"] || req.headers["Authorization"];
if (typeof authHeader === "string") {
if (authHeader.startsWith("Bearer ") || authHeader.startsWith("bearer ")) {
return authHeader.slice(7).trim();
}
return authHeader.trim();
}
const customKey = req.headers["x-aura-key"] || req.headers["x-api-key"];
if (typeof customKey === "string") {
return customKey.trim();
}
const qKey = req.query["aura_key"] || req.query["api_key"];
if (typeof qKey === "string") {
return qKey.trim();
}
return undefined;
}
/**
* Optional Auth Evaluator:
* Public endpoints, discovery, and BYOK requests are permitted.
* If server has AURA_API_KEY set, master-account mutating actions require authentication.
*/
export function optionalAuthMiddleware(req: Request, res: Response, next: NextFunction): void {
const serverApiKey = process.env.AURA_API_KEY || process.env.COURIER_AUTH_TOKEN;
const isByok = hasByokCredentials(req);
const callerToken = extractAuthToken(req);
const isMasterAuthorized = Boolean(
!serverApiKey || (callerToken && callerToken === serverApiKey)
);
req.auraAuth = {
isByok,
isMasterAuthorized,
callerToken,
};
next();
}
/**
* Helper to verify whether an action requires master auth and whether it is granted
*/
export function isActionPermitted(req: Request, toolName: string): { permitted: boolean; reason?: string } {
const isMutatingAction = ["create_parcel", "get_balance", "resolve_ndr_issue"].includes(toolName);
// Read-only tools (list_couriers, calculate_delivery_zone_and_fee, compare_courier_rates, etc.) are always permitted
if (!isMutatingAction) {
return { permitted: true };
}
// If caller brought their own courier credentials, they are modifying their own account — permitted!
if (req.auraAuth?.isByok) {
return { permitted: true };
}
// If using server default merchant credentials, verify master authorization
if (req.auraAuth?.isMasterAuthorized) {
return { permitted: true };
}
return {
permitted: false,
reason: `Unauthorized: Dispatching parcels or checking wallet balance using the master merchant account requires a valid Aura API key (pass 'Authorization: Bearer <token>' or 'x-aura-key') or Bring-Your-Own-Keys (BYOK) courier headers.`,
};
}
+92
View File
@@ -0,0 +1,92 @@
import { Request, Response, NextFunction } from "express";
interface RateLimiterOptions {
windowMs: number;
max: number;
message?: string;
name?: string;
}
interface ClientRecord {
count: number;
resetAt: number;
}
export function createRateLimiter(options: RateLimiterOptions) {
const { windowMs, max, message = "Too Many Requests. Rate limit exceeded, please retry later.", name = "Default" } = options;
const store = new Map<string, ClientRecord>();
// Prune expired rate limit entries every 5 minutes to avoid memory bloat
setInterval(() => {
const now = Date.now();
for (const [key, record] of store.entries()) {
if (now > record.resetAt) {
store.delete(key);
}
}
}, 5 * 60 * 1000).unref();
return (req: Request, res: Response, next: NextFunction): void => {
// Extract Client IP (supporting Cloudflare cf-connecting-ip and reverse proxies like Traefik / Nginx)
const cfIp = req.headers["cf-connecting-ip"];
const xForwardedFor = req.headers["x-forwarded-for"];
let clientIp = "";
if (typeof cfIp === "string") {
clientIp = cfIp.trim();
} else if (typeof xForwardedFor === "string") {
clientIp = xForwardedFor.split(",")[0].trim();
} else if (Array.isArray(xForwardedFor) && xForwardedFor.length > 0) {
clientIp = xForwardedFor[0].trim();
} else {
clientIp = req.socket?.remoteAddress || "unknown";
}
// Bypass loopback and internal orchestration networks
if (
clientIp === "127.0.0.1" ||
clientIp === "::1" ||
clientIp === "::ffff:127.0.0.1" ||
clientIp.startsWith("10.") ||
clientIp.startsWith("172.16.") ||
clientIp.startsWith("172.17.") ||
clientIp.startsWith("172.18.")
) {
return next();
}
const now = Date.now();
let record = store.get(clientIp);
if (!record || now > record.resetAt) {
record = {
count: 1,
resetAt: now + windowMs,
};
store.set(clientIp, record);
} else {
record.count++;
}
const remaining = Math.max(0, max - record.count);
const resetTimeSec = Math.ceil(record.resetAt / 1000);
const retryAfterSec = Math.ceil((record.resetAt - now) / 1000);
res.setHeader("X-RateLimit-Limit", max);
res.setHeader("X-RateLimit-Remaining", remaining);
res.setHeader("X-RateLimit-Reset", resetTimeSec);
if (record.count > max) {
res.setHeader("Retry-After", retryAfterSec);
res.status(429).json({
error: "Too Many Requests",
limiter: name,
message,
retryAfterSeconds: retryAfterSec,
timestamp: new Date().toISOString(),
});
return;
}
next();
};
}
+13 -1
View File
@@ -138,7 +138,10 @@ export const TOOLS: Tool[] = [
* The registry carries the credentials — for STDIO it comes from env, * The registry carries the credentials — for STDIO it comes from env,
* for HTTP it is built per-request from that client's keys. * for HTTP it is built per-request from that client's keys.
*/ */
export function buildMcpServer(registry: CourierRegistry): Server { export function buildMcpServer(
registry: CourierRegistry,
authChecker?: (toolName: string) => { permitted: boolean; reason?: string }
): Server {
const server = new Server( const server = new Server(
{ name: "aura-courier-mcp", version: "2.4.0" }, { name: "aura-courier-mcp", version: "2.4.0" },
{ capabilities: { tools: {} } } { capabilities: { tools: {} } }
@@ -148,6 +151,15 @@ export function buildMcpServer(registry: CourierRegistry): Server {
server.setRequestHandler(CallToolRequestSchema, async (request) => { server.setRequestHandler(CallToolRequestSchema, async (request) => {
const { name, arguments: args } = request.params; const { name, arguments: args } = request.params;
if (authChecker) {
const auth = authChecker(name);
if (!auth.permitted) {
return {
isError: true,
content: [{ type: "text", text: JSON.stringify({ error: "Unauthorized", message: auth.reason }, null, 2) }],
};
}
}
try { try {
switch (name) { switch (name) {
case "list_couriers": case "list_couriers":