@vitrion/zentria-mcp 1.0.1 → 1.2.0

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 CHANGED
@@ -13,7 +13,7 @@ This server uses the official **public REST API** at `/api/public`. Paths and re
13
13
 
14
14
  ## Features
15
15
 
16
- - **76 tools** covering discovery, to-dos, sales (people, deals, notes, activities, organizations, pipelines, forms, submissions), customers, CRM, Speed to Lead, webhooks, members, settings, and integrations
16
+ - **90 tools** covering discovery, to-dos, sales (people, deals, notes, activities, organizations, pipelines, forms, submissions), customers, CRM, Speed to Lead, Google Business Profiles, webhooks, members, settings, and integrations
17
17
  - Team-bound **Personal Access Token** auth (`Authorization: Bearer`)
18
18
  - Automatic rate-limit retry (429 + `Retry-After`)
19
19
  - Stdio transport (Cursor, Claude Desktop, Claude Code)
@@ -91,6 +91,7 @@ Set `ZENTRIA_API_KEY` in your shell environment or MCP host config.
91
91
  | **Customers** | `list-customers`, `create-customer`, `archive-customer`, `list-customer-contacts` |
92
92
  | **CRM** | `list-crm-leads`, `approve-crm-lead`, `reject-crm-lead` |
93
93
  | **Speed to Lead** | `list-stl-flows`, `list-stl-sms-templates`, `list-stl-leads` |
94
+ | **Business Profiles** | `list-business-profile-locations`, `list-business-profile-reviews`, `approve-business-profile-review-reply`, `accept-business-profile-change`, `create-business-profile-post`, `get-location-performance`, `list-location-search-keywords` (scopes `business-profiles:read` / `business-profiles:write`, only when the module is on) |
94
95
  | **Webhooks** | `list-webhooks`, `create-webhook` (secret returned once) |
95
96
  | **Members** | `list-members`, `invite-member`, `change-member-role` |
96
97
  | **Settings** | `get-settings`, `get-integrations` |
@@ -1,13 +1,13 @@
1
1
  import { McpServer } from "@modelcontextprotocol/server";
2
- import { ZentriaClient } from "./zentria/client.js";
2
+ import { registerBusinessProfileTools } from "./tools/business-profiles.js";
3
3
  import { registerCrmTools } from "./tools/crm.js";
4
4
  import { registerCustomerContactTools } from "./tools/customer-contacts.js";
5
5
  import { registerCustomerTools } from "./tools/customers.js";
6
6
  import { registerDiscoveryTools } from "./tools/discovery.js";
7
7
  import { registerMemberTools, registerSettingsTools } from "./tools/members.js";
8
- import { registerSalesFormTools, registerSalesSubmissionTools, } from "./tools/sales-forms.js";
9
8
  import { registerSalesActivityTools } from "./tools/sales-activities.js";
10
9
  import { registerSalesDealTools } from "./tools/sales-deals.js";
10
+ import { registerSalesFormTools, registerSalesSubmissionTools, } from "./tools/sales-forms.js";
11
11
  import { registerSalesNoteTools } from "./tools/sales-notes.js";
12
12
  import { registerSalesOrganizationTools } from "./tools/sales-organizations.js";
13
13
  import { registerSalesPeopleTools } from "./tools/sales-people.js";
@@ -16,6 +16,7 @@ import { registerStlTools } from "./tools/stl.js";
16
16
  import { registerTodoTools } from "./tools/todos.js";
17
17
  import { registerWebhookTools } from "./tools/webhooks.js";
18
18
  import { PACKAGE_NAME, PACKAGE_VERSION } from "./version.js";
