feat: MCP server / AI-agent surface - #25
Merged
Merged
Conversation
This was referenced Jul 9, 2026
This was referenced Jul 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat: MCP server / AI-agent surface
What & why
This PR adds a
tmforge mcpserver so an AI agent can drive Threat Model Forge end-to-end — read, author, analyze, and report on models — over the same engine Studio and the CLI use. The durable move comes first: imperative authoring (add/connect/set/rename/remove) and declarative manifests (apply/export) were CLI-only, so before exposing anything we lifted that orchestration out of the CLI into the shared engine facade. The surface is stateless and additive: every tool takes a canonicaltmforge-jsonmodel in and returns the edited model out.Highlights
AuthoringOperations(aThreatModel-level core) andAuthoringService(a statelesstmforge-jsonfaçade). The five imperative verbs plusapply/exportbecome thin argument-parsers over it. CLI behavior (exit codes and--jsonoutput) is unchanged, and the/v1OpenAPI is byte-identical.tmforge mcpstdio server: a Model Context Protocol server (official ModelContextProtocol SDK) that projects the facade as 20 tools; agents launch it withcommand: "tmforge", args: ["mcp"]— no separate binary or deployment.formats,stencils,property_schema,rules,rule_packs,manifest_schema,detect), model I/O + analysis (read,save,analyze,threats,report,merge), and authoring (apply,export_manifest,add,connect,set,rename,remove).{ "Protocol": "HTTPS" }), and file paths, marshaled onto the typed facade requests; an unknown kind or invalid property comes back as a structured{ success: false, error }, never a crash..tm7fidelity preserved: the CLI still edits the file-loaded model directly (full threat-register / geometry fidelity, no DTO round-trip); only the agent/HTTP/WASM facade round-trips throughtmforge-json, so imperative CLI edits never silently lose register data./v1and the in-browser WASM engine are not wired to authoring in this PR