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
访问服务器

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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选