Repository navigation
Expand file tree
/
Copy pathmcp-integration.html
More file actions
259 lines (243 loc) · 11.5 KB
/
Copy pathmcp-integration.html
File metadata and controls
259 lines (243 loc) · 11.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<!--
SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Nomos MCP Request Builder</title>
<link rel="stylesheet" href="assets/interactive-docs.css">
</head>
<body>
<main class="shell">
<header class="hero">
<div>
<p class="eyebrow">MCP integration</p>
<h1>Build a council tool call without guessing the payload</h1>
<p class="lead">
Choose a tool, version, council, command, and attachment mode. The builder shows
the JSON-RPC call, expected response shape, and transport notes.
</p>
</div>
<aside class="hero-card">
<h2>Endpoint</h2>
<p>External clients use the monitor-owned Streamable HTTP endpoint: <code>http://localhost:9901/mcp</code>. The internal council service stays behind the monitor.</p>
</aside>
</header>
<nav class="nav">
<a href="../index.md">Docs index</a>
<a href="../council-mcp-validation.md">Validation checklist</a>
<a href="../reference/mcp-api.md#mcp-tools-reference">MCP tools reference</a>
<a href="multi-council.html">Multi-council routing</a>
<a href="workflow.html">Runtime workflow</a>
</nav>
<section>
<div class="section-head">
<h2>Request Builder</h2>
<p>Generate the tool call payload that a client library would send after MCP session initialization.</p>
</div>
<div class="control-panel">
<div class="controls">
<div class="field">
<label for="tool">Tool family</label>
<select id="tool">
<option value="authorize">authorize and mint writ</option>
<option value="propose">propose only</option>
<option value="public_key">get public key</option>
<option value="writ_status">check writ status</option>
</select>
</div>
<div class="field">
<label for="version">Version</label>
<select id="version">
<option value="v1">v1 / default council</option>
<option value="v2">v2 / explicit council</option>
</select>
</div>
<div class="field">
<label for="council">Council id</label>
<select id="council">
<option value="">omit</option>
<option value="council-prod">council-prod</option>
<option value="council-git-workflow">council-git-workflow</option>
</select>
</div>
<div class="field">
<label for="attachments">Attachments</label>
<select id="attachments">
<option value="none">none</option>
<option value="script">one packaged script</option>
</select>
</div>
<div class="field grow">
<label for="command">Command</label>
<input id="command" value="/usr/bin/git diff --stat HEAD">
</div>
</div>
</div>
<div class="result-grid" style="margin-top:14px">
<div class="result-card">
<h3>JSON-RPC tool call</h3>
<pre class="codebox" id="payload"></pre>
</div>
<div class="stage">
<h3 class="stage-title" id="tool-title">Tool behavior</h3>
<p class="stage-copy" id="tool-copy"></p>
<div class="node-row" aria-hidden="true">
<div class="node">Client</div>
<div class="connector active"></div>
<div class="node active">Monitor</div>
<div class="connector active"></div>
<div class="node">Council tool</div>
</div>
<div class="pill-row" id="pills"></div>
</div>
</div>
</section>
<section>
<div class="section-head">
<h2>Transport Snippets</h2>
<p>The raw HTTP examples are useful for debugging. Production clients should prefer an MCP SDK.</p>
</div>
<div class="grid two">
<div class="result-card">
<h3>Initialize session</h3>
<pre class="codebox" id="init"></pre>
</div>
<div class="result-card">
<h3>Expected result shape</h3>
<pre class="codebox light" id="result"></pre>
</div>
</div>
</section>
<section>
<div class="section-head">
<h2>Deployment Validation</h2>
<p>Before debugging client payloads, prove the deployed monitor, council, and MCP contract are healthy.</p>
</div>
<div class="grid two">
<div class="result-card">
<h3>Portable Kind or Compose checks</h3>
<pre class="codebox">curl -fsS http://127.0.0.1:9901/healthz | python3 -m json.tool
curl -fsS http://127.0.0.1:9907/v1/health | python3 -m json.tool
uv run ./scripts/run_test_suite.py \
--suite grpc-live \
--suite mcp-live \
--require-deployed</pre>
</div>
<div class="result-card">
<h3>Low-risk live MCP council checks</h3>
<pre class="codebox">set -a
. deploy/.env
set +a
NOMOS_MCP_LIVE_URL=http://127.0.0.1:9901/mcp \
NOMOS_AGENT_ID="$NOMOS_AGENT_ID" \
NOMOS_AUTH_TOKEN="$NOMOS_AUTH_TOKEN" \
uv run pytest \
tests/test_mcp_live_integration.py::test_live_council_exposes_expected_tools_and_key \
tests/test_mcp_live_integration.py::test_live_council_fails_closed_for_invalid_auth \
tests/test_mcp_live_integration.py::test_live_council_mints_and_indexes_low_risk_writ \
-q</pre>
</div>
</div>
<div class="callout" style="margin-top:14px">
Compose-only deep smoke scripts are documented in the
<a href="../council-mcp-validation.md">Council MCP Validation</a> guide because they require host Redis access and Docker container inspection.
</div>
</section>
<section>
<div class="section-head">
<h2>Tool Selection Rules</h2>
<p>Use these as client integration defaults.</p>
</div>
<table class="matrix">
<thead><tr><th>Need</th><th>Tool</th><th>Notes</th></tr></thead>
<tbody>
<tr><td>Run a command after approval</td><td><code>council_authorize</code> or <code>council_v2_authorize</code></td><td>Returns a writ blob; submit it to the executor.</td></tr>
<tr><td>Ask “would this be approved?”</td><td><code>council_propose_intent</code></td><td>Runs policy and review but does not mint a writ.</td></tr>
<tr><td>Select a specialized council</td><td><code>council_v2_authorize</code></td><td>Requires <code>council_id</code> and membership.</td></tr>
<tr><td>Verify executor trust root</td><td><code>council_get_public_key</code></td><td>Executors can also load the public key from a mounted file.</td></tr>
</tbody>
</table>
</section>
<footer>Reference: <a href="../reference/mcp-api.md#mcp-tools-reference">MCP tools reference</a>.</footer>
</main>
<script>
const els = {
tool: document.querySelector("#tool"),
version: document.querySelector("#version"),
council: document.querySelector("#council"),
attachments: document.querySelector("#attachments"),
command: document.querySelector("#command"),
payload: document.querySelector("#payload"),
init: document.querySelector("#init"),
result: document.querySelector("#result"),
title: document.querySelector("#tool-title"),
copy: document.querySelector("#tool-copy"),
pills: document.querySelector("#pills")
};
function toolName() {
if (els.tool.value === "public_key") return "council_get_public_key";
if (els.tool.value === "writ_status") return "council_check_writ_status";
const prefix = els.version.value === "v2" ? "council_v2_" : "council_";
return `${prefix}${els.tool.value === "authorize" ? "authorize" : "propose_intent"}`;
}
function args() {
if (els.tool.value === "public_key") return {};
if (els.tool.value === "writ_status") return { writ_id: "writ-019c4e848c7774e6c2d7" };
const out = {
auth_token: "replace-with-agent-token",
agent_id: "agent-developer",
command: els.command.value,
working_directory: "/workspace/projects/example",
description: "Inspect repository state before making changes.",
context: "Task: fix the failing unit test in the example project; nothing changed yet.",
target_resource: "/workspace/projects/example",
justification: "Need to understand current worktree state before continuing.",
blast_radius: "Read-only repository inspection"
};
if (els.version.value === "v2" || els.council.value) out.council_id = els.council.value || "council-prod";
if (els.attachments.value === "script") {
out.packaged_files = [{
path: "scripts/inspect.sh",
content_base64: "<base64-encoded-file-content>",
sha256: "example-sha256-of-decoded-content",
mode: "0755"
}];
}
return out;
}
function expectedResult() {
if (els.tool.value === "public_key") return { council_id: "council-prod", public_key_hex: "hex-encoded-ed25519-public-key", fingerprint: "sha256-of-the-public-key", key_id: "nomos-council" };
if (els.tool.value === "writ_status") return { writ_id: "writ-019c4e848c7774e6c2d7", status: "valid | expired | used | not_found", issued_at: 1739226000.0, expires_at: 1739226300.0, command: "git status --short" };
if (els.tool.value === "propose") return { success: true, intent_id: "intent-...", state: "approved | denied | awaiting_approval", requires_approval: false, council_members: ["..."], chairman: {"risk_level": "low"} };
return { status: "approved | denied", writ_id: "writ-...", writ: "<base64 blob if approved>", guidance: [], council_members: ["..."], chairman: {"risk_level": "low"} };
}
function render() {
const name = toolName();
const payload = { jsonrpc: "2.0", id: 2, method: "tools/call", params: { name, arguments: args() } };
els.payload.textContent = JSON.stringify(payload, null, 2);
els.init.textContent = `curl -X POST http://localhost:9901/mcp \\
-H "Content-Type: application/json" \\
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"my-agent","version":"1.0"}}}'`;
els.result.textContent = JSON.stringify(expectedResult(), null, 2);
const isV2 = name.includes("_v2_");
els.title.textContent = name;
els.copy.textContent = els.tool.value === "authorize"
? "Full authorization evaluates policy and council review, then returns a signed writ when approved."
: els.tool.value === "propose" ? "Propose-only runs evaluation without minting a writ or allowing execution."
: "Utility tools return council metadata or stored writ status.";
els.pills.innerHTML = [
`<span class="pill blue">Streamable HTTP</span>`,
`<span class="pill ${isV2 ? "warn" : "good"}">${isV2 ? "explicit council_id" : "default council allowed"}</span>`,
els.attachments.value === "script" ? `<span class="pill warn">Code Review sidecar</span>` : `<span class="pill good">no attachments</span>`,
els.tool.value === "authorize" ? `<span class="pill good">writ possible</span>` : `<span class="pill blue">no execution</span>`
].join("");
}
[els.tool, els.version, els.council, els.attachments, els.command].forEach((el) => el.addEventListener("input", render));
render();
</script>
</body>
</html>