Skip to content
Back to search

SecureAI-MCP

Role-aware AI governance platform: RBAC-enforced assistant, transparent rule-based risk scoring, policy-grounded answers with citations, a tamper-evident audit trail, and human-decided governance cases. Includes an MCP server for AI clients and MCP incident alerts to GitHub and Slack.

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/shridhar618--secureai-mcp/badge.svg)](/listings/shridhar618--secureai-mcp)

HTML

<a href="/listings/shridhar618--secureai-mcp"><img src="/api/listings/shridhar618--secureai-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

Requires Python 3.11+ and Node 18+.

./setup.sh      # venv, core deps, npm install, backend/.env with random secrets
./run.sh        # backend :5001 + frontend :3000

Open **http://localhost:3000** and use the one-click demo logins (below). Manual:

cd backend && python -m venv venv && source venv/bin/activate   # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env            # then set SECRET_KEY / JWT_SECRET_KEY (setup.sh does this for you)
python app.py                   # http://localhost:5001

cd frontend && npm install && npm run dev      # http://localhost:3000

Docker: `docker compose up --build` (frontend on :3000).

Deploy on Render

This repository includes a Render Blueprint in [`render.yaml`](render.yaml). It deploys the frontend and backend as one same-origin Docker web service, so API requests and Socket.IO do not need a separate proxy or frontend service.

1. Push this repository to GitHub. 2. In Render, choose **New → Blueprint** and select the repository. 3. Confirm the generated `SECRET_KEY` and `JWT_SECRET_KEY` values, then deploy. 4. Set `AI_PROVIDER` to `gemini` and add `GEMINI_API_KEY` in the Render service environment if you want hosted model responses. The default `mock` provider keeps the deployment usable without an external AI key.

The Blueprint uses a small persistent disk for the SQLite prototype database. For production or multiple instances, use a managed PostgreSQL database and set `DATABASE_URL` to its connection string. Replace `CORS_ORIGINS=*` with the exact public origin if the frontend is later split into a separate service.

Demo accounts

| Role | Username | Login code | Password | |---|---|---|---| | Admin | admin | ADMINCODE1 | admin123 | | HR | hr_jane | HRCODE0001 | hr123 | | Intern | intern_bob | INTCODE001 | intern123 | | Data Engineer | de_arjun | DENGCODE01 | dataeng123 | | Data Analyst | da_meera | DANACODE01 | analyst123 |

