@kynver-app/mcp-estimator 0.1.1

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 (52) hide show
  1. package/dist/index.d.ts +7 -0
  2. package/dist/index.js +11 -0
  3. package/dist/lib/kynver-client.d.ts +20 -0
  4. package/dist/lib/kynver-client.js +110 -0
  5. package/dist/lib/mcp-sse-server.d.ts +29 -0
  6. package/dist/lib/mcp-sse-server.js +191 -0
  7. package/dist/server.d.ts +6 -0
  8. package/dist/server.js +78 -0
  9. package/dist/sse.d.ts +1 -0
  10. package/dist/sse.js +9 -0
  11. package/dist/tools/catalog-tools.d.ts +387 -0
  12. package/dist/tools/catalog-tools.js +193 -0
  13. package/dist/tools/client-tools.d.ts +193 -0
  14. package/dist/tools/client-tools.js +105 -0
  15. package/dist/tools/company-tools.d.ts +163 -0
  16. package/dist/tools/company-tools.js +98 -0
  17. package/dist/tools/create-estimate.d.ts +107 -0
  18. package/dist/tools/create-estimate.js +64 -0
  19. package/dist/tools/estimate-tools.d.ts +531 -0
  20. package/dist/tools/estimate-tools.js +259 -0
  21. package/dist/tools/estimator-chat.d.ts +25 -0
  22. package/dist/tools/estimator-chat.js +15 -0
  23. package/dist/tools/get-estimate.d.ts +19 -0
  24. package/dist/tools/get-estimate.js +14 -0
  25. package/dist/tools/list-catalog.d.ts +25 -0
  26. package/dist/tools/list-catalog.js +22 -0
  27. package/dist/tools/photo-tools.d.ts +77 -0
  28. package/dist/tools/photo-tools.js +51 -0
  29. package/dist/tools/stats-pdf-tools.d.ts +113 -0
  30. package/dist/tools/stats-pdf-tools.js +73 -0
  31. package/dist/tools/template-tools.d.ts +96 -0
  32. package/dist/tools/template-tools.js +70 -0
  33. package/dist/tools/version-tools.d.ts +46 -0
  34. package/dist/tools/version-tools.js +33 -0
  35. package/dist/tools/vision-tools.d.ts +52 -0
  36. package/dist/tools/vision-tools.js +42 -0
  37. package/package.json +27 -0
  38. package/src/index.ts +13 -0
  39. package/src/lib/kynver-client.ts +136 -0
  40. package/src/lib/mcp-sse-server.ts +249 -0
  41. package/src/server.ts +101 -0
  42. package/src/sse.ts +10 -0
  43. package/src/tools/catalog-tools.ts +217 -0
  44. package/src/tools/client-tools.ts +114 -0
  45. package/src/tools/company-tools.ts +108 -0
  46. package/src/tools/estimate-tools.ts +281 -0
  47. package/src/tools/photo-tools.ts +60 -0
  48. package/src/tools/stats-pdf-tools.ts +80 -0
  49. package/src/tools/template-tools.ts +80 -0
  50. package/src/tools/version-tools.ts +39 -0
  51. package/src/tools/vision-tools.ts +48 -0
  52. package/tsconfig.json +15 -0