19
+ import { ZentriaClient } from "./zentria/client.js";
19
20
  export function createServer() {
20
21
  const server = new McpServer({
21
22
  name: PACKAGE_NAME,
@@ -36,6 +37,7 @@ export function createServer() {
36
37
  registerCustomerContactTools(server, client);
37
38
  registerCrmTools(server, client);
38
39
  registerStlTools(server, client);
40
+ registerBusinessProfileTools(server, client);
39
41
  registerWebhookTools(server, client);
40
42
  registerMemberTools(server, client);
41
43
  registerSettingsTools(server, client);
@@ -0,0 +1,227 @@
1
+ import * as z from "zod/v4";
2
+ import { compactBody, encodePathSegment, paginationQuery, paginationSchema, registerJsonTool, } from "./_shared.js";
3
+ const BASE = "/api/public/business-profiles";
4
+ const pageSchema = {
5
+ page: paginationSchema.page,
6
+ itemsPerPage: paginationSchema.itemsPerPage,
7
+ };
8
+ function query(input, filters) {
9
+ const out = paginationQuery(input);
10
+ for (const [key, value] of Object.entries(filters)) {
11
+ if (value !== undefined) {
12
+ out[key] = typeof value === "boolean" ? String(value) : value;
13
+ }
14
+ }
15
+ return out;
16
+ }
17
+ export function registerBusinessProfileTools(server, client) {
18
+ registerJsonTool(server, "list-business-profile-locations", {
19
+ description: "List Google Business Profile locations (GET /api/public/business-profiles/locations). Scope: business-profiles:read. Only available when Business Profiles is on for the team.",
20
+ annotations: { readOnlyHint: true },
21
+ inputSchema: z.object({
22
+ ...paginationSchema,
23
+ customerId: z.number().int().positive().optional().describe("Only locations linked to this customer."),
24
+ campaignId: z.number().int().positive().optional().describe("Only locations linked to this campaign."),
25
+ verified: z.boolean().optional().describe("Filter on verification."),
26
+ syncEnabled: z.boolean().optional().describe("Filter on review sync being enabled."),
27
+ }),
28
+ }, async (input) => client.request({
29
+ path: `${BASE}/locations`,
30
+ query: {
31
+ ...query(input, {
32
+ customer_id: input.customerId,
33
+ campaign_id: input.campaignId,
34
+ verified: input.verified,
35
+ sync_enabled: input.syncEnabled,
36
+ }),
37
+ ...(input.q ? { q: input.q } : {}),
38
+ },
39
+ }));
40
+ registerJsonTool(server, "get-business-profile-location", {
41
+ description: "Fetch a Business Profile location (GET /api/public/business-profiles/locations/{id}). Scope: business-profiles:read.",
42
+ annotations: { readOnlyHint: true },
43
+ inputSchema: z.object({
44
+ id: z.number().int().positive().describe("Location id."),
45
+ }),
46
+ }, async (input) => client.request({ path: `${BASE}/locations/${encodePathSegment(input.id)}` }));
47
+ registerJsonTool(server, "list-business-profile-reviews", {
48
+ description: "List Google reviews, newest first (GET /api/public/business-profiles/reviews). Scope: business-profiles:read.",
49
+ annotations: { readOnlyHint: true },
50
+ inputSchema: z.object({
51
+ ...pageSchema,
52
+ locationId: z.number().int().positive().optional().describe("Only reviews of this location."),
53
+ stars: z.number().int().min(1).max(5).optional().describe("Only reviews with this star rating."),
54
+ answered: z.boolean().optional().describe("true for reviews with a reply, false for unanswered ones."),
55
+ since: z.string().optional().describe("ISO-8601 date or datetime: only reviews created at or after it."),
56
+ }),
57
+ }, async (input) => client.request({
58
+ path: `${BASE}/reviews`,
59
+ query: query(input, {
60
+ location_id: input.locationId,
61
+ stars: input.stars,
62
+ answered: input.answered,
63
+ since: input.since,
64
+ }),
65
+ }));
66
+ registerJsonTool(server, "list-business-profile-review-replies", {
67
+ description: "List review reply drafts and sent replies (GET /api/public/business-profiles/review-replies). Use status pending_approval to find drafts waiting for approval. Scope: business-profiles:read.",
68
+ annotations: { readOnlyHint: true },
69
+ inputSchema: z.object({
70
+ ...pageSchema,
71
+ status: z
72
+ .string()
73
+ .optional()
74
+ .describe("draft, pending_approval, approved, sending, sent, rejected, failed or superseded."),
75
+ locationId: z.number().int().positive().optional().describe("Only replies for reviews of this location."),
76
+ }),
77
+ }, async (input) => client.request({
78
+ path: `${BASE}/review-replies`,
79
+ query: query(input, { status: input.status, location_id: input.locationId }),
80
+ }));
81
+ registerJsonTool(server, "approve-business-profile-review-reply", {
82
+ description: "Approve a reply draft and send it to Google (POST /api/public/business-profiles/review-replies/{id}/approve). Optionally replace the text first. Fails with 422 when the location is not verified or the review already has a reply. Scope: business-profiles:write.",
83
+ inputSchema: z.object({
84
+ id: z.number().int().positive().describe("Review reply id."),
85
+ body: z.string().max(4096).optional().describe("Edited reply text. Omit to send the draft as is."),
86
+ }),
87
+ }, async (input) => client.request({
88
+ method: "POST",
89
+ path: `${BASE}/review-replies/${encodePathSegment(input.id)}/approve`,
90
+ body: compactBody({ body: input.body }) ?? {},
91
+ }));
92
+ registerJsonTool(server, "reject-business-profile-review-reply", {
93
+ description: "Reject a reply draft (POST /api/public/business-profiles/review-replies/{id}/reject). Scope: business-profiles:write.",
94
+ inputSchema: z.object({
95
+ id: z.number().int().positive().describe("Review reply id."),
96
+ }),
97
+ }, async (input) => client.request({
98
+ method: "POST",
99
+ path: `${BASE}/review-replies/${encodePathSegment(input.id)}/reject`,
100
+ body: {},
101
+ }));
102
+ registerJsonTool(server, "list-business-profile-changes", {
103
+ description: "List changes Google made to locations (GET /api/public/business-profiles/changes). Use status open for changes waiting for a decision. Scope: business-profiles:read.",
104
+ annotations: { readOnlyHint: true },
105
+ inputSchema: z.object({
106
+ ...pageSchema,
107
+ status: z
108
+ .string()
109
+ .optional()
110
+ .describe("open, accepted, rejected, dismissed, superseded or failed."),
111
+ locationId: z.number().int().positive().optional().describe("Only changes of this location."),
112
+ }),
113
+ }, async (input) => client.request({
114
+ path: `${BASE}/changes`,
115
+ query: query(input, { status: input.status, location_id: input.locationId }),
116
+ }));
117
+ registerJsonTool(server, "accept-business-profile-change", {
118
+ description: "Accept the values Google set on a location (POST /api/public/business-profiles/changes/{id}/accept). Fails with 422 when the change was already handled. Scope: business-profiles:write.",
119
+ inputSchema: z.object({
120
+ id: z.number().int().positive().describe("Change id."),
121
+ }),
122
+ }, async (input) => client.request({
123
+ method: "POST",
124
+ path: `${BASE}/changes/${encodePathSegment(input.id)}/accept`,
125
+ body: {},
126
+ }));
127
+ registerJsonTool(server, "reject-business-profile-change", {
128
+ description: "Reject a change: the previous values are restored at Google in the background (POST /api/public/business-profiles/changes/{id}/reject). Fails with 422 when the change was already handled. Scope: business-profiles:write.",
129
+ annotations: { destructiveHint: true },
130
+ inputSchema: z.object({
131
+ id: z.number().int().positive().describe("Change id."),
132
+ }),
133
+ }, async (input) => client.request({
134
+ method: "POST",
135
+ path: `${BASE}/changes/${encodePathSegment(input.id)}/reject`,
136
+ body: {},
137
+ }));
138
+ registerJsonTool(server, "list-business-profile-posts", {
139
+ description: "List Business Profile posts, newest first (GET /api/public/business-profiles/posts). Scope: business-profiles:read.",
140
+ annotations: { readOnlyHint: true },
141
+ inputSchema: z.object({
142
+ ...pageSchema,
143
+ locationId: z.number().int().positive().optional().describe("Only posts of this location."),
144
+ status: z
145
+ .string()
146
+ .optional()
147
+ .describe("draft, pending_approval, scheduled, publishing, published, failed, deleted or expired."),
148
+ }),
149
+ }, async (input) => client.request({
150
+ path: `${BASE}/posts`,
151
+ query: query(input, { location_id: input.locationId, status: input.status }),
152
+ }));
153
+ registerJsonTool(server, "create-business-profile-post", {
154
+ description: "Create one post per location (POST /api/public/business-profiles/posts). mode draft saves a draft, schedule needs scheduled_for (Europe/Amsterdam time), publish_now publishes right away. Returns { posts: [...] }. Scope: business-profiles:write.",
155
+ inputSchema: z.object({
156
+ location_ids: z.array(z.number().int().positive()).min(1).max(50).describe("Location ids to post to."),
157
+ topic_type: z.enum(["STANDARD", "EVENT", "OFFER"]).describe("Post type."),
158
+ summary: z.string().min(1).max(1500).describe("Post text."),
159
+ mode: z.enum(["draft", "schedule", "publish_now"]).optional().describe("Default draft."),
160
+ scheduled_for: z.string().optional().describe("Date and time, required for mode schedule."),
161
+ title: z.string().max(58).optional().describe("Required for EVENT and OFFER."),
162
+ language: z.enum(["nl", "en"]).optional(),
163
+ cta_type: z.enum(["BOOK", "ORDER", "SHOP", "LEARN_MORE", "SIGN_UP", "CALL"]).optional(),
164
+ cta_url: z.string().url().optional().describe("Required for every cta_type except CALL."),
165
+ event_start: z.string().optional().describe("Required for EVENT and OFFER."),
166
+ event_end: z.string().optional().describe("Required for EVENT and OFFER."),
167
+ offer: z
168
+ .object({
169
+ coupon_code: z.string().max(58).optional(),
170
+ redeem_url: z.string().url().optional(),
171
+ terms: z.string().max(5000).optional(),
172
+ })
173
+ .optional()
174
+ .describe("Offer details for OFFER posts."),
175
+ }),
176
+ }, async (input) => client.request({
177
+ method: "POST",
178
+ path: `${BASE}/posts`,
179
+ body: compactBody(input) ?? {},
180
+ }));
181
+ registerJsonTool(server, "delete-business-profile-post", {
182
+ description: "Delete a post (DELETE /api/public/business-profiles/posts/{id}). Published posts are removed at Google first. Scope: business-profiles:write.",
183
+ annotations: { destructiveHint: true },
184
+ inputSchema: z.object({
185
+ id: z.number().int().positive().describe("Post id."),
186
+ }),
187
+ }, async (input) => client.request({
188
+ method: "DELETE",
189
+ path: `${BASE}/posts/${encodePathSegment(input.id)}`,
190
+ }));
191
+ registerJsonTool(server, "get-location-performance", {
192
+ description: "Results of a Business Profile location: views, calls, website clicks, direction requests, conversations and bookings with the previous period, the views split (search, maps, mobile, desktop) and a time series (GET /api/public/business-profiles/locations/{locationId}/performance). Google reports these numbers 2 to 3 days late, see latestDate in the response. Google does not link search terms to calls, so calls cannot be traced back to a keyword. Scope: business-profiles:read.",
193
+ annotations: { readOnlyHint: true },
194
+ inputSchema: z.object({
195
+ locationId: z.number().int().positive().describe("Location id."),
196
+ period: z
197
+ .enum(["last_7", "last_28", "last_90", "this_month", "last_month", "custom"])
198
+ .optional()
199
+ .describe("Period preset. Default last_28. Use custom together with from and to."),
200
+ from: z.string().optional().describe("Start date (YYYY-MM-DD), for period custom."),
201
+ to: z.string().optional().describe("End date (YYYY-MM-DD), for period custom."),
202
+ granularity: z
203
+ .enum(["day", "week"])
204
+ .optional()
205
+ .describe("Series buckets. Default day, or week for periods over 62 days."),
206
+ }),
207
+ }, async (input) => client.request({
208
+ path: `${BASE}/locations/${encodePathSegment(input.locationId)}/performance`,
209
+ query: query({}, { period: input.period, from: input.from, to: input.to, granularity: input.granularity }),
210
+ }));
211
+ registerJsonTool(server, "list-location-search-keywords", {
212
+ description: "List the search terms that showed a Business Profile location in one month, most used first (GET /api/public/business-profiles/locations/{locationId}/search-keywords). Rare terms have no count but a threshold: the term was used fewer than that many times. Data is 2 to 3 days late and Google does not link search terms to calls. Scope: business-profiles:read.",
213
+ annotations: { readOnlyHint: true },
214
+ inputSchema: z.object({
215
+ ...paginationSchema,
216
+ locationId: z.number().int().positive().describe("Location id."),
217
+ month: z
218
+ .string()
219
+ .regex(/^\d{4}-\d{2}$/)
220
+ .optional()
221
+ .describe("Month as YYYY-MM. Default: the newest month with data."),
222
+ }),
223
+ }, async (input) => client.request({
224
+ path: `${BASE}/locations/${encodePathSegment(input.locationId)}/search-keywords`,
225
+ query: query(input, { month: input.month }),
226
+ }));
227
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitrion/zentria-mcp",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "provenance": true