Enterprise AI Security Gateway for REST + MCP runtimes.
Injection defense, trust-aware tool governance, HITL escalation, and tamper-evident auditability.
- Executive Summary
- Why This Product
- Architecture Overview
- MCP as the Strategic Differentiator
- Agents and Security Engines
- End-to-End Workflows
- Repository Layout
- Quick Start
- Runbook: API + Frontend
- Runbook: MCP Gateway
- MCP Usage Guide (JSON-RPC)
- Security Model
- Observability and Operations
- Configuration
- Testing and Quality Gates
- Troubleshooting
- Current Maturity and Production Hardening
- Roadmap Direction
NovaSentinel (SentriCore) secures AI agent interactions with a policy-first gateway model:
- Root API track delivers product-facing secure chat and analytics consumed by the React frontend.
- TrustChain MCP track secures Model Context Protocol tool traffic with a dedicated security pipeline.
The platform is designed for teams building agentic systems that need:
- deterministic policy enforcement,
- runtime risk controls on tool execution,
- and verifiable audit evidence.
Most AI applications secure prompts, but not the runtime execution path where real damage happens.
NovaSentinel addresses this gap with layered controls:
- Detect malicious or manipulative intent before execution.
- Enforce authorization and risk tiers at tool-call time.
- Escalate critical actions to humans when trust is low.
- Preserve immutable cryptographic evidence for governance and incident response.
-
Track A: Secure API Gateway (root)
- Entry:
api.py - Product UX:
frontend/ - Security pipeline: threat score -> input PII scrub -> agent/RBAC -> output scrub -> audit
- Entry:
-
Track B: MCP Security Gateway (
trustchain_ig/)- Entry:
trustchain_ig/run_gateway.py - Transport: MCP JSON-RPC + SSE/stdio proxying
- Security pipeline: injection + embedding drift -> capability auth -> HITL/trust -> audit/metrics
- Entry:
Client Request
-> Security Gateway
-> Threat/Injection Analysis
-> Privacy + Authorization Controls
-> Tool/Agent Execution (PASS / BLOCK / ESCALATE)
-> Output Sanitization
-> Audit Chain + Metrics
-> Safe Response
MCP is the strongest product lever because it governs tool execution, not just model text.
With trustchain_ig, each tools/call can be:
- Passed when clean and authorized,
- Blocked when injection, abuse, or policy violations are detected,
- Escalated to HITL when risk is high or trust falls below threshold.
This gives enterprise teams a practical control plane for agent operations across frameworks.
- Security policies are centralized and enforceable at runtime.
- Sensitive operations gain approval gates and forensic traceability.
- Teams can adopt agentic automation without blind trust in model behavior.
person3_scorer.py- prompt threat scoring (ML + signatures)person2_security.py- PII detection, masking policy, token vaultperson1_agent.py- tool-enabled assistant with RBAC checksaudit_logger.py- tamper-evident hash-chain security loggingdatabase.py- local storage for demo records and audit backing data
engines/injection.py- signature and embedding-drift detectorengines/capability.py- HMAC capability token issue/validationengines/hitl.py- human approval queue and decisionsgateway/session.py- session trust score lifecycle and decayaudit/chain.py- cryptographic ledger with chain verificationtelemetry/metrics.py- Prometheus metrics surface
- Client sends
POST /api/v1/chat - Threat scorer evaluates malicious intent
- Input PII scrub policy executes
- Agent/tool flow runs with RBAC-aware controls
- Output sanitization and response normalization
- Security event written to audit chain
- Frontend receives secure response + assessment metadata
- MCP client sends
tools/callto/mcp - Session and trust context loaded
- Injection + semantic drift analysis performed
- Capability token validated for high/critical tools
- Decision path:
PASS-> execute/forwardBLOCK-> JSON-RPC error with reasonESCALATE-> HITL request created
- Decision and flags written to cryptographic audit log
api.py- FastAPI root gatewayfrontend/- React/Vite production frontendperson1_agent.py- assistant and guarded tool accessperson2_security.py- PII scrub engines and policy helpersperson3_scorer.py- threat scoring engineaudit_logger.py,database.py,schemas.py- contracts + persistencetrustchain_ig/- MCP gateway, engines, audit, transport, telemetrydocker-compose.yml- root API + frontend runtimetrustchain_ig/docker-compose.yml- MCP + Prometheus + Grafana
- Python 3.10+
- Node.js 18+
- pip
- Docker + Docker Compose (optional)
Optional for live LLM behavior:
OPENROUTER_API_KEY
pip install -r requirements.txt
python -m spacy download en_core_web_lgLinux/macOS:
export OPENROUTER_API_KEY=your_key_hereWindows PowerShell:
setx OPENROUTER_API_KEY "your_key_here"python -m uvicorn api:app --host 0.0.0.0 --port 8000 --reloadcd frontend
npm install
npm run dev -- --host 127.0.0.1 --port=5173- API:
http://localhost:8000 - API docs:
http://localhost:8000/docs - Frontend:
http://localhost:5173
run.batcd trustchain_ig
pip install -r requirements.txtpython run_gateway.pyhttp://localhost:7070
POST /mcp- JSON-RPC entrypointGET /health- service health + chain statusGET /stats- sessions/HITL/audit statisticsGET /sessions/{session_id}- trust/session stateGET /hitl-queue- pending approvalsPOST /hitl-decision/{request_id}- approve/rejectGET /audit- audit queryGET /verify-chain- chain integrity checkGET /metrics- Prometheus metrics
GET /mcp/{server_id}/ssePOST /mcp/{server_id}/message
curl -X POST http://localhost:7070/mcp \
-H "Content-Type: application/json" \
-H "X-Session-ID: sess_demo_001" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"clientInfo":{"name":"demo-client"}}}'curl -X POST http://localhost:7070/mcp \
-H "Content-Type: application/json" \
-H "X-Session-ID: sess_demo_001" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}'curl -X POST http://localhost:7070/mcp \
-H "Content-Type: application/json" \
-H "X-Session-ID: sess_demo_001" \
-d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"search_database","arguments":{"query":"find patient 123"}}}'If blocked/escalated, you receive JSON-RPC errors with structured reason data.
- Injection signature detection
- Semantic drift scoring
- Capability-token checks for privileged tools
- HITL escalation for critical/low-trust operations
- Session trust scoring + termination thresholding
- PII input/output sanitization (root stack)
- Tamper-evident audit chain verification
low- baseline allowedmedium- controlled operationshigh- token-bound authorization + max-call ceilingscritical- requires HITL
- Gateway health and trust session stats
- HITL queue inspection and actions
- Audit event querying and integrity verification
- Prometheus metrics endpoint for dashboards and alerting
- MCP Gateway:
7070 - Prometheus:
9091 - Grafana:
3000
OPENROUTER_API_KEY- optional live model keyAPP_ENV- environment mode (dev/prod)ALLOWED_ORIGINS- CORS allowed originsAPI_BEARER_TOKEN- auth token when auth is enforcedENFORCE_AUTH- force strict auth in non-prodRATE_LIMIT_WINDOW_SECONDS,RATE_LIMIT_MAX_REQUESTS
All trustchain_ig config values are overrideable via TRUSTCHAIN_*.
Examples:
TRUSTCHAIN_MCP_PORTTRUSTCHAIN_TELEMETRY_PROMETHEUS_ENABLEDTRUSTCHAIN_AUDIT_DATABASE_URL
Canonical defaults live in trustchain_ig/config/defaults.yaml.
Run full suite:
python -m pytestRun security-only suites:
python -m pytest -m securitySecurity test strategy and CI gates are documented in SECURITY_TESTING.md.
- Port conflict: free
8000,5173,7070,3000,9091 - Model initialization delay: first run may download model assets
- No OpenRouter key: root stack runs in safe mock-compatible mode
- Frontend/API mismatch: verify backend is live and token/origin config is correct
- Coverage command errors: install
pytest-cov
Current state: strong engineering prototype with real security controls.
Before production rollout, prioritize:
- strict authn/authz on all sensitive endpoints
- secret management for capability signing keys
- tenant-aware policy boundaries
- hardened CORS/network posture and rate policy tuning
- SIEM integration and incident response runbooks
Target architecture is a unified gateway:
- MCP security pipeline as the canonical control plane
- REST endpoints as stable product-facing facade
- one policy model, one trust model, one audit model, one telemetry layer
This delivers lower operational complexity and higher governance consistency.