LabOps Agent MCP Server

LabOps Agent MCP Server

MCP server that enables clinical lab staff to predict reagent stockouts, check inventory, create orders, and update inventory canvases directly from Slack.

Category
Visit Server

README

LabOps Agent πŸ”¬

Slack Agent for Good β€” Slack Agent Builder Challenge 2026 (Salesforce/Devpost)

Predict. Alert. Act. All from Slack.

LabOps Agent is a Slack-native AI agent that predicts reagent stockouts in clinical laboratories before they happen, based on historical demand patterns by test type β€” and enables lab staff to act directly from Slack without switching to external LIMS systems.


The Problem

Clinical laboratories run on reagents. When a critical reagent runs out mid-operation, testing stops. Current solutions (Quartzy, Scispot) only send passive threshold alerts after stock is already low. No product today predicts stockouts based on test-type demand patterns.

Example: TSH demand spikes every winter in Argentina (Jun–Aug). A lab with 680 units, at a projected winter demand of ~185 units/day, runs out in ~4 days β€” inside the 7-day reorder window. Without prediction, they find out when the analyzer throws an error.


What LabOps Agent Does

  1. Predicts stockouts using Prophet, calibrated with patterns derived from anonymized demand analysis in Argentine clinical labs
  2. Alerts lab staff in #labops-alerts with interactive Block Kit messages β€” before the stockout happens
  3. Acts β€” staff orders reagents, assigns tasks, and updates inventory without leaving Slack

Why LabOps Agent is Different

No existing product (Quartzy, Scispot, Benchling) combines:

  • Prediction by test type β€” TSH spikes in winter, Hemograma is stable; each reagent gets its own Prophet model
  • Native Slack agent β€” not a webhook or Zapier bridge; Bolt Python with Socket Mode, interactive Block Kit buttons, and modals
  • Domain expertise β€” built by someone with 4 years of B2B KAM experience in clinical diagnostics (Argentina), not a generic inventory template

Technologies Used

Technology How It's Used Platform
MCP Server Exposes 4 lab tools: get_inventory, get_forecast, create_order, update_canvas Anthropic/Slack
Claude Tool-Use Agent LLM selects and invokes MCP tools via agent_router.py on every @mention Anthropic
Slack Channel History API Queries #labops-alerts message history for past reagent incidents (works with the bot token) Slack
Claude API Summarization Generates natural language summaries of reagent alert history Anthropic

Optional add-on (not part of the headline tech): the Slack Search API (search.messages) surfaces cross-channel mentions, but it requires a workspace user token (xoxp-) β€” the bot token returns empty results. It is wired up and degrades gracefully when absent; set SLACK_USER_TOKEN to enable it.


MCP Server

LabOps Agent exposes a real MCP Server using the official Anthropic MCP Python SDK:

# Run MCP Server (stdio transport)
cd backend
python mcp_server.py

Tools available:

  • get_inventory β€” Query current reagent stock
  • get_forecast β€” Prophet demand forecast
  • create_order β€” Create reagent order
  • update_canvas β€” Update inventory Canvas

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  SLACK WORKSPACE                     β”‚
β”‚   #labops-alerts  β”‚  Canvas Inventario  β”‚  App Home  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚ Bolt Python (Socket Mode)
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                FASTAPI BACKEND                       β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚   MCP SERVER    β”‚   β”‚   PREDICTION ENGINE      β”‚ β”‚
β”‚  β”‚ get_inventory   β”‚   β”‚   Prophet + seasonality  β”‚ β”‚
β”‚  β”‚ get_forecast    β”‚   β”‚   calibrated: synthetic  β”‚ β”‚
β”‚  β”‚ create_order    β”‚   β”‚   rolling-CV MAPE 8-11%  β”‚ β”‚
β”‚  β”‚ update_canvas   β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    SUPABASE                          β”‚
β”‚  inventory β”‚ demand_history β”‚ orders β”‚ alerts_log    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  CLAUDE API                          β”‚
β”‚  Natural language explanations of predictions        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Demo Flow (3 minutes)

0:00–0:45 β€” Agent detects TSH will run out in ~4 days (demand forecast exceeds stock)

0:45–1:30 β€” Alert fires in #labops-alerts with Block Kit buttons:

  • πŸ“Š Ver proyecciΓ³n
  • πŸ›’ Ordenar reactivo
  • πŸ‘€ Asignar al equipo

1:30–2:15 β€” User clicks "Ordenar reactivo" β†’ modal opens β†’ one click confirms β†’ Canvas auto-updates

2:15–3:00 β€” Agent explains WHY TSH is at risk (seasonal demand pattern) β†’ Claude API summarizes past incidents


