@hypequery/mcp 0.8.3 → 0.8.4
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/dist/prompts/dataset-guide.d.ts.map +1 -1
- package/dist/prompts/dataset-guide.js +11 -2
- package/dist/tools/args.d.ts +6 -0
- package/dist/tools/args.d.ts.map +1 -1
- package/dist/tools/args.js +1 -0
- package/dist/tools/query-dataset.d.ts.map +1 -1
- package/dist/tools/query-dataset.js +3 -1
- package/dist/tools/query-metric.d.ts.map +1 -1
- package/dist/tools/query-metric.js +3 -1
- package/dist/tools/tool-manifest.d.ts.map +1 -1
- package/dist/tools/tool-manifest.js +9 -1
- package/dist/tools/utils/legacy-agent-catalog.d.ts.map +1 -1
- package/dist/tools/utils/legacy-agent-catalog.js +0 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataset-guide.d.ts","sourceRoot":"","sources":["../../src/prompts/dataset-guide.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"dataset-guide.d.ts","sourceRoot":"","sources":["../../src/prompts/dataset-guide.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAGnD,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,eAAe,EAAE,WAAW,CAAC,EAAE,MAAM;;;;;;;;EA+IjF"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Provides natural language guidance for querying datasets.
|
|
5
5
|
*/
|
|
6
|
+
import { getDatasetCatalog } from '@hypequery/datasets';
|
|
6
7
|
export function datasetGuidePrompt(datasets, datasetName) {
|
|
7
8
|
if (datasetName) {
|
|
8
9
|
const dataset = datasets[datasetName];
|
|
@@ -12,7 +13,10 @@ export function datasetGuidePrompt(datasets, datasetName) {
|
|
|
12
13
|
const datasetAny = dataset;
|
|
13
14
|
// Generate dataset-specific guide
|
|
14
15
|
const dimensions = datasetAny.dimensions ? Object.keys(datasetAny.dimensions) : [];
|
|
15
|
-
const
|
|
16
|
+
const catalog = datasetAny.__type === 'dataset' ? getDatasetCatalog(datasetAny) : undefined;
|
|
17
|
+
const measures = catalog
|
|
18
|
+
? [...Object.keys(catalog.measures), ...Object.keys(catalog.derivedMeasures ?? {})]
|
|
19
|
+
: datasetAny.measures ? Object.keys(datasetAny.measures) : [];
|
|
16
20
|
const metrics = datasetAny.metrics ? Object.keys(datasetAny.metrics) : [];
|
|
17
21
|
const guide = `# Querying the ${datasetName} dataset
|
|
18
22
|
|
|
@@ -20,7 +24,12 @@ export function datasetGuidePrompt(datasets, datasetName) {
|
|
|
20
24
|
${dimensions.map((d) => `- ${d}`).join('\n')}
|
|
21
25
|
|
|
22
26
|
## Available Measures
|
|
23
|
-
${measures.map((m) =>
|
|
27
|
+
${measures.map((m) => {
|
|
28
|
+
const definition = catalog?.measures[m] ?? catalog?.derivedMeasures?.[m];
|
|
29
|
+
const range = definition?.requiresTimeRange ? ` (requires by and a bounded ISO time range on ${catalog?.timeKey})` : '';
|
|
30
|
+
const grains = definition?.supportedGrains ? ` [grains: ${definition.supportedGrains.join(', ')}]` : '';
|
|
31
|
+
return `- ${m}${range}${grains}`;
|
|
32
|
+
}).join('\n')}
|
|
24
33
|
|
|
25
34
|
## Available Metrics
|
|
26
35
|
${metrics.map((m) => `- ${m}`).join('\n')}
|
package/dist/tools/args.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export declare const queryMetricArgsSchema: z.ZodObject<{
|
|
|
17
17
|
}>, "many">>;
|
|
18
18
|
segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
19
19
|
grain: z.ZodOptional<z.ZodEnum<[TimeGrain, ...TimeGrain[]]>>;
|
|
20
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
20
21
|
orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
22
|
field: z.ZodString;
|
|
22
23
|
direction: z.ZodEnum<["asc", "desc"]>;
|
|
@@ -43,6 +44,7 @@ export declare const queryMetricArgsSchema: z.ZodObject<{
|
|
|
43
44
|
segments?: string[] | undefined;
|
|
44
45
|
metric?: string | undefined;
|
|
45
46
|
grain?: TimeGrain | undefined;
|
|
47
|
+
timezone?: string | undefined;
|
|
46
48
|
orderBy?: {
|
|
47
49
|
field: string;
|
|
48
50
|
direction: "asc" | "desc";
|
|
@@ -60,6 +62,7 @@ export declare const queryMetricArgsSchema: z.ZodObject<{
|
|
|
60
62
|
segments?: string[] | undefined;
|
|
61
63
|
metric?: string | undefined;
|
|
62
64
|
grain?: TimeGrain | undefined;
|
|
65
|
+
timezone?: string | undefined;
|
|
63
66
|
orderBy?: {
|
|
64
67
|
field: string;
|
|
65
68
|
direction: "asc" | "desc";
|
|
@@ -84,6 +87,7 @@ export declare const queryDatasetArgsSchema: z.ZodObject<{
|
|
|
84
87
|
}>, "many">>;
|
|
85
88
|
segments: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
86
89
|
grain: z.ZodOptional<z.ZodEnum<[TimeGrain, ...TimeGrain[]]>>;
|
|
90
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
87
91
|
orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
88
92
|
field: z.ZodString;
|
|
89
93
|
direction: z.ZodEnum<["asc", "desc"]>;
|
|
@@ -110,6 +114,7 @@ export declare const queryDatasetArgsSchema: z.ZodObject<{
|
|
|
110
114
|
}[] | undefined;
|
|
111
115
|
segments?: string[] | undefined;
|
|
112
116
|
grain?: TimeGrain | undefined;
|
|
117
|
+
timezone?: string | undefined;
|
|
113
118
|
orderBy?: {
|
|
114
119
|
field: string;
|
|
115
120
|
direction: "asc" | "desc";
|
|
@@ -127,6 +132,7 @@ export declare const queryDatasetArgsSchema: z.ZodObject<{
|
|
|
127
132
|
}[] | undefined;
|
|
128
133
|
segments?: string[] | undefined;
|
|
129
134
|
grain?: TimeGrain | undefined;
|
|
135
|
+
timezone?: string | undefined;
|
|
130
136
|
orderBy?: {
|
|
131
137
|
field: string;
|
|
132
138
|
direction: "asc" | "desc";
|
package/dist/tools/args.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/tools/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../../src/tools/args.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,SAAS,EACf,MAAM,qBAAqB,CAAC;AAmC7B,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGhC,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGjC,CAAC;AAWH,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,CAAC,CASzF;AAED,wBAAgB,eAAe,CAC7B,OAAO,GAAE,KAAK,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,YAAY,CAAC,UAAU,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAM,GAC1F,YAAY,EAAE,CAMhB"}
|
package/dist/tools/args.js
CHANGED
|
@@ -18,6 +18,7 @@ const baseQuerySchema = z.object({
|
|
|
18
18
|
segments: z.array(z.string().min(1)).max(MAX_QUERY_FILTERS).optional(),
|
|
19
19
|
// Each dataset narrows this further through its catalog `supportedGrains`.
|
|
20
20
|
grain: z.enum(SUPPORTED_TIME_GRAINS).optional(),
|
|
21
|
+
timezone: z.string().min(1).max(100).optional(),
|
|
21
22
|
orderBy: z.array(orderBySchema).max(MAX_QUERY_ORDER_BY).optional(),
|
|
22
23
|
limit: z.number().int().positive().max(MAX_QUERY_LIMIT).optional(),
|
|
23
24
|
offset: z.number().int().nonnegative().max(MAX_QUERY_OFFSET).optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-dataset.d.ts","sourceRoot":"","sources":["../../src/tools/query-dataset.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYtF,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"query-dataset.d.ts","sourceRoot":"","sources":["../../src/tools/query-dataset.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAgB,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYtF,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAiE1B"}
|
|
@@ -13,7 +13,7 @@ import { createMCPToolResponse } from './utils/tool-response.js';
|
|
|
13
13
|
export async function queryDatasetTool(datasets, analytics, args, options = {}) {
|
|
14
14
|
const inputSchema = options.inputSchema ?? buildMCPQuerySchemas(datasets, options.limits).queryDataset;
|
|
15
15
|
const validatedArgs = parseToolArgs(inputSchema, 'query_dataset', args);
|
|
16
|
-
const { dataset: datasetName, dimensions, measures, filters, segments, grain, orderBy } = validatedArgs;
|
|
16
|
+
const { dataset: datasetName, dimensions, measures, filters, segments, grain, timezone, orderBy } = validatedArgs;
|
|
17
17
|
if (!datasetName) {
|
|
18
18
|
throw new MCPToolError('MCP_INVALID_ARGUMENTS', 'dataset parameter is required');
|
|
19
19
|
}
|
|
@@ -34,6 +34,8 @@ export async function queryDatasetTool(datasets, analytics, args, options = {})
|
|
|
34
34
|
orderBy: orderBy || [],
|
|
35
35
|
limit: pagination.limit,
|
|
36
36
|
};
|
|
37
|
+
if (timezone !== undefined)
|
|
38
|
+
query.timezone = timezone;
|
|
37
39
|
if (grain) {
|
|
38
40
|
query.by = grain;
|
|
39
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query-metric.d.ts","sourceRoot":"","sources":["../../src/tools/query-metric.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYtF,wBAAsB,eAAe,CACnC,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"query-metric.d.ts","sourceRoot":"","sources":["../../src/tools/query-metric.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,qBAAqB,CAAC;AAEtE,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAYtF,wBAAsB,eAAe,CACnC,QAAQ,EAAE,eAAe,EACzB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,OAAO,EACb,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,eAAe,CAAC,CAwE1B"}
|
|
@@ -13,7 +13,7 @@ import { createMCPToolResponse } from './utils/tool-response.js';
|
|
|
13
13
|
export async function queryMetricTool(datasets, analytics, args, options = {}) {
|
|
14
14
|
const inputSchema = options.inputSchema ?? buildMCPQuerySchemas(datasets, options.limits).queryMetric;
|
|
15
15
|
const validatedArgs = parseToolArgs(inputSchema, 'query_metric', args);
|
|
16
|
-
const { dataset: datasetName, metric: metricName, dimensions, filters, segments, grain, orderBy } = validatedArgs;
|
|
16
|
+
const { dataset: datasetName, metric: metricName, dimensions, filters, segments, grain, timezone, orderBy } = validatedArgs;
|
|
17
17
|
if (!datasetName) {
|
|
18
18
|
throw new MCPToolError('MCP_INVALID_ARGUMENTS', 'dataset parameter is required');
|
|
19
19
|
}
|
|
@@ -38,6 +38,8 @@ export async function queryMetricTool(datasets, analytics, args, options = {}) {
|
|
|
38
38
|
orderBy: orderBy || [],
|
|
39
39
|
limit: pagination.limit,
|
|
40
40
|
};
|
|
41
|
+
if (timezone !== undefined)
|
|
42
|
+
query.timezone = timezone;
|
|
41
43
|
if (grain) {
|
|
42
44
|
query.by = grain;
|
|
43
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-manifest.d.ts","sourceRoot":"","sources":["../../src/tools/tool-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAQ,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-manifest.d.ts","sourceRoot":"","sources":["../../src/tools/tool-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAChG,OAAO,KAAK,EAAE,eAAe,EAAQ,MAAM,oCAAoC,CAAC;AAiEhF,eAAO,MAAM,0BAA0B;;;;;;;2BAsBrC,CAAC;AAEH,eAAO,MAAM,4BAA4B;;;;;;;2BAmIvC,CAAC;AAEH,eAAO,MAAM,mBAAmB;;;;;;;2BAwC9B,CAAC;AAYH,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,6BAA6B,GAC1C,eAAe,CA8CjB"}
|
|
@@ -5,7 +5,6 @@ const semanticMetadataProperties = {
|
|
|
5
5
|
format: { type: 'string' },
|
|
6
6
|
unit: { type: 'string' },
|
|
7
7
|
currency: { type: 'string' },
|
|
8
|
-
timezone: { type: 'string' },
|
|
9
8
|
sensitivity: {
|
|
10
9
|
type: 'string',
|
|
11
10
|
enum: ['public', 'internal', 'confidential', 'restricted'],
|
|
@@ -131,6 +130,15 @@ export const DATASET_SCHEMA_OUTPUT_SCHEMA = resultSchema({
|
|
|
131
130
|
label: { type: 'string' },
|
|
132
131
|
description: { type: 'string' },
|
|
133
132
|
...semanticMetadataProperties,
|
|
133
|
+
kind: { type: 'string', enum: ['window', 'shift'] },
|
|
134
|
+
measure: { type: 'string' },
|
|
135
|
+
interval: { type: 'object', properties: { amount: { type: 'integer', minimum: 1 }, unit: { type: 'string', enum: [...SUPPORTED_TIME_GRAINS] } }, required: ['amount', 'unit'], additionalProperties: false },
|
|
136
|
+
trailing: { type: 'object', properties: { amount: { type: 'integer', minimum: 1 }, unit: { type: 'string', enum: [...SUPPORTED_TIME_GRAINS] } }, required: ['amount', 'unit'], additionalProperties: false },
|
|
137
|
+
toDate: { type: 'string', enum: SUPPORTED_TIME_GRAINS.filter(grain => grain !== 'minute') },
|
|
138
|
+
cumulative: { const: true },
|
|
139
|
+
requiresTimeRange: { const: true },
|
|
140
|
+
supportedGrains: { type: 'array', items: { type: 'string', enum: [...SUPPORTED_TIME_GRAINS] } },
|
|
141
|
+
approximate: { const: true },
|
|
134
142
|
},
|
|
135
143
|
required: ['name'],
|
|
136
144
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"legacy-agent-catalog.d.ts","sourceRoot":"","sources":["../../../src/tools/utils/legacy-agent-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAQpB,MAAM,qBAAqB,CAAC;AAG7B,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"legacy-agent-catalog.d.ts","sourceRoot":"","sources":["../../../src/tools/utils/legacy-agent-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAQpB,MAAM,qBAAqB,CAAC;AAG7B,KAAK,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AA2F7C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,aAAa,EACpB,QAAQ,GAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM,GAC/C,mBAAmB,CAuFrB"}
|
|
@@ -43,7 +43,6 @@ function semanticMetadata(value) {
|
|
|
43
43
|
...(text(value.format) !== undefined ? { format: text(value.format) } : {}),
|
|
44
44
|
...(text(value.unit) !== undefined ? { unit: text(value.unit) } : {}),
|
|
45
45
|
...(/^[A-Z]{3}$/.test(String(value.currency)) ? { currency: String(value.currency) } : {}),
|
|
46
|
-
...(text(value.timezone) !== undefined ? { timezone: text(value.timezone) } : {}),
|
|
47
46
|
...(sensitivity !== undefined ? { sensitivity } : {}),
|
|
48
47
|
};
|
|
49
48
|
}
|
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const MCP_PACKAGE_VERSION = "0.8.
|
|
1
|
+
export declare const MCP_PACKAGE_VERSION = "0.8.4";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hypequery/mcp",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.4",
|
|
4
4
|
"description": "Governed ClickHouse MCP server for semantic metrics, datasets, Claude, Cursor, and AI agents",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"dist"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@hypequery/datasets": "^0.
|
|
36
|
+
"@hypequery/datasets": "^0.20.0",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
38
38
|
"zod": "^3.23.8"
|
|
39
39
|
},
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@types/node": "^20.11.30",
|
|
42
42
|
"typescript": "^5.7.3",
|
|
43
43
|
"vitest": "^3.2.6",
|
|
44
|
-
"@hypequery/clickhouse": "2.12.
|
|
44
|
+
"@hypequery/clickhouse": "2.12.1"
|
|
45
45
|
},
|
|
46
46
|
"repository": {
|
|
47
47
|
"type": "git",
|