Mount PluginHost and merge MCP tools
Create PluginHost, merge create*Tools factories, and expose governance MCP tools to the IDE.
What you will learn
- Bootstrap createPluginHost
- Merge MCP factories with merge-host-tools
- Connect .mcp.json to the host
Prerequisites
Surface
| Imports | @tmrxjd/agent-governance-system/plugin · @tmrxjd/agent-governance-system/mcp/merge-host-tools.mjs |
|---|---|
| MCP | governance_toc · commit_authorize · staging_enforce · enforcement_begin |
| Config | .mcp.json · GOVERNANCE_REPO_ROOT · AGS_LICENSE_KEY |
What this feature does
`createPluginHost` registers graphs, probes, DiffRules, and MCP tool names. Runtime `run` handlers come from `src/mcp/*-tools.mjs` and are merged via `buildGovernanceMcpModules` / merge-host-tools. Inject `monorepoRoot`, `runRepoTsx`, and `parseCliJson` so tools can invoke mechanics-trust CLIs.
Configuration
Wire these surfaces first: .mcp.json, GOVERNANCE_REPO_ROOT, AGS_LICENSE_KEY.. Treat them as the contract agents must not invent around.
{
"mcpServers": {
"ags-gov": {
"command": "node",
"args": ["./scripts/ags-mcp-host.mjs"],
"env": {
"AGS_LICENSE_KEY": "${AGS_LICENSE_KEY}",
"GOVERNANCE_REPO_ROOT": "${workspaceFolder}"
}
}
}
}How to call it
Call these MCP tools through your AGS / tower-gov host — governance_toc, commit_authorize, staging_enforce, enforcement_begin.. Prefer scan/get before validate/diff, and enforce only when the change set is ready.
- Implement host entry script
- Add .mcp.json
- Reload MCP servers
- Call governance_toc
import { createPluginHost } from '@tmrxjd/agent-governance-system/plugin'
import { buildGovernanceMcpModules } from '@tmrxjd/agent-governance-system/mcp/merge-host-tools.mjs'
const host = createPluginHost({ repoRoot: process.env.GOVERNANCE_REPO_ROOT! })
const modules = buildGovernanceMcpModules({
monorepoRoot: process.env.GOVERNANCE_REPO_ROOT!,
runRepoTsx,
parseCliJson,
host,
})What success looks like
IDE shows ags-gov / tower-gov Connected
governance_toc lists commit_checkpoint and staging_enforce
commit_authorize {} returns CAP state
Common failure modes
Tool names without run → factory not merged
CLI not found → monorepoRoot wrong
Empty catalog → plugins never loaded