@honua/mcp-server 0.0.10-alpha.0 → 0.1.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. package/README.md +259 -15
  2. package/certification/geospatial-mcp-schemas/PROVENANCE.md +41 -0
  3. package/certification/geospatial-mcp-schemas/README.md +90 -0
  4. package/certification/geospatial-mcp-schemas/common/geoprocessing-error.schema.json +45 -0
  5. package/certification/geospatial-mcp-schemas/conformance/manifest.schema.json +79 -0
  6. package/certification/geospatial-mcp-schemas/index.json +390 -0
  7. package/certification/geospatial-mcp-schemas/resources/app-package.schema.json +20 -0
  8. package/certification/geospatial-mcp-schemas/resources/app-template.schema.json +15 -0
  9. package/certification/geospatial-mcp-schemas/resources/artifact.schema.json +69 -0
  10. package/certification/geospatial-mcp-schemas/resources/deployment.schema.json +27 -0
  11. package/certification/geospatial-mcp-schemas/resources/map-package.schema.json +21 -0
  12. package/certification/geospatial-mcp-schemas/resources/map-template.schema.json +15 -0
  13. package/certification/geospatial-mcp-schemas/resources/provenance.schema.json +50 -0
  14. package/certification/geospatial-mcp-schemas/resources/published-service.schema.json +21 -0
  15. package/certification/geospatial-mcp-schemas/resources/result-package.schema.json +64 -0
  16. package/certification/geospatial-mcp-schemas/resources/style.schema.json +12 -0
  17. package/certification/geospatial-mcp-schemas/resources/theme.schema.json +12 -0
  18. package/certification/geospatial-mcp-schemas/resources/workspace.schema.json +63 -0
  19. package/certification/geospatial-mcp-schemas/tools/apply_style_preset.schema.json +27 -0
  20. package/certification/geospatial-mcp-schemas/tools/buffer_features.schema.json +60 -0
  21. package/certification/geospatial-mcp-schemas/tools/cancel_job.schema.json +15 -0
  22. package/certification/geospatial-mcp-schemas/tools/clarify_intent.schema.json +69 -0
  23. package/certification/geospatial-mcp-schemas/tools/compose_mixed_protocol_map.schema.json +21 -0
  24. package/certification/geospatial-mcp-schemas/tools/create_app_package.schema.json +33 -0
  25. package/certification/geospatial-mcp-schemas/tools/create_map_package.schema.json +41 -0
  26. package/certification/geospatial-mcp-schemas/tools/edit_features.schema.json +74 -0
  27. package/certification/geospatial-mcp-schemas/tools/execute_plan.schema.json +64 -0
  28. package/certification/geospatial-mcp-schemas/tools/export_dataset.schema.json +60 -0
  29. package/certification/geospatial-mcp-schemas/tools/geocode_address.schema.json +36 -0
  30. package/certification/geospatial-mcp-schemas/tools/geocode_addresses.schema.json +34 -0
  31. package/certification/geospatial-mcp-schemas/tools/get_style.schema.json +40 -0
  32. package/certification/geospatial-mcp-schemas/tools/ground_candidates.schema.json +66 -0
  33. package/certification/geospatial-mcp-schemas/tools/ingest_dataset.schema.json +45 -0
  34. package/certification/geospatial-mcp-schemas/tools/join_features.schema.json +73 -0
  35. package/certification/geospatial-mcp-schemas/tools/list_capabilities.schema.json +21 -0
  36. package/certification/geospatial-mcp-schemas/tools/list_layers.schema.json +14 -0
  37. package/certification/geospatial-mcp-schemas/tools/overlay_features.schema.json +53 -0
  38. package/certification/geospatial-mcp-schemas/tools/plan_analysis.schema.json +19 -0
  39. package/certification/geospatial-mcp-schemas/tools/preview_app_package.schema.json +15 -0
  40. package/certification/geospatial-mcp-schemas/tools/preview_map_package.schema.json +17 -0
  41. package/certification/geospatial-mcp-schemas/tools/preview_package.schema.json +40 -0
  42. package/certification/geospatial-mcp-schemas/tools/propose_operation.schema.json +28 -0
  43. package/certification/geospatial-mcp-schemas/tools/publish_result.schema.json +29 -0
  44. package/certification/geospatial-mcp-schemas/tools/publish_service.schema.json +59 -0
  45. package/certification/geospatial-mcp-schemas/tools/query_features.schema.json +74 -0
  46. package/certification/geospatial-mcp-schemas/tools/refine_map_package.schema.json +22 -0
  47. package/certification/geospatial-mcp-schemas/tools/render_map.schema.json +60 -0
  48. package/certification/geospatial-mcp-schemas/tools/reproject_features.schema.json +49 -0
  49. package/certification/geospatial-mcp-schemas/tools/resolve_entity.schema.json +30 -0
  50. package/certification/geospatial-mcp-schemas/tools/solve_route.schema.json +39 -0
  51. package/certification/geospatial-mcp-schemas/tools/summarize_statistics.schema.json +71 -0
  52. package/certification/geospatial-mcp-schemas/tools/validate_package.schema.json +35 -0
  53. package/certification/geospatial-mcp-schemas/tools/validate_plan.schema.json +61 -0
  54. package/dist/src/capability.d.ts +48 -0
  55. package/dist/src/capability.d.ts.map +1 -0
  56. package/dist/src/capability.js +44 -0
  57. package/dist/src/certification/census-data.d.ts +33 -0
  58. package/dist/src/certification/census-data.d.ts.map +1 -0
  59. package/dist/src/certification/census-data.js +506 -0
  60. package/dist/src/certification/census-fixture-client.d.ts +7 -0
  61. package/dist/src/certification/census-fixture-client.d.ts.map +1 -0
  62. package/dist/src/certification/census-fixture-client.js +226 -0
  63. package/dist/src/certification/certifier.d.ts +125 -0
  64. package/dist/src/certification/certifier.d.ts.map +1 -0
  65. package/dist/src/certification/certifier.js +455 -0
  66. package/dist/src/certification/cli.d.ts +3 -0
  67. package/dist/src/certification/cli.d.ts.map +1 -0
  68. package/dist/src/certification/cli.js +63 -0
  69. package/dist/src/certification/contracts.d.ts +103 -0
  70. package/dist/src/certification/contracts.d.ts.map +1 -0
  71. package/dist/src/certification/contracts.js +245 -0
  72. package/dist/src/certification/fixture-client.d.ts +4 -0
  73. package/dist/src/certification/fixture-client.d.ts.map +1 -0
  74. package/dist/src/certification/fixture-client.js +113 -0
  75. package/dist/src/certification/fixtures.d.ts +45 -0
  76. package/dist/src/certification/fixtures.d.ts.map +1 -0
  77. package/dist/src/certification/fixtures.js +92 -0
  78. package/dist/src/certification/json-schema.d.ts +71 -0
  79. package/dist/src/certification/json-schema.d.ts.map +1 -0
  80. package/dist/src/certification/json-schema.js +172 -0
  81. package/dist/src/certification/lifecycle.d.ts +14 -0
  82. package/dist/src/certification/lifecycle.d.ts.map +1 -0
  83. package/dist/src/certification/lifecycle.js +326 -0
  84. package/dist/src/certification/mock-upstream.d.ts +29 -0
  85. package/dist/src/certification/mock-upstream.d.ts.map +1 -0
  86. package/dist/src/certification/mock-upstream.js +96 -0
  87. package/dist/src/certification/operator-catalog.d.ts +90 -0
  88. package/dist/src/certification/operator-catalog.d.ts.map +1 -0
  89. package/dist/src/certification/operator-catalog.js +650 -0
  90. package/dist/src/certification/report.d.ts +4 -0
  91. package/dist/src/certification/report.d.ts.map +1 -0
  92. package/dist/src/certification/report.js +103 -0
  93. package/dist/src/certification/run.d.ts +28 -0
  94. package/dist/src/certification/run.d.ts.map +1 -0
  95. package/dist/src/certification/run.js +32 -0
  96. package/dist/src/certification/schema-index.d.ts +94 -0
  97. package/dist/src/certification/schema-index.d.ts.map +1 -0
  98. package/dist/src/certification/schema-index.js +109 -0
  99. package/dist/src/certification/target.d.ts +48 -0
  100. package/dist/src/certification/target.d.ts.map +1 -0
  101. package/dist/src/certification/target.js +219 -0
  102. package/dist/src/eval/cli.d.ts +3 -0
  103. package/dist/src/eval/cli.d.ts.map +1 -0
  104. package/dist/src/eval/cli.js +118 -0
  105. package/dist/src/eval/corpus.d.ts +34 -0
  106. package/dist/src/eval/corpus.d.ts.map +1 -0
  107. package/dist/src/eval/corpus.js +150 -0
  108. package/dist/src/eval/drivers/anthropic.d.ts +14 -0
  109. package/dist/src/eval/drivers/anthropic.d.ts.map +1 -0
  110. package/dist/src/eval/drivers/anthropic.js +120 -0
  111. package/dist/src/eval/drivers/bedrock.d.ts +54 -0
  112. package/dist/src/eval/drivers/bedrock.d.ts.map +1 -0
  113. package/dist/src/eval/drivers/bedrock.js +178 -0
  114. package/dist/src/eval/drivers/deterministic.d.ts +17 -0
  115. package/dist/src/eval/drivers/deterministic.d.ts.map +1 -0
  116. package/dist/src/eval/drivers/deterministic.js +64 -0
  117. package/dist/src/eval/drivers/index.d.ts +34 -0
  118. package/dist/src/eval/drivers/index.d.ts.map +1 -0
  119. package/dist/src/eval/drivers/index.js +74 -0
  120. package/dist/src/eval/drivers/openai.d.ts +14 -0
  121. package/dist/src/eval/drivers/openai.d.ts.map +1 -0
  122. package/dist/src/eval/drivers/openai.js +136 -0
  123. package/dist/src/eval/grade.d.ts +14 -0
  124. package/dist/src/eval/grade.d.ts.map +1 -0
  125. package/dist/src/eval/grade.js +75 -0
  126. package/dist/src/eval/northstar-corpus.d.ts +3 -0
  127. package/dist/src/eval/northstar-corpus.d.ts.map +1 -0
  128. package/dist/src/eval/northstar-corpus.js +194 -0
  129. package/dist/src/eval/operator-corpus.d.ts +3 -0
  130. package/dist/src/eval/operator-corpus.d.ts.map +1 -0
  131. package/dist/src/eval/operator-corpus.js +193 -0
  132. package/dist/src/eval/report.d.ts +109 -0
  133. package/dist/src/eval/report.d.ts.map +1 -0
  134. package/dist/src/eval/report.js +133 -0
  135. package/dist/src/eval/runner.d.ts +28 -0
  136. package/dist/src/eval/runner.d.ts.map +1 -0
  137. package/dist/src/eval/runner.js +130 -0
  138. package/dist/src/eval/standalone-corpus.d.ts +3 -0
  139. package/dist/src/eval/standalone-corpus.d.ts.map +1 -0
  140. package/dist/src/eval/standalone-corpus.js +699 -0
  141. package/dist/src/eval/types.d.ts +118 -0
  142. package/dist/src/eval/types.d.ts.map +1 -0
  143. package/dist/src/eval/types.js +10 -0
  144. package/dist/src/helpers.d.ts +11 -0
  145. package/dist/src/helpers.d.ts.map +1 -1
  146. package/dist/src/helpers.js +22 -0
  147. package/dist/src/index.d.ts +31 -0
  148. package/dist/src/index.d.ts.map +1 -1
  149. package/dist/src/index.js +50 -4
  150. package/dist/src/provenance.d.ts +44 -0
  151. package/dist/src/provenance.d.ts.map +1 -0
  152. package/dist/src/provenance.js +37 -0
  153. package/dist/src/proxy.d.ts +46 -0
  154. package/dist/src/proxy.d.ts.map +1 -0
  155. package/dist/src/proxy.js +124 -0
  156. package/dist/src/resources/styles.d.ts +29 -0
  157. package/dist/src/resources/styles.d.ts.map +1 -0
  158. package/dist/src/resources/styles.js +76 -0
  159. package/dist/src/styles.d.ts +112 -0
  160. package/dist/src/styles.d.ts.map +1 -0
  161. package/dist/src/styles.js +144 -0
  162. package/dist/src/tools/apply-style-preset.d.ts +27 -0
  163. package/dist/src/tools/apply-style-preset.d.ts.map +1 -0
  164. package/dist/src/tools/apply-style-preset.js +41 -0
  165. package/dist/src/tools/count-features.d.ts.map +1 -1
  166. package/dist/src/tools/count-features.js +5 -4
  167. package/dist/src/tools/get-extent.d.ts.map +1 -1
  168. package/dist/src/tools/get-extent.js +6 -4
  169. package/dist/src/tools/get-style.d.ts +24 -0
  170. package/dist/src/tools/get-style.d.ts.map +1 -0
  171. package/dist/src/tools/get-style.js +39 -0
  172. package/dist/src/tools/list-services.d.ts.map +1 -1
  173. package/dist/src/tools/list-services.js +16 -1
  174. package/dist/src/tools/query-features.d.ts.map +1 -1
  175. package/dist/src/tools/query-features.js +4 -1
  176. package/package.json +28 -4
