@honua/mcp-server 0.0.10-alpha.0 → 0.0.20-alpha.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.
- package/README.md +167 -0
- package/certification/geospatial-mcp-schemas/PROVENANCE.md +33 -0
- package/certification/geospatial-mcp-schemas/README.md +90 -0
- package/certification/geospatial-mcp-schemas/common/geoprocessing-error.schema.json +45 -0
- package/certification/geospatial-mcp-schemas/conformance/manifest.schema.json +73 -0
- package/certification/geospatial-mcp-schemas/index.json +311 -0
- package/certification/geospatial-mcp-schemas/resources/app-package.schema.json +20 -0
- package/certification/geospatial-mcp-schemas/resources/app-template.schema.json +15 -0
- package/certification/geospatial-mcp-schemas/resources/artifact.schema.json +69 -0
- package/certification/geospatial-mcp-schemas/resources/deployment.schema.json +27 -0
- package/certification/geospatial-mcp-schemas/resources/map-package.schema.json +21 -0
- package/certification/geospatial-mcp-schemas/resources/map-template.schema.json +15 -0
- package/certification/geospatial-mcp-schemas/resources/provenance.schema.json +50 -0
- package/certification/geospatial-mcp-schemas/resources/published-service.schema.json +21 -0
- package/certification/geospatial-mcp-schemas/resources/result-package.schema.json +64 -0
- package/certification/geospatial-mcp-schemas/resources/style.schema.json +12 -0
- package/certification/geospatial-mcp-schemas/resources/theme.schema.json +12 -0
- package/certification/geospatial-mcp-schemas/resources/workspace.schema.json +63 -0
- package/certification/geospatial-mcp-schemas/tools/apply_style_preset.schema.json +23 -0
- package/certification/geospatial-mcp-schemas/tools/cancel_job.schema.json +15 -0
- package/certification/geospatial-mcp-schemas/tools/clarify_intent.schema.json +69 -0
- package/certification/geospatial-mcp-schemas/tools/compose_mixed_protocol_map.schema.json +21 -0
- package/certification/geospatial-mcp-schemas/tools/create_app_package.schema.json +33 -0
- package/certification/geospatial-mcp-schemas/tools/create_map_package.schema.json +41 -0
- package/certification/geospatial-mcp-schemas/tools/execute_plan.schema.json +64 -0
- package/certification/geospatial-mcp-schemas/tools/geocode_address.schema.json +36 -0
- package/certification/geospatial-mcp-schemas/tools/get_style.schema.json +30 -0
- package/certification/geospatial-mcp-schemas/tools/ground_candidates.schema.json +66 -0
- package/certification/geospatial-mcp-schemas/tools/list_capabilities.schema.json +21 -0
- package/certification/geospatial-mcp-schemas/tools/list_layers.schema.json +14 -0
- package/certification/geospatial-mcp-schemas/tools/plan_analysis.schema.json +19 -0
- package/certification/geospatial-mcp-schemas/tools/preview_app_package.schema.json +15 -0
- package/certification/geospatial-mcp-schemas/tools/preview_map_package.schema.json +17 -0
- package/certification/geospatial-mcp-schemas/tools/preview_package.schema.json +40 -0
- package/certification/geospatial-mcp-schemas/tools/propose_operation.schema.json +28 -0
- package/certification/geospatial-mcp-schemas/tools/publish_result.schema.json +29 -0
- package/certification/geospatial-mcp-schemas/tools/publish_service.schema.json +59 -0
- package/certification/geospatial-mcp-schemas/tools/query_features.schema.json +54 -0
- package/certification/geospatial-mcp-schemas/tools/refine_map_package.schema.json +22 -0
- package/certification/geospatial-mcp-schemas/tools/render_map.schema.json +55 -0
- package/certification/geospatial-mcp-schemas/tools/resolve_entity.schema.json +30 -0
- package/certification/geospatial-mcp-schemas/tools/solve_route.schema.json +39 -0
- package/certification/geospatial-mcp-schemas/tools/validate_package.schema.json +35 -0
- package/certification/geospatial-mcp-schemas/tools/validate_plan.schema.json +61 -0
- package/dist/src/certification/certifier.d.ts +119 -0
- package/dist/src/certification/certifier.d.ts.map +1 -0
- package/dist/src/certification/certifier.js +410 -0
- package/dist/src/certification/cli.d.ts +3 -0
- package/dist/src/certification/cli.d.ts.map +1 -0
- package/dist/src/certification/cli.js +48 -0
- package/dist/src/certification/contracts.d.ts +62 -0
- package/dist/src/certification/contracts.d.ts.map +1 -0
- package/dist/src/certification/contracts.js +174 -0
- package/dist/src/certification/fixture-client.d.ts +4 -0
- package/dist/src/certification/fixture-client.d.ts.map +1 -0
- package/dist/src/certification/fixture-client.js +113 -0
- package/dist/src/certification/fixtures.d.ts +32 -0
- package/dist/src/certification/fixtures.d.ts.map +1 -0
- package/dist/src/certification/fixtures.js +64 -0
- package/dist/src/certification/json-schema.d.ts +49 -0
- package/dist/src/certification/json-schema.d.ts.map +1 -0
- package/dist/src/certification/json-schema.js +164 -0
- package/dist/src/certification/mock-upstream.d.ts +29 -0
- package/dist/src/certification/mock-upstream.d.ts.map +1 -0
- package/dist/src/certification/mock-upstream.js +96 -0
- package/dist/src/certification/operator-catalog.d.ts +82 -0
- package/dist/src/certification/operator-catalog.d.ts.map +1 -0
- package/dist/src/certification/operator-catalog.js +466 -0
- package/dist/src/certification/report.d.ts +4 -0
- package/dist/src/certification/report.d.ts.map +1 -0
- package/dist/src/certification/report.js +90 -0
- package/dist/src/certification/run.d.ts +28 -0
- package/dist/src/certification/run.d.ts.map +1 -0
- package/dist/src/certification/run.js +31 -0
- package/dist/src/certification/schema-index.d.ts +69 -0
- package/dist/src/certification/schema-index.d.ts.map +1 -0
- package/dist/src/certification/schema-index.js +82 -0
- package/dist/src/certification/target.d.ts +40 -0
- package/dist/src/certification/target.d.ts.map +1 -0
- package/dist/src/certification/target.js +167 -0
- package/dist/src/eval/cli.d.ts +3 -0
- package/dist/src/eval/cli.d.ts.map +1 -0
- package/dist/src/eval/cli.js +116 -0
- package/dist/src/eval/corpus.d.ts +27 -0
- package/dist/src/eval/corpus.d.ts.map +1 -0
- package/dist/src/eval/corpus.js +134 -0
- package/dist/src/eval/drivers/anthropic.d.ts +14 -0
- package/dist/src/eval/drivers/anthropic.d.ts.map +1 -0
- package/dist/src/eval/drivers/anthropic.js +120 -0
- package/dist/src/eval/drivers/bedrock.d.ts +54 -0
- package/dist/src/eval/drivers/bedrock.d.ts.map +1 -0
- package/dist/src/eval/drivers/bedrock.js +178 -0
- package/dist/src/eval/drivers/deterministic.d.ts +17 -0
- package/dist/src/eval/drivers/deterministic.d.ts.map +1 -0
- package/dist/src/eval/drivers/deterministic.js +51 -0
- package/dist/src/eval/drivers/index.d.ts +34 -0
- package/dist/src/eval/drivers/index.d.ts.map +1 -0
- package/dist/src/eval/drivers/index.js +74 -0
- package/dist/src/eval/drivers/openai.d.ts +14 -0
- package/dist/src/eval/drivers/openai.d.ts.map +1 -0
- package/dist/src/eval/drivers/openai.js +136 -0
- package/dist/src/eval/grade.d.ts +14 -0
- package/dist/src/eval/grade.d.ts.map +1 -0
- package/dist/src/eval/grade.js +56 -0
- package/dist/src/eval/northstar-corpus.d.ts +3 -0
- package/dist/src/eval/northstar-corpus.d.ts.map +1 -0
- package/dist/src/eval/northstar-corpus.js +194 -0
- package/dist/src/eval/operator-corpus.d.ts +3 -0
- package/dist/src/eval/operator-corpus.d.ts.map +1 -0
- package/dist/src/eval/operator-corpus.js +193 -0
- package/dist/src/eval/report.d.ts +104 -0
- package/dist/src/eval/report.d.ts.map +1 -0
- package/dist/src/eval/report.js +130 -0
- package/dist/src/eval/runner.d.ts +22 -0
- package/dist/src/eval/runner.d.ts.map +1 -0
- package/dist/src/eval/runner.js +116 -0
- package/dist/src/eval/types.d.ts +93 -0
- package/dist/src/eval/types.d.ts.map +1 -0
- package/dist/src/eval/types.js +10 -0
- package/dist/src/helpers.d.ts +11 -0
- package/dist/src/helpers.d.ts.map +1 -1
- package/dist/src/helpers.js +22 -0
- package/dist/src/index.d.ts +7 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +30 -4
- package/dist/src/proxy.d.ts +46 -0
- package/dist/src/proxy.d.ts.map +1 -0
- package/dist/src/proxy.js +124 -0
- package/dist/src/resources/styles.d.ts +29 -0
- package/dist/src/resources/styles.d.ts.map +1 -0
- package/dist/src/resources/styles.js +43 -0
- package/dist/src/styles.d.ts +110 -0
- package/dist/src/styles.d.ts.map +1 -0
- package/dist/src/styles.js +118 -0
- package/dist/src/tools/apply-style-preset.d.ts +27 -0
- package/dist/src/tools/apply-style-preset.d.ts.map +1 -0
- package/dist/src/tools/apply-style-preset.js +29 -0
- package/dist/src/tools/count-features.d.ts.map +1 -1
- package/dist/src/tools/count-features.js +5 -4
- package/dist/src/tools/get-extent.d.ts.map +1 -1
- package/dist/src/tools/get-extent.js +6 -4
- package/dist/src/tools/get-style.d.ts +24 -0
- package/dist/src/tools/get-style.d.ts.map +1 -0
- package/dist/src/tools/get-style.js +28 -0
- package/dist/src/tools/query-features.d.ts.map +1 -1
- package/dist/src/tools/query-features.js +4 -1
- package/package.json +19 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/eval/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,4DAA4D;AAC5D,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,sEAAsE;AACtE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAChF;AAED,kEAAkE;AAClE,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,+CAA+C;AAC/C,MAAM,WAAW,kBAAkB;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,sBAAsB,EAAE,OAAO,CAAC;IAChC,8EAA8E;IAC9E,UAAU,EAAE,MAAM,CAAC;IACnB,oEAAoE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GAAG,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CACpF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-model MCP workflow eval — shared types (honua-server #1956, WS-H).
|
|
3
|
+
*
|
|
4
|
+
* The eval proves the north-star claim "any client → any workflow": a held-out
|
|
5
|
+
* corpus of GIS workflows is driven through the honua MCP surface by DIFFERENT
|
|
6
|
+
* client LLMs (Claude AND a GPT model), and end-to-end success / clarification /
|
|
7
|
+
* edit rates are recorded per model. A deterministic (scripted) driver provides
|
|
8
|
+
* an offline control that runs in CI with no model/API calls.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
package/dist/src/helpers.d.ts
CHANGED
|
@@ -10,6 +10,17 @@ export declare function jsonText(result: unknown): {
|
|
|
10
10
|
}>;
|
|
11
11
|
};
|
|
12
12
|
export declare function metadataErrorText(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Coerce a feature `count` from a query response into a usable value.
|
|
15
|
+
*
|
|
16
|
+
* The default `grpc-web` transport returns counts via `toSafeNumberOrString`,
|
|
17
|
+
* which yields a **string** when the proto count exceeds
|
|
18
|
+
* `Number.MAX_SAFE_INTEGER` (chosen specifically to avoid precision loss). Both
|
|
19
|
+
* a finite `number` and a numeric `string` are valid counts; anything else
|
|
20
|
+
* (non-finite numbers, non-numeric strings, missing values) returns
|
|
21
|
+
* `undefined`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function coerceCount(value: unknown): number | string | undefined;
|
|
13
24
|
export declare function encodeServiceId(serviceId: string): string;
|
|
14
25
|
export declare function decodeServiceId(encoded: string): string;
|
|
15
26
|
export declare function parseLayerId(value: string): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAMtE,eAAO,M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GAAG,SAAS,GAAG,cAAc,GAAG,SAAS,CAKjF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAG5D;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,YAAY,EAAE,gBAAgB,GAAG,SAAS,GACzC,gBAAgB,GAAG,SAAS,CA8B9B;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAE5F;AAED,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAWvE;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAMvD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKlD;AAED,wBAAsB,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAC3C,KAAK,EAAE,SAAS,CAAC,EAAE,EACnB,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,GACzC,OAAO,CAAC,CAAC,EAAE,CAAC,CAqBd"}
|
package/dist/src/helpers.js
CHANGED
|
@@ -55,6 +55,28 @@ export function jsonText(result) {
|
|
|
55
55
|
export function metadataErrorText() {
|
|
56
56
|
return METADATA_ERROR_MESSAGE;
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* Coerce a feature `count` from a query response into a usable value.
|
|
60
|
+
*
|
|
61
|
+
* The default `grpc-web` transport returns counts via `toSafeNumberOrString`,
|
|
62
|
+
* which yields a **string** when the proto count exceeds
|
|
63
|
+
* `Number.MAX_SAFE_INTEGER` (chosen specifically to avoid precision loss). Both
|
|
64
|
+
* a finite `number` and a numeric `string` are valid counts; anything else
|
|
65
|
+
* (non-finite numbers, non-numeric strings, missing values) returns
|
|
66
|
+
* `undefined`.
|
|
67
|
+
*/
|
|
68
|
+
export function coerceCount(value) {
|
|
69
|
+
if (typeof value === "number") {
|
|
70
|
+
return Number.isFinite(value) ? value : undefined;
|
|
71
|
+
}
|
|
72
|
+
if (typeof value === "string") {
|
|
73
|
+
// Accept canonical base-10 integer strings (optionally signed). These are
|
|
74
|
+
// the large-count representation the grpc adapter emits to preserve
|
|
75
|
+
// precision beyond Number.MAX_SAFE_INTEGER.
|
|
76
|
+
return /^-?\d+$/.test(value.trim()) ? value.trim() : undefined;
|
|
77
|
+
}
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
58
80
|
export function encodeServiceId(serviceId) {
|
|
59
81
|
return encodeURIComponent(serviceId);
|
|
60
82
|
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,5 +12,12 @@ export interface RuntimeOptions {
|
|
|
12
12
|
export declare const SERVER_VERSION: string;
|
|
13
13
|
export declare function resolveRuntimeOptions(env: NodeJS.ProcessEnv): RuntimeOptions;
|
|
14
14
|
export declare function createClientFromEnv(env?: NodeJS.ProcessEnv): HonuaClient;
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated Static, hand-maintained 9-tool MCP server. This is NO LONGER the
|
|
17
|
+
* product surface and is NOT on the certification trust path — the honua-server
|
|
18
|
+
* `/mcp` catalog is the source of truth, mirrored to stdio by `honua-mcp-proxy`
|
|
19
|
+
* (see {@link runProxy}). `createServer` is retained ONLY as a labeled offline
|
|
20
|
+
* test fixture (proxy parity harness). Do not ship it as the operator surface.
|
|
21
|
+
*/
|
|
15
22
|
export declare function createServer(client: HonuaClient): McpServer;
|
|
16
23
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAC;AAgBtF,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,SAAS,EAAE,cAAc,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;CACzB;AAMD,eAAO,MAAM,cAAc,QAAyB,CAAC;AA2DrD,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,cAAc,CAgD5E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,WAAW,CASrF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,aAyF/C"}
|
package/dist/src/index.js
CHANGED
|
@@ -6,10 +6,13 @@ import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mc
|
|
|
6
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
7
|
import * as layerSchemaResource from "./resources/layer-schema.js";
|
|
8
8
|
import * as servicesResource from "./resources/services.js";
|
|
9
|
+
import * as stylesResource from "./resources/styles.js";
|
|
10
|
+
import * as applyStylePreset from "./tools/apply-style-preset.js";
|
|
9
11
|
import * as countFeatures from "./tools/count-features.js";
|
|
10
12
|
import * as describeLayer from "./tools/describe-layer.js";
|
|
11
13
|
import * as explainCapabilityGap from "./tools/explain-capability-gap.js";
|
|
12
14
|
import * as getExtent from "./tools/get-extent.js";
|
|
15
|
+
import * as getStyle from "./tools/get-style.js";
|
|
13
16
|
import * as listServices from "./tools/list-services.js";
|
|
14
17
|
import * as queryFeatures from "./tools/query-features.js";
|
|
15
18
|
import * as statistics from "./tools/statistics.js";
|
|
@@ -113,6 +116,13 @@ export function createClientFromEnv(env = process.env) {
|
|
|
113
116
|
retry: options.retryMaxRetries > 0 ? { maxRetries: options.retryMaxRetries } : undefined,
|
|
114
117
|
});
|
|
115
118
|
}
|
|
119
|
+
/**
|
|
120
|
+
* @deprecated Static, hand-maintained 9-tool MCP server. This is NO LONGER the
|
|
121
|
+
* product surface and is NOT on the certification trust path — the honua-server
|
|
122
|
+
* `/mcp` catalog is the source of truth, mirrored to stdio by `honua-mcp-proxy`
|
|
123
|
+
* (see {@link runProxy}). `createServer` is retained ONLY as a labeled offline
|
|
124
|
+
* test fixture (proxy parity harness). Do not ship it as the operator surface.
|
|
125
|
+
*/
|
|
116
126
|
export function createServer(client) {
|
|
117
127
|
const server = new McpServer({
|
|
118
128
|
name: "honua",
|
|
@@ -126,16 +136,31 @@ export function createServer(client) {
|
|
|
126
136
|
server.tool("honua_get_extent", "Get the spatial bounding box of features matching a filter.", getExtent.schema.shape, async (args) => getExtent.execute(client, getExtent.schema.parse(args)));
|
|
127
137
|
server.tool("honua_statistics", "Compute aggregate statistics (count, sum, avg, min, max, stddev) on a field, optionally grouped.", statistics.schema.shape, async (args) => statistics.execute(client, statistics.schema.parse(args)));
|
|
128
138
|
server.tool("honua_explain_capability_gap", "Explain whether a Honua source/protocol supports a capability and suggest a safe fallback when it does not.", explainCapabilityGap.schema.shape, async (args) => explainCapabilityGap.execute(client, explainCapabilityGap.schema.parse(args)));
|
|
139
|
+
server.tool("honua_get_style", "Resolve a style from the server's OGC API – Styles surface. Pass styleId for the canonical StyleRef (style_id, title, encodings incl. inlined MapLibre); omit it to list available styles.", getStyle.schema.shape, async (args) => getStyle.execute(client, getStyle.schema.parse(args)));
|
|
140
|
+
server.tool("honua_apply_style_preset", "Resolve a style preset and its MapLibre stylesheet for client-side application. Read-only: returns the stylesheet to apply locally; it does not mutate server state.", applyStylePreset.schema.shape, async (args) => applyStylePreset.execute(client, applyStylePreset.schema.parse(args)));
|
|
129
141
|
// ── Resources ──────────────────────────────────────────────────
|
|
130
142
|
server.resource("services-catalog", servicesResource.uri, async (uri) => servicesResource.read(client));
|
|
131
143
|
server.resource("layer-schema", new ResourceTemplate(layerSchemaResource.uriTemplate, { list: undefined }), async (uri, params) => layerSchemaResource.read(client, params.encodedServiceId, params.layerId));
|
|
144
|
+
server.resource("styles-catalog", stylesResource.uri, async (uri) => stylesResource.readCatalog(client));
|
|
145
|
+
server.resource("style", new ResourceTemplate(stylesResource.uriTemplate, { list: undefined }), async (uri, params) => stylesResource.read(client, params.styleId));
|
|
132
146
|
return server;
|
|
133
147
|
}
|
|
148
|
+
/* v8 ignore start -- deprecated bin entry: delegates to the dynamic proxy at
|
|
149
|
+
runtime; the proxy's logic is unit-tested in proxy.test.ts. */
|
|
150
|
+
/**
|
|
151
|
+
* Deprecated `honua-mcp` bin entry.
|
|
152
|
+
*
|
|
153
|
+
* The static 9-tool server has been retired from the product/trust path. This
|
|
154
|
+
* bin now prints a deprecation notice and launches the dynamic proxy
|
|
155
|
+
* (`honua-mcp-proxy`), which mirrors the honua-server `/mcp` catalog. It
|
|
156
|
+
* therefore requires `HONUA_MCP_REMOTE_URL` (the remote `/mcp` endpoint) instead
|
|
157
|
+
* of the old `HONUA_BASE_URL`.
|
|
158
|
+
*/
|
|
134
159
|
async function main() {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
const
|
|
138
|
-
await
|
|
160
|
+
process.stderr.write("DEPRECATION: `honua-mcp` is deprecated and now proxies the honua-server /mcp catalog. " +
|
|
161
|
+
"Use `honua-mcp-proxy` directly. Set HONUA_MCP_REMOTE_URL to the remote /mcp endpoint.\n");
|
|
162
|
+
const { runProxy } = await import("./proxy.js");
|
|
163
|
+
await runProxy();
|
|
139
164
|
}
|
|
140
165
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
141
166
|
main().catch((err) => {
|
|
@@ -143,3 +168,4 @@ if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
|
143
168
|
process.exit(1);
|
|
144
169
|
});
|
|
145
170
|
}
|
|
171
|
+
/* v8 ignore stop */
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
4
|
+
/**
|
|
5
|
+
* Transport-symmetric stdio proxy for the honua MCP surface (honua-server #1950).
|
|
6
|
+
*
|
|
7
|
+
* The honua server exposes a single MCP catalog over streamable-HTTP/SSE at
|
|
8
|
+
* `/mcp`. Claude-Desktop-style clients speak stdio. Rather than reimplementing
|
|
9
|
+
* the tool/resource catalog (the older `@honua/mcp-server` discovery surface did
|
|
10
|
+
* exactly that, which is how the two halves drifted apart), this proxy bridges a
|
|
11
|
+
* local stdio MCP client to the remote HTTP-SSE MCP server: it connects upstream
|
|
12
|
+
* as an MCP client, then re-exposes the *same* catalog downstream over stdio.
|
|
13
|
+
*
|
|
14
|
+
* Because every request and notification is forwarded verbatim, the stdio
|
|
15
|
+
* surface is transport-symmetric with the HTTP-SSE surface by construction —
|
|
16
|
+
* identical tools, identical input/output schemas, identical resources and
|
|
17
|
+
* prompts, and live `list_changed` notifications. There is one source-of-truth
|
|
18
|
+
* catalog (the server's `/mcp`); the SDK proxies it.
|
|
19
|
+
*/
|
|
20
|
+
export interface ProxyOptions {
|
|
21
|
+
/** Absolute URL of the remote honua MCP endpoint (e.g. https://demo.honua.io/mcp). */
|
|
22
|
+
remoteUrl: string;
|
|
23
|
+
/** Optional bearer token for the remote MCP surface. */
|
|
24
|
+
authToken?: string | undefined;
|
|
25
|
+
/** Optional API key (sent as x-api-key) for deployments that require it. */
|
|
26
|
+
apiKey?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export declare function resolveProxyOptions(env?: NodeJS.ProcessEnv): ProxyOptions;
|
|
29
|
+
/** Build request headers for the upstream connection from the resolved options. */
|
|
30
|
+
export declare function buildUpstreamHeaders(options: ProxyOptions): Record<string, string>;
|
|
31
|
+
/** Connect an upstream MCP client to the remote honua /mcp over streamable HTTP. */
|
|
32
|
+
export declare function connectUpstream(options: ProxyOptions): Promise<Client>;
|
|
33
|
+
/**
|
|
34
|
+
* Build a low-level MCP server that forwards every request and `list_changed`
|
|
35
|
+
* notification to the already-connected upstream client. The proxy advertises
|
|
36
|
+
* exactly the upstream's name, version, and capabilities, so the downstream
|
|
37
|
+
* (stdio) surface mirrors the upstream (HTTP-SSE) surface.
|
|
38
|
+
*/
|
|
39
|
+
export declare function createProxyServer(upstream: Client): Server;
|
|
40
|
+
/**
|
|
41
|
+
* Run the stdio proxy end-to-end: resolve the remote `/mcp` from the
|
|
42
|
+
* environment, connect upstream, and expose the mirrored catalog over stdio.
|
|
43
|
+
* Also used by the deprecated `honua-mcp` bin, which now delegates here.
|
|
44
|
+
*/
|
|
45
|
+
export declare function runProxy(env?: NodeJS.ProcessEnv): Promise<void>;
|
|
46
|
+
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/proxy.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAiBnE;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,YAAY;IAC3B,sFAAsF;IACtF,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,4EAA4E;IAC5E,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7B;AAED,wBAAgB,mBAAmB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,YAAY,CAqBtF;AAED,mFAAmF;AACnF,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASlF;AAED,oFAAoF;AACpF,wBAAsB,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ5E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA+C1D;AAOD;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBlF"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
5
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
6
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
|
+
import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListResourceTemplatesRequestSchema, ListResourcesRequestSchema, ListToolsRequestSchema, PromptListChangedNotificationSchema, ReadResourceRequestSchema, ResourceListChangedNotificationSchema, ToolListChangedNotificationSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
8
|
+
import { SERVER_VERSION } from "./index.js";
|
|
9
|
+
export function resolveProxyOptions(env = process.env) {
|
|
10
|
+
const remoteUrl = env.HONUA_MCP_REMOTE_URL ?? env.HONUA_MCP_URL;
|
|
11
|
+
if (!remoteUrl) {
|
|
12
|
+
throw new Error("HONUA_MCP_REMOTE_URL environment variable is required (the remote honua /mcp endpoint to proxy).");
|
|
13
|
+
}
|
|
14
|
+
let parsed;
|
|
15
|
+
try {
|
|
16
|
+
parsed = new URL(remoteUrl);
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
throw new Error(`HONUA_MCP_REMOTE_URL must be a valid absolute URL: ${remoteUrl}`);
|
|
20
|
+
}
|
|
21
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") {
|
|
22
|
+
throw new Error(`HONUA_MCP_REMOTE_URL must use http or https: ${remoteUrl}`);
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
remoteUrl: parsed.toString(),
|
|
26
|
+
authToken: env.HONUA_MCP_AUTH_TOKEN,
|
|
27
|
+
apiKey: env.HONUA_API_KEY,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Build request headers for the upstream connection from the resolved options. */
|
|
31
|
+
export function buildUpstreamHeaders(options) {
|
|
32
|
+
const headers = {};
|
|
33
|
+
if (options.authToken) {
|
|
34
|
+
headers.Authorization = `Bearer ${options.authToken}`;
|
|
35
|
+
}
|
|
36
|
+
if (options.apiKey) {
|
|
37
|
+
headers["x-api-key"] = options.apiKey;
|
|
38
|
+
}
|
|
39
|
+
return headers;
|
|
40
|
+
}
|
|
41
|
+
/** Connect an upstream MCP client to the remote honua /mcp over streamable HTTP. */
|
|
42
|
+
export async function connectUpstream(options) {
|
|
43
|
+
const headers = buildUpstreamHeaders(options);
|
|
44
|
+
const transport = new StreamableHTTPClientTransport(new URL(options.remoteUrl), {
|
|
45
|
+
requestInit: Object.keys(headers).length > 0 ? { headers } : undefined,
|
|
46
|
+
});
|
|
47
|
+
const client = new Client({ name: "honua-mcp-stdio-proxy", version: SERVER_VERSION });
|
|
48
|
+
await client.connect(transport);
|
|
49
|
+
return client;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a low-level MCP server that forwards every request and `list_changed`
|
|
53
|
+
* notification to the already-connected upstream client. The proxy advertises
|
|
54
|
+
* exactly the upstream's name, version, and capabilities, so the downstream
|
|
55
|
+
* (stdio) surface mirrors the upstream (HTTP-SSE) surface.
|
|
56
|
+
*/
|
|
57
|
+
export function createProxyServer(upstream) {
|
|
58
|
+
const upstreamInfo = upstream.getServerVersion() ?? { name: "honua", version: SERVER_VERSION };
|
|
59
|
+
const upstreamCapabilities = upstream.getServerCapabilities() ?? {};
|
|
60
|
+
const server = new Server({ name: upstreamInfo.name, version: upstreamInfo.version }, {
|
|
61
|
+
capabilities: upstreamCapabilities,
|
|
62
|
+
instructions: upstream.getInstructions(),
|
|
63
|
+
});
|
|
64
|
+
// ── Tools ──────────────────────────────────────────────────────
|
|
65
|
+
if (upstreamCapabilities.tools) {
|
|
66
|
+
server.setRequestHandler(ListToolsRequestSchema, async (request) => upstream.listTools(request.params));
|
|
67
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => upstream.callTool(request.params));
|
|
68
|
+
}
|
|
69
|
+
// ── Resources ──────────────────────────────────────────────────
|
|
70
|
+
if (upstreamCapabilities.resources) {
|
|
71
|
+
server.setRequestHandler(ListResourcesRequestSchema, async (request) => upstream.listResources(request.params));
|
|
72
|
+
server.setRequestHandler(ListResourceTemplatesRequestSchema, async (request) => upstream.listResourceTemplates(request.params));
|
|
73
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => upstream.readResource(request.params));
|
|
74
|
+
}
|
|
75
|
+
// ── Prompts ────────────────────────────────────────────────────
|
|
76
|
+
if (upstreamCapabilities.prompts) {
|
|
77
|
+
server.setRequestHandler(ListPromptsRequestSchema, async (request) => upstream.listPrompts(request.params));
|
|
78
|
+
server.setRequestHandler(GetPromptRequestSchema, async (request) => upstream.getPrompt(request.params));
|
|
79
|
+
}
|
|
80
|
+
// ── list_changed notification forwarding ───────────────────────
|
|
81
|
+
// Keeps the stdio surface live: when the server's catalog changes, the
|
|
82
|
+
// downstream client is told, exactly as an HTTP-SSE client would be.
|
|
83
|
+
upstream.setNotificationHandler(ToolListChangedNotificationSchema, async () => {
|
|
84
|
+
await server.sendToolListChanged();
|
|
85
|
+
});
|
|
86
|
+
upstream.setNotificationHandler(ResourceListChangedNotificationSchema, async () => {
|
|
87
|
+
await server.sendResourceListChanged();
|
|
88
|
+
});
|
|
89
|
+
upstream.setNotificationHandler(PromptListChangedNotificationSchema, async () => {
|
|
90
|
+
await server.sendPromptListChanged();
|
|
91
|
+
});
|
|
92
|
+
return server;
|
|
93
|
+
}
|
|
94
|
+
/* v8 ignore start -- live-process entry: wires the stdio transport to a real
|
|
95
|
+
remote /mcp upstream; exercised by running the proxy, not by unit tests. The
|
|
96
|
+
unit-testable logic (option/header resolution, upstream connect, catalog
|
|
97
|
+
forwarding) lives in the exported functions above and is covered there. */
|
|
98
|
+
/**
|
|
99
|
+
* Run the stdio proxy end-to-end: resolve the remote `/mcp` from the
|
|
100
|
+
* environment, connect upstream, and expose the mirrored catalog over stdio.
|
|
101
|
+
* Also used by the deprecated `honua-mcp` bin, which now delegates here.
|
|
102
|
+
*/
|
|
103
|
+
export async function runProxy(env = process.env) {
|
|
104
|
+
const options = resolveProxyOptions(env);
|
|
105
|
+
const upstream = await connectUpstream(options);
|
|
106
|
+
const server = createProxyServer(upstream);
|
|
107
|
+
// Tear down both ends together so a dropped upstream surfaces to the client.
|
|
108
|
+
const shutdown = async () => {
|
|
109
|
+
await server.close().catch(() => { });
|
|
110
|
+
await upstream.close().catch(() => { });
|
|
111
|
+
};
|
|
112
|
+
upstream.onclose = () => {
|
|
113
|
+
void shutdown();
|
|
114
|
+
};
|
|
115
|
+
const transport = new StdioServerTransport();
|
|
116
|
+
await server.connect(transport);
|
|
117
|
+
}
|
|
118
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
119
|
+
runProxy().catch((err) => {
|
|
120
|
+
process.stderr.write(`Fatal: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
121
|
+
process.exit(1);
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
/* v8 ignore stop */
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HonuaClient } from "@honua/sdk-js";
|
|
2
|
+
/** URI for the styles catalog resource (`honua://styles`). */
|
|
3
|
+
export declare const uri = "honua://styles";
|
|
4
|
+
/** URI template for a single style resource (`honua://styles/{styleId}`). */
|
|
5
|
+
export declare const uriTemplate = "honua://styles/{styleId}";
|
|
6
|
+
/**
|
|
7
|
+
* Read the styles catalog: the list of styles available on the server, each
|
|
8
|
+
* with its stable styleId, title, and canonical URI (`honua://styles/{id}`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function readCatalog(client: HonuaClient): Promise<{
|
|
11
|
+
contents: {
|
|
12
|
+
uri: string;
|
|
13
|
+
mimeType: "application/json";
|
|
14
|
+
text: string;
|
|
15
|
+
}[];
|
|
16
|
+
}>;
|
|
17
|
+
/**
|
|
18
|
+
* Read a single style as a `StyleRef` projection (style_id / title /
|
|
19
|
+
* description / style_version / encodings / legend_url), resolved against the
|
|
20
|
+
* server's `/ogc/styles/{styleId}` surface.
|
|
21
|
+
*/
|
|
22
|
+
export declare function read(client: HonuaClient, styleId: string): Promise<{
|
|
23
|
+
contents: {
|
|
24
|
+
uri: string;
|
|
25
|
+
mimeType: "application/json";
|
|
26
|
+
text: string;
|
|
27
|
+
}[];
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/resources/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD,8DAA8D;AAC9D,eAAO,MAAM,GAAG,mBAAmB,CAAC;AAEpC,6EAA6E;AAC7E,eAAO,MAAM,WAAW,6BAA6B,CAAC;AAEtD;;;GAGG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,WAAW;;;;;;GAiBpD;AAED;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM;;;;;;GAY9D"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { listStyles, resolveStyleRef } from "../styles.js";
|
|
2
|
+
/** URI for the styles catalog resource (`honua://styles`). */
|
|
3
|
+
export const uri = "honua://styles";
|
|
4
|
+
/** URI template for a single style resource (`honua://styles/{styleId}`). */
|
|
5
|
+
export const uriTemplate = "honua://styles/{styleId}";
|
|
6
|
+
/**
|
|
7
|
+
* Read the styles catalog: the list of styles available on the server, each
|
|
8
|
+
* with its stable styleId, title, and canonical URI (`honua://styles/{id}`).
|
|
9
|
+
*/
|
|
10
|
+
export async function readCatalog(client) {
|
|
11
|
+
const list = await listStyles(client);
|
|
12
|
+
const styles = list.styles.map((entry) => ({
|
|
13
|
+
styleId: entry.id,
|
|
14
|
+
title: entry.title ?? entry.id,
|
|
15
|
+
uri: `honua://styles/${encodeURIComponent(entry.id)}`,
|
|
16
|
+
}));
|
|
17
|
+
return {
|
|
18
|
+
contents: [
|
|
19
|
+
{
|
|
20
|
+
uri,
|
|
21
|
+
mimeType: "application/json",
|
|
22
|
+
text: JSON.stringify({ styles, default: list.default ?? null }, null, 2),
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Read a single style as a `StyleRef` projection (style_id / title /
|
|
29
|
+
* description / style_version / encodings / legend_url), resolved against the
|
|
30
|
+
* server's `/ogc/styles/{styleId}` surface.
|
|
31
|
+
*/
|
|
32
|
+
export async function read(client, styleId) {
|
|
33
|
+
const styleRef = await resolveStyleRef(client, styleId);
|
|
34
|
+
return {
|
|
35
|
+
contents: [
|
|
36
|
+
{
|
|
37
|
+
uri: `honua://styles/${encodeURIComponent(styleId)}`,
|
|
38
|
+
mimeType: "application/json",
|
|
39
|
+
text: JSON.stringify(styleRef, null, 2),
|
|
40
|
+
},
|
|
41
|
+
],
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { HonuaClient } from "@honua/sdk-js";
|
|
2
|
+
/**
|
|
3
|
+
* Thin read-only client over the server's OGC API – Styles surface
|
|
4
|
+
* (honua-server, ADR-0048):
|
|
5
|
+
*
|
|
6
|
+
* GET /ogc/styles -> styles list ({ styles: [{ id, title, links }], default? })
|
|
7
|
+
* GET /ogc/styles/{styleId}/metadata -> style metadata ({ id, title, description, keywords, license, version, links })
|
|
8
|
+
* GET /ogc/styles/{styleId} -> stylesheet body (MapLibre/Mapbox JSON by default; SLD via Accept)
|
|
9
|
+
*
|
|
10
|
+
* These helpers project the server responses into the geospatial-grpc
|
|
11
|
+
* `StyleRef` / `StyleEncoding` shape (style_id / title / encodings) so the MCP
|
|
12
|
+
* resource + `get_style` tool surface a single canonical style object.
|
|
13
|
+
*
|
|
14
|
+
* The MCP package only consumes the public {@link HonuaClient.pipelineFetch}
|
|
15
|
+
* request pipeline (auth / retry / timeout / interceptors) rather than a
|
|
16
|
+
* private route, matching the other `/ogc/*` consumers in the SDK.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
/** Default path prefix for the server's OGC API – Styles surface. */
|
|
21
|
+
export declare const OGC_STYLES_PATH = "/ogc/styles";
|
|
22
|
+
/** MapLibre / Mapbox style media type (server default stylesheet encoding). */
|
|
23
|
+
export declare const MAPLIBRE_STYLE_MEDIA_TYPE = "application/vnd.mapbox.style+json";
|
|
24
|
+
/** SLD 1.0 stylesheet media type. */
|
|
25
|
+
export declare const SLD_10_MEDIA_TYPE = "application/vnd.ogc.sld+xml;version=1.0";
|
|
26
|
+
/** SLD 1.1 stylesheet media type. */
|
|
27
|
+
export declare const SLD_11_MEDIA_TYPE = "application/vnd.ogc.sld+xml;version=1.1";
|
|
28
|
+
/**
|
|
29
|
+
* Stylesheet encodings the MCP surface understands, keyed by the canonical
|
|
30
|
+
* geospatial-grpc `StyleEncoding.encoding` identifier. The server
|
|
31
|
+
* content-negotiates these via the `Accept` header.
|
|
32
|
+
*/
|
|
33
|
+
export declare const STYLE_ENCODINGS: {
|
|
34
|
+
readonly "mapbox-style": "application/vnd.mapbox.style+json";
|
|
35
|
+
readonly "sld-1.0.0": "application/vnd.ogc.sld+xml;version=1.0";
|
|
36
|
+
readonly "sld-1.1.0": "application/vnd.ogc.sld+xml;version=1.1";
|
|
37
|
+
};
|
|
38
|
+
/** A geospatial-grpc `StyleEncoding`-aligned encoding identifier. */
|
|
39
|
+
export type StyleEncodingId = keyof typeof STYLE_ENCODINGS;
|
|
40
|
+
/** Hypermedia link entry on an OGC styles document. */
|
|
41
|
+
export interface OgcStyleLink {
|
|
42
|
+
href: string;
|
|
43
|
+
rel?: string;
|
|
44
|
+
type?: string;
|
|
45
|
+
title?: string;
|
|
46
|
+
}
|
|
47
|
+
/** One entry in the `GET /ogc/styles` styles list. */
|
|
48
|
+
export interface OgcStyleListEntry {
|
|
49
|
+
id: string;
|
|
50
|
+
title?: string;
|
|
51
|
+
links?: OgcStyleLink[];
|
|
52
|
+
}
|
|
53
|
+
/** Response body of `GET /ogc/styles`. */
|
|
54
|
+
export interface OgcStyleList {
|
|
55
|
+
styles: OgcStyleListEntry[];
|
|
56
|
+
default?: string;
|
|
57
|
+
links?: OgcStyleLink[];
|
|
58
|
+
}
|
|
59
|
+
/** Response body of `GET /ogc/styles/{styleId}/metadata`. */
|
|
60
|
+
export interface OgcStyleMetadata {
|
|
61
|
+
id: string;
|
|
62
|
+
title?: string;
|
|
63
|
+
description?: string;
|
|
64
|
+
keywords?: string[];
|
|
65
|
+
license?: string;
|
|
66
|
+
version?: string;
|
|
67
|
+
links?: OgcStyleLink[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* A single encoded representation of a style, aligned with the geospatial-grpc
|
|
71
|
+
* `StyleEncoding` message. The MCP surface carries the inline body for the
|
|
72
|
+
* MapLibre encoding (the default the server serves) and exposes the alternate
|
|
73
|
+
* SLD encodings by reference (`storageRef` = the stylesheet URL).
|
|
74
|
+
*/
|
|
75
|
+
export interface StyleEncoding {
|
|
76
|
+
encoding: StyleEncodingId | string;
|
|
77
|
+
contentType?: string;
|
|
78
|
+
inlineBody?: unknown;
|
|
79
|
+
storageRef?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Canonical style projection aligned with the geospatial-grpc `StyleRef`
|
|
83
|
+
* message (`style_id` / `title` / `description` / `style_version` /
|
|
84
|
+
* `encodings` / `legend_url`).
|
|
85
|
+
*/
|
|
86
|
+
export interface StyleRef {
|
|
87
|
+
styleId: string;
|
|
88
|
+
title: string;
|
|
89
|
+
description: string | null;
|
|
90
|
+
styleVersion: number | null;
|
|
91
|
+
legendUrl: string | null;
|
|
92
|
+
encodings: StyleEncoding[];
|
|
93
|
+
}
|
|
94
|
+
/** List available styles via `GET /ogc/styles`. */
|
|
95
|
+
export declare function listStyles(client: HonuaClient): Promise<OgcStyleList>;
|
|
96
|
+
/** Fetch style metadata via `GET /ogc/styles/{styleId}/metadata`. */
|
|
97
|
+
export declare function getStyleMetadata(client: HonuaClient, styleId: string): Promise<OgcStyleMetadata>;
|
|
98
|
+
/**
|
|
99
|
+
* Fetch the MapLibre/Mapbox stylesheet body via `GET /ogc/styles/{styleId}`
|
|
100
|
+
* (content-negotiated to {@link MAPLIBRE_STYLE_MEDIA_TYPE}).
|
|
101
|
+
*/
|
|
102
|
+
export declare function getMapLibreStylesheet(client: HonuaClient, styleId: string): Promise<unknown>;
|
|
103
|
+
/**
|
|
104
|
+
* Resolve a single style into a `StyleRef` projection: fetch metadata and the
|
|
105
|
+
* canonical MapLibre stylesheet, and advertise the alternate SLD encodings by
|
|
106
|
+
* reference. The stylesheet base URL (`{baseUrl}/ogc/styles/{styleId}`) backs
|
|
107
|
+
* the `storageRef` for the by-reference encodings.
|
|
108
|
+
*/
|
|
109
|
+
export declare function resolveStyleRef(client: HonuaClient, styleId: string): Promise<StyleRef>;
|
|
110
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AAEH,qEAAqE;AACrE,eAAO,MAAM,eAAe,gBAAgB,CAAC;AAE7C,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,sCAAsC,CAAC;AAE7E,qCAAqC;AACrC,eAAO,MAAM,iBAAiB,4CAA4C,CAAC;AAE3E,qCAAqC;AACrC,eAAO,MAAM,iBAAiB,4CAA4C,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAEX,qEAAqE;AACrE,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,eAAe,CAAC;AAE3D,uDAAuD;AACvD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,sDAAsD;AACtD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB;AAED,0CAA0C;AAC1C,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,iBAAiB,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,YAAY,EAAE,CAAC;CACxB;AAED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