Demo credentials are for local use only. Create further roles (Manager, Software Engineer, Supervisor, Guest…) in **Admin → User Access**.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 123 lines
  1. # SecureAI — AI Governance & Accountability Platform
  2. **Make AI use role-aware, policy-checked, auditable and accountable.** SecureAI sits between employees and AI assistants: every request is authorized by role, evaluated by a transparent rule engine, grounded in company policy, scored for cumulative risk, and recorded in a tamper-evident audit trail. Consequential decisions always stay with a human administrator. Governance data is also exposed to AI clients and incident tools through the Model Context Protocol (MCP). MCA final-year capstone.
  3. > Built on top of the open-source *SentinelSystem* codebase (governed chat, work management, attendance, messaging). This project adds the governance core: permissions, rule-based compliance, risk scoring, cumulative escalation, governance cases, alerts, audit, policy management, and the employee/admin dashboards.
  4. ## Problem
  5. Organizations have employees with different roles and permissions, but general-purpose AI doesn't know those boundaries. An employee can ask it for data their role can't access, use it against policy, or repeatedly attempt risky things — and nobody is accountable.
  6. ## What SecureAI does
  7. 1. **Role-Based Access Control** — permission catalog; enforced on the server.
  8. 2. **Governance assistant** — every answer carries decision (ALLOWED / WARNING / RESTRICTED), risk, explanation, recommended action, and policy evidence.
  9. 3. **Transparent rule-based risk engine** (not ML) with admin-configurable weights/thresholds.
  10. 4. **Cumulative risk → governance case → human decision** (warn / restrict / restore / escalate / resolve). Nothing is auto-terminated.
  11. 5. **Real-time alerts** (Socket.IO), **audit log** of everything (AI requests, logins, admin actions, config/policy changes), **security events**.
  12. 6. **Policy-grounded chatbot** — retrieves active company policy passages and uses a configured LLM to answer with source references, scoped to the signed-in user's role.
  13. 7. Supporting modules: face-recognition attendance, Kanban tasks, KPI/workload, private messaging, Ghost Mode (honeypot simulation plus database-backed interactive investigations of real suspicious users, driven by contextual threat detection) and Attack Simulation (safe, labelled simulation).
  14. **Principles:** RBAC authorizes · the rule engine decides · policy documents provide evidence · the LLM explains · audit records · humans decide consequences.
  15. ## MCP integration
  16. SecureAI uses the [Model Context Protocol](https://modelcontextprotocol.io) in both directions:
  17. | Direction | What it does | Docs |
  18. |---|---|---|
  19. | **MCP server** (`python -m app.mcp_server`) | Lets Claude Desktop, Claude Code and other MCP clients query governance data (risk events, cases, audit log, policy search) with the same RBAC as the web API. Token-authenticated, deny-by-default per-tool permissions, every call audited, no raw prompts or personal data returned. | [docs/MCP_SERVER.md](docs/MCP_SERVER.md) |
  20. | **MCP client** (incident response) | On a high-risk request or a new governance case, can open a GitHub issue and post to Slack. Off by default; `dry_run` mode previews every call without sending. Payloads carry rule names and scores only, never prompt text. | [docs/MCP_INCIDENT_RESPONSE.md](docs/MCP_INCIDENT_RESPONSE.md) |
  21. ## Tech stack
  22. Backend: Python, Flask, Flask-SQLAlchemy, Flask-JWT-Extended, Flask-SocketIO · Frontend: React, Vite, Tailwind, Framer Motion, Recharts · DB: SQLite · AI/RAG: sentence-transformers, Qdrant, and a configured Ollama, Gemini, or OpenAI LLM · Vision: OpenCV (YuNet/Haar detection + LBPH embeddings) · Tests: pytest · CI: GitHub Actions.
  23. ## Quick start
  24. Requires Python 3.11+ and Node 18+.
  25. ```bash
  26. ./setup.sh # venv, core deps, npm install, backend/.env with random secrets
  27. ./run.sh # backend :5001 + frontend :3000
  28. ```
  29. Open **http://localhost:3000** and use the one-click demo logins (below). Manual:
  30. ```bash
  31. cd backend && python -m venv venv && source venv/bin/activate # Windows: venv\Scripts\activate
  32. pip install -r requirements.txt
  33. cp .env.example .env # then set SECRET_KEY / JWT_SECRET_KEY (setup.sh does this for you)
  34. python app.py # http://localhost:5001
  35. cd frontend && npm install && npm run dev # http://localhost:3000
  36. ```
  37. Docker: `docker compose up --build` (frontend on :3000).
  38. ### Deploy on Render
  39. This repository includes a Render Blueprint in [`render.yaml`](render.yaml).
  40. It deploys the frontend and backend as one same-origin Docker web service, so
  41. API requests and Socket.IO do not need a separate proxy or frontend service.
  42. 1. Push this repository to GitHub.
  43. 2. In Render, choose **New → Blueprint** and select the repository.
  44. 3. Confirm the generated `SECRET_KEY` and `JWT_SECRET_KEY` values, then deploy.
  45. 4. Set `AI_PROVIDER` to `gemini` and add `GEMINI_API_KEY` in the Render
  46. service environment if you want hosted model responses. The default
  47. `mock` provider keeps the deployment usable without an external AI key.
  48. The Blueprint uses a small persistent disk for the SQLite prototype database.
  49. For production or multiple instances, use a managed PostgreSQL database and
  50. set `DATABASE_URL` to its connection string. Replace `CORS_ORIGINS=*` with the
  51. exact public origin if the frontend is later split into a separate service.
  52. ### Demo accounts
  53. | Role | Username | Login code | Password |
  54. |---|---|---|---|
  55. | Admin | admin | ADMINCODE1 | admin123 |
  56. | HR | hr_jane | HRCODE0001 | hr123 |
  57. | Intern | intern_bob | INTCODE001 | intern123 |
  58. | Data Engineer | de_arjun | DENGCODE01 | dataeng123 |
  59. | Data Analyst | da_meera | DANACODE01 | analyst123 |
  60. Demo credentials are for local use only. Create further roles (Manager, Software Engineer, Supervisor, Guest…) in **Admin → User Access**.
  61. ## Enable policy chat (RAG + LLM)
  62. The chat requires a built policy index and a working LLM provider. From `backend/`:
  63. ```bash
  64. source venv/bin/activate # Windows: venv\Scripts\activate
  65. pip install -r requirements-rag.txt
  66. ```
  67. Configure `AI_PROVIDER` in `backend/.env` as `gemini`, `openai`, or `ollama`, then set the matching API key (`GEMINI_API_KEY` or `OPENAI_API_KEY`) or install Ollama and pull a model (`ollama pull gemma3:4b`). Build the index against the same database used by the running app:
  68. ```bash
  69. python scripts/ingest_policies.py
  70. ```
  71. Restart the backend. The chatbot status shows whether the LLM and policy retrieval are ready. If either service is unavailable it says so instead of answering.
  72. ## Optional feature packs
  73. | Pack | Install | Enables |
  74. |---|---|---|
  75. | RAG | Included in the policy chat setup above | Policy retrieval, ingestion, re-index, RAG evaluation |
  76. | Face recognition | `pip install -r requirements-face.txt` | Real face enrollment/verification. `dlib` can be hard to build on Windows — see the file's header for the conda route |
  77. | Local LLM | install [Ollama](https://ollama.com), `ollama pull gemma3:4b`, set `AI_PROVIDER=ollama` | Local Gemma-4B answers for the policy chatbot |
  78. ## Environment variables
  79. All documented in `backend/.env.example` (every variable there is actually read by the code): `SECRET_KEY`, `JWT_SECRET_KEY`, `JWT_ACCESS_TOKEN_EXPIRES_HOURS`, `CORS_ORIGINS` (**must include the origin you open the app from** — Socket.IO enforces it), `DATABASE_URL`, `PORT`, `DEBUG` (keep `0`), `AI_PROVIDER` + provider keys.
  80. ## Database, tests, evaluation
  81. - Schema: `docs/DATABASE_SCHEMA.md` (26 tables, SQLite, auto-created and auto-seeded at startup).
  82. - Tests: `cd backend && python -m pytest -v` → see `docs/TESTING.md` (**read the verification-status section**).
  83. - Risk-engine evaluation: `python scripts/evaluate_risk_engine.py` (run: 80 % decision / 86.7 % risk accuracy on 15 scenarios, with the 3 mismatches explained). RAG evaluation harness is included but **not yet run**.
  84. ## Documentation
  85. `docs/features/` (per-feature docs: tech stack, how it works, API, data, security) · `docs/ARCHITECTURE.md` · `docs/API_DOCUMENTATION.md` (generated, 113 endpoints) · `docs/DATABASE_SCHEMA.md` (generated) · `docs/RISK_ENGINE.md` · `docs/RAG_PIPELINE.md` · `docs/TESTING.md` · `docs/DEMO_GUIDE.md` (6 demo workflows) · `docs/build-notes/` (phase-by-phase engineering log incl. decisions and findings) · `docs/legacy/` (superseded pre-capstone docs). Regenerate the generated docs with `python backend/scripts/generate_docs.py`.
  86. ## Honest limitations
  87. - The original author's environment had no network, so the suite was not run end-to-end at first delivery. It has since been run: **151/151 backend tests pass** (including 32 Ghost Mode investigation tests), `npm run build` succeeds, and the app was exercised live (HTTP + Socket.IO). Live LLM/RAG answers still need a configured provider and an ingested index; see `docs/TESTING.md`.
  88. - The rule engine has known coverage gaps (e.g. "personal addresses" phrasing isn't caught as PII; single keyword hits move the score little) — documented with evidence in `docs/RISK_ENGINE.md`.
  89. - The policy chatbot only knows the documents present in the indexed corpus. Add approved company policies through the policy management workflow and re-index them.
  90. - Face recognition accuracy has not been tested with a real camera.
  91. - SQLite, in-memory login rate limiter, single-process Socket.IO — fine for a prototype, not for production scale. No migration framework.
  92. - Attack Simulation and the Ghost Mode honeypot are simulations with dummy data only. Ghost Mode interactive investigations act on real accounts (admin-only, confirmed, audited, isolated decoy); see `docs/features/12-ghost-mode.md`.
  93. ## Future scope
  94. Broaden/learn detection rules and add a labelled dataset; priority field on tasks; Redis-backed rate limiting and Socket.IO scaling; Postgres + Alembic; SSO; per-department policy sets.
  95. # SentinelSystem-using-RAG

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.