@centrali-io/centrali-mcp 4.5.0 → 4.5.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.
- package/README.md +3 -3
- package/dist/tools/describe.js +18 -0
- package/dist/tools/records.js +23 -4
- package/package.json +1 -1
- package/src/tools/describe.ts +19 -0
- package/src/tools/records.ts +24 -3
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ Add to your MCP client configuration (e.g., Claude Desktop, Cursor):
|
|
|
17
17
|
"command": "npx",
|
|
18
18
|
"args": ["@centrali-io/centrali-mcp"],
|
|
19
19
|
"env": {
|
|
20
|
-
"CENTRALI_URL": "https://
|
|
20
|
+
"CENTRALI_URL": "https://centrali.io",
|
|
21
21
|
"CENTRALI_CLIENT_ID": "<service-account-client-id>",
|
|
22
22
|
"CENTRALI_CLIENT_SECRET": "<service-account-secret>",
|
|
23
23
|
"CENTRALI_WORKSPACE": "my-workspace"
|
|
@@ -31,7 +31,7 @@ Add to your MCP client configuration (e.g., Claude Desktop, Cursor):
|
|
|
31
31
|
|
|
32
32
|
| Variable | Required | Description |
|
|
33
33
|
|----------|----------|-------------|
|
|
34
|
-
| `CENTRALI_URL` | Yes | Centrali instance URL (e.g., `https://
|
|
34
|
+
| `CENTRALI_URL` | Yes | Centrali instance URL (e.g., `https://centrali.io`) |
|
|
35
35
|
| `CENTRALI_CLIENT_ID` | Yes | Service account client ID |
|
|
36
36
|
| `CENTRALI_CLIENT_SECRET` | Yes | Service account client secret |
|
|
37
37
|
| `CENTRALI_WORKSPACE` | Yes | Workspace slug to operate in |
|
|
@@ -268,7 +268,7 @@ npm install
|
|
|
268
268
|
npm run build
|
|
269
269
|
|
|
270
270
|
# Test with MCP inspector
|
|
271
|
-
CENTRALI_URL=https://
|
|
271
|
+
CENTRALI_URL=https://centrali.io \
|
|
272
272
|
CENTRALI_CLIENT_ID=... \
|
|
273
273
|
CENTRALI_CLIENT_SECRET=... \
|
|
274
274
|
CENTRALI_WORKSPACE=my-workspace \
|
package/dist/tools/describe.js
CHANGED
|
@@ -598,6 +598,24 @@ function registerDescribeTools(server) {
|
|
|
598
598
|
description: "Comma-separated list of reference field names to expand (join). Returns the full referenced record instead of just the ID.",
|
|
599
599
|
example: "expand: 'customer,product'",
|
|
600
600
|
},
|
|
601
|
+
dateWindow: {
|
|
602
|
+
description: "Date range filter. Restricts results to records where a date field falls within a given range. Both 'from' and 'to' are optional (open-ended ranges allowed).",
|
|
603
|
+
shape: {
|
|
604
|
+
field: "string — date field to filter on (e.g., 'createdAt', 'updatedAt', or a custom date field)",
|
|
605
|
+
from: "string? — ISO 8601 lower bound (inclusive)",
|
|
606
|
+
to: "string? — ISO 8601 upper bound (inclusive)",
|
|
607
|
+
},
|
|
608
|
+
examples: {
|
|
609
|
+
"Last 30 days": { field: "createdAt", from: "2024-03-01T00:00:00Z" },
|
|
610
|
+
"Specific range": { field: "updatedAt", from: "2024-01-01T00:00:00Z", to: "2024-03-31T23:59:59Z" },
|
|
611
|
+
},
|
|
612
|
+
},
|
|
613
|
+
includeDeleted: {
|
|
614
|
+
description: "Set to true to include soft-deleted records in the results (default: false). Alias: includeArchived, all.",
|
|
615
|
+
},
|
|
616
|
+
includeTotal: {
|
|
617
|
+
description: "Set to true to include the total record count in response metadata (default: false).",
|
|
618
|
+
},
|
|
601
619
|
upsert: {
|
|
602
620
|
description: "Atomic create-or-update. Provide 'match' fields to find existing record and 'data' for the full record body.",
|
|
603
621
|
example: {
|
package/dist/tools/records.js
CHANGED
|
@@ -90,14 +90,14 @@ function createRecordsClient(sdk, centraliUrl, workspaceId, recordSlug) {
|
|
|
90
90
|
return client;
|
|
91
91
|
}
|
|
92
92
|
function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
93
|
-
server.tool("query_records", "Query records from a collection with optional filters, sorting, and
|
|
93
|
+
server.tool("query_records", "Query records from a collection with optional filters, sorting, pagination, and date range filtering. Filters use 'data.' prefix for custom fields and bracket notation for operators (e.g., 'data.status': 'active', 'data.price[lte]': 100). Use dateWindow for date range queries.", {
|
|
94
94
|
recordSlug: zod_1.z
|
|
95
95
|
.string()
|
|
96
96
|
.describe("The collection's record slug (e.g., 'orders')"),
|
|
97
97
|
filters: zod_1.z
|
|
98
98
|
.record(zod_1.z.string(), zod_1.z.any())
|
|
99
99
|
.optional()
|
|
100
|
-
.describe("Filter object with keys like 'data.fieldName' or 'data.fieldName[operator]'. Operators: eq, ne, gt, gte, lt, lte, in, nin, contains, startswith, endswith"),
|
|
100
|
+
.describe("Filter object with keys like 'data.fieldName' or 'data.fieldName[operator]'. Operators: eq, ne, gt, gte, lt, lte, in, nin, contains, startswith, endswith, hasAny, hasAll"),
|
|
101
101
|
sort: zod_1.z
|
|
102
102
|
.string()
|
|
103
103
|
.optional()
|
|
@@ -111,12 +111,31 @@ function registerRecordTools(server, sdk, centraliUrl, workspaceId) {
|
|
|
111
111
|
.string()
|
|
112
112
|
.optional()
|
|
113
113
|
.describe("Comma-separated reference fields to expand (e.g., 'customer,product')"),
|
|
114
|
-
|
|
114
|
+
dateWindow: zod_1.z
|
|
115
|
+
.object({
|
|
116
|
+
field: zod_1.z.string().describe("Date field to filter on (e.g., 'createdAt', 'updatedAt')"),
|
|
117
|
+
from: zod_1.z.string().optional().describe("ISO 8601 lower bound (inclusive)"),
|
|
118
|
+
to: zod_1.z.string().optional().describe("ISO 8601 upper bound (inclusive)"),
|
|
119
|
+
})
|
|
120
|
+
.optional()
|
|
121
|
+
.describe("Date range filter. Restricts results to records where the specified date field falls within the given range."),
|
|
122
|
+
includeDeleted: zod_1.z
|
|
123
|
+
.boolean()
|
|
124
|
+
.optional()
|
|
125
|
+
.describe("Include soft-deleted records (default: false)"),
|
|
126
|
+
includeTotal: zod_1.z
|
|
127
|
+
.boolean()
|
|
128
|
+
.optional()
|
|
129
|
+
.describe("Include total record count in response metadata (default: false)"),
|
|
130
|
+
}, (_a) => __awaiter(this, [_a], void 0, function* ({ recordSlug, filters, sort, page, pageSize, expand, dateWindow, includeDeleted, includeTotal }) {
|
|
115
131
|
try {
|
|
116
132
|
const params = Object.assign(Object.assign({}, filters), { sort,
|
|
117
133
|
page,
|
|
118
134
|
pageSize,
|
|
119
|
-
expand
|
|
135
|
+
expand,
|
|
136
|
+
dateWindow,
|
|
137
|
+
includeDeleted,
|
|
138
|
+
includeTotal });
|
|
120
139
|
// Remove undefined values
|
|
121
140
|
Object.keys(params).forEach((key) => params[key] === undefined && delete params[key]);
|
|
122
141
|
const result = yield sdk.queryRecords(recordSlug, params);
|
package/package.json
CHANGED
package/src/tools/describe.ts
CHANGED
|
@@ -642,6 +642,25 @@ export function registerDescribeTools(server: McpServer) {
|
|
|
642
642
|
"Comma-separated list of reference field names to expand (join). Returns the full referenced record instead of just the ID.",
|
|
643
643
|
example: "expand: 'customer,product'",
|
|
644
644
|
},
|
|
645
|
+
dateWindow: {
|
|
646
|
+
description:
|
|
647
|
+
"Date range filter. Restricts results to records where a date field falls within a given range. Both 'from' and 'to' are optional (open-ended ranges allowed).",
|
|
648
|
+
shape: {
|
|
649
|
+
field: "string — date field to filter on (e.g., 'createdAt', 'updatedAt', or a custom date field)",
|
|
650
|
+
from: "string? — ISO 8601 lower bound (inclusive)",
|
|
651
|
+
to: "string? — ISO 8601 upper bound (inclusive)",
|
|
652
|
+
},
|
|
653
|
+
examples: {
|
|
654
|
+
"Last 30 days": { field: "createdAt", from: "2024-03-01T00:00:00Z" },
|
|
655
|
+
"Specific range": { field: "updatedAt", from: "2024-01-01T00:00:00Z", to: "2024-03-31T23:59:59Z" },
|
|
656
|
+
},
|
|
657
|
+
},
|
|
658
|
+
includeDeleted: {
|
|
659
|
+
description: "Set to true to include soft-deleted records in the results (default: false). Alias: includeArchived, all.",
|
|
660
|
+
},
|
|
661
|
+
includeTotal: {
|
|
662
|
+
description: "Set to true to include the total record count in response metadata (default: false).",
|
|
663
|
+
},
|
|
645
664
|
upsert: {
|
|
646
665
|
description:
|
|
647
666
|
"Atomic create-or-update. Provide 'match' fields to find existing record and 'data' for the full record body.",
|
package/src/tools/records.ts
CHANGED
|
@@ -84,7 +84,7 @@ function createRecordsClient(sdk: CentraliSDK, centraliUrl: string, workspaceId:
|
|
|
84
84
|
export function registerRecordTools(server: McpServer, sdk: CentraliSDK, centraliUrl: string, workspaceId: string) {
|
|
85
85
|
server.tool(
|
|
86
86
|
"query_records",
|
|
87
|
-
"Query records from a collection with optional filters, sorting, and
|
|
87
|
+
"Query records from a collection with optional filters, sorting, pagination, and date range filtering. Filters use 'data.' prefix for custom fields and bracket notation for operators (e.g., 'data.status': 'active', 'data.price[lte]': 100). Use dateWindow for date range queries.",
|
|
88
88
|
{
|
|
89
89
|
recordSlug: z
|
|
90
90
|
.string()
|
|
@@ -93,7 +93,7 @@ export function registerRecordTools(server: McpServer, sdk: CentraliSDK, central
|
|
|
93
93
|
.record(z.string(), z.any())
|
|
94
94
|
.optional()
|
|
95
95
|
.describe(
|
|
96
|
-
"Filter object with keys like 'data.fieldName' or 'data.fieldName[operator]'. Operators: eq, ne, gt, gte, lt, lte, in, nin, contains, startswith, endswith"
|
|
96
|
+
"Filter object with keys like 'data.fieldName' or 'data.fieldName[operator]'. Operators: eq, ne, gt, gte, lt, lte, in, nin, contains, startswith, endswith, hasAny, hasAll"
|
|
97
97
|
),
|
|
98
98
|
sort: z
|
|
99
99
|
.string()
|
|
@@ -112,8 +112,26 @@ export function registerRecordTools(server: McpServer, sdk: CentraliSDK, central
|
|
|
112
112
|
.describe(
|
|
113
113
|
"Comma-separated reference fields to expand (e.g., 'customer,product')"
|
|
114
114
|
),
|
|
115
|
+
dateWindow: z
|
|
116
|
+
.object({
|
|
117
|
+
field: z.string().describe("Date field to filter on (e.g., 'createdAt', 'updatedAt')"),
|
|
118
|
+
from: z.string().optional().describe("ISO 8601 lower bound (inclusive)"),
|
|
119
|
+
to: z.string().optional().describe("ISO 8601 upper bound (inclusive)"),
|
|
120
|
+
})
|
|
121
|
+
.optional()
|
|
122
|
+
.describe(
|
|
123
|
+
"Date range filter. Restricts results to records where the specified date field falls within the given range."
|
|
124
|
+
),
|
|
125
|
+
includeDeleted: z
|
|
126
|
+
.boolean()
|
|
127
|
+
.optional()
|
|
128
|
+
.describe("Include soft-deleted records (default: false)"),
|
|
129
|
+
includeTotal: z
|
|
130
|
+
.boolean()
|
|
131
|
+
.optional()
|
|
132
|
+
.describe("Include total record count in response metadata (default: false)"),
|
|
115
133
|
},
|
|
116
|
-
async ({ recordSlug, filters, sort, page, pageSize, expand }) => {
|
|
134
|
+
async ({ recordSlug, filters, sort, page, pageSize, expand, dateWindow, includeDeleted, includeTotal }) => {
|
|
117
135
|
try {
|
|
118
136
|
const params: Record<string, any> = {
|
|
119
137
|
...filters,
|
|
@@ -121,6 +139,9 @@ export function registerRecordTools(server: McpServer, sdk: CentraliSDK, central
|
|
|
121
139
|
page,
|
|
122
140
|
pageSize,
|
|
123
141
|
expand,
|
|
142
|
+
dateWindow,
|
|
143
|
+
includeDeleted,
|
|
144
|
+
includeTotal,
|
|
124
145
|
};
|
|
125
146
|
// Remove undefined values
|
|
126
147
|
Object.keys(params).forEach(
|