SEBI Compliance MCP System
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@SEBI Compliance MCP SystemCheck compliance of my research note on Reliance"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
š”ļø SEBI Compliance MCP System (Working End-to-End Demo)
A deterministic regulatory compliance evaluation system built for SEBI (Research Analyst) Regulations, 2014.
This project exposes regulatory compliance rules as Model Context Protocol (MCP) tools served by a FastMCP (streamable-http) server. The rules are queried deterministically from a structured JSON file (data/rules.json) without any database, RAG pipeline, or vector store. A LangGraph React Agent powered by Groq (ChatGroq) acts as the MCP client, orchestrating tool calls based on natural language queries and returning verifiable, deterministic audit trails.
šļø Architecture & Core Principles
+-------------------------------------------------------------------------------+
| Streamlit Frontend (Port 8501) |
| - Chat Interface & Expandable Deterministic Tool Audit Trails |
| - Preset Scenario Buttons for One-Click Live Demos |
+-------------------------------------------------------------------------------+
|
POST /chat (JSON)
v
+-------------------------------------------------------------------------------+
| FastAPI Backend (Port 8001) |
| - MultiServerMCPClient (langchain-mcp-adapters) |
| - LangGraph React Agent (langgraph.prebuilt.create_react_agent) |
| - Groq LLM (ChatGroq) orchestration & tool selection logic |
+-------------------------------------------------------------------------------+
|
MCP Streamable HTTP Transport (Port 8000)
v
+-------------------------------------------------------------------------------+
| FastMCP Server (`mcp_server/server.py`) |
| - Tools: check_compliance, get_applicable_rules, get_audit_log |
| - Deterministic evaluation using safe operator map (NO eval()) |
+-------------------------------------------------------------------------------+
/ \
Reads Rules / \ Writes Audit Log
v v
+------------------------+ +---------------------------+
| data/rules.json | | audit/audit_log.json |
| (14 Verified Rules) | | (Persistent Log Array) |
+------------------------+ +---------------------------+šÆ Why Deterministic MCP?
Compliance verdicts (pass, fail, needs_review) must come exclusively from deterministic code evaluating structured JSON rules ā NEVER from an LLM judging raw text or hallucinating regulatory limits.
The LLM's only job is:
Deciding which MCP tool(s) to call based on the user's natural-language question (
check_compliance,get_applicable_rules,get_audit_log).Turning the structured tool output into a readable response while citing exact SEBI regulations and displaying the unique
audit_id.
No
eval(): Numeric and boolean rule conditions are evaluated strictly via safe operator mappings (operator.ge,operator.le,operator.eq,operator.contains).Qualitative Rules: Clauses that require human judgment or documentary verification (e.g. conflict of interest policies or research rationale reasonableness) use
operator: "manual_review"and deterministically outputneeds_review.
Related MCP server: @run-iq/mcp-server
š Project Structure
sebi-compliance-mcp/
āāā .env.example # Example environment configuration
āāā .env # Local environment variables (GROQ_API_KEY)
āāā requirements.txt # Pinned Python package dependencies
āāā README.md # Project documentation & run guide
āāā data/
ā āāā rules.json # 14 hand-authored SEBI Research Analyst rules
āāā mcp_server/
ā āāā server.py # FastMCP server exposing compliance evaluation tools
āāā backend/
ā āāā app.py # FastAPI backend + LangGraph React Agent + MCP Client
āāā frontend/
ā āāā streamlit_app.py # Streamlit interactive chat UI
āāā audit/
āāā audit_log.json # Persistent JSON audit log (generated at runtime)š Setup & Installation
1. Prerequisites
Python 3.11+ installed locally.
A Groq API Key (
GROQ_API_KEY). You can get one for free at console.groq.com.
2. Create Virtual Environment & Install Dependencies
# Create and activate virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt3. Configure Environment Variables
Copy .env.example to .env and add your Groq API key:
cp .env.example .envIn .env:
GROQ_API_KEY=your_actual_groq_api_key_here
GROQ_MODEL=llama-3.3-70b-versatileā¶ļø Running the System (Exact Run Order)
The FastMCP server (server.py) MUST be running BEFORE the FastAPI backend starts, because the backend MultiServerMCPClient connects and fetches available tools from the server during startup.
Open three separate terminal windows/tabs (make sure your virtual environment venv is activated in all three):
Terminal 1: Start FastMCP Server (Port 8000)
python mcp_server/server.pyYou should see output indicating the server is running on http://0.0.0.0:8000 (streamable-http).
Terminal 2: Start FastAPI Backend (Port 8001)
uvicorn backend.app:app --reload --port 8001On startup, the backend connects to http://localhost:8000/mcp, initializes the MultiServerMCPClient, and registers tools with the LangGraph React Agent.
Terminal 3: Start Streamlit Frontend (Port 8501)
streamlit run frontend/streamlit_app.pyYour browser will automatically open at http://localhost:8501 showing the interactive chat UI.
š ļø MCP Tools Reference (mcp_server/server.py)
check_compliance(entity_type: str, scenario: dict) -> dictLoads rules matching
entity_type(individual_RA,partnership_RA,non_individual_RA).Evaluates each scenario attribute against
rules.json.Computes
overall_status:"fail"if any rule failed, else"needs_review"if any rule requires manual verification or scenario fields are missing, else"pass".Generates a unique
audit_id(e.g.q-2026-07-12T15:30:00Z-a1b2c3) and saves the exact execution record toaudit/audit_log.json.
get_applicable_rules(entity_type: str) -> listReturns all verified SEBI rules and regulatory citations applicable to the specified entity type without evaluating a scenario.
get_audit_log(audit_id: str) -> dictRetrieves the persistent log entry from
audit/audit_log.jsonby its uniqueaudit_id.
š Rule Schema (data/rules.json)
Each rule adheres strictly to the following schema:
{
"rule_id": "SEBI-RA-2014-3.2-a",
"regulation": "SEBI (Research Analysts) Regulations, 2014",
"clause_ref": "Regulation 3(2)(a)",
"entity_type": "individual_RA",
"condition_type": "net_worth_min",
"operator": ">=",
"value": 100000,
"unit": "INR",
"effective_date": "2014-09-01",
"effective_until": null,
"source_citation": "SEBI (Research Analysts) Regulations, 2014, Reg 3(2)(a)",
"status": "verified"
}Covered Conditions & Operators
Numeric Limits:
net_worth_min,experience_years_min,trading_window_lockin_days_before/after,record_keeping_years_min,holding_in_subject_company_max_pct(>=,<=,==)Categorical & Set Matches:
qualification_req(inarray of allowed qualifications)Boolean Requirements:
nism_certification_active,compliance_officer_appointed,compensation_from_merchant_banking(==)Qualitative Standards (
operator: "manual_review"):conflict_of_interest_policy_quality,research_rationale_basis_adequacy(returnsneeds_reviewwith regulatory targets)
š” Example Demo Queries
Try these out in the Streamlit UI or by clicking the preset sidebar buttons:
Individual RA (Should Fail):
"Check compliance for an individual_RA with net_worth_min of 80000 INR, qualification_req of post_graduate_degree, nism_certification_active true, experience_years_min of 5, trading_window_lockin_days_before 30, trading_window_lockin_days_after 5, compensation_from_merchant_banking false, holding_in_subject_company_max_pct 0.5, and record_keeping_years_min 5."
Non-Individual RA (Should Pass / Review):
"Verify compliance for a non_individual_RA with net_worth_min 3000000, compliance_officer_appointed true, record_keeping_years_min 6, conflict_of_interest_policy_quality documented_and_effectively_enforced, and compensation_from_merchant_banking false."
Missing Information (Should Trigger Clarification / Needs Review):
"Check compliance for an individual RA with ā¹200,000 net worth."
This server cannot be deployed
Maintenance
Related MCP Connectors
A paid remote MCP for Equibles, built to return verdicts, receipts, usage logs, and audit-ready JSON
EU compliance corpus across 8 frameworks (NIS2, DORA, AI Act, ISO 27001 + more) via MCP.
AI governance MCP server for EU AI Act compliance and jurisdiction verification
City hiring-compliance MCP server with regulation search and full audit risk scoring.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA production-grade MCP server that automates financial compliance audits by combining LLMs with structured analysis, enabling policy validation, risk profiling, and automated reporting.-

@run-iq/mcp-serverofficial
AlicenseNot gradedqualityDmaintenanceMCP server exposing a parametric policy engine for evaluating, simulating, and managing rules, with dynamic plugin support for domain-specific calculations.23 npm1MIT- AlicenseNot gradedqualityDmaintenanceAn MCP server that gives Claude searchable, cited access to RBI and SEBI regulatory documents ā circulars, master directions, notifications, and regulations.34 npm2MIT
- AlicenseAqualityDmaintenanceMCP server for querying compliance regulations including GDPR, EU AI Act, and CCPA through natural language questions, keyword search, and compliance checks.619 npmMIT