@@ -0,0 +1,226 @@
1
+ import { CENSUS_EXTENT, CENSUS_FIELDS, CENSUS_LAYER_NAME, CENSUS_ROWS, CENSUS_SERVICE_ID, } from "./census-data.js";
2
+ /**
3
+ * Offline PLATFORM-FREE fixture `HonuaClient` (issue #369).
4
+ *
5
+ * Where {@link ./fixture-client.ts:createFixtureClient} models a Honua-enhanced
6
+ * deployment (it serves the OGC API – Styles surface), this client models a PLAIN
7
+ * public Esri FeatureServer — exactly what the standalone `honua-mcp` front door
8
+ * points at. It replays the recorded US Census apportionment layer
9
+ * (services.arcgis.com; see `census-data.ts`) through a tiny in-memory GeoServices
10
+ * evaluator so `count / query / extent / statistics` return REAL, deterministic
11
+ * answers with no network. Crucially it exposes NO Honua-only surface: every
12
+ * `pipelineFetch` (the OGC API – Styles path the style tools probe) 404s, so the
13
+ * capability-degradation path is exercised for real.
14
+ *
15
+ * The evaluator is verified against the live recordings in
16
+ * `test/certification/census-fixture-client.test.ts` (count=52, sum(pop)=335085841,
17
+ * sum(seats)=435, max=California, min=Wyoming), so the semantic eval assertions
18
+ * that ride on it are grounded, not hand-waved.
19
+ */
20
+ const SPATIAL_REFERENCE = { wkid: 102100, latestWkid: 3857 };
21
+ function fieldValue(row, field) {
22
+ return row[field];
23
+ }
24
+ function compare(actual, op, expected) {
25
+ if (actual === undefined || actual === null) {
26
+ // NULL never satisfies a comparison (matches GeoServices/SQL semantics).
27
+ return false;
28
+ }
29
+ if (typeof expected === "string" || typeof actual === "string") {
30
+ const a = String(actual);
31
+ const e = String(expected);
32
+ switch (op) {
33
+ case "=":
34
+ return a === e;
35
+ case "<>":
36
+ case "!=":
37
+ return a !== e;
38
+ default:
39
+ throw new Error(`census fixture: operator ${op} is not supported for string values`);
40
+ }
41
+ }
42
+ switch (op) {
43
+ case "=":
44
+ return actual === expected;
45
+ case "<>":
46
+ case "!=":
47
+ return actual !== expected;
48
+ case ">":
49
+ return actual > expected;
50
+ case ">=":
51
+ return actual >= expected;
52
+ case "<":
53
+ return actual < expected;
54
+ case "<=":
55
+ return actual <= expected;
56
+ default:
57
+ throw new Error(`census fixture: unsupported operator "${op}"`);
58
+ }
59
+ }
60
+ function matchClause(row, clause) {
61
+ const match = /^\s*([A-Za-z_][A-Za-z0-9_]*)\s*(>=|<=|<>|!=|=|>|<)\s*(.+?)\s*$/.exec(clause);
62
+ if (!match) {
63
+ throw new Error(`census fixture: unsupported WHERE clause "${clause}"`);
64
+ }
65
+ const [, field, op, rawValue] = match;
66
+ const actual = fieldValue(row, field);
67
+ if (actual === undefined) {
68
+ throw new Error(`census fixture: unknown field "${field}" in WHERE`);
69
+ }
70
+ const expected = /^'.*'$/.test(rawValue) ? rawValue.slice(1, -1) : Number(rawValue);
71
+ if (typeof expected === "number" && Number.isNaN(expected)) {
72
+ throw new Error(`census fixture: unparseable value in WHERE clause "${clause}"`);
73
+ }
74
+ return compare(actual, op, expected);
75
+ }
76
+ /** Filter the recorded rows by a (minimal) SQL WHERE clause. */
77
+ export function filterRows(where) {
78
+ const clause = (where ?? "1=1").trim();
79
+ if (clause === "" || clause === "1=1") {
80
+ return [...CENSUS_ROWS];
81
+ }
82
+ const conditions = clause.split(/\s+AND\s+/i);
83
+ return CENSUS_ROWS.filter((row) => conditions.every((condition) => matchClause(row, condition)));
84
+ }
85
+ function orderRows(rows, orderByFields) {
86
+ const specs = orderByFields.split(",").map((part) => {
87
+ const [field, dir] = part.trim().split(/\s+/);
88
+ return { field, descending: (dir ?? "ASC").toUpperCase() === "DESC" };
89
+ });
90
+ return [...rows].sort((a, b) => {
91
+ for (const { field, descending } of specs) {
92
+ const av = fieldValue(a, field);
93
+ const bv = fieldValue(b, field);
94
+ if (av === bv) {
95
+ continue;
96
+ }
97
+ const less = (av ?? 0) < (bv ?? 0);
98
+ return (less ? -1 : 1) * (descending ? -1 : 1);
99
+ }
100
+ return 0;
101
+ });
102
+ }
103
+ function aggregate(rows, type, field) {
104
+ // GeoServices aggregate statistics ignore NULL values (e.g. DC/PR seats).
105
+ const values = rows.map((row) => fieldValue(row, field)).filter((v) => typeof v === "number");
106
+ switch (type) {
107
+ case "count":
108
+ return values.length;
109
+ case "sum":
110
+ return values.reduce((acc, v) => acc + v, 0);
111
+ case "min":
112
+ return values.length > 0 ? Math.min(...values) : 0;
113
+ case "max":
114
+ return values.length > 0 ? Math.max(...values) : 0;
115
+ case "avg":
116
+ return values.reduce((acc, v) => acc + v, 0) / (values.length || 1);
117
+ case "stddev": {
118
+ const mean = values.reduce((acc, v) => acc + v, 0) / (values.length || 1);
119
+ const variance = values.reduce((acc, v) => acc + (v - mean) ** 2, 0) / (values.length || 1);
120
+ return Math.sqrt(variance);
121
+ }
122
+ default:
123
+ throw new Error(`census fixture: unsupported statisticType "${type}"`);
124
+ }
125
+ }
126
+ function computeStatistics(rows, request) {
127
+ const stats = request.outStatistics ?? [];
128
+ const groupField = request.groupByFieldsForStatistics?.split(",")[0]?.trim();
129
+ const build = (subset, groupValue) => {
130
+ const attributes = {};
131
+ if (groupField && groupValue !== undefined) {
132
+ attributes[groupField] = groupValue;
133
+ }
134
+ for (const stat of stats) {
135
+ attributes[stat.outStatisticFieldName] = aggregate(subset, stat.statisticType, stat.onStatisticField);
136
+ }
137
+ return { attributes };
138
+ };
139
+ if (!groupField) {
140
+ return { features: [build(rows)] };
141
+ }
142
+ const groups = new Map();
143
+ for (const row of rows) {
144
+ const key = fieldValue(row, groupField) ?? "";
145
+ const bucket = groups.get(key) ?? [];
146
+ bucket.push(row);
147
+ groups.set(key, bucket);
148
+ }
149
+ const features = [...groups.entries()].map(([value, subset]) => build(subset, value));
150
+ return { features };
151
+ }
152
+ function projectAttributes(row, outFields) {
153
+ if (outFields === undefined || outFields === "*" || (Array.isArray(outFields) && outFields.length === 0)) {
154
+ return { ...row };
155
+ }
156
+ const requested = Array.isArray(outFields) ? outFields : outFields.split(",").map((f) => f.trim());
157
+ const attributes = {};
158
+ for (const field of requested) {
159
+ const value = fieldValue(row, field);
160
+ if (value !== undefined) {
161
+ attributes[field] = value;
162
+ }
163
+ }
164
+ return attributes;
165
+ }
166
+ /** Build the offline platform-free fixture client (a plain public FeatureServer). */
167
+ export function createStandaloneFixtureClient() {
168
+ const client = {
169
+ serverBaseUrl: "https://services.arcgis.com",
170
+ async listServices() {
171
+ return { services: [{ name: CENSUS_SERVICE_ID, type: "FeatureServer" }] };
172
+ },
173
+ async getFeatureServiceMetadata(_serviceId) {
174
+ return {
175
+ serviceDescription: "US Census 2020 apportionment (public Esri Living Atlas FeatureServer)",
176
+ layers: [{ id: 0, name: CENSUS_LAYER_NAME }],
177
+ spatialReference: SPATIAL_REFERENCE,
178
+ };
179
+ },
180
+ async getLayerMetadata(_serviceId, _layerId) {
181
+ return {
182
+ id: 0,
183
+ name: CENSUS_LAYER_NAME,
184
+ description: "One row per state (plus DC and Puerto Rico) with 2020 population and apportioned House seats.",
185
+ geometryType: "esriGeometryPolygon",
186
+ fields: CENSUS_FIELDS.map((f) => ({ ...f })),
187
+ extent: CENSUS_EXTENT,
188
+ spatialReference: SPATIAL_REFERENCE,
189
+ relationships: [],
190
+ };
191
+ },
192
+ async queryFeatures(request = {}) {
193
+ const rows = filterRows(request.where);
194
+ const extra = request.extraParams ?? {};
195
+ if (extra.returnCountOnly === true) {
196
+ return { count: rows.length };
197
+ }
198
+ if (extra.returnExtentOnly === true) {
199
+ return { count: rows.length, extent: CENSUS_EXTENT };
200
+ }
201
+ if (request.outStatistics && request.outStatistics.length > 0) {
202
+ return computeStatistics(rows, request);
203
+ }
204
+ const ordered = request.orderByFields ? orderRows(rows, request.orderByFields) : rows;
205
+ const offset = request.resultOffset ?? 0;
206
+ const limit = request.resultRecordCount ?? ordered.length;
207
+ const page = ordered.slice(offset, offset + limit);
208
+ return {
209
+ objectIdFieldName: "OBJECTID",
210
+ geometryType: "esriGeometryPolygon",
211
+ spatialReference: SPATIAL_REFERENCE,
212
+ features: page.map((row) => ({ attributes: projectAttributes(row, request.outFields) })),
213
+ exceededTransferLimit: false,
214
+ };
215
+ },
216
+ // No Honua-only surface: the OGC API - Styles probe always 404s so the
217
+ // capability-degradation path is exercised against a real plain endpoint.
218
+ async pipelineFetch(_method, _path) {
219
+ return new Response(JSON.stringify({ error: { code: 404, message: "not found" } }), {
220
+ status: 404,
221
+ headers: { "Content-Type": "application/json" },
222
+ });
223
+ },
224
+ };
225
+ return client;
226
+ }
@@ -0,0 +1,125 @@
1
+ import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
+ import { type AuthMode, type SuiteProvenance } from "../provenance.js";
3
+ import { AUTH_ERROR_CODES } from "./contracts.js";
4
+ import type { CertTargetMode } from "./target.js";
5
+ /** Per-tool certification record (machine-readable). */
6
+ export interface ToolCertification {
7
+ name: string;
8
+ discovered: true;
9
+ /** inputSchema is structurally valid JSON Schema (draft 2020-12 dialect). */
10
+ schemaValid: boolean;
11
+ /** Whether the server advertises a structured-output schema for this tool. */
12
+ hasOutputSchema: boolean;
13
+ /** Matched standard tool (by referenceToolName / alias), if any. */
14
+ standardName: string | null;
15
+ /** Conformant to the matched standard schema. `null` when no standard match. */
16
+ conformant: boolean | null;
17
+ /** Server-advertised read-only hint; round-trip only runs for read-only tools. */
18
+ readOnly: boolean;
19
+ /** Round-trip outcome. `skipped` when not read-only or no fixture input. */
20
+ roundTrip: "passed" | "failed" | "skipped";
21
+ /** Whether structuredContent validated against the advertised outputSchema. `null` when not exercised. */
22
+ structuredOutputValidated: boolean | null;
23
+ errors: string[];
24
+ notes: string[];
25
+ }
26
+ /** Per-resource certification record. */
27
+ export interface ResourceCertification {
28
+ name: string;
29
+ uri: string;
30
+ discovered: true;
31
+ }
32
+ /** A standard capability advertised by the spec but not implemented here. */
33
+ export interface KnownGap {
34
+ kind: "standard-tool" | "advertised-tool";
35
+ name: string;
36
+ family?: string;
37
+ detail: string;
38
+ }
39
+ /** A cross-cutting contract check against the certified surface. */
40
+ export interface ContractCheck {
41
+ contract: "output-schema" | "error-shape" | "auth-unauthenticated" | "list-pagination" | "query-pagination" | "mutating-round-trip" | "mutating-permission-denied" | "async-job-lifecycle";
42
+ target: string;
43
+ status: "passed" | "failed" | "skipped";
44
+ detail: string;
45
+ }
46
+ export interface CertificationReport {
47
+ schemaVersion: 2;
48
+ generatedAt: string;
49
+ server: {
50
+ name: string;
51
+ version: string;
52
+ };
53
+ protocol: {
54
+ mcpTransport: string;
55
+ honuaTransport: string | null;
56
+ backend: "mock-upstream" | "live";
57
+ targetMode: CertTargetMode;
58
+ surface: string;
59
+ };
60
+ standard: {
61
+ source: string;
62
+ indexDate: string;
63
+ dialect: string;
64
+ };
65
+ /** Self-proving provenance: what was certified, with which suite, how authed. */
66
+ provenance: SuiteProvenance;
67
+ summary: {
68
+ pass: boolean;
69
+ toolsDiscovered: number;
70
+ toolsSchemaValid: number;
71
+ toolsConformanceChecked: number;
72
+ toolsConformant: number;
73
+ toolsRoundTripped: number;
74
+ toolsOutputValidated: number;
75
+ resourcesDiscovered: number;
76
+ promptsDiscovered: number;
77
+ contractsChecked: number;
78
+ contractsPassed: number;
79
+ contractsFailed: number;
80
+ contractsSkipped: number;
81
+ knownGaps: number;
82
+ failures: number;
83
+ };
84
+ tools: ToolCertification[];
85
+ resources: ResourceCertification[];
86
+ prompts: {
87
+ name: string;
88
+ discovered: true;
89
+ }[];
90
+ contracts: ContractCheck[];
91
+ knownGaps: KnownGap[];
92
+ }
93
+ export interface CertifyOptions {
94
+ /** Authenticated, connected MCP client to certify. */
95
+ client: Client;
96
+ /** Which target the client is connected to. */
97
+ targetMode: CertTargetMode;
98
+ /** Backend behind the surface (mock upstream or a live server). */
99
+ backend: "mock-upstream" | "live";
100
+ /** Human-readable label of the certified surface. */
101
+ surface: string;
102
+ /** Logical Honua backend transport for the artifact, if known. */
103
+ honuaTransport?: string | null;
104
+ /** Open a fresh, unauthenticated client for the auth contract (optional). */
105
+ connectUnauthenticated?: (() => Promise<Client>) | undefined;
106
+ /** How the authenticated client reached the surface (recorded in provenance). */
107
+ authMode?: AuthMode;
108
+ /** Environment used to resolve round-trip identifiers. */
109
+ env?: NodeJS.ProcessEnv;
110
+ }
111
+ /** Determine whether a discovered tool is safe to round-trip (read-only). */
112
+ export declare function isReadOnlyTool(tool: {
113
+ name: string;
114
+ annotations?: {
115
+ readOnlyHint?: boolean;
116
+ };
117
+ }): boolean;
118
+ /**
119
+ * Connect an MCP client to the certified surface and produce a deterministic
120
+ * certification report. The client is already connected (offline mock upstream,
121
+ * a live `/mcp`, or the stdio proxy); certify never owns its lifecycle.
122
+ */
123
+ export declare function certify(options: CertifyOptions): Promise<CertificationReport>;
124
+ export { AUTH_ERROR_CODES };
125
+ //# sourceMappingURL=certifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"certifier.d.ts","sourceRoot":"","sources":["../../../src/certification/certifier.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACxE,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EAGrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,gBAAgB,EAMjB,MAAM,gBAAgB,CAAC;AAYxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wDAAwD;AACxD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,UA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