Labsco
zerubroberts logo

SafetyCulture MCP Server

from zerubroberts

Ask natural language questions about your SafetyCulture data using the SafetyCulture API.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

SafetyCulture MCP Server

A Model Context Protocol (MCP) server for the SafetyCulture API. This project allows users to ask natural language questions about their SafetyCulture data after providing an API key.

Features

  • Query SafetyCulture data using natural language
  • Analyze inspection data and trends
  • Compare safety metrics across time periods and categories
  • Visualize inspection trends over time

Testing the API

To test if your SafetyCulture API key works properly:

test_api.bat YOUR_API_KEY

Additional testing options:

  • test_api.bat - Run tests in interactive mode (prompts for API key)
  • test_api.bat feed YOUR_API_KEY - Test just the Feed API
  • test_api.bat url - Check which API URLs are accessible without authentication

Available Tools

Authentication

  • authenticate: Authenticate with the SafetyCulture API using your API key

Inspection Data (Using Feed API)

  • get_inspections: Get SafetyCulture inspections for a specific time period
  • get_inspection_trends: Analyze trends in SafetyCulture inspections over time
  • compare_injury_reports: Compare injury reports between two time periods

Action Data (Using Feed API)

  • get_actions: Get SafetyCulture actions for a specific time period
    • Filter by status (e.g., 'in_progress', 'completed', 'overdue')
    • Filter by priority (e.g., 'low', 'medium', 'high')
    • View detailed information about each action
  • get_action_details: Get detailed information about a specific action by ID

About the Feed API

This MCP server uses the SafetyCulture Feed API, which provides a simple way to access collections of resources:

  • /feed/inspections: For listing inspections with various filter parameters
  • /feed/actions: For listing actions with various filter parameters

The Feed API is preferred over the individual resource endpoints when you need to list multiple items.

Development

Project Structure

.
โ”œโ”€โ”€ README.md
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ example.env
โ””โ”€โ”€ src/
    โ”œโ”€โ”€ main.py                      # Main entry point
    โ”œโ”€โ”€ safetyculture_api/           # SafetyCulture API client
    โ”‚   โ”œโ”€โ”€ __init__.py
    โ”‚   โ””โ”€โ”€ client.py                # API client implementation
    โ”œโ”€โ”€ tools/                       # MCP tools
    โ”‚   โ”œโ”€โ”€ __init__.py
    โ”‚   โ””โ”€โ”€ inspection_tools.py      # Inspection and action tools
    โ””โ”€โ”€ utils/                       # Utility modules
        โ”œโ”€โ”€ __init__.py
        โ”œโ”€โ”€ analysis.py              # Data analysis utilities
        โ”œโ”€โ”€ config.py                # Configuration management
        โ””โ”€โ”€ date_utils.py            # Date parsing utilities

Development Log

Initial Setup

  • Created project structure
  • Set up git repository
  • Added README and requirements
  • Implemented SafetyCulture API client
  • Added MCP tools for querying inspection data
  • Added utility modules for date parsing and data analysis
  • Added configuration management