@@ -0,0 +1,80 @@
1
+ import { z } from "zod";
2
+ import * as client from "../lib/kynver-client.js";
3
+
4
+ // --- estimator_save_template ---
5
+
6
+ const saveTemplateSchema = z.object({
7
+ estimateId: z.string(),
8
+ name: z.string(),
9
+ });
10
+
11
+ export const saveTemplate = {
12
+ name: "estimator_save_template",
13
+ description: "Save an existing estimate as a reusable template. Templates capture the estimate's line items, quantities, and structure so you can quickly create similar estimates in the future. Requires the estimateId of the source estimate and a name for the template.",
14
+ inputSchemaZod: saveTemplateSchema,
15
+ execute: async (args: z.infer<typeof saveTemplateSchema>): Promise<string> => {
16
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
17
+ const data = await client.post("/estimator/templates", args);
18
+ return JSON.stringify(data);
19
+ },
20
+ };
21
+
22
+ // --- estimator_list_templates ---
23
+
24
+ const listTemplatesSchema = z.object({
25
+ type: z.string().optional(),
26
+ });
27
+
28
+ export const listTemplates = {
29
+ name: "estimator_list_templates",
30
+ description: "List all saved estimate templates. Optionally filter by type: 'replacement' or 'repair_service'. Returns template names, types, and IDs. Use template IDs with estimator_create_from_template to create new estimates.",
31
+ inputSchemaZod: listTemplatesSchema,
32
+ execute: async (args: z.infer<typeof listTemplatesSchema>): Promise<string> => {
33
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
34
+
35
+ const params = new URLSearchParams();
36
+ if (args.type) params.set("type", args.type);
37
+
38
+ const q = params.toString();
39
+ const path = q ? `/estimator/templates?${q}` : "/estimator/templates";
40
+
41
+ const data = await client.get<unknown>(path);
42
+ return JSON.stringify(data);
43
+ },
44
+ };
45
+
46
+ // --- estimator_delete_template ---
47
+
48
+ const deleteTemplateSchema = z.object({
49
+ id: z.string(),
50
+ });
51
+
52
+ export const deleteTemplate = {
53
+ name: "estimator_delete_template",
54
+ description: "Delete a saved estimate template permanently. This does not affect any estimates that were previously created from this template.",
55
+ inputSchemaZod: deleteTemplateSchema,
56
+ execute: async (args: z.infer<typeof deleteTemplateSchema>): Promise<string> => {
57
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
58
+ const data = await client.del(`/estimator/templates/${args.id}`);
59
+ return JSON.stringify(data);
60
+ },
61
+ };
62
+
63
+ // --- estimator_create_from_template ---
64
+
65
+ const createFromTemplateSchema = z.object({
66
+ templateId: z.string(),
67
+ projectName: z.string(),
68
+ clientId: z.string().optional(),
69
+ });
70
+
71
+ export const createFromTemplate = {
72
+ name: "estimator_create_from_template",
73
+ description: "Create a new estimate from a saved template. The new estimate gets all the template's line items and structure. Requires: templateId (from estimator_list_templates), projectName. Optionally link to a clientId. The new estimate is created as a draft.",
74
+ inputSchemaZod: createFromTemplateSchema,
75
+ execute: async (args: z.infer<typeof createFromTemplateSchema>): Promise<string> => {
76
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
77
+ const data = await client.post("/estimator/estimates", args);
78
+ return JSON.stringify(data);
79
+ },
80
+ };
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ import * as client from "../lib/kynver-client.js";
3
+
4
+ // --- estimator_list_versions ---
5
+
6
+ const listVersionsSchema = z.object({
7
+ estimateId: z.string(),
8
+ });
9
+
10
+ export const listVersions = {
11
+ name: "estimator_list_versions",
12
+ description: "List all saved version snapshots of an estimate. Versions are created automatically when significant changes are made. Shows version numbers and timestamps. Use this to track the history of changes to an estimate.",
13
+ inputSchemaZod: listVersionsSchema,
14
+ execute: async (args: z.infer<typeof listVersionsSchema>): Promise<string> => {
15
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
16
+ const data = await client.get<unknown>(`/estimator/estimates/${args.estimateId}/versions`);
17
+ return JSON.stringify(data);
18
+ },
19
+ };
20
+
21
+ // --- estimator_get_version ---
22
+
23
+ const getVersionSchema = z.object({
24
+ estimateId: z.string(),
25
+ versionId: z.string(),
26
+ });
27
+
28
+ export const getVersion = {
29
+ name: "estimator_get_version",
30
+ description: "Get a specific historical version of an estimate. Returns the full estimate snapshot as it existed at that point in time — all line items, totals, and metadata. Useful for comparing current vs previous versions or reverting changes.",
31
+ inputSchemaZod: getVersionSchema,
32
+ execute: async (args: z.infer<typeof getVersionSchema>): Promise<string> => {
33
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
34
+ const data = await client.get<unknown>(
35
+ `/estimator/estimates/${args.estimateId}/versions/${args.versionId}`
36
+ );
37
+ return JSON.stringify(data);
38
+ },
39
+ };
@@ -0,0 +1,48 @@
1
+ import { z } from "zod";
2
+ import * as client from "../lib/kynver-client.js";
3
+
4
+ // --- estimator_analyze_photos ---
5
+
6
+ const analyzePhotosSchema = z.object({
7
+ images: z.array(z.string()),
8
+ prompt: z.string().optional(),
9
+ });
10
+
11
+ export const analyzePhotos = {
12
+ name: "estimator_analyze_photos",
13
+ description:
14
+ "Analyze roof photos using Claude's vision AI. Provide image URLs (can be multiple). The AI identifies: roofing materials, visible damage (missing shingles, cracks, moss, ponding), approximate measurements, and repair recommendations. Use the optional prompt parameter to ask specific questions about the photos. Results can inform estimate creation.",
15
+ inputSchemaZod: analyzePhotosSchema,
16
+ execute: async (args: z.infer<typeof analyzePhotosSchema>): Promise<string> => {
17
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
18
+ const data = await client.post("/estimator/analyze", {
19
+ type: "photos",
20
+ images: args.images,
21
+ prompt: args.prompt,
22
+ });
23
+ return JSON.stringify(data);
24
+ },
25
+ };
26
+
27
+ // --- estimator_analyze_document ---
28
+
29
+ const analyzeDocumentSchema = z.object({
30
+ text: z.string(),
31
+ prompt: z.string().optional(),
32
+ });
33
+
34
+ export const analyzeDocument = {
35
+ name: "estimator_analyze_document",
36
+ description:
37
+ "Analyze a text document (inspection report, insurance scope of work, contractor notes) and extract structured estimating data — identified services, quantities, materials, and damage descriptions. Pass the document text in the text field. Use the optional prompt parameter to focus the analysis. Results can be used to create estimates with accurate line items.",
38
+ inputSchemaZod: analyzeDocumentSchema,
39
+ execute: async (args: z.infer<typeof analyzeDocumentSchema>): Promise<string> => {
40
+ if (!client.hasApiKey()) return client.noApiKeyMessage();
41
+ const data = await client.post("/estimator/analyze", {
42
+ type: "document",
43
+ text: args.text,
44
+ prompt: args.prompt,
45
+ });
46
+ return JSON.stringify(data);
47
+ },
48
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "NodeNext",
5
+ "moduleResolution": "NodeNext",
6
+ "outDir": "dist",
7
+ "rootDir": "src",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "declaration": true,
11
+ "skipLibCheck": true
12
+ },
13
+ "include": ["src/**/*"],
14
+ "exclude": ["node_modules", "dist"]
15
+ }