@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,28 @@
1
+ import { type EvalReport } from "./report.js";
2
+ import type { ModelDriver, Scenario } from "./types.js";
3
+ /**
4
+ * Cross-model eval runner (honua-server #1956).
5
+ *
6
+ * Backend selection mirrors the certifier: offline-first and deterministic.
7
+ * - HONUA_MCP_REMOTE_URL set → drive the live remote /mcp over streamable HTTP
8
+ * (the same surface the stdio proxy bridges).
9
+ * - otherwise → the offline in-memory fixture server (no network, no models).
10
+ *
11
+ * Drivers default to whatever `resolveDrivers` returns: the deterministic control
12
+ * always, plus Claude/GPT when their API keys are present.
13
+ */
14
+ export interface RunEvalOptions {
15
+ env?: NodeJS.ProcessEnv;
16
+ drivers?: ModelDriver[];
17
+ corpus?: Scenario[];
18
+ /** Force the in-memory fixture surface even if HONUA_MCP_REMOTE_URL is set. */
19
+ forceOffline?: boolean;
20
+ /**
21
+ * Use the PLATFORM-FREE standalone fixture surface (a plain public FeatureServer,
22
+ * recorded census layer) instead of the Honua operator fixture. Implies offline.
23
+ * Defaults to true when `HONUA_EVAL_CORPUS=standalone`.
24
+ */
25
+ forceStandaloneSurface?: boolean;
26
+ }
27
+ export declare function runEval(options?: RunEvalOptions): Promise<EvalReport>;
28
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/eval/runner.ts"],"names":[],"mappings":"AAUA,OAAO,EAAiB,KAAK,UAAU,EAAkB,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAmC,MAAM,YAAY,CAAC;AAEzF;;;;;;;;;;GAUG;AAEH,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC;IACpB,+EAA+E;IAC/E,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AA+FD,wBAAsB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,UAAU,CAAC,CAiD/E"}
@@ -0,0 +1,130 @@
1
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2
+ import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
3
+ import { createStandaloneFixtureClient } from "../certification/census-fixture-client.js";
4
+ import { createFixtureClient } from "../certification/fixture-client.js";
5
+ import { createServer } from "../index.js";
6
+ import { readNegotiatedProtocolVersion, resolveSuiteGitSha } from "../provenance.js";
7
+ import { connectUpstream, resolveProxyOptions } from "../proxy.js";
8
+ import { isStandaloneCorpus, resolveCorpus } from "./corpus.js";
9
+ import { resolveDrivers } from "./drivers/index.js";
10
+ import { grade } from "./grade.js";
11
+ import { assembleReport } from "./report.js";
12
+ /** Truthy-flag parse shared with the driver opt-ins (0/false/no/off ⇒ false). */
13
+ function isTruthy(value) {
14
+ if (typeof value !== "string") {
15
+ return false;
16
+ }
17
+ const v = value.trim().toLowerCase();
18
+ return v.length > 0 && v !== "0" && v !== "false" && v !== "no" && v !== "off";
19
+ }
20
+ async function connectSurface(env, forceOffline, standalone) {
21
+ const live = !forceOffline && !standalone && typeof env.HONUA_MCP_REMOTE_URL === "string" && env.HONUA_MCP_REMOTE_URL.length > 0;
22
+ if (live) {
23
+ const options = resolveProxyOptions(env);
24
+ // The live lane authenticates via the proxy's real credential headers — no
25
+ // dev-auth bypass. `Bearer` takes precedence over `x-api-key`; anonymous means
26
+ // no credential was supplied at all.
27
+ const auth = options.authToken ? "bearer" : options.apiKey ? "api-key" : "anonymous";
28
+ if (auth === "anonymous" && isTruthy(env.HONUA_EVAL_REQUIRE_AUTH)) {
29
+ throw new Error("HONUA_EVAL_REQUIRE_AUTH is set but the live MCP surface would be reached anonymously " +
30
+ "(no HONUA_MCP_AUTH_TOKEN / HONUA_API_KEY). Refusing to run an unauthenticated live eval.");
31
+ }
32
+ const client = await connectUpstream(options);
33
+ return {
34
+ client,
35
+ backend: "live",
36
+ mcpTransport: "streamable-http",
37
+ remoteUrl: options.remoteUrl,
38
+ auth,
39
+ close: async () => {
40
+ await client.close().catch(() => { });
41
+ },
42
+ };
43
+ }
44
+ const fixtureClient = standalone ? createStandaloneFixtureClient() : createFixtureClient();
45
+ const server = createServer(fixtureClient);
46
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
47
+ const client = new Client({ name: "honua-mcp-eval", version: "1.0.0" });
48
+ await server.connect(serverTransport);
49
+ await client.connect(clientTransport);
50
+ return {
51
+ client,
52
+ backend: "fixture",
53
+ mcpTransport: standalone ? "in-memory (standalone FeatureServer fixture)" : "in-memory",
54
+ auth: "none",
55
+ close: async () => {
56
+ await client.close().catch(() => { });
57
+ await server.close().catch(() => { });
58
+ },
59
+ };
60
+ }
61
+ function flattenToolResult(result) {
62
+ const r = result;
63
+ const isError = r.isError === true;
64
+ const texts = (r.content ?? [])
65
+ .filter((b) => b.type === "text" && typeof b.text === "string")
66
+ .map((b) => b.text);
67
+ const text = texts.length > 0 ? texts.join("\n") : JSON.stringify(r.content ?? result);
68
+ return { isError, text };
69
+ }
70
+ function buildContext(client, tools) {
71
+ return {
72
+ tools,
73
+ async callTool(name, args) {
74
+ try {
75
+ const result = await client.callTool({ name, arguments: args });
76
+ return flattenToolResult(result);
77
+ }
78
+ catch (err) {
79
+ return { isError: true, text: err instanceof Error ? err.message : String(err) };
80
+ }
81
+ },
82
+ };
83
+ }
84
+ export async function runEval(options = {}) {
85
+ const env = options.env ?? process.env;
86
+ const corpus = options.corpus ?? resolveCorpus(env);
87
+ const drivers = options.drivers ?? resolveDrivers({ env });
88
+ const standalone = options.forceStandaloneSurface ?? isStandaloneCorpus(env);
89
+ const forceOffline = options.forceOffline ?? standalone;
90
+ const surface = await connectSurface(env, forceOffline, standalone);
91
+ try {
92
+ const listed = await surface.client.listTools();
93
+ const tools = listed.tools.map((t) => ({
94
+ name: t.name,
95
+ description: t.description ?? "",
96
+ inputSchema: t.inputSchema,
97
+ }));
98
+ const ctx = buildContext(surface.client, tools);
99
+ const graded = [];
100
+ for (const driver of drivers) {
101
+ for (const scenario of corpus) {
102
+ const transcript = await driver.runWorkflow(scenario, ctx);
103
+ graded.push({ grade: grade(scenario, transcript), transcript });
104
+ }
105
+ }
106
+ const gitSha = resolveSuiteGitSha(env);
107
+ const provenance = {
108
+ suiteGitSha: gitSha.sha,
109
+ suiteGitShaSource: gitSha.source,
110
+ targetUrl: surface.remoteUrl ?? `${surface.backend} (${surface.mcpTransport})`,
111
+ protocolVersion: readNegotiatedProtocolVersion(surface.client),
112
+ toolCount: tools.length,
113
+ authMode: surface.auth,
114
+ };
115
+ return assembleReport({
116
+ backend: surface.backend,
117
+ mcpTransport: surface.mcpTransport,
118
+ remoteUrl: surface.remoteUrl,
119
+ auth: surface.auth,
120
+ provenance,
121
+ advertisedTools: tools.map((t) => t.name),
122
+ corpus,
123
+ drivers,
124
+ graded,
125
+ });
126
+ }
127
+ finally {
128
+ await surface.close();
129
+ }
130
+ }
@@ -0,0 +1,3 @@
1
+ import type { Scenario } from "./types.js";
2
+ export declare const STANDALONE_CORPUS: Scenario[];
3
+ //# sourceMappingURL=standalone-corpus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standalone-corpus.d.ts","sourceRoot":"","sources":["../../../src/eval/standalone-corpus.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAgC3C,eAAO,MAAM,iBAAiB,EAAE,QAAQ,EA2qBvC,CAAC"}