{"id":"d673ad1f-2e03-4d43-a64e-0fcd7774da07","slug":"mitra","kind":"mcp","name":"mitra","summary":"Mental Health App - Google X Kaggle Vibe Coding Capstone Project","owner":"sbsuba","repoUrl":"https://github.com/sbsuba/mitra","license":"MIT","licenseTier":"permissive","trust":"community","stars":1,"match":null,"fewStars":true,"format":"mcp","createdAt":"2026-07-04T13:13:15.000Z","addedAt":"2026-10-21T09:16:06.818Z","logoUrl":"https://avatars.githubusercontent.com/u/28937131?u=5754e9d64383583a1725650f683b60ba280e17e6&v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["utilities"],"tags":["agents-for-good","ai-agents","google-adk","kaggle","mental-health"],"runtime":"binary","local":true,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-23T03:55:02.045Z","sample":false,"url":"https://conduits.dev/tools/mitra","language":"Python","transports":["stdio"],"install":{},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# Mitra — Global Mental Health Early Warning Agent\n\n> *\"The friend who notices — before you do.\"*\n\n[![Kaggle](https://img.shields.io/badge/Kaggle-Agents%20for%20Good-blue)](https://kaggle.com)\n[![Track](https://img.shields.io/badge/Track-Agents%20for%20Good-green)](https://kaggle.com)\n[![Tests](https://img.shields.io/badge/Tests-24%20passing-success)](https://github.com/sbsuba/mitra)\n\n## The Problem\n\nOver 1 billion people globally live with a mental health condition.\n75%+ in low-income countries receive zero treatment.\nThe average delay between symptom onset and treatment is 5-30 years.\n\n**The core insight:** Behavioral health deterioration is rarely sudden.\nEarly warning signals — disrupted sleep, low energy, social withdrawal,\nlow mood — exist in daily life weeks before crisis. But nobody is\nwatching for them.\n\n## The Solution\n\nMitra (Sanskrit/Persian for \"friend\") is a proactive AI agent that:\n- Tracks 4 daily behavioral signals: sleep, energy, social connection, mood\n- Detects early warning patterns across 7 days — not just today\n- Catches warning signs before they become crises\n- Connects users to global crisis resources in their language\n- Works globally, in any language, free for everyone\n\n## Architecture Diagram\n┌─────────────────────────────────────────────────────┐\n│                      USER                           │\n│            Daily check-in (4 signals)               │\n│     sleep · energy · social connection · mood       │\n└─────────────────────────┬───────────────────────────┘\n│\n▼\n┌─────────────────────────────────────────────────────┐\n│              ANTIGRAVITY CLI (agy)                  │\n│                   Orchestrator                      │\n│          Reads AGENTS.md + 4 Agent Skills           │\n│         google-developer-knowledge MCP              │\n└──────┬──────────┬──────────┬──────────┬─────────────┘\n│ A2A      │ A2A      │ A2A      │ A2A\n▼          ▼          ▼          ▼\n┌──────────┐ ┌──────────┐ ┌──────────┐ ┌────────────┐\n│ Check-in │ │  Risk    │ │ Selfcare │ │  Crisis    │\n│  Agent   │ │ Scoring  │ │  Agent   │ │ Escalation │\n│ Level 1  │ │ Level 3  │ │ Level 2  │ │  Level 4   │\n│ Basic    │ │ Few-shot │ │  Asset   │ │Procedural  │\n│ Router   │ │ Examples │ │  Util.   │ │   Logic    │\n└──────────┘ └──────────┘ └──────────┘ └────────────┘\n│\nMCP stdio transport\n│\n┌───────────────┴───────────────┐\n▼                               ▼\n┌─────────────────┐             ┌─────────────────────┐\n│  signal_store   │             │    who_resources     │\n│   MCP Server    │             │     MCP Server       │\n│                 │             │                      │\n│ SQLite          │             │ Crisis lines by      │\n│ 30-day history  │             │ country + language   │\n│ per user        │             │ 8 countries + global │\n└─────────────────┘             └─────────────────────┘\nRisk Routing (pure Python — no LLM for speed + reliability):\nScore  0-25  → auto_recommend    (no LLM — fast, free, always on)\nScore 26-55  → llm_analysis      (warm explanation via Gemini)\nScore 56-100 → crisis_escalation (human confirm → WHO resources)\nSecurity (3-layer defence in depth):\nLayer 1 — Code:    Semgrep pre-commit hooks block secrets\nLayer 2 — Runtime: Agent PreToolUse hooks validate commands\nLayer 3 — Data:    sanitise_input() blocks injection before LLM\n\n## Why This Architecture Is Different\n\n| Decision | Why it matters |\n|---|---|\n| No LLM for score 0-25 | Faster, cheaper, more reliable. AI only where it adds value |\n| 4 different skill levels | Each skill uses the right Day 3 codelab pattern for its job |\n| 2 MCP servers | signal_store (history) + who_resources (crisis lines) |\n| 3-layer security | Defence in depth — no single point of failure |\n| Longitudinal 7-day scoring | Patterns not snapshots — what no competitor does |\n\n## Risk Scoring Pipeline\nSignal weights (clinically validated):\nsleep:  poor=30, fair=15, good=0\nenergy: low=25,  fair=10, high=0\nsocial: no=25,   brief=12, yes=0\nmood:   low=20,  neutral=8, good=0\nScore ranges:\n0-25:   Low risk  → auto_recommend (no LLM)\n26-55:  Watch     → LLM warm analysis\n56-100: High risk → crisis escalation + human confirm\n\n## Course Concepts Used\n\n| Concept | Where | Day |\n|---|---|---|\n| ADK Multi-agent | app/agent.py — 4 specialist nodes | Day 4 |\n| MCP Server | mcp_servers/ — signal_store + who_resources | Day 2 |\n| Antigravity | agy orchestrates everything | Day 3 |\n| Security | STRIDE + Semgrep + hooks + sanitisation | Day 4 |\n| Agent Skills | 4 domain skills following 4 codelab levels | Day 3 |\n| Deployability | FastAPI ambient + mcp_config.json | Day 5 |\n| Spec-driven | specs/mitra_spec.md + bdd_scenarios.md | Day 5 |\n\n## Setup\n\n```bash\n# 1. Clone\ngit clone https://github.com/sbsuba/mitra\ncd mitra\n\n# 2. Install core dependencies (Python 3.8+)\npython3 -m pip install pytest python-dotenv\n\n# 3. Run tests immediately — no API key needed\npython3 -m pytest tests/unit/ -v\n# Expected: 24 passed\n\n# 4. Configure API key for full agent\necho \"GEMINI_API_KEY=your_key_here\" > .env\n# Get free key at: aistudio.google.com\n\n# 5. Install ADK dependencies (requires Python 3.11+)\npip install \".[adk]\"\n\n# 6. Start local server\nuvicorn app.fast_api_app:app --port 8080 --reload\n\n# 7. Test check-in API\ncurl -X POST http://localhost:8080/checkin \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"user_id\": \"test_user\",\n    \"signals\": {\n      \"sleep\": \"poor\",\n      \"energy\": \"low\",\n      \"social\": \"no\",\n      \"mood\": \"low\"\n    },\n    \"language\": \"en\",\n    \"country\": \"US\"\n  }'\n```\n\n## Project Structure\nmitra/\n├── AGENTS.md                    ← Agent constitution + security rules\n├── app/\n│   ├── agent.py                 ← ADK 2.0 graph workflow\n│   ├── config.py                ← Risk thresholds + signal weights\n│   ├── core.py                  ← Pure Python logic (testable)\n│   └── fast_api_app.py          ← Ambient FastAPI service\n├── .agents/\n│   ├── CONTEXT.md               ← TDD planning gate\n│   ├── hooks.json               ← PreToolUse security hook\n│   └── skills/\n│       ├── daily_checkin/       ← Level 1: Basic Router\n│       ├── risk_scoring/        ← Level 3: Few-shot Examples\n│       ├── selfcare_recommendations/ ← Level 2: Asset Utilization\n│       ├── crisis_escalation/   ← Level 4: Procedural Logic\n│       └── stride-threat-model/ ← STRIDE security assessment\n├── mcp_servers/\n│   ├── signal_store.py          ← SQLite 30-day history MCP\n│   └── who_resources.py         ← WHO crisis lines MCP\n├── specs/\n│   ├── mitra_spec.md            ← Technical specification\n│   └── bdd_scenarios.md         ← BDD test scenarios\n├── tests/\n│   ├── unit/\n│   │   ├── test_risk_scoring.py      ← 9 tests\n│   │   ├── test_crisis_escalation.py ← 8 tests\n│   │   └── test_security.py          ← 7 tests\n│   └── eval/\n│       ├── datasets/basic-dataset.json\n│       └── eval_config.yaml\n└── data/\n└── synthetic_signals.csv    ← 42-row demo dataset\n\n## Security\n\n- Input sanitisation before any LLM call\n- Prompt injection detection and blocking\n- Pre-commit Semgrep hooks (blocks hardcoded API keys)\n- Agent PreToolUse hooks (validates every command)\n- STRIDE threat model documented in threat_model.md\n- No user data stored externally — SQLite local only\n- Disclaimer on all crisis responses\n- JIT tokens — no ambient authority\n\n## Why Mitra is Different\n\n| Existing Apps | Mitra |\n|---|---|\n| Reactive — you go to them | Proactive — notices patterns before you do |\n| Single demographic | All ages (12+), all regions |\n| Paywalled premium features | Free globally |\n| Conversation/chatbot only | Signal detection pipeline (Ascend-style) |\n| US/UK centric | Designed for the 75% with no access globally |\n| Today only | 7-day longitudinal pattern detection |\n\n## Live Demo\n\nTry Mitra: https://sbsuba.github.io/mitra\n\n## Disclaimer\n\nMitra is an awareness tool, not a clinical service.\nThis is not medical advice. Please consult a qualified\nprofessional for clinical mental health support.\n\nIf you are in crisis right now:\n- US: Call or text 988\n- UK: 116 123 (Samaritans)\n- India: 9152987821 (iCall)\n- Global: https://www.iasp.info/resources/Crisis_Centres/\n\n## License\n\nMIT — Copyright 2026 sbsuba\n\nSee [LICENSE](LICENSE) for full details.\n"}