@malloy-publisher/server 0.0.76 → 0.0.77
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/server.js +4319 -185
- package/dxt/malloy_bridge.py +274 -0
- package/dxt/manifest.json +22 -0
- package/malloy_mcp.dxt +0 -0
- package/package.json +2 -1
- package/src/mcp/server.ts +3 -0
- package/src/mcp/tools/discovery_tools.ts +258 -0
- package/src/mcp/tools/execute_query_tool.ts +14 -10
- package/src/service/model.ts +11 -0
- package/src/service/package.spec.ts +3 -0
- package/src/service/package.ts +12 -0
package/src/service/package.ts
CHANGED
|
@@ -37,6 +37,7 @@ export class Package {
|
|
|
37
37
|
private databases: ApiDatabase[];
|
|
38
38
|
private models: Map<string, Model> = new Map();
|
|
39
39
|
private scheduler: Scheduler | undefined;
|
|
40
|
+
private packagePath: string;
|
|
40
41
|
private static meter = metrics.getMeter("publisher");
|
|
41
42
|
private static packageLoadHistogram = this.meter.createHistogram(
|
|
42
43
|
"malloy_package_load_duration",
|
|
@@ -49,6 +50,7 @@ export class Package {
|
|
|
49
50
|
constructor(
|
|
50
51
|
projectName: string,
|
|
51
52
|
packageName: string,
|
|
53
|
+
packagePath: string,
|
|
52
54
|
packageMetadata: ApiPackage,
|
|
53
55
|
databases: ApiDatabase[],
|
|
54
56
|
models: Map<string, Model>,
|
|
@@ -56,6 +58,7 @@ export class Package {
|
|
|
56
58
|
) {
|
|
57
59
|
this.projectName = projectName;
|
|
58
60
|
this.packageName = packageName;
|
|
61
|
+
this.packagePath = packagePath;
|
|
59
62
|
this.packageMetadata = packageMetadata;
|
|
60
63
|
this.databases = databases;
|
|
61
64
|
this.models = models;
|
|
@@ -106,6 +109,7 @@ export class Package {
|
|
|
106
109
|
return new Package(
|
|
107
110
|
projectName,
|
|
108
111
|
packageName,
|
|
112
|
+
packagePath,
|
|
109
113
|
packageConfig,
|
|
110
114
|
databases,
|
|
111
115
|
models,
|
|
@@ -143,6 +147,14 @@ export class Package {
|
|
|
143
147
|
return this.models.get(modelPath);
|
|
144
148
|
}
|
|
145
149
|
|
|
150
|
+
public async getModelFileText(modelPath: string): Promise<string> {
|
|
151
|
+
const model = this.getModel(modelPath);
|
|
152
|
+
if (!model) {
|
|
153
|
+
throw new Error(`Model not found: ${modelPath}`);
|
|
154
|
+
}
|
|
155
|
+
return await model.getFileText(this.packagePath);
|
|
156
|
+
}
|
|
157
|
+
|
|
146
158
|
public async listModels(): Promise<ApiModel[]> {
|
|
147
159
|
const values = await Promise.all(
|
|
148
160
|
Array.from(this.models.keys())
|