Citizen MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
๐๏ธ SewaSetu AI
Autonomous Agentic Public Welfare & Pension Infrastructure
๐ Table of Contents
Related MCP server: Works With Agents MCP Server
๐ก Overview
Public distribution systems and state welfare pensions often present severe hurdles for the vulnerable and elderly: opaque application queues, complex documentation requirements, and inflexible bureaucratic portals.
SewaSetu AI solves this by establishing an agent-ready civic bridge:
Citizens interact seamlessly with an AI Assistant powered by specialized Model Context Protocol (MCP) tools that check eligibility, lodge verified pension claims, track progress, generate certified receipts, and submit grievances.
Administrative Officers supervise the scheme with high-assurance tools to review backlogs, inspect uploaded credentials, approve or reject applications with auditable notes, and manage block queues.
Strict Privilege Segregation: Citizen agents are physically prevented from ever viewing or invoking officer-scoped administrative tools. Authorization boundaries are enforced at the protocol and cryptographic layers via OAuth 2.1 and RS256 token verification.
๐๏ธ System Architecture
flowchart TD
subgraph Citizens["Citizen & Public Domain"]
C1["Senior Citizen / Applicant"]
C2["Citizen AI Agent (Claude / Assistant)"]
C3["Web Browser (Senior Accessibility UI)"]
end
subgraph Officers["Administrative Domain"]
O1["Block Welfare Officer"]
O2["Administrative AI Agent"]
O3["Departmental Admin Portal"]
end
subgraph Gateway["Edge & Security Layer (Caddy / Reverse Proxy)"]
D1["RFC 8414 Authorization Discovery<br>/.well-known/oauth-authorization-server"]
D2["RFC 9728 Protected Resource Metadata<br>/.well-known/oauth-protected-resource"]
JWKS["JWKS Public Key Set<br>/.well-known/jwks.json"]
end
subgraph MCPServers["Model Context Protocol Core"]
MCP_C["Citizen MCP Server<br>(/mcp/citizen)<br>Scope: citizen | 10 Tools"]
MCP_O["Officer MCP Server<br>(/mcp/officer)<br>Scope: officer | 10 Tools"]
end
subgraph CoreBackend["Application & Persistence"]
APP["Flask Web Application Core<br>(State Machine, PDF Engine, OTP Engine)"]
DB[("PostgreSQL 15 Database<br>(100k Seed Records, Audit Ledger)")]
SCHED["RTPS Nightly Scheduler<br>(Statutory 15-Day Deemed Approval)"]
SMS["Simulated SMS Gateway<br>(/__gateway/)"]
end
C1 --> C3
C2 -->|Streamable HTTP / SSE| MCP_C
C3 --> APP
O1 --> O3
O2 -->|Streamable HTTP / SSE| MCP_O
O3 --> APP
MCP_C -->|OAuth 2.1 Token Validation| JWKS
MCP_O -->|RS256 Bearer Check| JWKS
MCP_C --> APP
MCP_O --> APP
APP --> DB
APP --> SMS
SCHED --> DB
SCHED --> SMS๐ Key Innovations & Technical Pillars
1. Physical MCP Separation
Citizen Endpoint (
/mcp/citizen): Exposes applicant-scoped tools (get_scheme_information,check_eligibility,get_my_application_status,submit_application,withdraw_application,download_acknowledgment,submit_grievance,list_schemes,get_required_documents). A citizen's assistant never receives officer tools in its schema.Block Officer Endpoint (
/mcp/officer): Exposes departmental administrative tools (get_officer_dashboard,list_pending_applications,get_application_details,approve_application,reject_application,search_applications,verify_documents,get_application_queue,get_welfare_analytics,update_application_status).Cryptographic Access Control: Validates RS256 Bearer tokens against the server's public JWKS. Cross-role invocations immediately fail with
403 Forbidden(insufficient_scope).
2. Enterprise OAuth 2.1 & RFC 9728 Discovery
RFC 8414 Authorization Server Discovery:
/.well-known/oauth-authorization-serverRFC 9728 Protected Resource Metadata:
/.well-known/oauth-protected-resourceRFC 8707 Resource Indicators: Tokens carry
audmatching the canonical URL and explicit scopes (citizenorofficer).RFC 7009 Token Revocation:
/oauth/revokeSession Caps: Hard session limit (2h for citizens on public kiosks; 8h for administrative officers) with rotating refresh tokens that never exceed the master session ceiling.
3. Persona-Driven PostgreSQL Invariant Evaluations
Unlike fragile synthetic LLM-as-a-judge scoring, SewaSetu AI features a rigorous invariant evaluation suite accessible at /eval-dashboard. It executes multi-turn dialogues across 7 authentic personas and verifies post-condition assertions directly against PostgreSQL:
Persona | Scenario | Invariant Asserted in Database |
1. Rameswar Barman (64) | Valid first-time pension application | Record created in DB with status |
2. Minati Das (58) | Underage applicant attempt | 60-year statutory threshold enforces rejection; zero database records created. |
3. Bhaben Kalita (68) | Duplicate application attempt | Detects existing pending record; duplicate blocked; single active record maintained. |
4. Anowara Khatun (66) | Re-application after voluntary withdrawal | State transitions from |
5. Prabhat Sarma (72) & Officer | End-to-end multi-agent workflow | Applicant submits; Block Officer reviews and transitions state to |
6. Tarun Gogoi (65) & Officer | Officer rejection with audit trail | Application rejected with mandatory justification; applicant is unblocked for re-filing. |
7. Statutory RTPS SLA | Automatic Deemed Approval Engine | Applications pending beyond 15-day SLA transition automatically to |
4. Senior-First Accessible Web Portal
Accessibility Toolbar: On-screen quick toggles for font scaling (
A- / A / A+) and High Contrast Dark Mode with preference persistence vialocalStorage.Keyboard & Screen Reader Navigable: Semantic HTML, ARIA attributes, skip links, and zero focus trapping.
Multilingual Ready: Clean layouts accommodating Assamese, Hindi, and English scripts.
5. Statutory SLA & RTPS Deemed Approval Engine
Enforces the Right to Public Services (RTPS) 15-day statutory turnaround.
Nightly background scheduler identifies overdue applications and transitions them to
DEEMED_APPROVEDbyRTPS-AUTOwith instant beneficiary SMS dispatch.
๐ Interactive Endpoints Directory
Category | Endpoint | Method / Protocol | Description | Auth Required |
Portal |
| HTTP | Public Portal Homepage with live scheme highlights | None |
Portal |
| HTTP | Citizen Application Status Lookup (Mobile + DoB DDMMYYYY) | None |
Assistant |
| HTTP | In-browser Citizen AI Assistant with database grounding | None |
Officer |
| HTTP | Block Welfare Officer Dashboard and Application Queue | Session ( |
Tokens |
| HTTP | Programmatic OAuth Token Minting for Officer Agents | Session ( |
Evaluations |
| HTTP | Live Persona Invariant Evaluation Runner & Dashboard | None |
MCP |
| Streamable HTTP / SSE | Citizen Model Context Protocol Server (10 tools) | Bearer ( |
MCP |
| Streamable HTTP / SSE | Block Officer Model Context Protocol Server (10 tools) | Bearer ( |
Discovery |
| HTTP | RFC 8414 Authorization Server Metadata | None |
Discovery |
| HTTP | RFC 9728 Protected Resource Metadata | None |
Discovery |
| HTTP | RS256 JWKS Public Key Set | None |
SMS |
| HTTP | Simulated SMS Gateway Console & Real-time Inbox | None |
Ops |
| HTTP | Operational Health Check (DB, Disk, Scheduler) | None |
๐ ๏ธ MCP Toolsets Reference
get_scheme_information: Retrieve statutory rules, pension amounts, eligibility criteria, and required documents.check_eligibility: Pre-screen applicant age, block residence, and bank eligibility.get_my_application_status: Track live application status by Application ID or Mobile + DoB.submit_application: Lodge a formal pension application with automated validation.withdraw_application: Voluntarily cancel a pending application to permit re-application.download_acknowledgment: Retrieve official certified PDF acknowledgment with digital seal.submit_grievance: File an RTPS grievance regarding delayed processing or officer rejection.list_schemes: Alias for scheme discovery across departments.get_required_documents: Detailed document checklist for proof of age and bank account.get_block_list: List eligible administrative blocks in the jurisdiction.
get_officer_dashboard: Summarize pending, approved, deemed approved, and overdue applications.list_pending_applications: Retrieve priority queue sorted by submission date and SLA urgency.get_application_details: Deep inspection of applicant records, age proofs, and bank details.approve_application: Formally approve an application with mandatory verification remarks.reject_application: Formally reject an application with specific statutory justification.search_applications: Query applications by name, mobile, block, status, or date range.verify_documents: Perform automated checks on uploaded age proofs (Voter ID, Aadhaar, etc.).get_application_queue: Queue inspection with status filtering and pagination.get_welfare_analytics: Comprehensive scheme performance metrics and block-wise distribution.update_application_status: Generic status update wrapper with strict role enforcement.
โก Quick Start & Local Setup
Option A: Launch with Docker Compose (Recommended)
The complete stack includes the Flask web core, PostgreSQL 15 (seeded with 100k demo records), the simulated SMS gateway, and the RTPS scheduler:
# Clone the repository
git clone https://github.com/12636373/harish-sewasetu-ai.git
cd harish-sewasetu-ai
# Start the complete production stack
docker compose up -d --buildAccess the services:
Public Portal: http://localhost:8000
Evaluation Dashboard: http://localhost:8000/eval-dashboard
Departmental Admin: http://localhost:8000/admin (Username:
admin, Password:change-me-before-deploying)SMS Gateway: http://localhost:8000/__gateway/
Option B: Native Python Setup
# Create and activate virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\Activate.ps1
# Install dependencies
pip install -r requirements.txt
# Run with local SQLite fallback (or set POSTGRES_* environment variables)
export USE_SQLITE=1
export SECRET_KEY=development-secret-key
python app/app.py๐ค Connecting Agent Clients
SewaSetu AI is fully compatible with any Model Context Protocol client including Claude Code, Cursor, Windsurf, and autonomous agents.
Claude Code Integration
# Connect to the Citizen MCP Server
claude mcp add sewasetu-citizen --transport http https://<YOUR-DOMAIN>/mcp/citizen
# Connect to the Administrative Officer MCP Server
claude mcp add sewasetu-officer --transport http https://<YOUR-DOMAIN>/mcp/officerCursor / Windsurf Configuration (mcp.json)
{
"mcpServers": {
"sewasetu-citizen": {
"url": "http://localhost:8000/mcp/citizen",
"transport": "http",
"headers": {
"Authorization": "Bearer <YOUR_CITIZEN_TOKEN>"
}
},
"sewasetu-officer": {
"url": "http://localhost:8000/mcp/officer",
"transport": "http",
"headers": {
"Authorization": "Bearer <YOUR_OFFICER_TOKEN>"
}
}
}
}๐งช Test Suites & Quality Verification
SewaSetu AI includes a comprehensive, multi-tiered automated testing framework:
# 1. Run the standalone 8-step independent MCP verification suite
python verify_mcp_independent.py
# 2. Run backend business logic and database state machine tests
pytest tests/test_backend_logic.py -v
# 3. Execute live persona evaluations via CLI
python -c "from app.evals import run_all_evaluations; print(run_all_evaluations())"๐ Directory Structure
harish-sewasetu-ai/
โโโ app/
โ โโโ app.py # Main Flask application & routing
โ โโโ mcp_server.py # Segregated Citizen & Officer MCP servers
โ โโโ evals.py # 7 Persona evaluation framework & invariant runner
โ โโโ schema.sql # PostgreSQL relational schema
โ โโโ scripts/
โ โ โโโ deemed_approval.py # RTPS 15-day statutory deemed approval job
โ โโโ static/ # CSS, JavaScript, and asset files
โ โโโ templates/ # Accessible Jinja2 UI templates
โ โโโ base.html # Layout with accessibility controls (A-/A/A+)
โ โโโ index.html # Scheme home & key metrics
โ โโโ apply.html # Application form
โ โโโ status.html # Public status tracking portal
โ โโโ assistant.html # Grounded Citizen AI Assistant
โ โโโ admin_dashboard.html # Officer triage queue
โ โโโ eval_dashboard.html # Live evaluation dashboard
โโโ seed/
โ โโโ seed.sql # Initial database seed (100k records)
โโโ smsgw/ # Simulated SMS gateway microservice
โโโ tests/
โ โโโ test_backend_logic.py # Unit and integration test suite
โโโ docker-compose.yml # Local multi-service orchestration
โโโ docker-compose.prod.yml # Production deployment compose with Caddy
โโโ Caddyfile # Reverse proxy with automated Let's Encrypt SSL
โโโ verify_mcp_independent.py # Standalone 8-step independent MCP test runner
โโโ wasmer.toml # Wasmer Edge runtime configuration
โโโ app.yaml # Wasmer Edge application manifest
โโโ LICENSE # MIT Open Source License
โโโ README.md # Project documentation๐ Security & Prompt Injection Defenses
SewaSetu AI enforces robust multi-layered defenses:
Separation of Concerns: Citizen assistants have zero access to officer tools in their schema.
Administrative Action Interception: Any prompt attempting to coerce a citizen assistant into approving applications or changing statuses is rejected with an explicit security warning.
Credential Protection: System instructions strictly forbid the disclosure of internal API keys, passwords, database credentials, or private keys.
Statutory Guardrails: Applications cannot be backdated or submitted outside established business and residency criteria.
๐ค Author & License
Designed, architected, and built by Harish.
Released under the MIT License. Contributions, issues, and feature requests are welcome!
This server cannot be deployed
Maintenance
Related MCP Connectors
Secure gift, flower, occasion, reminder, approval, and growth tools for personal AI agents.
Identity verification, document checks, sanctions/PEP screening and case review as agent tools.
Atomadic MCP: 68 deterministic tools for agent identity, escrow, SLA, EU AI Act compliance.
Context and control for any AI. Agent identity, scoped access, and proof across tools.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceExposes identity, tools, workflows, guardrails, and evaluation as MCP tools โ so any AI agent can read and write your ecosystem programmatically.53 npmMIT
- AlicenseAqualityFmaintenanceProvides 14 MCP tools for AI agent infrastructure, enabling knowledge base queries, skill search, handoffs, blueprint validation, trust scoring, identity verification, SLA validation, and compliance checks.22MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI-powered consumer dispute resolution by providing tools for secure evidence storage with confidence scoring, autonomous negotiation, formal dispute notice generation, and consumer rights verification under the Consumer Protection Act.Apache 2.0
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to retrieve customer, order, ticket, policy, and agreement information, and to prepare or execute state-changing support actions like escalations and follow-ups with confirmation and access control.-