Autonomous Operational Reporting Agent with Human-in-the-Loop Safety & MCP Integration
Built on TrueForge for the WeMakeDevs & TrueFoundry Agent Harness Hackathon.
🎥 Watch the 2-Minute Walkthrough: M's Desk Demo Video (replace with your public YouTube/Loom link)
Demonstrates dynamic CSV ingestion, sandboxed Python computation, human-in-the-loop Markdown approval gating, and Slack dispatch with structured audit logging.
graph LR
%% Modern Card Styles
classDef userStyle fill:#1e1e2e,stroke:#cba6f7,stroke-width:2px,color:#cdd6f4;
classDef agentStyle fill:#1e1e2e,stroke:#89b4fa,stroke-width:2px,color:#cdd6f4;
classDef toolStyle fill:#1e1e2e,stroke:#a6e3a1,stroke-width:2px,color:#cdd6f4;
classDef sandboxStyle fill:#1e1e2e,stroke:#fab387,stroke-width:2px,color:#cdd6f4;
classDef gateStyle fill:#1e1e2e,stroke:#f38ba8,stroke-width:2px,color:#cdd6f4;
classDef slackStyle fill:#1e1e2e,stroke:#f9e2af,stroke-width:2px,color:#cdd6f4;
A["👤 User"]:::userStyle -->|"1. Asks for report"| B["🤖 M's Desk Agent"]:::agentStyle
B -->|"2. Requests metrics"| C["🔌 Slack MCP Server"]:::toolStyle
C -->|"3. Reads file"| D[("📊 weekly_metrics.csv")]:::toolStyle
D -->|"4. Returns data"| B
B -->|"5. Runs Python code"| E["🧪 Code Sandbox"]:::sandboxStyle
E -->|"6. Computes totals"| B
B -->|"7. Shows draft table"| F["🛑 Approval Gate"]:::gateStyle
A -->|"8. Types 'APPROVE'"| F
F -->|"9. Dispatches report"| C
C -->|"10. Posts message"| G["💬 Slack Channel"]:::slackStyle
G -->|"11. Audit confirmation"| A
Mandatory Submission Requirement (Hackathon Rule 10)
All project enhancements and refactors were reviewed by Qodo across dedicated pull requests to ensure strict security, robust error handling, and high-quality open-source standards.
- Primary Reviewed Pull Request: PR #3 — Complete M's Desk ops reporting agent & PR #4 — Qodo Remediation & Code Quality Polish
- What Qodo Surfaced & Remediated:
- Reasoning Leak & Role Scoping: Qodo flagged that reasoning/thinking tag stripping was being applied universally across all messages. We refactored
groq-proxy.mjsto scope tag stripping strictly toassistantmessages and preserve authentic user prompts. - Rate Limit Resilience: Qodo identified missing backoff mechanisms under API pressure. Added an exponential retry budget (
MAX_RETRIES = 5) with dynamicretry-afterheader inspection. - Transport Security & Session Isolation: Qodo caught session fallback across clients on SSE
/message. Updatedslack-sse-server.mjsto strictly validatesessionIdparameters and reject unmatched sessions with standard 400/404 HTTP codes. - Data Surface Minimization: Removed the unauthenticated direct
/csvroute, ensuring data access is exclusively brokered via authorized MCP tool flows.
- Reasoning Leak & Role Scoping: Qodo flagged that reasoning/thinking tag stripping was being applied universally across all messages. We refactored
- Review Cycle History:
- Double-O Track (Best Use of TrueForge):
- Reach (Real Tools): Custom Model Context Protocol (MCP) server (
slack-sse-server.mjs) running over Server-Sent Events (SSE) with local filesystem CSV tool integration (read_local_csv). - Sandbox (Code Execution): Executes real Python scripts in the TrueForge sandbox to parse
data/weekly_metrics.csvand calculate exact totals, averages, and SLA adherence without hallucination. - Approval (Human-in-the-Loop): System instructions strictly prohibit irreversible write actions (posting to Slack) without human authorization, halting execution at a distinct Markdown Approval Gate.
- Reach (Real Tools): Custom Model Context Protocol (MCP) server (
- Q Branch Track (Best Code Quality):
- Production-grade code review trail with Qodo, modular architecture, strict session handling, and clean TypeScript/ESM integration.
- Savile Row Track (Best UI & Transparency):
- Real-time state logging in chat (
Planning,Executing Sandbox), an unmistakable Markdown Approval Gate (🛑 [ DRAFT APPROVAL REQUIRED ] 🛑), and structured post-execution Audit Logs (✅ ACTION EXECUTED).
- Real-time state logging in chat (
Clone the repository and install Node dependencies:
git clone https://github.com/AnvitDevadiga/msdesk.git
cd msdesk
npm installCreate a .env file in the root directory:
# Slack Bot Credentials
SLACK_BOT_TOKEN=xoxb-your-slack-bot-token
SLACK_TEAM_ID=your-slack-team-id
# Optional: Groq API Key (if using Cloud Model instead of Ollama)
GROQ_API_KEY=gsk_your_groq_api_key- Install Ollama and pull
qwen2.5:7b:ollama pull qwen2.5:7b
- In TrueForge Settings → Models, add Provider:
- Base URL:
http://localhost:11434/v1 - Model ID:
qwen2.5:7b(orqwen2.5-32k) - Max output tokens:
4096 - Context length:
32768
- Base URL:
Start the Groq Anti-Rate-Limit Proxy:
npm run proxyIn TrueForge Settings → Models:
- Base URL:
http://localhost:3002/v1 - Model ID:
openai/gpt-oss-20borqwen/qwen3.6-27b
Start the local Slack SSE MCP Server:
npm startLaunch TrueForge:
npx -y @truefoundry/trueforge- Connectors: Add SSE connector pointing to
http://localhost:3001/sse. - Agents: Create an agent named M's Desk, paste
prompts/agent_mission.mdinto Instructions, and attach theslackconnector.
Start a chat and prompt:
"Draft the weekly metrics report for the new-channel based on this week's CSV data."
- Watch the agent fetch local CSV data via
read_local_csv. - Inspect the Python sandbox execution computing the metrics dynamically from
data/weekly_metrics.csv. - Review the Markdown Approval Gate.
- Type
APPROVEto post the message directly to Slack!