Try it Live

Demo video (≀3 min): <add YouTube/Vimeo link here once recorded> β€” this is the canonical proof that the agent runs live in a real Slack sandbox. Sandbox workspace: https://labopsespacio.slack.com (invite-only sandbox).

Reproduce the live deploy (judge-reachable, chart renders)

Slack fetches forecast-chart images from its own servers, so the backend must be reachable over public HTTPS. Socket Mode also needs a persistent host, so this deploys to Render/Railway/Fly β€” not Vercel serverless (see Deployment).

  1. Join the Slack Developer Program and create a Developer Sandbox workspace.
  2. Create a new app from slack-manifest.json, install it, and copy the Bot + App tokens.
  3. Deploy with the included render.yaml blueprint (one persistent web service hosts both the chart endpoint and the Socket Mode websocket).
  4. After the first deploy, set BACKEND_URL=https://<your-service>.onrender.com and redeploy so the forecast chart renders in Slack.

Local + tunnel (for recording the demo on your machine):

docker-compose up --build                 # backend + slack client + DB
cloudflared tunnel --url http://localhost:8000   # public HTTPS for the chart
# set BACKEND_URL=https://<random>.trycloudflare.com in .env, restart slack_client

Without a public BACKEND_URL, the forecast still shows as native Block Kit fields β€” the chart image is simply omitted, never broken.


Setup Instructions

Prerequisites

1. Clone and install

git clone https://github.com/Marianooss/labops-agent
cd labops-agent
pip install -r requirements.txt

2. Configure environment

cp .env.example .env
# Fill in your keys:
# SUPABASE_URL, SUPABASE_KEY
# SLACK_BOT_TOKEN, SLACK_APP_TOKEN, SLACK_SIGNING_SECRET
# SLACK_USER_TOKEN (optional β€” required for search.messages)
# ANTHROPIC_API_KEY
# LABOPS_ALERTS_CHANNEL=#labops-alerts

3. Set up Supabase

# Run in Supabase SQL Editor:
# 1. data/create_tables.sql
# 2. data/seed_data.sql

4. Create Slack App (from manifest)

  1. Go to api.slack.com/apps β†’ Create New App
  2. Select From an app manifest
  3. Choose your Developer Sandbox workspace
  4. Paste the contents of slack-manifest.json
  5. Click Create
  6. Go to OAuth & Permissions β†’ Install to Workspace
  7. Copy the Bot User OAuth Token and App-Level Token into your .env

Manifest includes all required scopes: chat:write, channels:read, channels:history, groups:read, groups:history, im:write, users:read, app_mentions:read, canvases:read, canvases:write, search:read.

5. One-Click Docker Setup (recommended for judges)

# Clone and start everything (PostgreSQL + backend + slack client + auto-seed)
git clone https://github.com/Marianooss/labops-agent
cd labops-agent
docker-compose up --build

# Wait ~30s for DB init, then test:
curl "http://localhost:8000/alert/trigger?reagent_name=TSH"

This runs the full stack locally without needing a cloud Supabase account:

  • db β€” PostgreSQL with auto-created schema and seed data
  • backend β€” FastAPI on http://localhost:8000
  • slack_client β€” Bolt Python Socket Mode (waits gracefully if Slack tokens are missing)

To enable Slack integration, copy .env.example to .env and fill in SLACK_BOT_TOKEN, SLACK_APP_TOKEN, and SLACK_SIGNING_SECRET before running docker-compose up.

6. Local Setup without Docker (one-script)

# Single command β€” starts backend + Slack client + seeds DB
python scripts/start_local.py

Or manually in separate terminals:

# Terminal 1: FastAPI backend
cd backend && uvicorn main:app --reload --port 8000

# Terminal 2: Slack agent
cd backend && python slack_client.py

Note: Backend commands must be run from the backend/ directory because modules use relative imports.


Deployment (Render / Railway / Fly)

Why not Vercel? The agent uses Slack Socket Mode, which holds a persistent websocket. Vercel serverless functions are short-lived and cannot keep that connection open. (If you must use Vercel, you would have to switch to HTTP Events mode and expose /slack/events β€” a different integration path this repo does not use.) Instead, deploy to a persistent host.

The included render.yaml provisions one web service that hosts both:

  1. the FastAPI HTTP app (serves the public /chart/forecast/{reagent} PNG that Slack image blocks fetch β€” needs public HTTPS), and
  2. the Socket Mode websocket, started in a background thread via RUN_SOCKET_MODE=1 (see backend/main.py startup).
Render β†’ New β†’ Blueprint β†’ select this repo β†’ fill the secret env vars
β†’ after first deploy, set BACKEND_URL=https://<service>.onrender.com β†’ redeploy

