mcp-zenskar 1.0.8 → 1.0.9
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/package.json +2 -2
- package/src/mcp-config.json +172 -14
- package/src/response-processor.js +4 -2
- package/src/server.js +806 -255
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcp-zenskar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server for Zenskar API - customer management, invoicing, and billing operations",
|
|
5
|
-
"type": "module",
|
|
6
5
|
"main": "src/server.js",
|
|
7
6
|
"bin": {
|
|
8
7
|
"mcp-zenskar": "src/server.js"
|
|
@@ -26,6 +25,7 @@
|
|
|
26
25
|
"license": "MIT",
|
|
27
26
|
"dependencies": {
|
|
28
27
|
"@modelcontextprotocol/sdk": "^1.18.0",
|
|
28
|
+
"uuid": "^9.0.1",
|
|
29
29
|
"zod": "^3.22.0"
|
|
30
30
|
},
|
|
31
31
|
"engines": {
|
package/src/mcp-config.json
CHANGED
|
@@ -1013,7 +1013,7 @@
|
|
|
1013
1013
|
},
|
|
1014
1014
|
{
|
|
1015
1015
|
"name": "dataschema",
|
|
1016
|
-
"description": "Data schema of raw metric (JSON object). Structure: {\"data\": {custom_fields}, \"timestamp\": \"DateTime64\", \"customer_id\": \"String\"}. The 'data' map must include only valid ClickHouse types (String, Int64, Float64, Date32, DateTime64, UUID, Bool).",
|
|
1016
|
+
"description": "Data schema of raw metric (JSON object). Structure: {\"data\": {custom_fields}, \"timestamp\": \"DateTime64\", \"customer_id\": \"String\"}. The 'data' map must include only valid ClickHouse types (String, Int64, Float64, Date32, DateTime64, UUID, Bool); use 'Bool' instead of 'Boolean'.",
|
|
1017
1017
|
"type": "object",
|
|
1018
1018
|
"required": true,
|
|
1019
1019
|
"position": "body",
|
|
@@ -1033,7 +1033,7 @@
|
|
|
1033
1033
|
},
|
|
1034
1034
|
{
|
|
1035
1035
|
"name": "column_order",
|
|
1036
|
-
"description": "Optional ordered list of columns for downstream processing.",
|
|
1036
|
+
"description": "Optional ordered list of columns for downstream processing. Locked to ['timestamp'] in production; leave as-is unless backend explicitly requests a schema change.",
|
|
1037
1037
|
"type": "array",
|
|
1038
1038
|
"required": false,
|
|
1039
1039
|
"position": "body",
|
|
@@ -2117,7 +2117,7 @@
|
|
|
2117
2117
|
{
|
|
2118
2118
|
"name": "createCustomer",
|
|
2119
2119
|
"description": "Creates a new customer in the system with various attributes including address, tax info, and contact details.",
|
|
2120
|
-
"needsApproval":
|
|
2120
|
+
"needsApproval": false,
|
|
2121
2121
|
"approvalConfig": {
|
|
2122
2122
|
"title": "Create New Customer",
|
|
2123
2123
|
"description": "This will create a new customer in your system. Please review the details carefully.",
|
|
@@ -2231,7 +2231,7 @@
|
|
|
2231
2231
|
}
|
|
2232
2232
|
],
|
|
2233
2233
|
"requestTemplate": {
|
|
2234
|
-
"url": "/
|
|
2234
|
+
"url": "/customer",
|
|
2235
2235
|
"method": "POST",
|
|
2236
2236
|
"headers": {
|
|
2237
2237
|
"Content-Type": "application/json"
|
|
@@ -2253,8 +2253,7 @@
|
|
|
2253
2253
|
"cancelText": "Cancel",
|
|
2254
2254
|
"sensitiveFields": [
|
|
2255
2255
|
"rawMetricSlug",
|
|
2256
|
-
"event"
|
|
2257
|
-
"key"
|
|
2256
|
+
"event"
|
|
2258
2257
|
]
|
|
2259
2258
|
},
|
|
2260
2259
|
"args": [
|
|
@@ -2265,16 +2264,9 @@
|
|
|
2265
2264
|
"required": true,
|
|
2266
2265
|
"position": "path"
|
|
2267
2266
|
},
|
|
2268
|
-
{
|
|
2269
|
-
"name": "key",
|
|
2270
|
-
"description": "Request key used for idempotency / replay protection (maps to ?key=).",
|
|
2271
|
-
"type": "string",
|
|
2272
|
-
"required": false,
|
|
2273
|
-
"position": "query"
|
|
2274
|
-
},
|
|
2275
2267
|
{
|
|
2276
2268
|
"name": "event",
|
|
2277
|
-
"description": "Usage event payload containing customer_id, timestamp, and data map with schema-compliant types.",
|
|
2269
|
+
"description": "Usage event payload containing customer_id, timestamp, and data map with schema-compliant types. Before constructing the event, fetch the schema via getRawMetricBySlug (or reuse the response from createRawMetric) so you only include fields that exist in the raw metric. Use the provided type buckets such as String/Int64 or the exact column names returned by sample logs; do not invent new keys.",
|
|
2278
2270
|
"type": "object",
|
|
2279
2271
|
"required": true,
|
|
2280
2272
|
"position": "body",
|
|
@@ -2304,6 +2296,172 @@
|
|
|
2304
2296
|
"responseTemplate": {
|
|
2305
2297
|
"prependBody": "## Usage Event Ingested\n\nThe usage event was ingested successfully:\n\n"
|
|
2306
2298
|
}
|
|
2299
|
+
},
|
|
2300
|
+
{
|
|
2301
|
+
"name": "extractContractFromRaw",
|
|
2302
|
+
"description": "Extract structured contract data from raw text content using AI. This tool analyzes natural language contract descriptions and extracts key fields like dates, products, pricing, and billing terms. The extracted data can then be used to create a customer and contract via createCustomer and createContract tools.",
|
|
2303
|
+
"needsApproval": false,
|
|
2304
|
+
"args": [
|
|
2305
|
+
{
|
|
2306
|
+
"name": "content",
|
|
2307
|
+
"description": "The raw text content describing the contract (e.g., 'Contract starts on 1st Jan 2025 and ends on 31 Dec 2025 with a single product called chat subscription, cost is $10 per month prepaid.').",
|
|
2308
|
+
"type": "string",
|
|
2309
|
+
"required": true,
|
|
2310
|
+
"position": "body"
|
|
2311
|
+
},
|
|
2312
|
+
{
|
|
2313
|
+
"name": "name",
|
|
2314
|
+
"description": "A name for the contract being extracted.",
|
|
2315
|
+
"type": "string",
|
|
2316
|
+
"required": true,
|
|
2317
|
+
"position": "body"
|
|
2318
|
+
},
|
|
2319
|
+
{
|
|
2320
|
+
"name": "organization_id",
|
|
2321
|
+
"description": "The organization ID for the contract extraction (will be auto-populated from user context if not provided).",
|
|
2322
|
+
"type": "string",
|
|
2323
|
+
"required": false,
|
|
2324
|
+
"position": "body"
|
|
2325
|
+
}
|
|
2326
|
+
],
|
|
2327
|
+
"requestTemplate": {
|
|
2328
|
+
"url": "https://ai.zenskar.com/api/contracts/extract/raw",
|
|
2329
|
+
"method": "POST",
|
|
2330
|
+
"headers": {
|
|
2331
|
+
"Content-Type": "application/json"
|
|
2332
|
+
}
|
|
2333
|
+
},
|
|
2334
|
+
"responseTemplate": {
|
|
2335
|
+
"prependBody": "## Contract Extraction Result\n\nThe AI has extracted the following contract data from your raw text. You can use this to create a customer (if missing_fields includes customer info) and then create the contract:\n\n"
|
|
2336
|
+
}
|
|
2337
|
+
},
|
|
2338
|
+
{
|
|
2339
|
+
"name": "createContract",
|
|
2340
|
+
"description": "Create a new contract in Zenskar. Use this after extracting contract data via extractContractFromRaw and creating a customer via createCustomer. The contract includes customer details, pricing phases, products, and billing configuration.",
|
|
2341
|
+
"needsApproval": false,
|
|
2342
|
+
"approvalConfig": {
|
|
2343
|
+
"title": "Create New Contract",
|
|
2344
|
+
"description": "This will create a new contract in your system. Please review the contract details carefully including customer, dates, pricing, and billing terms.",
|
|
2345
|
+
"warningText": "This action will create a new contract record that may trigger billing processes.",
|
|
2346
|
+
"confirmText": "Create Contract",
|
|
2347
|
+
"cancelText": "Cancel",
|
|
2348
|
+
"sensitiveFields": [
|
|
2349
|
+
"name",
|
|
2350
|
+
"customer_id",
|
|
2351
|
+
"start_date",
|
|
2352
|
+
"end_date",
|
|
2353
|
+
"phases"
|
|
2354
|
+
]
|
|
2355
|
+
},
|
|
2356
|
+
"args": [
|
|
2357
|
+
{
|
|
2358
|
+
"name": "name",
|
|
2359
|
+
"description": "Contract name (required).",
|
|
2360
|
+
"type": "string",
|
|
2361
|
+
"required": true,
|
|
2362
|
+
"position": "body"
|
|
2363
|
+
},
|
|
2364
|
+
{
|
|
2365
|
+
"name": "description",
|
|
2366
|
+
"description": "Contract description (optional).",
|
|
2367
|
+
"type": "string",
|
|
2368
|
+
"required": false,
|
|
2369
|
+
"position": "body"
|
|
2370
|
+
},
|
|
2371
|
+
{
|
|
2372
|
+
"name": "status",
|
|
2373
|
+
"description": "Contract status (defaults to 'draft').",
|
|
2374
|
+
"type": "string",
|
|
2375
|
+
"required": false,
|
|
2376
|
+
"position": "body",
|
|
2377
|
+
"default": "draft",
|
|
2378
|
+
"enum": ["draft", "active", "paused", "expired", "disputed"]
|
|
2379
|
+
},
|
|
2380
|
+
{
|
|
2381
|
+
"name": "currency",
|
|
2382
|
+
"description": "Currency code for the contract (e.g., 'USD', 'EUR').",
|
|
2383
|
+
"type": "string",
|
|
2384
|
+
"required": true,
|
|
2385
|
+
"position": "body",
|
|
2386
|
+
"default": "USD"
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
"name": "start_date",
|
|
2390
|
+
"description": "Contract start date in ISO 8601 format (e.g., '2025-01-01T00:00:00.000000').",
|
|
2391
|
+
"type": "string",
|
|
2392
|
+
"required": true,
|
|
2393
|
+
"position": "body"
|
|
2394
|
+
},
|
|
2395
|
+
{
|
|
2396
|
+
"name": "end_date",
|
|
2397
|
+
"description": "Contract end date in ISO 8601 format (e.g., '2025-12-31T23:59:59.999999').",
|
|
2398
|
+
"type": "string",
|
|
2399
|
+
"required": true,
|
|
2400
|
+
"position": "body"
|
|
2401
|
+
},
|
|
2402
|
+
{
|
|
2403
|
+
"name": "anchor_date",
|
|
2404
|
+
"description": "Anchor date for billing cycles in ISO 8601 format (defaults to start_date).",
|
|
2405
|
+
"type": "string",
|
|
2406
|
+
"required": false,
|
|
2407
|
+
"position": "body"
|
|
2408
|
+
},
|
|
2409
|
+
{
|
|
2410
|
+
"name": "customer_id",
|
|
2411
|
+
"description": "The ID of the customer for this contract (required, UUID format).",
|
|
2412
|
+
"type": "string",
|
|
2413
|
+
"required": true,
|
|
2414
|
+
"position": "body"
|
|
2415
|
+
},
|
|
2416
|
+
{
|
|
2417
|
+
"name": "renewal_policy",
|
|
2418
|
+
"description": "Contract renewal policy (defaults to 'do_not_renew').",
|
|
2419
|
+
"type": "string",
|
|
2420
|
+
"required": false,
|
|
2421
|
+
"position": "body",
|
|
2422
|
+
"default": "do_not_renew",
|
|
2423
|
+
"enum": ["do_not_renew", "auto_renew", "manual"]
|
|
2424
|
+
},
|
|
2425
|
+
{
|
|
2426
|
+
"name": "bill_parent_customer",
|
|
2427
|
+
"description": "Whether to bill the parent customer (defaults to false).",
|
|
2428
|
+
"type": "boolean",
|
|
2429
|
+
"required": false,
|
|
2430
|
+
"position": "body",
|
|
2431
|
+
"default": false
|
|
2432
|
+
},
|
|
2433
|
+
{
|
|
2434
|
+
"name": "phases",
|
|
2435
|
+
"description": "Array of contract phases with pricing details. Each phase includes name, start_date, end_date, phase_type, and pricings array.",
|
|
2436
|
+
"type": "array",
|
|
2437
|
+
"required": true,
|
|
2438
|
+
"position": "body"
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
"name": "source",
|
|
2442
|
+
"description": "Source information for the contract (e.g., {source_type: 'ai', source_id: 'uuid'}).",
|
|
2443
|
+
"type": "object",
|
|
2444
|
+
"required": false,
|
|
2445
|
+
"position": "body"
|
|
2446
|
+
},
|
|
2447
|
+
{
|
|
2448
|
+
"name": "custom_attributes",
|
|
2449
|
+
"description": "Custom attributes for the contract as key-value pairs.",
|
|
2450
|
+
"type": "object",
|
|
2451
|
+
"required": false,
|
|
2452
|
+
"position": "body"
|
|
2453
|
+
}
|
|
2454
|
+
],
|
|
2455
|
+
"requestTemplate": {
|
|
2456
|
+
"url": "/contract_v2",
|
|
2457
|
+
"method": "POST",
|
|
2458
|
+
"headers": {
|
|
2459
|
+
"Content-Type": "application/json"
|
|
2460
|
+
}
|
|
2461
|
+
},
|
|
2462
|
+
"responseTemplate": {
|
|
2463
|
+
"prependBody": "## Contract Created\n\nNew contract has been successfully created:\n\n"
|
|
2464
|
+
}
|
|
2307
2465
|
}
|
|
2308
2466
|
]
|
|
2309
2467
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Simple response processor for Zenskar API responses
|
|
2
|
-
|
|
2
|
+
class ResponseProcessor {
|
|
3
3
|
constructor() {
|
|
4
4
|
// Minimal configuration
|
|
5
5
|
this.maxResponseLength = 50000;
|
|
@@ -23,4 +23,6 @@ export default class ResponseProcessor {
|
|
|
23
23
|
return 'Error processing response';
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
module.exports = ResponseProcessor;
|