Skip to content

Add MCP server with 7 tools + Quarto output (Issues #212 and #216 in klausagnoletti/malware-and-monsters)#1

Open
klausagnoletti wants to merge 5 commits intoArcanum-Sec:mainfrom
klausagnoletti:feature/mcp-server
Open

Add MCP server with 7 tools + Quarto output (Issues #212 and #216 in klausagnoletti/malware-and-monsters)#1
klausagnoletti wants to merge 5 commits intoArcanum-Sec:mainfrom
klausagnoletti:feature/mcp-server

Conversation

@klausagnoletti
Copy link

@klausagnoletti klausagnoletti commented Mar 6, 2026

Summary

Implements two issues from klausagnoletti/malware-and-monsters:

  • Issue #212 — Convert TabletopExercise skill into an MCP server with 7 tools and 3 resources so AI agents can enrich M&M scenario cards in a schema-validated, additive-only way
  • Issue #216 — Add generate_exercise_qmd tool for native Quarto markdown output, enabling direct integration with the M&M handbook's Quarto book structure without an HTML conversion step

New files

  • schema.ts — Zod v3 schemas as single source of truth for TypeScript types, MCP validation, and the tabletop://schema resource. Extended with all QMD-specific fields.
  • mcp-server.ts — MCP server with StdioServerTransport and exported createServer() factory for testing. 7 tools + 3 resources.
  • generate-qmd.ts — QMD generator with formatting helpers, guards (safeQmd, validateTestNetIPs, validateContemporaryReadAloud), variation block wrapping, four section renderers, and a handout renderer.
  • test-mcp.ts — 18 integration tests (63 assertions) using InMemoryTransport — all pass.

Tools registered

# Tool Purpose
1 check_scenario_completeness Parse QMD frontmatter + body; return present/missing sections
2 validate_exercise_data Zod schema validation with structured errors
3 generate_exercise Produces facilitator.html + participant.html
4 merge_exercise_data Additive-only merge into existing JSON
5 validate_m_and_m_formatting M&M-specific rules beyond Zod (contemporary/historical)
6 generate_exercise_qmd Native Quarto output: 4 sections + handout-a/b QMD files
7 list_scenario_cards Walk directory, return completeness summary per card

Resources

URI Content
tabletop://schema Full JSON Schema derived from Zod
tabletop://atomics Full ATOMICS-LIBRARY.md
tabletop://template Annotated field-to-output mapping template

Verification

  • 63/63 integration tests pass (bun run test-mcp.ts)
  • quarto render on a lockbit/hospital-emergency fixture produces clean HTML with no warnings
  • Handout CSS block verified byte-for-byte against stuxnet/historical-foundation/handout-a-scada-diagnostics.qmd
  • MALMON_FAMILIES populated with all 13 canonical names from M&M scenario-cards

Note: Testing was performed via the integration test suite and quarto render. The MCP server has not been independently tested end-to-end in a live Claude session outside of these automated tests. Further testing against real M&M scenario cards is recommended before merging.

klausagnoletti and others added 2 commits March 6, 2026 17:13
Converts the TabletopExercise skill into an MCP server so AI coding
agents can enrich M&M scenario cards in a schema-validated,
additive-only way.

New files:
- generators/schema.ts — Zod v3 schemas as single source of truth for
  types, MCP validation, and the tabletop://schema resource
- generators/mcp-server.ts — MCP server (StdioServerTransport) with
  6 tools and 3 resources
- generators/test-mcp.ts — integration tests via InMemoryTransport
  (39/39 passing)
- CLAUDE.md — project coding standards (security, TypeScript, MCP
  tool design, code quality)
- .gitignore — excludes node_modules and generated test HTML

Modified files:
- generators/generate-pdf.ts — exports generateTabletopHTML(data, mode)
  wrapper; existing generatePDF and CLI entry point untouched
- generators/package.json — adds @modelcontextprotocol/sdk, zod,
  zod-to-json-schema; adds mcp and test scripts

Tools: check_scenario_completeness, validate_exercise_data,
generate_exercise, merge_exercise_data, validate_m_and_m_formatting,
list_scenario_cards

Resources: tabletop://schema, tabletop://atomics, tabletop://template

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…and-monsters)

Implements native Quarto markdown output for the M&M handbook:
- generate-qmd.ts: formatting helpers, guards (safeQmd, validateTestNetIPs,
  validateContemporaryReadAloud), variation block wrapping, section renderers
  for Inject Sequence / NPC Dialogue / Red Herrings / Gap Analysis, handout
  renderer with verified CSS block
- mcp-server.ts: registers generate_exercise_qmd as Tool 6; populates
  MALMON_FAMILIES with all 13 canonical names from M&M scenario-cards
- schema.ts: extends all sub-schemas with QMD-specific fields (trigger,
  read_aloud, artifact_inline, hint_if_stuck, NPCDialogueLinesQMD union,
  RedHerringSchema, handout artifact fields, etc.)
- test-mcp.ts: adds 6 new integration tests (Tests 13-18) covering basic
  generation, handout output, em dash guard, contemporary read_aloud
  violation, TEST-NET IP validation, path traversal; 63/63 pass

Verified: quarto render on lockbit/hospital-emergency fixture produces
clean HTML with no warnings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@klausagnoletti klausagnoletti changed the title Add TabletopExercise MCP server (Issue #212) Add generate_exercise_qmd tool and MCP server (Issues #212 and #216 in klausagnoletti/malware-and-monsters) Mar 6, 2026
klausagnoletti and others added 3 commits March 7, 2026 08:53
…stral Vibe

Documents setup for all four CLIs with correct config formats:
- Claude Code: claude mcp add CLI command
- Gemini CLI: ~/.gemini/settings.json (JSON mcpServers block)
- OpenAI Codex CLI: codex mcp add command + config.toml format
- Mistral Vibe: ~/.vibe/config.toml TOML format

Also adds v3.0 version entry and updated file structure.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@klausagnoletti klausagnoletti changed the title Add generate_exercise_qmd tool and MCP server (Issues #212 and #216 in klausagnoletti/malware-and-monsters) Add MCP server with 7 tools + Quarto output (Issues #212 and #216 in klausagnoletti/malware-and-monsters) Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant