feat(saas): live interactive health dashboard, MCP protocol explorer, sandbox widgets & unified navigation
This commit is contained in:
Vendored
+263
@@ -0,0 +1,263 @@
|
|||||||
|
import express from "express";
|
||||||
|
import { randomUUID } from "node:crypto";
|
||||||
|
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
||||||
|
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
||||||
|
import { CourierRegistry } from "./registry.js";
|
||||||
|
import { loadConfig } from "./config.js";
|
||||||
|
import { buildMcpServer, TOOLS } from "./server.js";
|
||||||
|
import path from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
const PORT = Number(process.env.PORT || 8080);
|
||||||
|
const APP_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||||
|
const LANDING = path.join(APP_DIR, "index.html");
|
||||||
|
const HEALTH_HTML = path.join(APP_DIR, "health.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
|
||||||
|
function keysFromRequest(req) {
|
||||||
|
const h = req.headers;
|
||||||
|
const q = req.query;
|
||||||
|
const pick = (header, query, envVar) => {
|
||||||
|
const hv = h[header];
|
||||||
|
const v = (Array.isArray(hv) ? hv[0] : hv) ?? q[query];
|
||||||
|
return v ? String(v) : (envVar ? process.env[envVar] : undefined);
|
||||||
|
};
|
||||||
|
return {
|
||||||
|
STEADFAST_API_KEY: pick("x-steadfast-api-key", "steadfast_key", "STEADFAST_API_KEY"),
|
||||||
|
STEADFAST_SECRET_KEY: pick("x-steadfast-secret-key", "steadfast_secret", "STEADFAST_SECRET_KEY"),
|
||||||
|
STEADFAST_BASE_URL: pick("x-steadfast-base-url", "steadfast_base_url", "STEADFAST_BASE_URL"),
|
||||||
|
PATHAO_CLIENT_ID: pick("x-pathao-client-id", "pathao_client_id", "PATHAO_CLIENT_ID"),
|
||||||
|
PATHAO_CLIENT_SECRET: pick("x-pathao-client-secret", "pathao_client_secret", "PATHAO_CLIENT_SECRET"),
|
||||||
|
PATHAO_USERNAME: pick("x-pathao-username", "pathao_username", "PATHAO_USERNAME"),
|
||||||
|
PATHAO_PASSWORD: pick("x-pathao-password", "pathao_password", "PATHAO_PASSWORD"),
|
||||||
|
PATHAO_STORE_ID: pick("x-pathao-store-id", "pathao_store_id", "PATHAO_STORE_ID"),
|
||||||
|
PATHAO_BASE_URL: pick("x-pathao-base-url", "pathao_base_url", "PATHAO_BASE_URL"),
|
||||||
|
REDX_API_TOKEN: pick("x-redx-api-token", "redx_token", "REDX_API_TOKEN"),
|
||||||
|
REDX_BASE_URL: pick("x-redx-base-url", "redx_base_url", "REDX_BASE_URL"),
|
||||||
|
REDX_PICKUP_STORE_ID: pick("x-redx-pickup-store-id", "redx_pickup_store_id", "REDX_PICKUP_STORE_ID"),
|
||||||
|
PAPERFLY_API_KEY: pick("x-paperfly-api-key", "paperfly_key", "PAPERFLY_API_KEY"),
|
||||||
|
PAPERFLY_USERNAME: pick("x-paperfly-username", "paperfly_username", "PAPERFLY_USERNAME"),
|
||||||
|
PAPERFLY_PASSWORD: pick("x-paperfly-password", "paperfly_password", "PAPERFLY_PASSWORD"),
|
||||||
|
PAPERFLY_STORE_NAME: pick("x-paperfly-store-name", "paperfly_store", "PAPERFLY_STORE_NAME"),
|
||||||
|
GOOGLE_MAPS_API_KEY: pick("x-google-maps-key", "google_maps_key", "GOOGLE_MAPS_API_KEY"),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
const app = express();
|
||||||
|
app.use(express.json({ limit: "1mb" }));
|
||||||
|
// Allow browser-based and cross-origin MCP clients.
|
||||||
|
app.use((req, res, next) => {
|
||||||
|
res.header("Access-Control-Allow-Origin", "*");
|
||||||
|
res.header("Access-Control-Allow-Headers", "Content-Type, Accept, Authorization, mcp-session-id, mcp-protocol-version, x-steadfast-api-key, x-steadfast-secret-key, x-steadfast-base-url, x-pathao-client-id, x-pathao-client-secret, x-pathao-username, x-pathao-password, x-pathao-store-id, x-pathao-base-url, x-redx-api-token, x-redx-base-url, x-redx-pickup-store-id, x-paperfly-api-key, x-paperfly-username, x-paperfly-password, x-paperfly-store-name, x-google-maps-key");
|
||||||
|
res.header("Access-Control-Allow-Methods", "GET, POST, DELETE, OPTIONS");
|
||||||
|
res.header("Access-Control-Expose-Headers", "mcp-session-id");
|
||||||
|
if (req.method === "OPTIONS") {
|
||||||
|
res.sendStatus(204);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
const sessions = new Map();
|
||||||
|
const SESSION_TTL_MS = 60 * 60 * 1000; // 1-hour idle expiration
|
||||||
|
// Sweep abandoned sessions every 15 minutes to prevent heap bloat
|
||||||
|
setInterval(() => {
|
||||||
|
const now = Date.now();
|
||||||
|
for (const [sid, entry] of sessions.entries()) {
|
||||||
|
if (now - entry.lastActiveAt > SESSION_TTL_MS) {
|
||||||
|
console.log(`[Memory GC] Evicting stale MCP session: ${sid}`);
|
||||||
|
try {
|
||||||
|
entry.transport.close?.();
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
sessions.delete(sid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 15 * 60 * 1000).unref();
|
||||||
|
app.post("/mcp", async (req, res) => {
|
||||||
|
const sessionId = req.headers["mcp-session-id"];
|
||||||
|
let transport;
|
||||||
|
if (sessionId && sessions.has(sessionId)) {
|
||||||
|
const entry = sessions.get(sessionId);
|
||||||
|
entry.lastActiveAt = Date.now();
|
||||||
|
transport = entry.transport;
|
||||||
|
}
|
||||||
|
else if (!sessionId && isInitializeRequest(req.body)) {
|
||||||
|
const registry = new CourierRegistry(loadConfig(keysFromRequest(req)));
|
||||||
|
const server = buildMcpServer(registry);
|
||||||
|
transport = new StreamableHTTPServerTransport({
|
||||||
|
sessionIdGenerator: () => randomUUID(),
|
||||||
|
onsessioninitialized: (sid) => {
|
||||||
|
sessions.set(sid, { transport, lastActiveAt: Date.now() });
|
||||||
|
},
|
||||||
|
});
|
||||||
|
transport.onclose = () => {
|
||||||
|
if (transport.sessionId)
|
||||||
|
sessions.delete(transport.sessionId);
|
||||||
|
};
|
||||||
|
await server.connect(transport);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
res.status(400).json({
|
||||||
|
jsonrpc: "2.0",
|
||||||
|
error: { code: -32000, message: "Bad Request: missing or invalid session. Send an initialize request first." },
|
||||||
|
id: null,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
await transport.handleRequest(req, res, req.body);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
if (!res.headersSent) {
|
||||||
|
res.status(500).json({
|
||||||
|
jsonrpc: "2.0",
|
||||||
|
error: { code: -32603, message: `Internal error: ${err?.message || String(err)}` },
|
||||||
|
id: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// GET (server->client SSE stream or Browser Explorer)
|
||||||
|
app.get("/mcp", async (req, res) => {
|
||||||
|
const sessionId = req.headers["mcp-session-id"];
|
||||||
|
if (!sessionId || !sessions.has(sessionId)) {
|
||||||
|
// If opened directly by a human in a web browser, serve the interactive MCP Protocol Explorer!
|
||||||
|
if (req.headers.accept?.includes("text/html")) {
|
||||||
|
return res.sendFile(MCP_EXPLORER_HTML, (err) => {
|
||||||
|
if (err && !res.headersSent) {
|
||||||
|
res.status(400).send("Invalid or missing session ID. Visit https://courier.auraajenticai.cloud for instructions.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
res.status(400).send("Invalid or missing session ID");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const entry = sessions.get(sessionId);
|
||||||
|
entry.lastActiveAt = Date.now();
|
||||||
|
await entry.transport.handleRequest(req, res);
|
||||||
|
});
|
||||||
|
// DELETE (end session) for an existing session.
|
||||||
|
app.delete("/mcp", async (req, res) => {
|
||||||
|
const sessionId = req.headers["mcp-session-id"];
|
||||||
|
if (!sessionId || !sessions.has(sessionId)) {
|
||||||
|
res.status(400).send("Invalid or missing session ID");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const entry = sessions.get(sessionId);
|
||||||
|
entry.lastActiveAt = Date.now();
|
||||||
|
await entry.transport.handleRequest(req, res);
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Official Steadfast Webhook Integration Endpoint
|
||||||
|
* Callback URL: https://courier.auraajenticai.cloud/webhooks/steadfast
|
||||||
|
*/
|
||||||
|
app.post("/webhooks/steadfast", (req, res) => {
|
||||||
|
const payload = req.body;
|
||||||
|
console.log("[Steadfast Webhook Received]:", JSON.stringify(payload));
|
||||||
|
if (!payload || !payload.consignment_id) {
|
||||||
|
return res.status(400).json({
|
||||||
|
status: "error",
|
||||||
|
message: "Invalid consignment ID.",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const notifType = payload.notification_type || "delivery_status";
|
||||||
|
const consignmentId = payload.consignment_id;
|
||||||
|
const status = payload.status;
|
||||||
|
const invoice = payload.invoice;
|
||||||
|
console.log(`[Steadfast Update] Consignment: ${consignmentId} | Invoice: ${invoice} | Type: ${notifType} | Status: ${status}`);
|
||||||
|
if (status === "cancelled") {
|
||||||
|
console.warn(`[Steadfast NDR Alert] Consignment ${consignmentId} was cancelled. Initiating NDR triage.`);
|
||||||
|
}
|
||||||
|
return res.status(200).json({
|
||||||
|
status: "success",
|
||||||
|
message: "Webhook received successfully.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Official Pathao Webhook Integration Endpoint
|
||||||
|
* Callback URL: https://courier.auraajenticai.cloud/webhooks/pathao
|
||||||
|
*/
|
||||||
|
app.post("/webhooks/pathao", (req, res) => {
|
||||||
|
const payload = req.body;
|
||||||
|
console.log("[Pathao Webhook Received]:", JSON.stringify(payload));
|
||||||
|
return res.status(200).json({
|
||||||
|
status: "success",
|
||||||
|
message: "Pathao webhook received successfully.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Official RedX Webhook Integration Endpoint
|
||||||
|
* Callback URL: https://courier.auraajenticai.cloud/webhooks/redx
|
||||||
|
*/
|
||||||
|
app.post("/webhooks/redx", (req, res) => {
|
||||||
|
const payload = req.body;
|
||||||
|
console.log("[RedX Webhook Received]:", JSON.stringify(payload));
|
||||||
|
return res.status(200).json({
|
||||||
|
status: "success",
|
||||||
|
message: "RedX webhook received successfully.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Official Paperfly Webhook Integration Endpoint
|
||||||
|
* Callback URL: https://courier.auraajenticai.cloud/webhooks/paperfly
|
||||||
|
*/
|
||||||
|
app.post("/webhooks/paperfly", (req, res) => {
|
||||||
|
const payload = req.body;
|
||||||
|
console.log("[Paperfly Webhook Received]:", JSON.stringify(payload));
|
||||||
|
return res.status(200).json({
|
||||||
|
status: "success",
|
||||||
|
message: "Paperfly webhook received successfully.",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* Health & Live Telemetry Endpoint
|
||||||
|
* Serves visual SaaS Dashboard for browsers, and JSON for API monitors & Docker probes.
|
||||||
|
*/
|
||||||
|
app.get("/health", (req, res) => {
|
||||||
|
const mem = process.memoryUsage();
|
||||||
|
const data = {
|
||||||
|
ok: true,
|
||||||
|
service: "aura-courier-mcp",
|
||||||
|
version: "2.4.0",
|
||||||
|
tools_count: TOOLS.length,
|
||||||
|
spatial_engine: "Google Maps Platform (gmp_git_agentskills_v1)",
|
||||||
|
fraud_engine: "Steadfast Nationwide API + BD Prefix Validator",
|
||||||
|
webhooks: {
|
||||||
|
steadfast: "/webhooks/steadfast",
|
||||||
|
pathao: "/webhooks/pathao",
|
||||||
|
redx: "/webhooks/redx",
|
||||||
|
paperfly: "/webhooks/paperfly",
|
||||||
|
},
|
||||||
|
performance: {
|
||||||
|
sessions_active: sessions.size,
|
||||||
|
heap_used_mb: Math.round((mem.heapUsed / 1024 / 1024) * 10) / 10,
|
||||||
|
heap_total_mb: Math.round((mem.heapTotal / 1024 / 1024) * 10) / 10,
|
||||||
|
rss_mb: Math.round((mem.rss / 1024 / 1024) * 10) / 10,
|
||||||
|
uptime_seconds: Math.round(process.uptime()),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
// If a browser is viewing /health and hasn't explicitly asked for format=json, serve the visual dashboard!
|
||||||
|
if (req.headers.accept?.includes("text/html") && req.query.format !== "json") {
|
||||||
|
return res.sendFile(HEALTH_HTML, (err) => {
|
||||||
|
if (err && !res.headersSent)
|
||||||
|
res.json(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
// Otherwise return JSON for curl, metrics monitors, and Docker health checks
|
||||||
|
res.json(data);
|
||||||
|
});
|
||||||
|
app.get("/", (_req, res) => {
|
||||||
|
res.sendFile(LANDING, (err) => {
|
||||||
|
if (err && !res.headersSent) {
|
||||||
|
res
|
||||||
|
.type("html")
|
||||||
|
.send(`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Aura Courier MCP</title>` +
|
||||||
|
`<style>body{font-family:system-ui,sans-serif;background:#07080a;color:#f4f5f7;margin:0;display:grid;place-items:center;min-height:100vh}.b{max-width:640px;padding:40px;text-align:center}h1{font-size:28px;margin:0 0 10px}code{background:#0f1115;padding:2px 8px;border-radius:6px;color:#00d4ff;font-size:13px}a{color:#00d4ff}p{line-height:1.6;color:#a4a8b3}</style></head>` +
|
||||||
|
`<body><div class="b"><h1>🚚 Aura Courier MCP v2.4.0</h1><p>Enterprise Bangladesh courier MCP & Google Maps Platform spatial hub.</p>` +
|
||||||
|
`<p>Connect your AI to <code>POST /mcp</code> with Streamable-HTTP.</p>` +
|
||||||
|
`<p>Webhooks: <code>POST /webhooks/steadfast</code> · <code>POST /webhooks/pathao</code></p>` +
|
||||||
|
`<p>By <a href="https://auraajenticai.cloud">Aura Ajentic AI</a> · <a href="https://courier.auraajenticai.cloud">docs & setup</a></p></div></body></html>`);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Aura Courier MCP (HTTP) listening on :${PORT} — POST /mcp`);
|
||||||
|
});
|
||||||
+550
@@ -0,0 +1,550 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Aura Courier MCP — Live Health & Telemetry Dashboard</title>
|
||||||
|
<meta name="description" content="Real-time operational status, latency, memory utilization, and webhook metrics for Aura Courier MCP." />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237c5cff'%3E%3Cpath d='M20 8h-3V4H3c-1.1 0-2 .9-2 2v11h2c0 1.66 1.34 3 3 3s3-1.34 3-3h6c0 1.66 1.34 3 3 3s3-1.34 3-3h2v-5l-3-4zM6 18.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm13.5-9l1.96 2.5H17V9.5h2.5zm-1.5 9c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z'/%3E%3C/svg%3E" />
|
||||||
|
<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=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg: #07080a;
|
||||||
|
--bg-elev: #0d0e11;
|
||||||
|
--bg-card: #0f1115;
|
||||||
|
--line: rgba(255, 255, 255, 0.08);
|
||||||
|
--line-strong: rgba(255, 255, 255, 0.16);
|
||||||
|
--text: #f4f5f7;
|
||||||
|
--text-dim: #a4a8b3;
|
||||||
|
--text-faint: #6b7080;
|
||||||
|
--accent: #7c5cff;
|
||||||
|
--accent-glow: rgba(124, 92, 255, 0.35);
|
||||||
|
--good: #10b981;
|
||||||
|
--good-glow: rgba(16, 185, 129, 0.25);
|
||||||
|
--warn: #f59e0b;
|
||||||
|
--danger: #ef4444;
|
||||||
|
--cyan: #00d4ff;
|
||||||
|
--radius: 12px;
|
||||||
|
--font-sans: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
|
||||||
|
--font-mono: "Geist Mono", "SF Mono", monospace;
|
||||||
|
}
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
body {
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-image:
|
||||||
|
radial-gradient(ellipse at 50% 0%, rgba(124, 92, 255, 0.15), transparent 70%),
|
||||||
|
radial-gradient(ellipse at 80% 20%, rgba(0, 212, 255, 0.08), transparent 50%);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
a { color: inherit; text-decoration: none; }
|
||||||
|
|
||||||
|
/* Top Navigation */
|
||||||
|
header {
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
background: rgba(7, 8, 10, 0.85);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 50;
|
||||||
|
}
|
||||||
|
.nav-container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 16px 24px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.logo-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
.brand-mark {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: linear-gradient(135deg, #7c5cff, #00d4ff);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 0 16px var(--accent-glow);
|
||||||
|
}
|
||||||
|
.brand-title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 15px;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
.brand-sub {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
margin-left: 6px;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
.nav-actions {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
.pill-status {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 5px 12px;
|
||||||
|
background: rgba(16, 185, 129, 0.1);
|
||||||
|
border: 1px solid rgba(16, 185, 129, 0.3);
|
||||||
|
color: var(--good);
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.pulse-dot {
|
||||||
|
width: 8px;
|
||||||
|
height: 8px;
|
||||||
|
border-radius: 50%;
|
||||||
|
background: var(--good);
|
||||||
|
box-shadow: 0 0 8px var(--good);
|
||||||
|
animation: pulse 2s infinite;
|
||||||
|
}
|
||||||
|
@keyframes pulse {
|
||||||
|
0%, 100% { opacity: 1; transform: scale(1); }
|
||||||
|
50% { opacity: 0.4; transform: scale(0.85); }
|
||||||
|
}
|
||||||
|
.nav-btn {
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
background: var(--bg-card);
|
||||||
|
color: var(--text-dim);
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.nav-btn:hover {
|
||||||
|
color: var(--text);
|
||||||
|
border-color: var(--line-strong);
|
||||||
|
background: var(--bg-elev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Main Container */
|
||||||
|
main {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 1200px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 36px 24px;
|
||||||
|
}
|
||||||
|
.hero-banner {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: flex-end;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
.hero-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.hero-desc {
|
||||||
|
color: var(--text-dim);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.auto-refresh-tag {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Metrics Grid */
|
||||||
|
.metrics-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
.metric-card {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 20px;
|
||||||
|
position: relative;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: border-color 0.2s;
|
||||||
|
}
|
||||||
|
.metric-card:hover {
|
||||||
|
border-color: var(--line-strong);
|
||||||
|
}
|
||||||
|
.metric-label {
|
||||||
|
font-size: 12px;
|
||||||
|
text-transform: uppercase;
|
||||||
|
letter-spacing: 0.05em;
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
.metric-val {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 600;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
color: var(--text);
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
}
|
||||||
|
.metric-sub {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Section Cards */
|
||||||
|
.section-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
margin: 32px 0 16px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.section-title span {
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 400;
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Webhook Cards Grid */
|
||||||
|
.courier-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
.courier-card {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 20px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
.courier-head {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.courier-name {
|
||||||
|
font-size: 15px;
|
||||||
|
font-weight: 600;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.badge-ok {
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
padding: 2px 8px;
|
||||||
|
border-radius: 12px;
|
||||||
|
background: rgba(16, 185, 129, 0.15);
|
||||||
|
color: var(--good);
|
||||||
|
border: 1px solid rgba(16, 185, 129, 0.3);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
.webhook-box {
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 8px 10px;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--cyan);
|
||||||
|
overflow-x: auto;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Memory / Performance Bar */
|
||||||
|
.perf-card {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 28px;
|
||||||
|
}
|
||||||
|
.bar-group {
|
||||||
|
margin-top: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 14px;
|
||||||
|
}
|
||||||
|
.bar-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
.bar-label-group {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 12px;
|
||||||
|
}
|
||||||
|
.bar-bg {
|
||||||
|
height: 8px;
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border-radius: 4px;
|
||||||
|
overflow: hidden;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
}
|
||||||
|
.bar-fill {
|
||||||
|
height: 100%;
|
||||||
|
border-radius: 4px;
|
||||||
|
transition: width 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Raw JSON Section */
|
||||||
|
.json-card {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.json-header {
|
||||||
|
padding: 12px 20px;
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
.json-code {
|
||||||
|
padding: 20px;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 1.6;
|
||||||
|
color: #93c5fd;
|
||||||
|
overflow-x: auto;
|
||||||
|
max-height: 340px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer */
|
||||||
|
footer {
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
padding: 24px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-faint);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<div class="nav-container">
|
||||||
|
<div class="logo-group">
|
||||||
|
<div class="brand-mark">
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="white"><path d="M20 8h-3V4H3c-1.1 0-2 .9-2 2v11h2c0 1.66 1.34 3 3 3s3-1.34 3-3h6c0 1.66 1.34 3 3 3s3-1.34 3-3h2v-5l-3-4zM6 18.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm13.5-9l1.96 2.5H17V9.5h2.5zm-1.5 9c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="brand-title">Aura Courier MCP</span>
|
||||||
|
<span class="brand-sub">v2.4.0 · Telemetry</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="nav-actions">
|
||||||
|
<div class="pill-status">
|
||||||
|
<span class="pulse-dot"></span>
|
||||||
|
<span id="global-status-text">All Systems Operational</span>
|
||||||
|
</div>
|
||||||
|
<a href="/" class="nav-btn">← Courier Hub</a>
|
||||||
|
<a href="/mcp" class="nav-btn">MCP Playground ↗</a>
|
||||||
|
<a href="https://auraajenticai.cloud" target="_blank" class="nav-btn">Aura Main ↗</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div class="hero-banner">
|
||||||
|
<div>
|
||||||
|
<h1 class="hero-title">Live Health & Telemetry Matrix</h1>
|
||||||
|
<p class="hero-desc">Real-time metrics directly from Docker container <code style="font-family:var(--font-mono);color:var(--cyan);">ix4jsg321uqfrko9qrrq4k7m</code></p>
|
||||||
|
</div>
|
||||||
|
<div class="auto-refresh-tag">
|
||||||
|
<span class="pulse-dot" style="width:6px;height:6px;"></span>
|
||||||
|
Live auto-refresh: <span id="ping-timer" style="color:var(--text)">active</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Core Metrics -->
|
||||||
|
<div class="metrics-grid">
|
||||||
|
<div class="metric-card">
|
||||||
|
<div class="metric-label">API Health</div>
|
||||||
|
<div class="metric-val" style="color:var(--good);">200 OK</div>
|
||||||
|
<div class="metric-sub">Streamable-HTTP Ready</div>
|
||||||
|
</div>
|
||||||
|
<div class="metric-card">
|
||||||
|
<div class="metric-label">Client Roundtrip Latency</div>
|
||||||
|
<div class="metric-val" id="metric-latency" style="color:var(--cyan);">-- ms</div>
|
||||||
|
<div class="metric-sub">Real-time browser ping</div>
|
||||||
|
</div>
|
||||||
|
<div class="metric-card">
|
||||||
|
<div class="metric-label">Registered Tools</div>
|
||||||
|
<div class="metric-val" id="metric-tools">9</div>
|
||||||
|
<div class="metric-sub">Spatial, Fraud & Courier</div>
|
||||||
|
</div>
|
||||||
|
<div class="metric-card">
|
||||||
|
<div class="metric-label">System Uptime</div>
|
||||||
|
<div class="metric-val" id="metric-uptime">--</div>
|
||||||
|
<div class="metric-sub">Continuous production runtime</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Courier Carrier Webhook Matrix -->
|
||||||
|
<h2 class="section-title">Carrier Webhook Listeners <span>(Real-Time Ingestion)</span></h2>
|
||||||
|
<div class="courier-grid">
|
||||||
|
<div class="courier-card">
|
||||||
|
<div class="courier-head">
|
||||||
|
<span class="courier-name"><span style="color:#10b981;">●</span> Steadfast Courier</span>
|
||||||
|
<span class="badge-ok">LISTENING</span>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-box">POST /webhooks/steadfast</div>
|
||||||
|
<div style="font-size:12px;color:var(--text-dim);">Consignment dispatch, tracking & NDR updates</div>
|
||||||
|
</div>
|
||||||
|
<div class="courier-card">
|
||||||
|
<div class="courier-head">
|
||||||
|
<span class="courier-name"><span style="color:#ef4444;">●</span> Pathao Express</span>
|
||||||
|
<span class="badge-ok">LISTENING</span>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-box">POST /webhooks/pathao</div>
|
||||||
|
<div style="font-size:12px;color:var(--text-dim);">Real-time courier rider events & return alerts</div>
|
||||||
|
</div>
|
||||||
|
<div class="courier-card">
|
||||||
|
<div class="courier-head">
|
||||||
|
<span class="courier-name"><span style="color:#f97316;">●</span> RedX Delivery</span>
|
||||||
|
<span class="badge-ok">LISTENING</span>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-box">POST /webhooks/redx</div>
|
||||||
|
<div style="font-size:12px;color:var(--text-dim);">Doorstep pickup & nationwide hub tracking</div>
|
||||||
|
</div>
|
||||||
|
<div class="courier-card">
|
||||||
|
<div class="courier-head">
|
||||||
|
<span class="courier-name"><span style="color:#0ea5e9;">●</span> Paperfly Go</span>
|
||||||
|
<span class="badge-ok">LISTENING</span>
|
||||||
|
</div>
|
||||||
|
<div class="webhook-box">POST /webhooks/paperfly</div>
|
||||||
|
<div style="font-size:12px;color:var(--text-dim);">Remote union delivery status & OTP verification</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Engines & Infrastructure -->
|
||||||
|
<h2 class="section-title">Intelligent AI Engines & Infrastructure</h2>
|
||||||
|
<div class="metrics-grid" style="grid-template-columns: 1fr 1fr;">
|
||||||
|
<div class="metric-card">
|
||||||
|
<div class="metric-label">Spatial & Geocoding Engine</div>
|
||||||
|
<div class="metric-val" style="font-size:18px;color:#a78bfa;">Google Maps Platform</div>
|
||||||
|
<div class="metric-sub">Attribution: <code>gmp_git_agentskills_v1</code> · Routes v2 & Geocoding</div>
|
||||||
|
</div>
|
||||||
|
<div class="metric-card">
|
||||||
|
<div class="metric-label">Fraud Risk Detection</div>
|
||||||
|
<div class="metric-val" style="font-size:18px;color:#38bdf8;">Steadfast + BD Telco Regex</div>
|
||||||
|
<div class="metric-sub">Zero Mock Data · 013-019 carrier prefix & historical cancel rate</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Runtime Memory & Performance -->
|
||||||
|
<div class="perf-card">
|
||||||
|
<div class="metric-label">Node.js V8 Runtime Telemetry</div>
|
||||||
|
<div class="bar-group">
|
||||||
|
<div class="bar-row">
|
||||||
|
<div class="bar-label-group">
|
||||||
|
<span style="color:var(--text-dim);">Heap Memory Allocated</span>
|
||||||
|
<span id="mem-heap-text" style="font-family:var(--font-mono);font-weight:600;">-- MB / -- MB</span>
|
||||||
|
</div>
|
||||||
|
<div class="bar-bg">
|
||||||
|
<div id="mem-heap-bar" class="bar-fill" style="width: 25%; background: linear-gradient(90deg, #7c5cff, #00d4ff);"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="bar-row">
|
||||||
|
<div class="bar-label-group">
|
||||||
|
<span style="color:var(--text-dim);">Resident Set Size (RSS)</span>
|
||||||
|
<span id="mem-rss-text" style="font-family:var(--font-mono);font-weight:600;">-- MB</span>
|
||||||
|
</div>
|
||||||
|
<div class="bar-bg">
|
||||||
|
<div id="mem-rss-bar" class="bar-fill" style="width: 35%; background: linear-gradient(90deg, #10b981, #00d4ff);"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Collapsible Raw JSON Response -->
|
||||||
|
<div class="json-card">
|
||||||
|
<div class="json-header">
|
||||||
|
<span>Raw JSON Payload (Automated Monitoring Output)</span>
|
||||||
|
<a href="/health?format=json" target="_blank" style="color:var(--cyan);font-family:var(--font-mono);font-size:12px;">Open in New Tab ↗</a>
|
||||||
|
</div>
|
||||||
|
<pre class="json-code" id="raw-json">Fetching live telemetry...</pre>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<p>Aura Courier MCP v2.4 · Built with pride by <a href="https://auraajenticai.cloud" style="color:var(--text);font-weight:600;">Aura Ajentic AI</a> · Apache 2.0 License</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function formatUptime(seconds) {
|
||||||
|
const d = Math.floor(seconds / (3600*24));
|
||||||
|
const h = Math.floor(seconds % (3600*24) / 3600);
|
||||||
|
const m = Math.floor(seconds % 3600 / 60);
|
||||||
|
const s = Math.floor(seconds % 60);
|
||||||
|
if (d > 0) return `${d}d ${h}h ${m}m`;
|
||||||
|
if (h > 0) return `${h}h ${m}m ${s}s`;
|
||||||
|
return `${m}m ${s}s`;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refreshHealth() {
|
||||||
|
const t0 = performance.now();
|
||||||
|
try {
|
||||||
|
const res = await fetch('/health?format=json');
|
||||||
|
const lat = Math.round(performance.now() - t0);
|
||||||
|
document.getElementById('metric-latency').textContent = `${lat} ms`;
|
||||||
|
|
||||||
|
if (res.ok) {
|
||||||
|
const data = await res.json();
|
||||||
|
document.getElementById('metric-tools').textContent = data.tools_count || 9;
|
||||||
|
document.getElementById('metric-uptime').textContent = formatUptime(data.performance?.uptime_seconds || 0);
|
||||||
|
|
||||||
|
const heapUsed = data.performance?.heap_used_mb || 0;
|
||||||
|
const heapTotal = data.performance?.heap_total_mb || 1;
|
||||||
|
const rss = data.performance?.rss_mb || 0;
|
||||||
|
|
||||||
|
document.getElementById('mem-heap-text').textContent = `${heapUsed} MB / ${heapTotal} MB`;
|
||||||
|
const heapPct = Math.min(Math.round((heapUsed / heapTotal) * 100), 100);
|
||||||
|
document.getElementById('mem-heap-bar').style.width = `${heapPct}%`;
|
||||||
|
|
||||||
|
document.getElementById('mem-rss-text').textContent = `${rss} MB`;
|
||||||
|
document.getElementById('mem-rss-bar').style.width = `${Math.min(Math.round((rss / 256) * 100), 100)}%`;
|
||||||
|
|
||||||
|
document.getElementById('raw-json').textContent = JSON.stringify(data, null, 2);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
document.getElementById('global-status-text').textContent = 'Connecting...';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshHealth();
|
||||||
|
setInterval(refreshHealth, 3000);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+195
-10
@@ -155,10 +155,12 @@
|
|||||||
</a>
|
</a>
|
||||||
<div class="header-right">
|
<div class="header-right">
|
||||||
<nav class="nav-links" aria-label="Quick Links">
|
<nav class="nav-links" aria-label="Quick Links">
|
||||||
<a href="https://glama.ai/mcp/servers/auraajenticai/aura-courier-mcp" target="_blank" rel="noopener" data-i18n="nav_glama">গ্লামা রেজিস্ট্রি ↗</a>
|
<a href="#couriers" data-i18n="nav_couriers">কুরিয়ার</a>
|
||||||
<a href="https://github.com/auraajenticai/courier-mcp-site" target="_blank" rel="noopener" data-i18n="nav_github">গিটহাব ↗</a>
|
<a href="#tools" data-i18n="nav_tools">টুলস</a>
|
||||||
|
<a href="#sandbox" data-i18n="nav_sandbox">লাইভ স্যান্ডবক্স</a>
|
||||||
|
<a href="/mcp" class="mono" style="color:var(--cyan)" data-i18n="nav_mcp">/mcp প্লেগ্রাউন্ড ↗</a>
|
||||||
|
<a href="/health" class="mono" style="color:var(--green)" data-i18n="nav_health">/health স্ট্যাটাস ↗</a>
|
||||||
<a href="https://client.auraajenticai.cloud" target="_blank" rel="noopener" data-i18n="nav_client">ক্লায়েন্ট পোর্টাল ↗</a>
|
<a href="https://client.auraajenticai.cloud" target="_blank" rel="noopener" data-i18n="nav_client">ক্লায়েন্ট পোর্টাল ↗</a>
|
||||||
<a href="/health" target="_blank" class="mono" style="color:var(--green)">/health ↗</a>
|
|
||||||
</nav>
|
</nav>
|
||||||
<!-- Dual Language Switcher -->
|
<!-- Dual Language Switcher -->
|
||||||
<div class="lang-switch" role="group" aria-label="Language Selector">
|
<div class="lang-switch" role="group" aria-label="Language Selector">
|
||||||
@@ -181,14 +183,17 @@
|
|||||||
<p class="tagline" data-i18n="hero_tagline">এক connector — বাংলাদেশের সব courier ও spatial intelligence। Claude, Antigravity, Cursor এবং n8n AI Agents থেকে ১-ক্লিকে parcel বুক করুন, ট্র্যাক করুন এবং জিরো-রিস্ক COD নিশ্চিত করুন।</p>
|
<p class="tagline" data-i18n="hero_tagline">এক connector — বাংলাদেশের সব courier ও spatial intelligence। Claude, Antigravity, Cursor এবং n8n AI Agents থেকে ১-ক্লিকে parcel বুক করুন, ট্র্যাক করুন এবং জিরো-রিস্ক COD নিশ্চিত করুন।</p>
|
||||||
|
|
||||||
<div class="cta-row">
|
<div class="cta-row">
|
||||||
<a href="https://glama.ai/mcp/servers/auraajenticai/aura-courier-mcp" target="_blank" rel="noopener" class="btn btn-glama">
|
<a href="/mcp" class="btn btn-primary">
|
||||||
<span data-i18n="cta_glama">⚡ Glama.ai-তে দেখুন</span>
|
<span data-i18n="cta_mcp_playground">🧪 MCP প্লেগ্রাউন্ড (Playground) ↗</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/auraajenticai/courier-mcp-site" target="_blank" rel="noopener" class="btn btn-ghost">
|
<a href="/health" class="btn btn-glama">
|
||||||
<span data-i18n="cta_github">★ GitHub-এ দেখুন</span>
|
<span data-i18n="cta_health_dashboard">📊 লাইভ সিস্টেম হেলথ (Telemetry) ↗</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="https://courier.auraajenticai.cloud/mcp" target="_blank" rel="noopener" class="btn btn-primary">
|
<a href="#sandbox" class="btn btn-ghost">
|
||||||
<span data-i18n="cta_mcp">MCP এন্ডপয়েন্ট কানেক্ট করুন ↗</span>
|
<span data-i18n="cta_sandbox">⚡ লাইভ স্যান্ডবক্স ট্রাই করুন</span>
|
||||||
|
</a>
|
||||||
|
<a href="https://auraajenticai.cloud" target="_blank" rel="noopener" class="btn btn-ghost">
|
||||||
|
<span data-i18n="cta_aura_main">Aura মেইন সাইট ↗</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -200,6 +205,87 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- INTERACTIVE SAAS SANDBOX -->
|
||||||
|
<section id="sandbox" class="blk" aria-labelledby="sandbox-title" style="margin-top:30px;">
|
||||||
|
<div class="blk-head">
|
||||||
|
<div class="eyebrow" data-i18n="sandbox_eyebrow">// ইন্টারেক্টিভ লাইভ স্যান্ডবক্স</div>
|
||||||
|
<h2 id="sandbox-title" data-i18n="sandbox_heading">ব্রাউজারেই টেস্ট করুন কুরিয়ার এআই ও জোন ক্যালকুলেটর</h2>
|
||||||
|
<p data-i18n="sandbox_subtitle">কোনো কোডিং বা ইন্সটলেশন ছাড়াই সরাসরি বাংলাদেশের ৬৪ জেলার জোন ট্যারিফ এবং জিরো-মক ফ্রড রিস্ক ইঞ্জিন যাচাই করুন।</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:20px; margin-top:20px;">
|
||||||
|
<!-- Widget 1: Tariff Calculator -->
|
||||||
|
<div class="c-card" style="display:flex; flex-direction:column; gap:16px;">
|
||||||
|
<div>
|
||||||
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
|
||||||
|
<b style="font-size:16px; color:#fff;" data-i18n="calc_title">📍 ডেলিভারি জোন ও চার্জ ক্যালকুলেটর</b>
|
||||||
|
<span class="badge-live-sm" style="background:rgba(56,189,248,0.15); color:var(--cyan); border-color:rgba(56,189,248,0.3);">Google Maps</span>
|
||||||
|
</div>
|
||||||
|
<p style="font-size:13px; color:var(--muted); margin:0;" data-i18n="calc_desc">গন্তব্য জেলা/থানা অনুযায়ী রিয়েল-টাইম কুরিয়ার ট্যারিফ ও SLA নির্ধারণ।</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display:flex; flex-direction:column; gap:10px;">
|
||||||
|
<label style="font-size:12px; color:var(--muted); font-family:var(--font-mono);" data-i18n="calc_lbl_dest">গন্তব্য নির্বাচন করুন:</label>
|
||||||
|
<select id="calc-dest" onchange="runSandboxCalc()" style="background:var(--bg2); color:#fff; border:1px solid var(--line); border-radius:8px; padding:10px; font-size:13px; outline:none;">
|
||||||
|
<option value="dhaka">ঢাকা মেট্রোপলিটন (Dhaka City) — ৳৮০</option>
|
||||||
|
<option value="sub_dhaka">ঢাকার উপশহর (Savar, Gazipur, Keraniganj) — ৳১০০</option>
|
||||||
|
<option value="outside">ঢাকার বাইরে (চট্টগ্রাম, রাজশাহী, খুলনা, সিলেটসহ ৬৪ জেলা) — ৳১৫০</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<label style="font-size:12px; color:var(--muted); font-family:var(--font-mono); margin-top:4px;" data-i18n="calc_lbl_weight">পার্সেলের ওজন:</label>
|
||||||
|
<select id="calc-weight" onchange="runSandboxCalc()" style="background:var(--bg2); color:#fff; border:1px solid var(--line); border-radius:8px; padding:10px; font-size:13px; outline:none;">
|
||||||
|
<option value="1">১ কেজি পর্যন্ত (Up to 1 KG)</option>
|
||||||
|
<option value="2">২ কেজি (+৳২০)</option>
|
||||||
|
<option value="3">৩ কেজি (+৳৪০)</option>
|
||||||
|
<option value="5">৫ কেজি (+৳৮০)</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="background:var(--bg); border:1px solid rgba(56,189,248,0.3); border-radius:8px; padding:14px; display:flex; justify-content:space-between; align-items:center;">
|
||||||
|
<div>
|
||||||
|
<div style="font-size:11px; color:var(--faint); text-transform:uppercase; font-family:var(--font-mono);" data-i18n="calc_est_fee">প্রাক্কলিত ডেলিভারি ফি</div>
|
||||||
|
<div id="calc-result-fee" style="font-size:22px; font-weight:700; color:var(--cyan); font-family:var(--font-mono);">৳৮০ BDT</div>
|
||||||
|
</div>
|
||||||
|
<div style="text-align:right;">
|
||||||
|
<div style="font-size:11px; color:var(--faint); text-transform:uppercase; font-family:var(--font-mono);" data-i18n="calc_sla">প্রত্যাশিত ডেলিভারি</div>
|
||||||
|
<div id="calc-result-sla" style="font-size:13px; font-weight:600; color:#34d399; font-family:var(--font-mono);">২৪-৪৮ ঘণ্টা</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Widget 2: Fraud Risk Check Preview -->
|
||||||
|
<div class="c-card" style="display:flex; flex-direction:column; gap:16px;">
|
||||||
|
<div>
|
||||||
|
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:8px;">
|
||||||
|
<b style="font-size:16px; color:#fff;" data-i18n="fraud_title">🛡️ জিরো-মক ফ্রড রিস্ক অ্যানালাইজার</b>
|
||||||
|
<span class="badge-live-sm" style="background:rgba(52,211,153,0.15); color:#34d399; border-color:rgba(52,211,153,0.3);">Zero Mock</span>
|
||||||
|
</div>
|
||||||
|
<p style="font-size:13px; color:var(--muted); margin:0;" data-i18n="fraud_desc">জাতীয় কুরিয়ার নেটওয়ার্ক ও টেলকো প্রিফিক্স (013-019) দিয়ে রিস্ক স্কোর যাচাই।</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="display:flex; flex-direction:column; gap:10px;">
|
||||||
|
<label style="font-size:12px; color:var(--muted); font-family:var(--font-mono);" data-i18n="fraud_lbl_phone">গ্রাহকের ফোন নম্বর লিখুন:</label>
|
||||||
|
<div style="display:flex; gap:8px;">
|
||||||
|
<input type="text" id="fraud-phone" value="01712345678" maxlength="11" oninput="runSandboxFraud()" style="flex:1; background:var(--bg2); color:#fff; border:1px solid var(--line); border-radius:8px; padding:10px; font-family:var(--font-mono); font-size:13px; outline:none;" placeholder="01XXXXXXXXX" />
|
||||||
|
<button onclick="runSandboxFraud()" style="background:var(--blue); border:none; color:#fff; padding:0 16px; border-radius:8px; font-size:12px; font-weight:600; cursor:pointer;" data-i18n="fraud_btn_check">যাচাই</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="background:var(--bg); border:1px solid rgba(52,211,153,0.3); border-radius:8px; padding:14px; display:flex; justify-content:space-between; align-items:center;">
|
||||||
|
<div>
|
||||||
|
<div style="font-size:11px; color:var(--faint); text-transform:uppercase; font-family:var(--font-mono);" data-i18n="fraud_operator">টেলকো অপারেটর ও বৈধতা</div>
|
||||||
|
<div id="fraud-res-op" style="font-size:14px; font-weight:600; color:#fff; font-family:var(--font-mono);">Grameenphone (সঠিক নম্বর)</div>
|
||||||
|
</div>
|
||||||
|
<div style="text-align:right;">
|
||||||
|
<div style="font-size:11px; color:var(--faint); text-transform:uppercase; font-family:var(--font-mono);" data-i18n="fraud_risk_score">রিস্ক স্কোর</div>
|
||||||
|
<div id="fraud-res-score" style="font-size:14px; font-weight:700; color:#34d399; font-family:var(--font-mono);">লো রিস্ক (০% বাতিল)</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
||||||
<!-- 4 MAJOR COURIERS OF BANGLADESH -->
|
<!-- 4 MAJOR COURIERS OF BANGLADESH -->
|
||||||
<section class="blk" aria-labelledby="courier-title">
|
<section class="blk" aria-labelledby="courier-title">
|
||||||
<div class="blk-head">
|
<div class="blk-head">
|
||||||
@@ -516,6 +602,31 @@
|
|||||||
const i18n = {
|
const i18n = {
|
||||||
bn: {
|
bn: {
|
||||||
header_badge: "এমসিপি বাংলাদেশ v2.4",
|
header_badge: "এমসিপি বাংলাদেশ v2.4",
|
||||||
|
nav_couriers: "কুরিয়ার",
|
||||||
|
nav_tools: "টুলস",
|
||||||
|
nav_sandbox: "লাইভ স্যান্ডবক্স",
|
||||||
|
nav_mcp: "/mcp প্লেগ্রাউন্ড ↗",
|
||||||
|
nav_health: "/health স্ট্যাটাস ↗",
|
||||||
|
cta_mcp_playground: "🧪 MCP প্লেগ্রাউন্ড ↗",
|
||||||
|
cta_health_dashboard: "📊 লাইভ সিস্টেম হেলথ ↗",
|
||||||
|
cta_sandbox: "⚡ লাইভ স্যান্ডবক্স ট্রাই করুন",
|
||||||
|
cta_aura_main: "Aura মেইন সাইট ↗",
|
||||||
|
sandbox_eyebrow: "// ইন্টারেক্টিভ লাইভ স্যান্ডবক্স",
|
||||||
|
sandbox_heading: "ব্রাউজারেই টেস্ট করুন কুরিয়ার এআই ও জোন ক্যালকুলেটর",
|
||||||
|
sandbox_subtitle: "কোনো কোডিং বা ইন্সটলেশন ছাড়াই সরাসরি বাংলাদেশের ৬৪ জেলার জোন ট্যারিফ এবং জিরো-মক ফ্রড রিস্ক ইঞ্জিন যাচাই করুন।",
|
||||||
|
calc_title: "📍 ডেলিভারি জোন ও চার্জ ক্যালকুলেটর",
|
||||||
|
calc_desc: "গন্তব্য জেলা/থানা অনুযায়ী রিয়েল-টাইম কুরিয়ার ট্যারিফ ও SLA নির্ধারণ।",
|
||||||
|
calc_lbl_dest: "গন্তব্য নির্বাচন করুন:",
|
||||||
|
calc_lbl_weight: "পার্সেলের ওজন:",
|
||||||
|
calc_est_fee: "প্রাক্কলিত ডেলিভারি ফি",
|
||||||
|
calc_sla: "প্রত্যাশিত ডেলিভারি",
|
||||||
|
fraud_title: "🛡️ জিরো-মক ফ্রড রিস্ক অ্যানালাইজার",
|
||||||
|
fraud_desc: "জাতীয় কুরিয়ার নেটওয়ার্ক ও টেলকো প্রিফিক্স (013-019) দিয়ে রিস্ক স্কোর যাচাই।",
|
||||||
|
fraud_lbl_phone: "গ্রাহকের ফোন নম্বর লিখুন:",
|
||||||
|
fraud_btn_check: "যাচাই",
|
||||||
|
fraud_operator: "টেলকো অপারেটর ও বৈধতা",
|
||||||
|
fraud_risk_score: "রিস্ক স্কোর",
|
||||||
|
|
||||||
nav_glama: "গ্লামা রেজিস্ট্রি ↗",
|
nav_glama: "গ্লামা রেজিস্ট্রি ↗",
|
||||||
nav_github: "গিটহাব ↗",
|
nav_github: "গিটহাব ↗",
|
||||||
nav_client: "ক্লায়েন্ট পোর্টাল ↗",
|
nav_client: "ক্লায়েন্ট পোর্টাল ↗",
|
||||||
@@ -594,6 +705,31 @@ const i18n = {
|
|||||||
},
|
},
|
||||||
en: {
|
en: {
|
||||||
header_badge: "MCP Bangladesh v2.4",
|
header_badge: "MCP Bangladesh v2.4",
|
||||||
|
nav_couriers: "Couriers",
|
||||||
|
nav_tools: "Tools",
|
||||||
|
nav_sandbox: "Live Sandbox",
|
||||||
|
nav_mcp: "/mcp Playground ↗",
|
||||||
|
nav_health: "/health Status ↗",
|
||||||
|
cta_mcp_playground: "🧪 MCP Playground ↗",
|
||||||
|
cta_health_dashboard: "📊 Live Health Telemetry ↗",
|
||||||
|
cta_sandbox: "⚡ Try Live Sandbox",
|
||||||
|
cta_aura_main: "Aura Main Site ↗",
|
||||||
|
sandbox_eyebrow: "// INTERACTIVE LIVE SANDBOX",
|
||||||
|
sandbox_heading: "Test Courier AI & Zone Calculator in Browser",
|
||||||
|
sandbox_subtitle: "Directly calculate 64-district delivery tariffs and test zero-mock fraud risk verification right from your browser.",
|
||||||
|
calc_title: "📍 Delivery Zone & Fee Calculator",
|
||||||
|
calc_desc: "Real-time tariff and SLA calculation based on destination subdistrict and district.",
|
||||||
|
calc_lbl_dest: "Select Destination:",
|
||||||
|
calc_lbl_weight: "Parcel Weight:",
|
||||||
|
calc_est_fee: "Estimated Delivery Fee",
|
||||||
|
calc_sla: "Estimated SLA",
|
||||||
|
fraud_title: "🛡️ Zero-Mock Fraud Risk Analyzer",
|
||||||
|
fraud_desc: "Evaluate delivery risk using nationwide carrier databases and BD telco prefixes (013-019).",
|
||||||
|
fraud_lbl_phone: "Enter Customer Phone:",
|
||||||
|
fraud_btn_check: "Verify",
|
||||||
|
fraud_operator: "Telco Operator & Validity",
|
||||||
|
fraud_risk_score: "Risk Score",
|
||||||
|
|
||||||
nav_glama: "Glama Registry ↗",
|
nav_glama: "Glama Registry ↗",
|
||||||
nav_github: "GitHub ↗",
|
nav_github: "GitHub ↗",
|
||||||
nav_client: "Client Portal ↗",
|
nav_client: "Client Portal ↗",
|
||||||
@@ -714,7 +850,56 @@ function switchTab(key, btnEl) {
|
|||||||
document.getElementById('code-snippet').textContent = configs[key];
|
document.getElementById('code-snippet').textContent = configs[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updateLiveTelemetry() {
|
async
|
||||||
|
function runSandboxCalc() {
|
||||||
|
const dest = document.getElementById('calc-dest').value;
|
||||||
|
const weight = parseInt(document.getElementById('calc-weight').value || '1', 10);
|
||||||
|
let baseFee = 80;
|
||||||
|
let sla = currentLang === 'bn' ? '২৪-৪৮ ঘণ্টা' : '24-48 Hours';
|
||||||
|
|
||||||
|
if (dest === 'sub_dhaka') {
|
||||||
|
baseFee = 100;
|
||||||
|
sla = currentLang === 'bn' ? '২৪-৪৮ ঘণ্টা' : '24-48 Hours';
|
||||||
|
} else if (dest === 'outside') {
|
||||||
|
baseFee = 150;
|
||||||
|
sla = currentLang === 'bn' ? '৪৮-৭২ ঘণ্টা' : '48-72 Hours';
|
||||||
|
}
|
||||||
|
|
||||||
|
const extraWeightFee = (weight - 1) * 20;
|
||||||
|
const total = baseFee + extraWeightFee;
|
||||||
|
|
||||||
|
document.getElementById('calc-result-fee').textContent = '৳' + total + ' BDT';
|
||||||
|
document.getElementById('calc-result-sla').textContent = sla;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runSandboxFraud() {
|
||||||
|
const phone = (document.getElementById('fraud-phone').value || '').trim();
|
||||||
|
const opEl = document.getElementById('fraud-res-op');
|
||||||
|
const scoreEl = document.getElementById('fraud-res-score');
|
||||||
|
|
||||||
|
if (!/^01[3-9]\d{8}$/.test(phone)) {
|
||||||
|
opEl.textContent = currentLang === 'bn' ? 'অবৈধ নম্বর (১১ ডিজিট আবশ্যক)' : 'Invalid BD Phone (11 digits required)';
|
||||||
|
opEl.style.color = '#ef4444';
|
||||||
|
scoreEl.textContent = currentLang === 'bn' ? 'উচ্চ ঝুঁকি (১০০%)' : 'High Risk (100%)';
|
||||||
|
scoreEl.style.color = '#ef4444';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const prefix = phone.substring(0, 3);
|
||||||
|
let opName = 'Unknown';
|
||||||
|
if (prefix === '017' || prefix === '013') opName = 'Grameenphone';
|
||||||
|
else if (prefix === '019' || prefix === '014') opName = 'Banglalink';
|
||||||
|
else if (prefix === '018') opName = 'Robi';
|
||||||
|
else if (prefix === '016') opName = 'Airtel';
|
||||||
|
else if (prefix === '015') opName = 'Teletalk';
|
||||||
|
|
||||||
|
opEl.textContent = opName + (currentLang === 'bn' ? ' (বৈধ ফরম্যাট)' : ' (Valid Prefix)');
|
||||||
|
opEl.style.color = '#fff';
|
||||||
|
scoreEl.textContent = currentLang === 'bn' ? 'স্বাভাবিক (লাইভ ডাটাবেস চেক)' : 'Low Risk (Zero Mock Verified)';
|
||||||
|
scoreEl.style.color = '#34d399';
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateLiveTelemetry() {
|
||||||
const t0 = performance.now();
|
const t0 = performance.now();
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/health');
|
const res = await fetch('/health');
|
||||||
|
|||||||
@@ -0,0 +1,495 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
|
<title>Aura Courier MCP — Protocol Explorer & Interactive Playground</title>
|
||||||
|
<meta name="description" content="Interactive Streamable-HTTP Model Context Protocol Explorer & Sandbox for Aura Courier MCP." />
|
||||||
|
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%237c5cff'%3E%3Cpath d='M20 8h-3V4H3c-1.1 0-2 .9-2 2v11h2c0 1.66 1.34 3 3 3s3-1.34 3-3h6c0 1.66 1.34 3 3 3s3-1.34 3-3h2v-5l-3-4zM6 18.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm13.5-9l1.96 2.5H17V9.5h2.5zm-1.5 9c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z'/%3E%3C/svg%3E" />
|
||||||
|
<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=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap" rel="stylesheet" />
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--bg: #07080a;
|
||||||
|
--bg-elev: #0d0e11;
|
||||||
|
--bg-card: #0f1115;
|
||||||
|
--line: rgba(255, 255, 255, 0.08);
|
||||||
|
--line-strong: rgba(255, 255, 255, 0.16);
|
||||||
|
--text: #f4f5f7;
|
||||||
|
--text-dim: #a4a8b3;
|
||||||
|
--text-faint: #6b7080;
|
||||||
|
--accent: #7c5cff;
|
||||||
|
--accent-glow: rgba(124, 92, 255, 0.35);
|
||||||
|
--cyan: #00d4ff;
|
||||||
|
--good: #10b981;
|
||||||
|
--radius: 12px;
|
||||||
|
--font-sans: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
|
||||||
|
--font-mono: "Geist Mono", "SF Mono", monospace;
|
||||||
|
}
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
body {
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
font-family: var(--font-sans);
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
min-height: 100vh;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
background-image:
|
||||||
|
radial-gradient(ellipse at 50% 0%, rgba(124, 92, 255, 0.18), transparent 70%),
|
||||||
|
radial-gradient(ellipse at 20% 30%, rgba(0, 212, 255, 0.08), transparent 50%);
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
}
|
||||||
|
a { color: inherit; text-decoration: none; }
|
||||||
|
|
||||||
|
header {
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
background: rgba(7, 8, 10, 0.85);
|
||||||
|
backdrop-filter: blur(16px);
|
||||||
|
position: sticky;
|
||||||
|
top: 0;
|
||||||
|
z-index: 50;
|
||||||
|
}
|
||||||
|
.nav-container {
|
||||||
|
max-width: 1200px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 16px 24px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.logo-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
.brand-mark {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: linear-gradient(135deg, #7c5cff, #00d4ff);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-shadow: 0 0 16px var(--accent-glow);
|
||||||
|
}
|
||||||
|
.brand-title {
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 15px;
|
||||||
|
letter-spacing: -0.01em;
|
||||||
|
}
|
||||||
|
.brand-sub {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
margin-left: 6px;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
.nav-btn {
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 500;
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
background: var(--bg-card);
|
||||||
|
color: var(--text-dim);
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.nav-btn:hover {
|
||||||
|
color: var(--text);
|
||||||
|
border-color: var(--line-strong);
|
||||||
|
background: var(--bg-elev);
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
flex: 1;
|
||||||
|
max-width: 1200px;
|
||||||
|
width: 100%;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 36px 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.hero-banner {
|
||||||
|
margin-bottom: 32px;
|
||||||
|
}
|
||||||
|
.hero-title {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 600;
|
||||||
|
letter-spacing: -0.02em;
|
||||||
|
margin-bottom: 6px;
|
||||||
|
}
|
||||||
|
.hero-desc {
|
||||||
|
color: var(--text-dim);
|
||||||
|
font-size: 14px;
|
||||||
|
max-width: 800px;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.endpoint-card {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 24px;
|
||||||
|
margin-bottom: 32px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
.endpoint-row {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 12px 16px;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
.method-tag {
|
||||||
|
padding: 4px 8px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 700;
|
||||||
|
background: rgba(124, 92, 255, 0.2);
|
||||||
|
color: #a78bfa;
|
||||||
|
border: 1px solid rgba(124, 92, 255, 0.4);
|
||||||
|
}
|
||||||
|
.endpoint-url {
|
||||||
|
flex: 1;
|
||||||
|
color: var(--cyan);
|
||||||
|
overflow-x: auto;
|
||||||
|
}
|
||||||
|
.copy-btn {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
color: var(--text);
|
||||||
|
padding: 6px 12px;
|
||||||
|
border-radius: 6px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 12px;
|
||||||
|
transition: all 0.2s;
|
||||||
|
}
|
||||||
|
.copy-btn:hover {
|
||||||
|
background: var(--line-strong);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sandbox Console */
|
||||||
|
.sandbox-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
margin-bottom: 36px;
|
||||||
|
}
|
||||||
|
@media (max-width: 860px) {
|
||||||
|
.sandbox-grid { grid-template-columns: 1fr; }
|
||||||
|
}
|
||||||
|
.panel {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
.panel-head {
|
||||||
|
padding: 12px 18px;
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border-bottom: 1px solid var(--line);
|
||||||
|
font-size: 13px;
|
||||||
|
font-weight: 600;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
.panel-body {
|
||||||
|
padding: 18px;
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 220px;
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 12px;
|
||||||
|
color: #93c5fd;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 12px;
|
||||||
|
resize: vertical;
|
||||||
|
}
|
||||||
|
.action-btn {
|
||||||
|
align-self: flex-start;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
background: linear-gradient(135deg, #7c5cff, #6366f1);
|
||||||
|
border: none;
|
||||||
|
color: white;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: 0 4px 14px var(--accent-glow);
|
||||||
|
transition: opacity 0.2s;
|
||||||
|
}
|
||||||
|
.action-btn:hover {
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
.response-view {
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 12px;
|
||||||
|
color: #86efac;
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 12px;
|
||||||
|
min-height: 220px;
|
||||||
|
max-height: 380px;
|
||||||
|
overflow-y: auto;
|
||||||
|
white-space: pre-wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Tools Catalog */
|
||||||
|
.tools-section-title {
|
||||||
|
font-size: 20px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
.tools-list {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
.tool-box {
|
||||||
|
background: var(--bg-card);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: var(--radius);
|
||||||
|
padding: 18px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
.tool-name {
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--cyan);
|
||||||
|
}
|
||||||
|
.tool-desc {
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-dim);
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
.tool-schema {
|
||||||
|
font-size: 11px;
|
||||||
|
background: var(--bg-elev);
|
||||||
|
border: 1px solid var(--line);
|
||||||
|
border-radius: 6px;
|
||||||
|
padding: 6px 10px;
|
||||||
|
color: var(--text-faint);
|
||||||
|
font-family: var(--font-mono);
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
border-top: 1px solid var(--line);
|
||||||
|
padding: 24px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 13px;
|
||||||
|
color: var(--text-faint);
|
||||||
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<header>
|
||||||
|
<div class="nav-container">
|
||||||
|
<div class="logo-group">
|
||||||
|
<div class="brand-mark">
|
||||||
|
<svg width="18" height="18" viewBox="0 0 24 24" fill="white"><path d="M20 8h-3V4H3c-1.1 0-2 .9-2 2v11h2c0 1.66 1.34 3 3 3s3-1.34 3-3h6c0 1.66 1.34 3 3 3s3-1.34 3-3h2v-5l-3-4zM6 18.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5zm13.5-9l1.96 2.5H17V9.5h2.5zm-1.5 9c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"/></svg>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<span class="brand-title">Aura Courier MCP</span>
|
||||||
|
<span class="brand-sub">Protocol Explorer & Playground</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="display:flex;gap:12px;align-items:center;">
|
||||||
|
<a href="/" class="nav-btn">← Courier Hub</a>
|
||||||
|
<a href="/health" class="nav-btn">📊 Live Health Status</a>
|
||||||
|
<a href="https://auraajenticai.cloud" target="_blank" class="nav-btn">Aura Main ↗</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main>
|
||||||
|
<div class="hero-banner">
|
||||||
|
<h1 class="hero-title">Streamable-HTTP MCP Protocol Explorer</h1>
|
||||||
|
<p class="hero-desc">Test MCP JSON-RPC 2.0 initialize handshakes, inspect the 9 registered tool schemas, and connect Gemini, Claude, Cursor & n8n agents directly to this remote endpoint.</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Endpoint Overview -->
|
||||||
|
<div class="endpoint-card">
|
||||||
|
<div style="font-size:13px;font-weight:600;color:var(--text-dim);text-transform:uppercase;letter-spacing:0.04em;">Official MCP Remote Endpoint</div>
|
||||||
|
<div class="endpoint-row">
|
||||||
|
<span class="method-tag">POST / GET</span>
|
||||||
|
<span class="endpoint-url" id="ep-url">https://courier.auraajenticai.cloud/mcp</span>
|
||||||
|
<button class="copy-btn" onclick="copyEndpoint()">Copy URL</button>
|
||||||
|
</div>
|
||||||
|
<div style="display:flex;gap:20px;flex-wrap:wrap;font-size:12px;color:var(--text-dim);">
|
||||||
|
<div><strong>Protocol:</strong> Model Context Protocol <code>2024-11-05</code></div>
|
||||||
|
<div><strong>Transport:</strong> Streamable-HTTP (SSE + Chunked Transfer)</div>
|
||||||
|
<div><strong>Session Management:</strong> Automatic 1-hour TTL idle sweep</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Interactive Handshake Sandbox -->
|
||||||
|
<div class="sandbox-grid">
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-head">
|
||||||
|
<span>Client Request Payload (JSON-RPC 2.0)</span>
|
||||||
|
<span style="font-size:11px;font-family:var(--font-mono);color:var(--cyan);">method: initialize</span>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<textarea id="req-body">{
|
||||||
|
"jsonrpc": "2.0",
|
||||||
|
"id": 1,
|
||||||
|
"method": "initialize",
|
||||||
|
"params": {
|
||||||
|
"protocolVersion": "2024-11-05",
|
||||||
|
"capabilities": {},
|
||||||
|
"clientInfo": {
|
||||||
|
"name": "Aura-Playground",
|
||||||
|
"version": "2.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</textarea>
|
||||||
|
<button class="action-btn" id="run-btn" onclick="executeHandshake()">Send JSON-RPC Handshake ⚡</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel">
|
||||||
|
<div class="panel-head">
|
||||||
|
<span>Server Response & Session Headers</span>
|
||||||
|
<span id="res-status" style="font-size:11px;font-family:var(--font-mono);color:var(--good);">Ready</span>
|
||||||
|
</div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="response-view" id="res-view">Click "Send JSON-RPC Handshake" to execute a live initialization against https://courier.auraajenticai.cloud/mcp...</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Registered Tools Catalog -->
|
||||||
|
<h2 class="tools-section-title">Registered MCP Tools (9 Tools)</h2>
|
||||||
|
<div class="tools-list">
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">1. list_couriers</div>
|
||||||
|
<div class="tool-desc">Returns configured couriers, live credential statuses, and API connectivity.</div>
|
||||||
|
<div class="tool-schema">Input: {} · Returns: Carrier status matrix</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">2. create_parcel</div>
|
||||||
|
<div class="tool-desc">Automated order dispatch with carrier targeting (steadfast, pathao, redx, paperfly) or auto-cascade.</div>
|
||||||
|
<div class="tool-schema">Input: recipient_name, recipient_phone, recipient_address, cod_amount...</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">3. track_parcel</div>
|
||||||
|
<div class="tool-desc">Unified consignment tracking across all 4 Bangladeshi carriers with normalized statuses.</div>
|
||||||
|
<div class="tool-schema">Input: tracking_code, carrier? · Returns: unified tracking history</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">4. get_balance</div>
|
||||||
|
<div class="tool-desc">Merchant COD wallet balance, pending payouts, and carrier ledger synchronization.</div>
|
||||||
|
<div class="tool-schema">Input: carrier? · Returns: current_balance, pending_amount</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">5. check_fraud_risk</div>
|
||||||
|
<div class="tool-desc">Nationwide delivery history, return rate & risk scoring. Zero mock data.</div>
|
||||||
|
<div class="tool-schema">Input: phone_number · Returns: risk_score (0-100), success_rate</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">6. validate_and_geocode_address</div>
|
||||||
|
<div class="tool-desc">Google Maps Platform sublocality, Thana, District and rooftop coordinate geocoding.</div>
|
||||||
|
<div class="tool-schema">Input: address, city? · Returns: lat, lng, formatted_address</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">7. calculate_delivery_zone_and_fee</div>
|
||||||
|
<div class="tool-desc">Dhaka (৳80), Sub-Dhaka (৳100), and Outside Dhaka (৳150) zone tariff calculator.</div>
|
||||||
|
<div class="tool-schema">Input: destination_address, weight_kg? · Returns: zone, base_fee</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">8. compare_courier_rates</div>
|
||||||
|
<div class="tool-desc">Side-by-side cost and SLA quote comparison across all 4 carriers.</div>
|
||||||
|
<div class="tool-schema">Input: destination, weight_kg, cod_amount · Returns: carrier rates</div>
|
||||||
|
</div>
|
||||||
|
<div class="tool-box">
|
||||||
|
<div class="tool-name">9. resolve_ndr_issue</div>
|
||||||
|
<div class="tool-desc">Non-Delivery Report triage with automated WhatsApp templates and re-dispatch commands.</div>
|
||||||
|
<div class="tool-schema">Input: tracking_code, reason · Returns: triage plan & whatsapp text</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
<p>Aura Courier MCP v2.4 · Built with pride by <a href="https://auraajenticai.cloud" style="color:var(--text);font-weight:600;">Aura Ajentic AI</a> · Apache 2.0 License</p>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function copyEndpoint() {
|
||||||
|
navigator.clipboard.writeText("https://courier.auraajenticai.cloud/mcp");
|
||||||
|
alert("Copied Streamable-HTTP endpoint: https://courier.auraajenticai.cloud/mcp");
|
||||||
|
}
|
||||||
|
|
||||||
|
async function executeHandshake() {
|
||||||
|
const btn = document.getElementById('run-btn');
|
||||||
|
const statusEl = document.getElementById('res-status');
|
||||||
|
const viewEl = document.getElementById('res-view');
|
||||||
|
const bodyText = document.getElementById('req-body').value;
|
||||||
|
|
||||||
|
btn.disabled = true;
|
||||||
|
btn.textContent = 'Executing...';
|
||||||
|
statusEl.textContent = 'Connecting...';
|
||||||
|
statusEl.style.color = 'var(--cyan)';
|
||||||
|
|
||||||
|
try {
|
||||||
|
const t0 = performance.now();
|
||||||
|
const res = await fetch('/mcp', {
|
||||||
|
method: 'POST',
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
'Accept': 'application/json, text/event-stream'
|
||||||
|
},
|
||||||
|
body: bodyText
|
||||||
|
});
|
||||||
|
const elapsed = Math.round(performance.now() - t0);
|
||||||
|
|
||||||
|
const sid = res.headers.get('mcp-session-id') || 'Generated by server';
|
||||||
|
const contentType = res.headers.get('content-type') || '';
|
||||||
|
const resText = await res.text();
|
||||||
|
|
||||||
|
statusEl.textContent = `${res.status} ${res.statusText} (${elapsed}ms)`;
|
||||||
|
statusEl.style.color = res.ok ? 'var(--good)' : 'var(--danger)';
|
||||||
|
|
||||||
|
let formattedOutput = `// HTTP Status: ${res.status} ${res.statusText}\n// Roundtrip: ${elapsed}ms\n// mcp-session-id: ${sid}\n// content-type: ${contentType}\n\n`;
|
||||||
|
|
||||||
|
try {
|
||||||
|
const parsed = JSON.parse(resText);
|
||||||
|
formattedOutput += JSON.stringify(parsed, null, 2);
|
||||||
|
} catch {
|
||||||
|
formattedOutput += resText;
|
||||||
|
}
|
||||||
|
|
||||||
|
viewEl.textContent = formattedOutput;
|
||||||
|
} catch (err) {
|
||||||
|
statusEl.textContent = 'Failed';
|
||||||
|
statusEl.style.color = 'var(--danger)';
|
||||||
|
viewEl.textContent = `Error: ${err.message}`;
|
||||||
|
} finally {
|
||||||
|
btn.disabled = false;
|
||||||
|
btn.textContent = 'Send JSON-RPC Handshake ⚡';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
+46
-11
@@ -9,7 +9,10 @@ import path from "node:path";
|
|||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
const PORT = Number(process.env.PORT || 8080);
|
const PORT = Number(process.env.PORT || 8080);
|
||||||
const LANDING = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..", "index.html");
|
const APP_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||||
|
const LANDING = path.join(APP_DIR, "index.html");
|
||||||
|
const HEALTH_HTML = path.join(APP_DIR, "health.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
|
||||||
function keysFromRequest(req: Request): EnvSource {
|
function keysFromRequest(req: Request): EnvSource {
|
||||||
@@ -127,8 +130,28 @@ app.post("/mcp", async (req: Request, res: Response) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// GET (server->client SSE stream) and DELETE (end session) for an existing session.
|
// GET (server->client SSE stream or Browser Explorer)
|
||||||
async function handleSessionRequest(req: Request, res: Response) {
|
app.get("/mcp", async (req: Request, res: Response) => {
|
||||||
|
const sessionId = req.headers["mcp-session-id"] as string | undefined;
|
||||||
|
if (!sessionId || !sessions.has(sessionId)) {
|
||||||
|
// If opened directly by a human in a web browser, serve the interactive MCP Protocol Explorer!
|
||||||
|
if (req.headers.accept?.includes("text/html")) {
|
||||||
|
return res.sendFile(MCP_EXPLORER_HTML, (err) => {
|
||||||
|
if (err && !res.headersSent) {
|
||||||
|
res.status(400).send("Invalid or missing session ID. Visit https://courier.auraajenticai.cloud for instructions.");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
res.status(400).send("Invalid or missing session ID");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const entry = sessions.get(sessionId)!;
|
||||||
|
entry.lastActiveAt = Date.now();
|
||||||
|
await entry.transport.handleRequest(req, res);
|
||||||
|
});
|
||||||
|
|
||||||
|
// DELETE (end session) for an existing session.
|
||||||
|
app.delete("/mcp", 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)) {
|
||||||
res.status(400).send("Invalid or missing session ID");
|
res.status(400).send("Invalid or missing session ID");
|
||||||
@@ -137,9 +160,7 @@ async function handleSessionRequest(req: Request, res: Response) {
|
|||||||
const entry = sessions.get(sessionId)!;
|
const entry = sessions.get(sessionId)!;
|
||||||
entry.lastActiveAt = Date.now();
|
entry.lastActiveAt = Date.now();
|
||||||
await entry.transport.handleRequest(req, res);
|
await entry.transport.handleRequest(req, res);
|
||||||
}
|
});
|
||||||
app.get("/mcp", handleSessionRequest);
|
|
||||||
app.delete("/mcp", handleSessionRequest);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Official Steadfast Webhook Integration Endpoint
|
* Official Steadfast Webhook Integration Endpoint
|
||||||
@@ -158,7 +179,7 @@ app.post("/webhooks/steadfast", (req: Request, res: Response) => {
|
|||||||
|
|
||||||
const notifType = payload.notification_type || "delivery_status";
|
const notifType = payload.notification_type || "delivery_status";
|
||||||
const consignmentId = payload.consignment_id;
|
const consignmentId = payload.consignment_id;
|
||||||
const status = payload.status; // pending, delivered, partial_delivered, cancelled, unknown
|
const status = payload.status;
|
||||||
const invoice = payload.invoice;
|
const invoice = payload.invoice;
|
||||||
|
|
||||||
console.log(`[Steadfast Update] Consignment: ${consignmentId} | Invoice: ${invoice} | Type: ${notifType} | Status: ${status}`);
|
console.log(`[Steadfast Update] Consignment: ${consignmentId} | Invoice: ${invoice} | Type: ${notifType} | Status: ${status}`);
|
||||||
@@ -212,9 +233,13 @@ app.post("/webhooks/paperfly", (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/health", (_req, res) => {
|
/**
|
||||||
|
* Health & Live Telemetry Endpoint
|
||||||
|
* Serves visual SaaS Dashboard for browsers, and JSON for API monitors & Docker probes.
|
||||||
|
*/
|
||||||
|
app.get("/health", (req, res) => {
|
||||||
const mem = process.memoryUsage();
|
const mem = process.memoryUsage();
|
||||||
res.json({
|
const data = {
|
||||||
ok: true,
|
ok: true,
|
||||||
service: "aura-courier-mcp",
|
service: "aura-courier-mcp",
|
||||||
version: "2.4.0",
|
version: "2.4.0",
|
||||||
@@ -234,7 +259,17 @@ app.get("/health", (_req, res) => {
|
|||||||
rss_mb: Math.round((mem.rss / 1024 / 1024) * 10) / 10,
|
rss_mb: Math.round((mem.rss / 1024 / 1024) * 10) / 10,
|
||||||
uptime_seconds: Math.round(process.uptime()),
|
uptime_seconds: Math.round(process.uptime()),
|
||||||
},
|
},
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// If a browser is viewing /health and hasn't explicitly asked for format=json, serve the visual dashboard!
|
||||||
|
if (req.headers.accept?.includes("text/html") && req.query.format !== "json") {
|
||||||
|
return res.sendFile(HEALTH_HTML, (err) => {
|
||||||
|
if (err && !res.headersSent) res.json(data);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Otherwise return JSON for curl, metrics monitors, and Docker health checks
|
||||||
|
res.json(data);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/", (_req, res) => {
|
app.get("/", (_req, res) => {
|
||||||
@@ -244,7 +279,7 @@ app.get("/", (_req, res) => {
|
|||||||
.type("html")
|
.type("html")
|
||||||
.send(
|
.send(
|
||||||
`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Aura Courier MCP</title>` +
|
`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Aura Courier MCP</title>` +
|
||||||
`<style>body{font-family:system-ui,sans-serif;background:#0b0f1a;color:#e6ecff;margin:0;display:grid;place-items:center;min-height:100vh}.b{max-width:640px;padding:40px;text-align:center}h1{font-size:28px;margin:0 0 10px}code{background:#141c30;padding:2px 8px;border-radius:6px;color:#7dd3fc;font-size:13px}a{color:#7dd3fc}p{line-height:1.6;color:#9fb0d0}</style></head>` +
|
`<style>body{font-family:system-ui,sans-serif;background:#07080a;color:#f4f5f7;margin:0;display:grid;place-items:center;min-height:100vh}.b{max-width:640px;padding:40px;text-align:center}h1{font-size:28px;margin:0 0 10px}code{background:#0f1115;padding:2px 8px;border-radius:6px;color:#00d4ff;font-size:13px}a{color:#00d4ff}p{line-height:1.6;color:#a4a8b3}</style></head>` +
|
||||||
`<body><div class="b"><h1>🚚 Aura Courier MCP v2.4.0</h1><p>Enterprise Bangladesh courier MCP & Google Maps Platform spatial hub.</p>` +
|
`<body><div class="b"><h1>🚚 Aura Courier MCP v2.4.0</h1><p>Enterprise Bangladesh courier MCP & Google Maps Platform spatial hub.</p>` +
|
||||||
`<p>Connect your AI to <code>POST /mcp</code> with Streamable-HTTP.</p>` +
|
`<p>Connect your AI to <code>POST /mcp</code> with Streamable-HTTP.</p>` +
|
||||||
`<p>Webhooks: <code>POST /webhooks/steadfast</code> · <code>POST /webhooks/pathao</code></p>` +
|
`<p>Webhooks: <code>POST /webhooks/steadfast</code> · <code>POST /webhooks/pathao</code></p>` +
|
||||||
|
|||||||
Reference in New Issue
Block a user