Skip to main content

K12 Safety MCP Server

Overview

The K12 Safety MCP Server exposes the complete K12 Education tool registry, covering Emergency Operation Plan (EOP) operations, scenario-specific annex kickoffs, role lookup helpers, and Quick Reference Guide (QRG) workflows. With 28 registered tools, it is the largest MCP server in the platform.

Server Metadata

PropertyValue
FactorycreateK12SafetyMcpServer()
Sourcepackages/domain-k12/src/mcp-server.ts
Version1.0.0
Tool Count28 (21 EOP/annex/role tools + 7 QRG)
Skip FlagMASTRA_SKIP_K12_MCP
Tool Registrypackages/domain-k12/src/tools.ts

Factory Implementation

// packages/domain-k12/src/mcp-server.ts
import { MCPServer } from '@mastra/mcp';
import { k12SafetyTools } from './tools.ts';

export const createK12SafetyMcpServer = () =>
new MCPServer({
name: 'K12 Safety MCP Server',
version: '1.0.0',
description:
'Provides tools for assessing K12 content safety signals and retrieving escalation guidance.',
tools: k12SafetyTools,
});

Tool Registry

The tool registry at packages/domain-k12/src/tools.ts exports 28 tools. The QRG tools are spread from packages/domain-k12/src/qrg/index.ts; the remaining tools live in the top-level K12 package.

EOP, Annex, and Role Tools (21)

Tool IDDescription
k12-lkp-task-status-by-session-or-requestQuery monitoring rows by sessionId or requestId to show status history
k12-lkp-task-request-resultFetch the persisted request row and attached response fields
k12-insert-task-in-monitoring-tableInsert a status/monitoring row into K12SAFETY.log_EOP_TaskStatus
k12-insert-task-request-logInsert a full workflow request into K12SAFETY.log_EOP_TaskRequests
k12-update-task-request-responseRecord the workflow's final response payload into the request log
k12-update-task-statusUpdate an existing monitoring row's status and message
k12-cancel-task-requestRequest cancellation for an in-flight workflow run
k12-annex-editing-kickoffMain entry point to kick off the EOP/Annex editing workflow
k12-district-planning-kickoffStart the district-planning annex scenario workflow
k12-facility-planning-kickoffStart the facility-planning annex scenario workflow
k12-functional-annex-kickoffStart the functional-annex scenario workflow
k12-hazard-annex-kickoffStart the hazard-annex scenario workflow
k12-functional-annex-suggest-roles-kickoffSuggest EOP roles for functional-annex planning
k12-hazard-annex-suggest-roles-kickoffSuggest EOP roles for hazard-annex planning
k12-functional-annex-suggest-responsibilities-kickoffSuggest responsibilities for functional-annex planning
k12-hazard-annex-suggest-responsibilities-kickoffSuggest responsibilities for hazard-annex planning
k12-annex-editing-statusPoll the status of an in-flight EOP editing workflow
k12-annex-editing-resultRetrieve the final result of a completed EOP editing workflow
k12-get-emergency-operation-plan-snapshotGet an EOP snapshot from MOEOP for contextual prompts
k12-get-selected-eop-rolesRead selected EOP role assignments for a plan/context
k12-get-eop-role-universeRead the available EOP role universe

QRG Tools (7)

These tools are defined in packages/domain-k12/src/qrg/index.ts and spread into the main tool registry:

Tool IDDescription
k12-qrg-generation-kickoffStart a QRG generation workflow from an EOP
k12-qrg-generation-statusPoll the status of a QRG generation workflow
k12-qrg-generation-resultRetrieve the final generated QRGs
k12-qrg-editing-kickoffStart a QRG editing workflow
k12-qrg-editing-statusPoll the status of a QRG editing workflow
k12-qrg-editing-resultRetrieve the result of a QRG editing workflow
k12-qrg-cancelCancel an in-flight QRG generation or editing workflow

Implementation Notes

QRG Sub-Module Pattern

The QRG tools are maintained in a separate sub-module (./qrg/index.ts) for organizational clarity but are spread into the top-level registry using the object spread operator:

// packages/domain-k12/src/tools.ts
import { annexEditingKickoffTool } from './annex-editing-kickoff.ts';
import { insertTaskRequestTool } from './insert-task-request-tool.ts';
import { qrgTools } from './qrg/index.ts';

export const k12SafetyTools = {
'k12-annex-editing-kickoff': annexEditingKickoffTool,
'k12-insert-task-request-log': insertTaskRequestTool,
// Other EOP, annex scenario, status/result, and role tools...
...qrgTools, // 7 QRG tools merged into the flat registry
};

This means all 28 tools appear as a flat list in the MCP server -- there is no sub-grouping visible to MCP clients.

Domain Gating

The K12 Safety MCP server is only loaded when MASTRA_TARGET includes k12 (or is set to all). It can also be explicitly disabled via MASTRA_SKIP_K12_MCP regardless of the target.

Database Dependencies

Most K12 tools require an active Azure SQL connection. The tools use the K12SAFETY schema with tables including:

  • log_EOP_TaskRequests -- Full request/response payloads
  • log_EOP_TaskStatus -- Status monitoring rows
  • log_Jobs -- General job tracking
  • qrg_requests, qrg_generations, qrg_generated_items -- QRG lifecycle

MOEOP Integration

The k12-get-emergency-operation-plan-snapshot tool calls an external MOEOP (Missouri EOP) API to fetch plan documents. This requires the K12_MOEOP_API_ENDPOINT environment variable to be configured.

Code Locations

  • Server factory: packages/domain-k12/src/mcp-server.ts
  • Tool registry: packages/domain-k12/src/tools.ts
  • QRG sub-module: packages/domain-k12/src/qrg/index.ts
  • Individual tools: packages/domain-k12/src/*.ts
  • Tests: tests/shared/unit/mcp-servers/mcp-servers.test.ts (K12 Safety MCP Server describe block)
  • Tool-level tests: packages/domain-k12/tests/tools/