Railway and Fly.io work identically with the same Dockerfile (it honors the host-injected $PORT).


Project Structure

labops-agent/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py           # FastAPI entry point
β”‚   β”œβ”€β”€ mcp_server.py     # MCP tools (4 lab tools)
β”‚   β”œβ”€β”€ prediction.py     # Prophet demand forecasting
β”‚   β”œβ”€β”€ slack_client.py   # Bolt Python + event handlers
β”‚   β”œβ”€β”€ database.py       # Dual backend: Supabase or PostgreSQL
β”‚   β”œβ”€β”€ claude_client.py  # Claude API wrapper
β”‚   └── blocks_loader.py  # Block Kit / Canvas template loader
β”œβ”€β”€ blocks/
β”‚   β”œβ”€β”€ alert.json        # Stockout alert Block Kit template
β”‚   β”œβ”€β”€ modal_order.json  # Order reagent modal template
β”‚   └── canvas.json       # Inventory canvas template
β”œβ”€β”€ data/
β”‚   β”œβ”€β”€ create_tables.sql # Database schema
β”‚   └── seed_data.sql     # Demo data (DEMO badge)
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ architecture.md   # Technical architecture
β”‚   β”œβ”€β”€ impact.md         # Impact metrics
β”‚   └── demo_script.md    # 3-minute demo script
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ init_db.py        # Auto-seed PostgreSQL on Docker startup
β”‚   β”œβ”€β”€ start_local.py    # One-script local startup (backend + slack + seed)
β”‚   β”œβ”€β”€ holdout_backtest.py   # Monthly hold-out backtest (illustrative)
β”‚   └── cross_validation.py   # Rolling-origin CV (headline accuracy metric)
β”œβ”€β”€ notebooks/
β”‚   β”œβ”€β”€ cv_metrics.json       # Rolling-origin CV results (real, reproducible)
β”‚   β”œβ”€β”€ holdout_metrics.json  # Monthly hold-out results (caveated)
β”‚   └── prophet_metrics.json  # Consolidated metrics summary
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_mcp.py       # MCP tool unit tests
β”‚   β”œβ”€β”€ test_prediction.py # Prophet engine tests
β”‚   └── test_integration.py # Bolt handler integration tests
β”œβ”€β”€ models/               # Prophet serialized models (.pkl)
β”œβ”€β”€ render.yaml           # Render Blueprint (persistent host + Socket Mode)
β”œβ”€β”€ docker-compose.yml    # One-click local stack
β”œβ”€β”€ Dockerfile            # Backend container
β”œβ”€β”€ Makefile              # make demo / make local / make test
β”œβ”€β”€ AGENTS.md             # Development operating system
β”œβ”€β”€ BIBLE.md              # Immutable declarations
└── CLAUDE.md             # Claude Code instructions

UiPath Components Used

None β€” this project uses Slack platform APIs (Channel History API, Canvas API) for messaging and surfaces, Anthropic MCP Server for tool exposure, and Claude API for natural language generation.


Demo Screenshots

Record the ≀3-minute demo in your live Slack sandbox and replace these placeholders:

Timestamp Screenshot What to capture
0:00-0:45 docs/demo/01_alert.png TSH alert in #labops-alerts with πŸ”΄ CRITICAL badge + 3 buttons
0:45-1:30 docs/demo/02_forecast.png Thread reply: 7-day Prophet forecast table + channel history
1:30-2:15 docs/demo/03_order.png Modal "Ordenar reactivo" β†’ confirmation β†’ Canvas update
2:15-3:00 docs/demo/04_agent.png @mention interaction showing agent tool-use (e.g. @LabOps Agent cuΓ‘nto stock hay de TSH?)

πŸ’‘ Tip: Use Slack's built-in screen recording (Cmd+Shift+5 on macOS, Win+Alt+R on Windows) or Loom for the GIF.

Data & Privacy

All data in this project is synthetic and clearly labeled with DEMO badges. No real patient data, no PHI. The prediction model was calibrated with patterns derived from anonymized demand analysis of Argentine clinical laboratories.


License

MIT License β€” see LICENSE


Builder

Mariano Adrian Oss Β· DevelopOss Β· Buenos Aires, Argentina

B2B KAM in clinical diagnostics (4 years) + AI Builder. This project applies real insider knowledge of clinical laboratory operations to a problem that existing software hasn't solved: uninterrupted diagnostic access for vulnerable patients inside the tools labs already use daily.


LabOps Agent Β· Slack Agent Builder Challenge 2026 Β· Track: Slack Agent for Good

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured