Welcome to the Enterprise Monitoring Platform. This is the Business Level graduation of the Boce Detection Proxy, redesigned for high-volume commercial throughput, multi-tenant isolation, and automated asynchronous lifecycle management.
The "Business Level" standard is built on three pillars of engineering excellence:
- Authentication: Every request must carry an
X-API-KEY. The system identifies the business unit, checks its is_active status, and retrieves its daily_quota. - Validation: URL patterns and JSON schemas are strictly validated BEFORE any points are spent or database resources are allocated.
- Point-Safe Assurance: Before accepting a task, the platform performs a Pre-check with the Boce balance API. It calculates the
total_cost(e.g., 1 point per domain) and rejects the request immediately if the balance is insufficient, protecting your application from 502/504 external errors.
- Bulk Buffering: When you submit 5,000 domains via
/api/detect/batch, the system iterates through the list and flags invalid URLs as "skipped". - Chunked Persistence (2000 per write): To prevent blocking the API or causing SQLite lock-timeouts, the platform writes tasks in atomic chunks of 2,000 records using
executemany. - Job Queuing: Each task is assigned a
batch_idand marked aspending. This ensures the API returns in milliseconds, even for massive volumes.
- Continuous Polling: A background Priority Scheduler scans the
detection_taskstable. - Strategic Retrieval: It fetches tasks ordered by
priority DESCandcreated_at ASC. Your urgent business requests jump the queue ahead of large background crawl batches. - Concurrency Management: Tasks are dispatched to asynchronous workers, ensuring high-concurrency external detection without stalling the main API thread.
- The Trigger: Upon task completion (Success or Failure), the system generates a result payload.
- The Dispatcher:
- If the task provided a
webhook_url, it is used. - If not, the system uses the Account Default Webhook configured for that API key.
- If the task provided a
- Reliability: A delivery worker ensures your business application is notified via
POSTwith a JSON payload, including the full detection results and global availability metrics.
The platform is optimized for Docker, providing auto-recovery and volume persistence.
- Clone & Configure: Ensure
.envcontains yourBOCE_API_KEY. - Deploy:
docker-compose up --build -d
- Check Health:
(Look for the
docker ps --filter "name=boce-api-v4"(healthy)status!)
Use this for debugging or development.
- Install Dependencies:
pip install -r requirements.txt
- Initialize & Run:
# Windows python -m uvicorn app.main:app --host 0.0.0.0 --port 3000 --reload
- Setup Keys: Run
python setup_keys.pyto generate your initialsk-business keys.
Ideal for low-latency ad-hoc checks.
Invoke-RestMethod -Uri "http://localhost:3000/api/detect/detect" `
-Method Post `
-Headers @{"X-API-KEY"="sk-test-points-safe-12345"} `
-ContentType "application/json" `
-Body '{"url": "http://example.com"}'High-volume ingestion for commercial crawling.
Invoke-RestMethod -Uri "http://localhost:3000/api/detect/batch" `
-Method Post `
-Headers @{"X-API-KEY"="sk-test-points-safe-12345"} `
-ContentType "application/json" `
-Body '{"urls": ["http://domain1.com", "http://domain2.com"], "webhook_url": "http://your-app.com/callback"}'Note: This returns a batch_id instantly.
# Get Summary Dashboard Data
Invoke-RestMethod -Uri "http://localhost:3000/api/stats/summary" -Headers @{"X-API-KEY"="..."}
# Track Specific Batch Progress
Invoke-RestMethod -Uri "http://localhost:3000/api/detect/batch/<BATCH_ID>/progress" -Headers @{"X-API-KEY"="..."}- System Health: Access
http://localhost:3000/– it should redirect to the Visual Dashboard. - Database Integrity: Check
boce_api.db(SQLite).- Table
api_keys: Contains business unit configurations. - Table
detection_tasks: Contains the high-volume task ledger.
- Table
- API Key Verification:
# This should fail with 403 (No Key) Invoke-WebRequest -Uri "http://localhost:3000/api/detect/history"
The system is now Wallet Ready and Audit Compliant. It ensures your detection infrastructure is as reliable as the business it supports.
Project Status: Ready for Production. 🚀💎
Developed for hninpwintcho by Antigravity AI.
This is another project "Your Project: boce-aggregated-api-system What is the project? This is a Node.js + TypeScript backend API that your boss ordered built. Its purpose:
Wrapper/aggregator around Boce.com — a Chinese website monitoring service. It tests websites from multiple locations in China (DNS, speed, HTTP status, etc.) and gives you a unified, standardized result.
Think of it like a quality inspector: you ask "Is www.baidu.com healthy from China?" — it sends probes from 许多 nodes (Node 31 = Fujian, Node 32 = elsewhere), collects results, calculates availability rates, detects anomalies, and returns clean JSON.
📂 Project Architecture boce-aggregated-api-system/ ├── src/ │ ├── app.ts ← Express app setup │ ├── index.ts ← Start HTTP server (port 3000) │ ├── config/ ← Env variables (API keys, ports, etc.) │ ├── middleware/ ← Rate limiting (30 req/min) │ ├── routes/ ← HTTP endpoints (/api/detect, /health) │ ├── services/ │ │ ├── boce/ ← Calls Boce.com API (create task, poll result) │ │ ├── detection/ ← Normalizes + calculates metrics + anomalies │ │ ├── queue/ ← BullMQ + Redis (async job queue) │ │ └── db/ ← Postgres (saves detection history) │ ├── types/ ← TypeScript type definitions │ └── mcp/ │ └── server.ts ← 🤖 MCP server (explained below!) ├── Dockerfile ← Container for production ├── docker-compose.yml ← Runs app + Redis + Postgres together └── package.json 🔄 How a Request Flows Your Client (curl/app) │ ▼ POST /api/detect ──→ Boce.com API (create task) │ poll every 10s (max 2min) │ get results from nodes │ normalize → metrics → anomaly detection │ save to Postgres │ return JSON response to you 🤖 MCP Server — What is it? MCP = Model Context Protocol
This is the most modern and exciting part of your project! Let me explain it step by step.
🧠 The Problem MCP Solves Normally, an AI like Claude or ChatGPT only knows what you type to it. It cannot call your APIs or run code on its own. So if you ask it "Is www.baidu.com healthy right now?" — it would say "I don't know, I can't check."
MCP fixes this. It gives AI assistants a standardized way to call your backend tools.
📡 How MCP Works (Simple Analogy) Without MCP: You → AI Chat → "I don't know, can't check" With MCP: You → AI Chat → [AI calls your MCP Server] → Your API → Real Data → AI answers! Think of MCP as a waiter between your AI assistant and your backend kitchen.
🛠️ Your MCP Server Has 4 Tools Tool What it does certificate_summary Checks if a website's SSL certificate is valid/expiring boce_probe_summary Probes a domain from Chinese nodes via Boce.com investigate_domain Combines cert + probe into one full investigation report investigate_domains_batch Investigates up to 20 domains at once (parallel) 💻 Your MCP Server Has 2 Modes Mode Command Use case stdio npm run mcp:start:stdio Local debug in Cursor IDE HTTP npm run mcp:start Remote AI clients connect via http://localhost:3010/mcp 🔌 Practical Example: Cursor IDE Integration Your .cursor/mcp.json config (already in your project!) lets Cursor IDE automatically use these tools. You can type in Cursor chat:
Call MCP tool investigate_domain with {"domain":"www.baidu.com","nodeIds":"31,32"} And Cursor will call your
src/mcp/server.ts , which calls Boce.com, and return a real result like:
domain: www.baidu.com final_status: HEALTHY availability_rate: 1.0 certificate_ok: true days_remaining: 142 🗺️ Technology Stack Summary Technology Role TypeScript/Node.js Main language + runtime Express.js HTTP web server Redis + BullMQ Async job queue (don't block while waiting for Boce) PostgreSQL Store detection history Docker Compose Run everything together easily @modelcontextprotocol/sdk The MCP library — lets AI agents use your tools Zod Validate inputs (type-safe) 🎯 Summary (Boss's Vision) Your boss built a system where:
Any client can call /api/detect to check website health from China Async queue handles bulk jobs without timeouts Postgres stores history so you can track health over time MCP server lets AI agents (Claude, Cursor, etc.) automatically investigate domains by calling your tools — making the system "AI-agent ready" This is a commercial-grade platform — it has auth, rate limiting, webhooks, pagination, and AI integration all in one project. Very impressive boss requirements! 🎉